Class: Smith::Commands::Version
- Inherits:
-
Smith::CommandBase
- Object
- Smith::CommandBase
- Smith::Commands::Version
- Defined in:
- lib/smith/commands/agency/version.rb
Instance Attribute Summary
Attributes inherited from Smith::CommandBase
Instance Method Summary collapse
Methods inherited from Smith::CommandBase
#banner, #format_help, #initialize, #parse_options
Methods included from Logger
Constructor Details
This class inherits a constructor from Smith::CommandBase
Instance Method Details
#execute ⇒ Object
5 6 7 8 9 |
# File 'lib/smith/commands/agency/version.rb', line 5 def execute version do |v| responder.succeed(v) end end |
#version(&blk) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/smith/commands/agency/version.rb', line 11 def version(&blk) if [:git] # EM.system doesn't do any shell expansion so do it ourselves. EM.system("sh -c 'git describe 2> /dev/null'") do |output,status| blk.call((status.exitstatus == 0) ? output.strip : 'The agency is not running in a git repo.') end else blk.call(Smith::VERSION) end end |