Sha256: 15a8a4e337e2a1e5553439cb0bf66443423db72195e5e48a21a480df25afce21

Contents?: true

Size: 1.81 KB

Versions: 31

Compression:

Stored size: 1.81 KB

Contents

require 'capistrano'
require 'capistrano/cli/execute'
require 'capistrano/cli/help'
require 'capistrano/cli/options'
require 'capistrano/cli/ui'

module Capistrano
  # The CLI class encapsulates the behavior of capistrano when it is invoked
  # as a command-line utility. This allows other programs to embed Capistrano
  # and preserve its command-line semantics.
  class CLI
    # The array of (unparsed) command-line options
    attr_reader :args

    # Create a new CLI instance using the given array of command-line parameters
    # to initialize it. By default, +ARGV+ is used, but you can specify a
    # different set of parameters (such as when embedded cap in a program):
    #
    #   require 'capistrano/cli'
    #   Capistrano::CLI.parse(%w(-vvvv -r config/deploy update_code)).execute!
    #
    # Note that you can also embed cap directly by creating a new Configuration
    # instance and setting it up, but you'll often wind up duplicating logic
    # defined in the CLI class. The above snippet, redone using the Configuration
    # class directly, would look like:
    #
    #   require 'capistrano'
    #   require 'capistrano/cli'
    #   config = Capistrano::Configuration.new
    #   config.logger_level = Capistrano::Logger::TRACE
    #   config.set(:password) { Capistrano::CLI.password_prompt }
    #   config.load "config/deploy"
    #   config.update_code
    #
    # There may be times that you want/need the additional control offered by
    # manipulating the Configuration directly, but generally interfacing with
    # the CLI class is recommended.
    def initialize(args)
      @args = args.dup
      $stdout.sync = true # so that Net::SSH prompts show up
    end

    # Mix-in the actual behavior
    include Execute, Options, UI
    include Help # needs to be included last, because it overrides some methods
  end
end

Version data entries

31 entries across 31 versions & 8 rubygems

Version Path
wulffeld-capistrano-2.5.8.3 lib/capistrano/cli.rb
dan-capistrano-2.5.6 lib/capistrano/cli.rb
fotonauts-capistrano-2.5.2 lib/capistrano/cli.rb
mbailey-capistrano-2.5.5 lib/capistrano/cli.rb
mbailey-capistrano-2.5.6 lib/capistrano/cli.rb
mbailey-capistrano-2.5.7 lib/capistrano/cli.rb
sneakin-capistrano-2.5.5 lib/capistrano/cli.rb
thoughtbot-capistrano-2.5.5 lib/capistrano/cli.rb
thoughtbot-capistrano-2.5.6 lib/capistrano/cli.rb
wulffeld-capistrano-2.5.8.1 lib/capistrano/cli.rb
wulffeld-capistrano-2.5.8 lib/capistrano/cli.rb
wulffeld-capistrano-2.5.8.2 lib/capistrano/cli.rb
capistrano-2.5.9 lib/capistrano/cli.rb
capistrano-2.5.6 lib/capistrano/cli.rb
capistrano-2.5.7 lib/capistrano/cli.rb
capistrano-2.5.8 lib/capistrano/cli.rb
capistrano-2.1.0 lib/capistrano/cli.rb
capistrano-2.0.0 lib/capistrano/cli.rb
capistrano-2.4.0 lib/capistrano/cli.rb
capistrano-2.4.3 lib/capistrano/cli.rb