class Dandelion::Command::Deploy
Public Class Methods
parser(options)
click to toggle source
# File lib/dandelion/command/deploy.rb, line 6 def self.parser(options) OptionParser.new do |opts| opts.banner = 'Usage: dandelion deploy [options] [<revision>]' options[:dry] = false opts.on('--dry-run', 'Show what would have been deployed') do options[:dry] = true end end end
Public Instance Methods
deployer()
click to toggle source
# File lib/dandelion/command/deploy.rb, line 42 def deployer @deployer ||= Deployer.new(deployer_adapter, config) end
deployer_adapter()
click to toggle source
# File lib/dandelion/command/deploy.rb, line 34 def deployer_adapter if options[:dry] Adapter::NoOpAdapter.new(config) else adapter end end
execute!()
click to toggle source
# File lib/dandelion/command/deploy.rb, line 21 def execute! log.info("Connecting to #{adapter.to_s}") local_commit = workspace.local_commit remote_commit = workspace.remote_commit log.info("Remote revision: #{remote_commit ? remote_commit.oid : '---'}") log.info("Deploying revision: #{local_commit.oid}") deploy_changeset! deploy_additional_files! end
setup(args)
click to toggle source
# File lib/dandelion/command/deploy.rb, line 17 def setup(args) config[:revision] = args.shift || nil end
Private Instance Methods
deploy_additional_files!()
click to toggle source
# File lib/dandelion/command/deploy.rb, line 60 def deploy_additional_files! if config[:additional] && config[:additional].length > 0 log.info("Deploying additional files...") deployer.deploy_files!(config[:additional]) end end
deploy_changeset!()
click to toggle source
# File lib/dandelion/command/deploy.rb, line 48 def deploy_changeset! changeset = workspace.changeset if changeset.empty? log.info("No changes to deploy") else log.info("Deploying changes...") deployer.deploy_changeset!(workspace.changeset) workspace.remote_commit = workspace.local_commit unless options[:dry] end end