Class: Dply::Cli::Deploy
- Inherits:
-
Object
show all
- Includes:
- Logger
- Defined in:
- lib/dply/cli/deploy.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Logger
#debug?, #logger, stderr, #stderr
Constructor Details
#initialize(argv) ⇒ Deploy
Returns a new instance of Deploy.
14
15
16
|
# File 'lib/dply/cli/deploy.rb', line 14
def initialize(argv)
@argv = argv
end
|
Instance Attribute Details
#argv ⇒ Object
Returns the value of attribute argv.
12
13
14
|
# File 'lib/dply/cli/deploy.rb', line 12
def argv
@argv
end
|
Instance Method Details
#config ⇒ Object
32
33
34
|
# File 'lib/dply/cli/deploy.rb', line 32
def config
@config ||= DeployConfig.build("#{Dir.pwd}/deploy.rb")
end
|
#lock ⇒ Object
28
29
30
|
# File 'lib/dply/cli/deploy.rb', line 28
def lock
@lock ||= Lock.new(Dir.pwd)
end
|
#options ⇒ Object
68
69
70
|
# File 'lib/dply/cli/deploy.rb', line 68
def options
@options ||= {}
end
|
#opts ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'lib/dply/cli/deploy.rb', line 36
def opts
OptionParser.new do |opts|
opts.banner = "Usage: dply deploy [options] [target]"
opts.on("-b", "--branch [BRANCH]" , "Specify git branch") do |b|
config.branch = b
end
opts.on("-r", "--revision [REVISION]", "Specify build revision (only used in archive strategy)") do |r|
config.revision = r
end
opts.on("--no-pull", "Enable/disable git pull") do |e|
options[:no_pull] = true
end
opts.on("--skip-git", "Disable git") do |e|
options[:skip_git] = true
end
opts.on("--skip-bundler", "Skip bundle install") do |e|
options[:skip_bundler] = true
end
opts.on("-h", "--help", "Help") do
puts opts
exit
end
end
end
|
#run ⇒ Object
18
19
20
21
22
|
# File 'lib/dply/cli/deploy.rb', line 18
def run
lock.acquire
opts.parse!(argv)
strategy.deploy
end
|
#strategy ⇒ Object
24
25
26
|
# File 'lib/dply/cli/deploy.rb', line 24
def strategy
@strategy ||= Strategy.load(config, options)
end
|