Class: Dply::Cli::Status

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/dply/cli/status.rb

Instance Method Summary collapse

Methods included from Logger

#debug?, #logger, stderr, #stderr

Constructor Details

#initialize(argv) ⇒ Status

Returns a new instance of Status.



10
11
12
# File 'lib/dply/cli/status.rb', line 10

def initialize(argv)
  @argv = argv
end

Instance Method Details

#current_dirObject



35
36
37
# File 'lib/dply/cli/status.rb', line 35

def current_dir
  @current_dir ||= "current"
end

#current_releaseObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/dply/cli/status.rb', line 24

def current_release
  @current_release ||= begin
    if File.symlink? current_dir
      name = File.basename( File.readlink current_dir )
    else
      name = "NA"
    end
    release_helper.parse name
  end
end


18
19
20
21
22
# File 'lib/dply/cli/status.rb', line 18

def print_status
  r = current_release
  color = r[:deployed] ? :green : :red
  logger.info "#{r[:revision].send color} #{r[:project]} #{r[:branch]} #{r[:timestamp]}"
end

#release_helperObject



39
40
41
# File 'lib/dply/cli/status.rb', line 39

def release_helper
  @release_helper ||= ReleaseHelper.new
end

#runObject



14
15
16
# File 'lib/dply/cli/status.rb', line 14

def run
  print_status
end