class DeploYML::CLI

The command-line interface to {DeploYML} using [Thor](github.com/wycats/thor#readme).

Public Instance Methods

config() click to toggle source

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
deploy() click to toggle source

Cold-deploys into the specified environment.

# File lib/deployml/cli.rb, line 194
def deploy
  status 'Deploying ...'

  project.deploy!(options[:environment])

  status 'Deployed'
end
exec(command) click to toggle source

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
install() click to toggle source

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
migrate() click to toggle source

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
rake(task) click to toggle source

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
redeploy() click to toggle source

Redeploys into the specified environment.

# File lib/deployml/cli.rb, line 210
def redeploy
  status 'Redeploying ...'

  project.redeploy!(options[:environment])

  status 'Redeployed'
end
restart() click to toggle source

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
setup() click to toggle source

Sets up the specified environment.

# File lib/deployml/cli.rb, line 66
def setup
  status 'Setting up ...'

  project.setup!(options[:environment])

  status 'Setup'
end
ssh() click to toggle source

Starts an SSH session with the specified environment.

# File lib/deployml/cli.rb, line 54
def ssh
  environment.ssh
end
start() click to toggle source

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
stop() click to toggle source

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
update() click to toggle source

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

environment() click to toggle source

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
find_root() click to toggle source

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
project() click to toggle source

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
status(message) click to toggle source

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