orca 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orca (0.3.4)
4
+ orca (0.3.5)
5
5
  colored
6
6
  net-sftp
7
7
  net-ssh
data/README.md CHANGED
@@ -27,17 +27,17 @@ Orca fills the rather large gap between (2) and (3). It's a bigger gap then you
27
27
 
28
28
  Orca fixes these problems by...
29
29
 
30
- - working directly over SSH, all you need is a box tht you can connect to
30
+ - working directly over SSH, all you need is a box that you can connect to
31
31
  - package definitions can all go in a single file and most servers can be configured in ~50 lines
32
32
  - packages are defined in a ruby based DSL that consists of only 5 very basic commands to learn
33
- - Orca makes no assumptions about the underlying OS accept to assume it supports SSH
33
+ - Orca makes no assumptions about the underlying OS except to assume it supports SSH
34
34
  - Orca is extensible and adding platform specific features like package manger support can be achieved in a dozen or so lines.
35
35
 
36
36
 
37
37
  What problems is Orca avoiding?
38
38
  -------------------------------
39
39
 
40
- Orca intentionally skirts around some important thengs that may or may not matter to you. If they do then you are probably better using more robust tools such as Puppet or Chef.
40
+ Orca intentionally skirts around some important things that may or may not matter to you. If they do then you are probably better using more robust tools such as Puppet or Chef.
41
41
 
42
42
  Orca doesn't...
43
43
 
data/lib/orca/cli.rb CHANGED
@@ -39,22 +39,24 @@ class Orca::Cli < Thor
39
39
 
40
40
  def run_command(package, group, cmd)
41
41
  Orca.verbose(options[:verbose] || false)
42
+ err = nil
42
43
  begin
43
44
  suite = Orca::Suite.new(options)
44
45
  suite.load_file(orca_file)
45
46
  suite.run(group, package, cmd)
46
47
  rescue => e
48
+ err = e
49
+ ensure
50
+ $stdout.print "Disconnecting...".green
51
+ suite.cleanup
52
+ $stdout.puts "Done!".green
53
+ exit(0) if err.nil?
47
54
  if options[:throw]
48
- raise e
55
+ raise err
49
56
  else
50
57
  $stderr.puts "!!! ERROR !!! [#{e.class.name}] #{e.message}".red.bold
51
58
  exit(1)
52
59
  end
53
- ensure
54
- $stdout.print "Disconnecting...".green
55
- suite.cleanup
56
- $stdout.puts "Done!".green
57
- exit(0)
58
60
  end
59
61
  end
60
62
 
data/lib/orca/dsl.rb CHANGED
@@ -15,8 +15,8 @@ module Orca
15
15
  Orca::Node.new(name, host, options)
16
16
  end
17
17
 
18
- def group(name, nodes=[], &blk)
19
- g = Orca::Group.new(name, nodes)
18
+ def group(name, config={}, nodes=[], &blk)
19
+ g = Orca::Group.new(name, config, nodes)
20
20
  g.instance_eval(&blk) if block_given?
21
21
  end
22
22
  end
data/lib/orca/group.rb CHANGED
@@ -6,7 +6,7 @@ class Orca::Group
6
6
  end
7
7
 
8
8
  def from_node(node)
9
- new(node.name, [node])
9
+ new(node.name, {}, [node])
10
10
  end
11
11
 
12
12
  def find(name)
@@ -16,16 +16,17 @@ class Orca::Group
16
16
  end
17
17
  end
18
18
 
19
- attr_reader :name, :nodes
19
+ attr_reader :name, :nodes, :config
20
20
 
21
- def initialize(name, nodes=[])
21
+ def initialize(name, config={}, nodes=[])
22
22
  @name = name
23
+ @config = config
23
24
  @nodes = nodes
24
25
  Orca::Group.register(self)
25
26
  end
26
27
 
27
28
  def node(name, host, options={})
28
- add_node( Orca::Node.new(name, host, options) )
29
+ add_node( Orca::Node.new(name, host, @config.merge(options)) )
29
30
  end
30
31
 
31
32
  def add_node(node)
@@ -35,4 +36,8 @@ class Orca::Group
35
36
  def includes(group)
36
37
  Orca::Group.find(group).nodes.each {|n| add_node(n) }
37
38
  end
39
+
40
+ def set(property, value)
41
+ @config[property.to_sym] = value
42
+ end
38
43
  end
data/orca.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
11
11
  gem.name = "orca"
12
12
  gem.require_paths = ["lib"]
13
- gem.version = '0.3.4'
13
+ gem.version = '0.3.5'
14
14
  gem.add_dependency('colored')
15
15
  gem.add_dependency('net-ssh')
16
16
  gem.add_dependency('net-sftp')
data/test/group_test.rb CHANGED
@@ -20,6 +20,15 @@ describe Orca::Group do
20
20
  group.nodes.first.name.must_equal 'mynode'
21
21
  group.nodes.first.host.must_equal 'myhost'
22
22
  end
23
+
24
+ it "inherits config from the group" do
25
+ group = Orca::Group.new('test', :user => 'testuser')
26
+ group.node('mynode', 'myhost')
27
+ group.nodes.size.must_equal 1
28
+ group.nodes.first.name.must_equal 'mynode'
29
+ group.nodes.first.host.must_equal 'myhost'
30
+ group.nodes.first.user.must_equal 'testuser'
31
+ end
23
32
  end
24
33
 
25
34
  describe ".add_node(node)" do
@@ -34,7 +43,7 @@ describe Orca::Group do
34
43
  describe ".includes(other_group)" do
35
44
  it "copied the nodes from another group" do
36
45
  node = mock
37
- group = Orca::Group.new('test-a', [node])
46
+ group = Orca::Group.new('test-a', {}, [node])
38
47
  group2 = Orca::Group.new('test-b')
39
48
  group2.nodes.must_equal []
40
49
  group2.includes(group)
@@ -43,11 +52,19 @@ describe Orca::Group do
43
52
 
44
53
  it "copied the nodes from another group by name" do
45
54
  node = mock
46
- group = Orca::Group.new('test-a', [node])
55
+ group = Orca::Group.new('test-a', {}, [node])
47
56
  group2 = Orca::Group.new('test-b')
48
57
  group2.nodes.must_equal []
49
58
  group2.includes('test-a')
50
59
  group2.nodes.must_equal [node]
51
60
  end
52
61
  end
62
+
63
+ describe ".set(property, value)" do
64
+ it "sets a config option for the group" do
65
+ group = Orca::Group.new('test')
66
+ group.set :user, 'testuser'
67
+ group.config[:user].must_equal 'testuser'
68
+ end
69
+ end
53
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orca
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-29 00:00:00.000000000 Z
12
+ date: 2013-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: 565408569363101895
136
+ hash: -2049972371270429172
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: 565408569363101895
145
+ hash: -2049972371270429172
146
146
  requirements: []
147
147
  rubyforge_project:
148
148
  rubygems_version: 1.8.23