Deploying Rails Apps, Part 6: Writing Capistrano Tasks - Vladi Gleba - 0 views
-
we can write our own tasks to help us automate various things.
- ...27 more annotations...
-
SSHKit was actually developed and released with Capistrano 3, and it’s basically a lower-level tool that provides methods for connecting and interacting with remote servers
-
capture(): executes a command and returns its output as a string
-
upload() has the bang symbol (!) because that’s how it’s defined in SSHKit, and it’s just a convention letting us know that the method will block until it finishes.
-
But in order to ensure rake runs with the proper environment variables set, we have to use rake as a symbol and pass db:seed as a string
-
This format will also be necessary whenever you’re running any other Rails-specific commands that rely on certain environment variables being set
-
we’re using the callbacks inside a namespace to make sure Capistrano knows which tasks the callbacks are referencing.
-
When you run cap production deploy, you’re actually calling a Capistrano task called deploy, which then sequentially invokes other tasks