class DeploYML::CLI
The command-line interface to {DeploYML} using [Thor](github.com/wycats/thor#readme).
Public Instance Methods
Configures the server for the specified environment.
# File lib/deployml/cli.rb, line 130 def config status 'Configuring ...' project.config!(options[:environment]) status 'Configured' end
Cold-deploys into the specified environment.
# File lib/deployml/cli.rb, line 194 def deploy status 'Deploying ...' project.deploy!(options[:environment]) status 'Deployed' end
Executes a command in the specified environment.
@param [String] command
The full command to execute.
# File lib/deployml/cli.rb, line 26 def exec(command) environment.exec(command) end
Installs any needed dependencies in the specified environment.
# File lib/deployml/cli.rb, line 98 def install status 'Installing ...' project.install!(options[:environment]) status 'Installed' end
Migrates the database for the specified environment.
# File lib/deployml/cli.rb, line 114 def migrate status 'Migrating ...' project.migrate!(options[:environment]) status 'Migrated' end
Invokes a rake task in the specified environment.
@param [String] task
The name of the rake task.
# File lib/deployml/cli.rb, line 42 def rake(task) environment.rake(task,*(options[:args])) end
Redeploys into the specified environment.
# File lib/deployml/cli.rb, line 210 def redeploy status 'Redeploying ...' project.redeploy!(options[:environment]) status 'Redeployed' end
Restarts the server in the specified environment.
# File lib/deployml/cli.rb, line 178 def restart status 'Restarting ...' project.restart!(options[:environment]) status 'Restarted' end
Sets up the specified environment.
# File lib/deployml/cli.rb, line 66 def setup status 'Setting up ...' project.setup!(options[:environment]) status 'Setup' end
Starts an SSH session with the specified environment.
# File lib/deployml/cli.rb, line 54 def ssh environment.ssh end
Starts the server in the specified environment.
# File lib/deployml/cli.rb, line 146 def start status 'Starting ...' project.start!(options[:environment]) status 'Started' end
Stops the server in the specified environment.
# File lib/deployml/cli.rb, line 162 def stop status 'Stopping ...' project.stop!(options[:environment]) status 'Stopped' end
Updates the deployment repository of the specified environment.
# File lib/deployml/cli.rb, line 82 def update status 'Updating' project.update!(options[:environment]) status 'Updated' end
Protected Instance Methods
The selected environment.
@return [Environment]
A deployment environment of the project.
@since 0.3.0
# File lib/deployml/cli.rb, line 266 def environment project.environment(options[:environment]) end
Finds the root of the project, starting at the current working directory and ascending upwards.
@return [Pathname]
The root of the project.
@since 0.3.0
# File lib/deployml/cli.rb, line 229 def find_root Pathname.pwd.ascend do |root| config_dir = root.join(Project::CONFIG_DIR) if config_dir.directory? config_file = config_dir.join(Project::CONFIG_FILE) return root if config_file.file? environments_dir = config_dir.join(Project::ENVIRONMENTS_DIR) return root if environments_dir.directory? end end shell.say "Could not find '#{Project::CONFIG_FILE}' in any parent directories", :red exit -1 end
The project.
@return [Project]
The project object.
@since 0.3.0
# File lib/deployml/cli.rb, line 254 def project @project ||= Project.new(find_root) end
Prints a status message.
@param [String] message
The message to print.
# File lib/deployml/cli.rb, line 276 def status(message) shell.say_status "[#{options[:environment]}]", message end