Module: Cosmo
- Defined in:
- lib/cosmo.rb,
lib/cosmo/shell.rb,
lib/cosmo/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.2.0"
Instance Method Summary collapse
- #commands(*comms, &block) ⇒ Object
- #job(name, &job) ⇒ Object
- #on_group(name, &group) ⇒ Object
- #pwd ⇒ Object
Instance Method Details
#commands(*comms, &block) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/cosmo.rb', line 33 def commands *comms, &block count = comms.count comms.each_with_index do |c,i| puts " => Command (#{i+1}/#{count}): #{c}" yield c end end |
#job(name, &job) ⇒ Object
21 22 23 24 25 |
# File 'lib/cosmo.rb', line 21 def job name, &job s = "Job: #{name}" puts s.blue job.call end |
#on_group(name, &group) ⇒ Object
27 28 29 30 31 |
# File 'lib/cosmo.rb', line 27 def on_group name, &group puts " => On worker group" group[Cosmo.groups[name]] puts "" end |
#pwd ⇒ Object
41 42 43 44 45 |
# File 'lib/cosmo.rb', line 41 def pwd full = ENV['PWD'] home = ENV['HOME'] full.sub(home, "~") end |