Capistrano 3 deploy -- copy file to release folder - capistrano3

I need to copy a file during deployment to the new deploy path. So I need a path like
<project_path>/releases/20201005215208/db/seeds.rb
I can't use the 'current' directory as it is pointing to the previous release (Link has not yet been updated).
There used to be a path variable for that, but apparently it no longer exists.
What is the current method of doing this?

OK, what I was looking for was the variable "release_path". I had tried that and was getting the error that it didn't exist. The problem was that I was hooking the task in before the directory in the releases folder was created. Hook it in "before :updating" and it works like a champ! Yea!

Related

How to watch local directory changes in Nextjs

I would like to get the name of each folder that is added to a certain folder.
I tried chokidar but I didn't make it working. so I searched for an equivalent and I didn't find anything...
I want to choose a local folder and each time there's a new file/folder added, i get a console.log of the name of the file/folder

Go Package Conflict

I am new to Go and AppEngine. I am trying to figure out how to create packages but I keep running into conflicts. My directory structure is below:
GOPATH
third-party-libs
app
app.yaml
controllers
default.go -- package controllers
models
models.go -- package models
templates
templates.go -- package templates
I am importing the templates package as follows import ("app/templates") inside default.go
When I do goapp serve I get this error:
Failed parsing input: app file templates.go conflicts with
same file imported from GOPATH
I have tried a bunch of things and nothing has worked so far. These are things I have tried:
Changed the templates directory to apptemplates and the corresponding file to apptemplates.go, changed package name to apptemplates. I imported it as app/apptemplates
I tried different combinations by changing the file name but not the package name, vice versa, etc. Either it does not find the file or has a conflict.
I am importing html/template in my templates.go file. So I commented out the entire file just keeping the package declaration but did not make the conflict go away
I thought may be another file is named templates.go but when I do this (at the GOPATH level) find . -name "*.go" | grep "templates.go" I only see the one file I have created.
I am confused as to how packages are created. I have changed the name to something generic so it does not look like a naming issue. Can someone please tell me how I can debug this error?
Thanks!
Rename the package to a non-conflicting name as in #1. Import the package using the path "apptemplates".
Packages inside of the application directory (the directory containing app.yaml) are imported with a path relative to the application directory. See Organizing Go Apps for the complete details.

Change the default location of Pycharm Project

