Class: Capistrano::Releases::CLI
- Inherits:
-
Object
- Object
- Capistrano::Releases::CLI
- Defined in:
- lib/capistrano/releases/cli.rb
Overview
Command line interface class for Manager class.
Instance Method Summary collapse
Instance Method Details
#run ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/capistrano/releases/cli.rb', line 5 def run = {} parser = OptionParser.new do |opts| opts. = 'Usage: manager [options]' opts.on('-bBUCKET', '--bucket=BUCKET', 'S3 bucket to pull/push releases.') do |v| [:bucket] = v end opts.on('-dDEPLOY_TO', '--deploy-to=DEPLOY_TO', 'App directory to deploy to.') do |v| [:deploy_to] = v end opts.on('-mMODE', '--mode=MODE', "Mode to run: 'push' or 'pull'") do |v| [:mode] = v end end parser.parse! unless [:bucket] puts('-b or --bucket is a required option.') && exit(1) end unless [:deploy_to] puts('-d or --deploy-to is a required option.') && exit(1) end puts('-m or --mode is a required option.') && exit(1) unless [:mode] manager = ::Capistrano::Releases::Manager.new() case [:mode] when 'push' manager.push when 'pull' manager.pull else puts 'Invalid mode.' exit(1) end end |