screwcap 0.3.5 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +7 -5
- data/README.rdoc +13 -0
- data/Rakefile +1 -1
- data/bin/screwcap +24 -9
- data/lib/screwcap.rb +2 -2
- data/lib/screwcap/base.rb +4 -0
- data/lib/screwcap/message_logger.rb +1 -1
- data/lib/screwcap/runner.rb +68 -75
- data/lib/screwcap/sequence.rb +0 -10
- data/lib/screwcap/server.rb +9 -7
- data/lib/screwcap/task.rb +48 -43
- data/lib/screwcap/{deployer.rb → task_manager.rb} +55 -46
- data/recipes/setup_rails.rb +3 -3
- data/runrdoc +1 -0
- data/screwcap.gemspec +1 -1
- data/spec/runner_spec.rb +51 -0
- data/spec/sequence_spec.rb +2 -16
- data/spec/server_spec.rb +0 -9
- data/spec/task_manager_spec.rb +100 -0
- data/spec/task_spec.rb +123 -60
- data/test/config/bad_use.rb +1 -0
- data/test/config/expect.rb +5 -0
- data/test/config/simple_recipe.rb +0 -6
- data/test/config/super_simple_recipe.rb +11 -0
- data/test/config/use.rb +1 -1
- data/test/config/use2.rb +1 -0
- metadata +10 -9
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -49
- data/spec/command_set_spec.rb +0 -57
- data/spec/deployer_spec.rb +0 -78
@@ -0,0 +1 @@
|
|
1
|
+
use :unknown_file
|
data/test/config/expect.rb
CHANGED
@@ -25,10 +25,6 @@ task_for :task3, :servers => [:test, :test2] do
|
|
25
25
|
local "ls" #empty in tests so it doesn't pollute
|
26
26
|
end
|
27
27
|
|
28
|
-
task_for :seq1, :server => :test do
|
29
|
-
run "1"
|
30
|
-
end
|
31
|
-
|
32
28
|
task_for :seq2, :server => :test do
|
33
29
|
run "2"
|
34
30
|
end
|
@@ -36,5 +32,3 @@ end
|
|
36
32
|
task_for :non_parallel, :server => :test, :parallel => false do
|
37
33
|
run "ls"
|
38
34
|
end
|
39
|
-
|
40
|
-
sequence :deploy, :tasks => [:seq1, :seq2]
|
data/test/config/use.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
use :
|
1
|
+
use :super_simple_recipe
|
data/test/config/use2.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
use "test/config/super_simple_recipe.rb"
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: screwcap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 3
|
9
8
|
- 5
|
10
|
-
version: 0.
|
9
|
+
version: "0.5"
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Grant Ammons
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2010-
|
17
|
+
date: 2010-11-19 00:00:00 -05:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
@@ -109,8 +108,6 @@ extra_rdoc_files:
|
|
109
108
|
- History.txt
|
110
109
|
- Manifest.txt
|
111
110
|
files:
|
112
|
-
- Gemfile
|
113
|
-
- Gemfile.lock
|
114
111
|
- History.txt
|
115
112
|
- Manifest.txt
|
116
113
|
- README.rdoc
|
@@ -119,23 +116,25 @@ files:
|
|
119
116
|
- bin/screwcap
|
120
117
|
- lib/screwcap.rb
|
121
118
|
- lib/screwcap/base.rb
|
122
|
-
- lib/screwcap/deployer.rb
|
123
119
|
- lib/screwcap/message_logger.rb
|
124
120
|
- lib/screwcap/runner.rb
|
125
121
|
- lib/screwcap/sequence.rb
|
126
122
|
- lib/screwcap/server.rb
|
127
123
|
- lib/screwcap/task.rb
|
124
|
+
- lib/screwcap/task_manager.rb
|
128
125
|
- lib/trollop.rb
|
129
126
|
- recipes/setup_rails.rb
|
127
|
+
- runrdoc
|
130
128
|
- screwcap.gemspec
|
131
|
-
- spec/
|
132
|
-
- spec/deployer_spec.rb
|
129
|
+
- spec/runner_spec.rb
|
133
130
|
- spec/sequence_spec.rb
|
134
131
|
- spec/server_spec.rb
|
135
132
|
- spec/spec.opts
|
136
133
|
- spec/spec_helper.rb
|
134
|
+
- spec/task_manager_spec.rb
|
137
135
|
- spec/task_spec.rb
|
138
136
|
- tasks/rspec.rake
|
137
|
+
- test/config/bad_use.rb
|
139
138
|
- test/config/command_sets.rb
|
140
139
|
- test/config/expect.rb
|
141
140
|
- test/config/gateway.rb
|
@@ -143,12 +142,14 @@ files:
|
|
143
142
|
- test/config/no_server.rb
|
144
143
|
- test/config/rails_tasks.rb
|
145
144
|
- test/config/simple_recipe.rb
|
145
|
+
- test/config/super_simple_recipe.rb
|
146
146
|
- test/config/undefined_command_set.rb
|
147
147
|
- test/config/undefined_item.rb
|
148
148
|
- test/config/undefined_server.rb
|
149
149
|
- test/config/unknown_use.rb
|
150
150
|
- test/config/upload.rb
|
151
151
|
- test/config/use.rb
|
152
|
+
- test/config/use2.rb
|
152
153
|
has_rdoc: true
|
153
154
|
homepage: http://gammons.github.com/screwcap
|
154
155
|
licenses: []
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
RedCloth (4.2.3)
|
5
|
-
activesupport (2.3.9)
|
6
|
-
columnize (0.3.1)
|
7
|
-
hoe (2.6.2)
|
8
|
-
rake (>= 0.8.7)
|
9
|
-
rubyforge (>= 2.0.4)
|
10
|
-
json_pure (1.4.6)
|
11
|
-
linecache (0.43)
|
12
|
-
mocha (0.9.8)
|
13
|
-
rake
|
14
|
-
net-scp (1.0.4)
|
15
|
-
net-ssh (>= 1.99.1)
|
16
|
-
net-ssh (2.0.23)
|
17
|
-
net-ssh-gateway (1.0.1)
|
18
|
-
net-ssh (>= 1.99.1)
|
19
|
-
newgem (1.5.3)
|
20
|
-
RedCloth (>= 4.1.1)
|
21
|
-
activesupport (~> 2.3.4)
|
22
|
-
hoe (>= 2.4.0)
|
23
|
-
rubigen (>= 1.5.3)
|
24
|
-
syntax (>= 1.0.0)
|
25
|
-
rake (0.8.7)
|
26
|
-
rspec (1.3.1)
|
27
|
-
rubigen (1.5.5)
|
28
|
-
activesupport (~> 2.3.5)
|
29
|
-
ruby-debug (0.10.3)
|
30
|
-
columnize (>= 0.1)
|
31
|
-
ruby-debug-base (~> 0.10.3.0)
|
32
|
-
ruby-debug-base (0.10.3)
|
33
|
-
linecache (>= 0.3)
|
34
|
-
rubyforge (2.0.4)
|
35
|
-
json_pure (>= 1.1.7)
|
36
|
-
syntax (1.0.0)
|
37
|
-
|
38
|
-
PLATFORMS
|
39
|
-
ruby
|
40
|
-
|
41
|
-
DEPENDENCIES
|
42
|
-
hoe
|
43
|
-
mocha
|
44
|
-
net-scp
|
45
|
-
net-ssh
|
46
|
-
net-ssh-gateway
|
47
|
-
newgem
|
48
|
-
rspec (= 1.3.1)
|
49
|
-
ruby-debug
|
data/spec/command_set_spec.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Command sets" do
|
4
|
-
before(:all) do
|
5
|
-
@stdout = []
|
6
|
-
Deployer.any_instance.stubs(:log).with() { |msg| @stdout << msg}
|
7
|
-
@deployer = Deployer.new(:recipe_file => "./test/config/command_sets.rb", :silent => true)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "should be able to define a generic list of commands" do
|
11
|
-
task = @deployer.__tasks.find {|t| t.__name == :really_simple_task }
|
12
|
-
task.should have(3).__commands
|
13
|
-
task.__commands.map{|c| c[:command]}.should == %w(1 2 3)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should be able to use deployment variables" do
|
17
|
-
task = @deployer.__tasks.find {|t| t.__name == :use_command_set_no_override }
|
18
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
19
|
-
task.__commands.map {|c| c[:command]}.should == ["tester","run with tester","bongo"]
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should be able to use task variables" do
|
23
|
-
task = @deployer.__tasks.find {|t| t.__name == :task_set_var }
|
24
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
25
|
-
task.__commands.map {|c| c[:command]}.should == ["bojangles"]
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should favor variables that were overridden by a task" do
|
29
|
-
task = @deployer.__tasks.find {|t| t.__name == :use_command_set_with_override }
|
30
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
31
|
-
task.__commands.map {|c| c[:command]}.should == ["shasta","run with shasta","bongo"]
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should favor variables defined in the command set definition" do
|
35
|
-
task = @deployer.__tasks.find {|t| t.__name == :command_set_override }
|
36
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
37
|
-
task.__commands.map {|c| c[:command]}.should == ["dingle"]
|
38
|
-
end
|
39
|
-
|
40
|
-
it "should accept nested command sets" do
|
41
|
-
task = @deployer.__tasks.find {|t| t.__name == :nested_command_set }
|
42
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
43
|
-
task.__commands.map {|c| c[:command]}.should == %w(1 2 3 4)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "nested command sets have their own variable scope" do
|
47
|
-
task = @deployer.__tasks.find {|t| t.__name == :nested_scoping }
|
48
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
49
|
-
task.__commands.map {|c| c[:command]}.should == %w(birdo nested birdo task)
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should be able to call scp just like a task" do
|
53
|
-
task = @deployer.__tasks.find {|t| t.__name == :task_use_scp}
|
54
|
-
task.__command_sets.first.instance_eval(&task.__command_sets.first.__block)
|
55
|
-
task.__commands.map {|c| c[:command]}.should == [nil]
|
56
|
-
end
|
57
|
-
end
|
data/spec/deployer_spec.rb
DELETED
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe "Deployers" do
|
4
|
-
before(:all) do
|
5
|
-
Net::SSH.stubs(:start).yields(SSHObject.new(:return_stream => :stdout, :return_data => "hostname = asdf\n"))
|
6
|
-
Runner.stubs(:ssh_exec!).returns(["ok","",0,nil])
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should complain if no server was defined" do
|
10
|
-
lambda { Deployer.new(:recipe_file => "./test/config/no_server.rb", :silent => true)}.should raise_error(Screwcap::ConfigurationError)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "should complain if there is an undefined item in a task" do
|
14
|
-
lambda { Deployer.new(:recipe_file => "./test/config/undefined_item.rb", :silent => true)}.should raise_error(NoMethodError)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should complain if screwcap cannot find the task to run" do
|
18
|
-
lambda { Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true).run! :task }.should raise_error(Screwcap::TaskNotFound)
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should complain if a gateway has more than one address" do
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should be able to define tasks and servers" do
|
25
|
-
deployer = Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true)
|
26
|
-
|
27
|
-
deployer.should have(6).__tasks
|
28
|
-
deployer.should have(2).__servers
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should be able to define variables with set" do
|
32
|
-
deployer = Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true)
|
33
|
-
deployer.should respond_to(:deploy_var)
|
34
|
-
deployer.should respond_to(:deploy_var_2)
|
35
|
-
deployer.should respond_to(:deploy_var_3)
|
36
|
-
|
37
|
-
deployer.deploy_var.should == "tester"
|
38
|
-
deployer.deploy_var_2.should == "bongo"
|
39
|
-
deployer.deploy_var_3.should == ["one","two"]
|
40
|
-
end
|
41
|
-
|
42
|
-
it "should be able to define command sets" do
|
43
|
-
deployer = Deployer.new(:recipe_file => "./test/config/command_sets.rb", :silent => true)
|
44
|
-
deployer.should have(9).__command_sets
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should be able to define gateways" do
|
48
|
-
deployer = Deployer.new(:recipe_file => "./test/config/gateway.rb", :silent => true)
|
49
|
-
deployer.should have(3).__servers
|
50
|
-
deployer.__servers.select {|s| s.__options[:is_gateway] == true }.size.should == 1
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should be able to define sequences" do
|
54
|
-
deployer = Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true)
|
55
|
-
deployer.should have(1).__sequences
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should be able to run a single task" do
|
59
|
-
deployer = Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true)
|
60
|
-
deployer.run! :task1
|
61
|
-
#lambda { deployer.run! :task1 }.should_not raise_error
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should be able to run multiple tasks" do
|
65
|
-
deployer = Deployer.new(:recipe_file => "./test/config/simple_recipe.rb", :silent => true)
|
66
|
-
lambda { deployer.run! :task1, :task2 }.should_not raise_error
|
67
|
-
end
|
68
|
-
|
69
|
-
it "should be able to include other task files with the use keyword" do
|
70
|
-
deployer = Deployer.new(:recipe_file => "./test/config/use.rb", :silent => true)
|
71
|
-
deployer.should have(6).__tasks
|
72
|
-
deployer.deploy_var.should == "tester"
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should complain if we attempt to use an unknown file" do
|
76
|
-
lambda {Deployer.new(:recipe_file => "./test/config/unknown_use.rb", :silent => true) }.should raise_error(Screwcap::IncludeFileNotFound)
|
77
|
-
end
|
78
|
-
end
|