Class: Dply::Cli::Ctl

Inherits:
Object
  • Object
show all
Defined in:
lib/dply/cli/ctl.rb

Instance Method Summary collapse

Instance Method Details

#configObject



25
26
27
# File 'lib/dply/cli/ctl.rb', line 25

def config
  @config ||= DeployConfig.build("#{Dir.pwd}/deploy.rb")
end

#lockObject



29
30
31
# File 'lib/dply/cli/ctl.rb', line 29

def lock
  @lock ||= Lock.new(Dir.pwd)
end

#run(command) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/dply/cli/ctl.rb', line 10

def run(command)
  case command
  when :start, :stop, :reopen_logs
    lock.acquire
    Dir.chdir("current") { util.run command }
  when :reload
    lock.acquire
    strategy.reload
  end
end

#strategyObject



21
22
23
# File 'lib/dply/cli/ctl.rb', line 21

def strategy
  @strategy ||= Strategy.load(config, {})
end

#utilObject



33
34
35
# File 'lib/dply/cli/ctl.rb', line 33

def util
  @util ||= ::Dply::Util.new
end