I am using PyCharm 3.4.1 on Ubuntu 14.04. For new project it suggests ~/PyCharmProjects for storing project folders. Is it possible to change the location and name of this proposed folder?
(I couldn't find any reference to changing it in the interface, on the JetBrains site, or in the settings files. Either it isn't possible or (I hope) I missed something.)
Note, it is not a duplicate of Can I change the location/name of PyCharmProjects? - I am aware that it is possible to change proposed path for every created project - but I want defaults that I like.
I know this is an old question, but is is certainly possible as of now
Settings | Appearance & Behaviour | System Settings | Default directory
See JetBrains support page
screenshot
In fact, this is possible. In the IDE settings folder (https://www.jetbrains.com/help/pycharm/project-and-ide-settings.html), under config/options/recentProjectDirectories.xml, you can add an option lastProjectLocation. It wil honor this setting when creating new projects. My recentProjectDirectories.xml looks like this:
<application>
<component name="RecentDirectoryProjectsManager">
<option name="lastProjectLocation" value="$USER_HOME$/my_projects" />
</component>
</application>
In fact, for most options that you want to customize, you could do a diff of the config/options folder before and after you make the change: this way you can find out a lot about how PyCharm (or any IntelliJ tool) configures its editor.
I haven't found an explicit option for doing this in PyCharm, but the following steps have worked as an alternative:
Move your PycharmProjects folder to the desired location.
When you create a new project, press the "..." button to the right of the path (This is on the pop up window that asks for location and interpreter).
Navigate to the new location of PycharmProjects and select that directory.
Add the name of the new project to the directory location (ie. /home/alex/Documents/PycharmProjects/new_project_name)
Now, whenever you create a new project, the location will default to the last chosen path.
This wouldn't be a good solution for someone who is creating projects in many different directories, rather than just PycharmProjects. All my projects are within PycharmProjects and this works just fine.
PyCharm (since at least version 2017) remembers the parent directory of the last place where you created a project. So create a junk project in the directory that you want to be your default projects directory, then close that project, and delete it from disk. The next time you create a project, pycharm will automatically put you in that directory.
It's not a provided option. See this old thread (2003) on devnet.jetbrains.com where this is being discussed.
Subsequent requests to specify a default directory for projects has gone unanswered:
https://devnet.jetbrains.com/thread/157005;jsessionid=5A2C7A1F90969DEAD3908924FFF1AF3A?tstart=1
https://devnet.jetbrains.com/message/857698
https://devnet.jetbrains.com/thread/67231;jsessionid=5255DB0AAB942F0DCDF1B86AFFE54976
Just an update to #Psionman's answer. At least in the professional version (2019.3.5), t appears to have shifted just a bit. The field is now available at
File | Settings | Appearance & Behavior | System Settings > Project Opening > Default Directory
The latest version 2021.3 has the following option:
File | Settings | Appearance & Behavior | System Settings > Project (Dialogue) > Default project directory
Just like virtualenvwrapper, PyCharm apparently obeys $PROJECT_HOME
export PROJECT_HOME=$HOME/Devel
pycharm
or
PROJECT_HOME=$HOME/Devel pycharm
I would have to agree, because I could not find an option in the program. However, based on the answers, found a folder labeled (in my case)
\Users\.PyCharmCE2018.1\config\options
In this folder there are XMLs, one named option with a tag "file.chooser.recent.files". I worked with this, which I found to work for me.
Maybe this also serves:
File -> Settings -> Project (name) -> Project Structure -> Add Content Root
Add folders and then create files and/or navigate between them easily.

Typing the command "cake" in console shows no output

Typing the command "cake" in console shows no output, no errors or anything like that. It just prints about 4 blank lines.
Has anyone else experience this problem before and how did you fix it?
C:\xampp\htdocs\project\app>cake
C:\xampp\htdocs\project\app>
I have had similar problem a moment ago and I found the solution. the problem was not the path for me. I have turn on the debug from 0 to 2. and it shows some error instead of empty output and I try to fix the error (which was in the core.php) and it works now.
So try to debug it like me and fix the error.
Hope it helps.
cake is not directly available in app - while you are in the right folder you still need to call the cake command relative from there:
\app>.\Console\cake
Note that this syntax is unique to Windows
For UNIX use
\app>Console/cake
In case you are using an old app version or didnt bake your application with the Console folder (which you should, though), you can also call the cake core version of it relatively from the APP dir:
\app>..\lib\Cake\Console\cake
(WIN)
\app>../lib/Cake/Console/cake
(UNIX)
Either way the cake file needs to have sufficient execution rights (UNIX mainly) and PHP must be in the system env path. Then it will all work out of the box.
Run this command in Cake/Console folder. I think you are not running it in the right folder.
In this directory:
C:\xampp\htdocs\project\app>
type this command:
php Console/cake.php
which will output:
Current Paths:
-app: app
-working: C:\xampp\htdocs\project\app
-root: C:\xampp\htdocs\project
-core: C:\xampp\htdocs\project\lib
Changing Paths:
Your working path should be the same as your application path. To change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
....
Similar issue encountered where Console wasn't outputting anything after installing Cake via Composer instead of git clone - no error, just returning a blank line. To solve it I made a backup of app/ (mv app/ app.bak/) and then used vendor/bin/cake -app app bake to bake a brand new app/ folder. Once that process was complete running Console from app/Console/cake started working again. Then just moved my app.bak/ code back in place. I'm assuming over time the paths present or code in app/Console had become unworkable.
Bringing back in the old code I was able to narrow down the issue to using Apc as a cache engine. Reverting to $engine = 'File'; in core.php and bootstrap.php solved the problem and Console worked as expected.
I guess you are using a composer powered cakephp which has console command in Vendor folder. If so, try this ;
AppRoot/Vendor/bin/cake
or you may try with full path to fw;
PATH_TO_APP\Vendor\cakephp\cakephp\lib\Cake\Console\cake.bat

How to prevent Joomla site creating unwanted folder

I have a menu link with the alias "inside" on a joomla 3.1.5 site here: http://naiwellness.com
Every morning I check the site and a folder named "inside" has been created in the root dir which prevents the site from loading as it should, instead displaying a directory contents listing at http://naiwellness.com/inside
Anyone have any ideas how to prevent this please?
Thanks
This is just a theory, but check the xml files of your installed modules and plugins (most likely a plugin) for this line...
<folder>inside</folder>
and if it exists try deleting that line of code - or better still uninstall the extension - that should fix it. It's possible that a plugin requires that folder and has php code to create the folder if it doesn't exist - and so creates the folder each time it is run - i.e. when the site is loaded. The above line of xml code I have asked you to look for will go someway to helping determine if this is the case.

Resources