cosmo 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require 'cosmo'
3
+ command = ARGV.shift
4
+
5
+ case command
6
+ when 'shell'
7
+ require 'cosmo/shell'
8
+ when 'list'
9
+ require 'cosmo/list'
10
+ end
@@ -8,12 +8,12 @@ require "colored"
8
8
  require "trollop"
9
9
 
10
10
  module Cosmo
11
- opts = Trollop::options do
11
+ @opts = Trollop::options do
12
12
  opt :dry, "dry run"
13
13
  opt :interactive, "For scripts which take interactive arguments"
14
14
  end
15
15
 
16
- if opts[:dry]
16
+ if @opts[:dry]
17
17
  puts "This is a dry run!".blue
18
18
  Cosmo.dry = true
19
19
  end
@@ -0,0 +1,41 @@
1
+ require 'bombshell'
2
+ module Cosmo
3
+ class Shell < Bombshell::Environment
4
+ include Bombshell::Shell
5
+ prompt_with 'cosmo'
6
+ def use arg = nil
7
+ if arg
8
+ if Cosmo.groups[arg]
9
+ Group.launch arg
10
+ else
11
+ puts "Sorry no such group try one of:"
12
+ puts Cosmo.groups.keys.join("\n")
13
+ end
14
+ else
15
+ puts "Sorry no such group try one of:"
16
+ puts Cosmo.groups.keys.join("\n")
17
+ end
18
+ end
19
+
20
+ class Group < Bombshell::Environment
21
+ include Bombshell::Shell
22
+ def initialize(name)
23
+ @name = name
24
+ end
25
+ prompt_with {|i| i.name}
26
+
27
+ def name
28
+ @name
29
+ end
30
+
31
+ def run command
32
+ Cosmo.groups[@name].run command
33
+ end
34
+
35
+ def main
36
+ quit
37
+ end
38
+ end
39
+ end
40
+ end
41
+ Bombshell.launch(Cosmo::Shell)
@@ -1,3 +1,3 @@
1
1
  module Cosmo
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-26 00:00:00.000000000Z
12
+ date: 2012-03-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colors
16
- requirement: &70107363907540 !ruby/object:Gem::Requirement
16
+ requirement: &70139069807020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70107363907540
24
+ version_requirements: *70139069807020
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: trollop
27
- requirement: &70107363907120 !ruby/object:Gem::Requirement
27
+ requirement: &70139069806600 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70107363907120
35
+ version_requirements: *70139069806600
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: net-ssh
38
- requirement: &70107363906700 !ruby/object:Gem::Requirement
38
+ requirement: &70139069806180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,11 +43,12 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70107363906700
46
+ version_requirements: *70139069806180
47
47
  description: Makes running things on multiple machines easy
48
48
  email:
49
49
  - thom.mulvaney@gmail.com
50
- executables: []
50
+ executables:
51
+ - cosmo
51
52
  extensions: []
52
53
  extra_rdoc_files: []
53
54
  files:
@@ -56,11 +57,13 @@ files:
56
57
  - LICENSE
57
58
  - README.md
58
59
  - Rakefile
60
+ - bin/cosmo
59
61
  - cosmo.gemspec
60
62
  - lib/cosmo.rb
61
63
  - lib/cosmo/account.rb
62
64
  - lib/cosmo/cosmo.rb
63
65
  - lib/cosmo/group.rb
66
+ - lib/cosmo/shell.rb
64
67
  - lib/cosmo/version.rb
65
68
  homepage: ''
66
69
  licenses: []