engineyard-serverside 2.1.4 → 2.2.0.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,45 +0,0 @@
1
- ## systemu.gemspec
2
- #
3
-
4
- Gem::Specification::new do |spec|
5
- spec.name = "systemu"
6
- spec.version = "2.5.0"
7
- spec.platform = Gem::Platform::RUBY
8
- spec.summary = "systemu"
9
- spec.description = "description: systemu kicks the ass"
10
-
11
- spec.files =
12
- ["LICENSE",
13
- "README",
14
- "README.erb",
15
- "Rakefile",
16
- "lib",
17
- "lib/systemu.rb",
18
- "samples",
19
- "samples/a.rb",
20
- "samples/b.rb",
21
- "samples/c.rb",
22
- "samples/d.rb",
23
- "samples/e.rb",
24
- "samples/f.rb",
25
- "systemu.gemspec",
26
- "test",
27
- "test/systemu_test.rb",
28
- "test/testing.rb"]
29
-
30
- spec.executables = []
31
-
32
- spec.require_path = "lib"
33
-
34
- spec.test_files = nil
35
-
36
- ### spec.add_dependency 'lib', '>= version'
37
- #### spec.add_dependency 'map'
38
-
39
- spec.extensions.push(*[])
40
-
41
- spec.rubyforge_project = "codeforpeople"
42
- spec.author = "Ara T. Howard"
43
- spec.email = "ara.t.howard@gmail.com"
44
- spec.homepage = "https://github.com/ahoward/systemu"
45
- end
@@ -1,95 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe EY::Serverside::Propagator do
4
- let(:config) do
5
- EY::Serverside::Deploy::Configuration.new({
6
- 'app' => 'app',
7
- 'deploy_to' => deploy_dir.to_s,
8
- 'user' => ENV['USER'],
9
- })
10
- end
11
-
12
- let(:servers) do
13
- EY::Serverside::Servers.from_hashes(
14
- [
15
- {:user => config.user, :hostname => 'localhost', :roles => %w[solo]},
16
- {:user => config.user, :hostname => '127.0.0.1', :roles => %w[util], :name => 'myutil'},
17
- ]
18
- )
19
- end
20
-
21
- let(:solo) { servers.roles(:solo).first }
22
- let(:util) { servers.roles(:util).first }
23
-
24
- let(:shell) { mock('shell') }
25
- let(:check_command) { util.command_on_server('sh -l -c', subject.check_command) }
26
- let(:scp_command) { subject.scp_command(util) }
27
- let(:install_command) { util.command_on_server('sudo sh -l -c', subject.install_command) }
28
-
29
- subject do
30
- EY::Serverside::Propagator.new(servers, config, shell)
31
- end
32
-
33
- def stub_shell_command(command, success, output="STUB OUTPUT")
34
- shell.should_receive(:logged_system).once.ordered.with(command).and_return do
35
- test_shell.command_show(command)
36
- EY::Serverside::Shell::CommandResult.new(command, success ? 0 : 1, output)
37
- end
38
- end
39
-
40
- before do
41
- shell.stub(:status) do |msg|
42
- test_shell.status(msg) # hax so you can see the output with VERBOSE
43
- end
44
- end
45
-
46
- context "no remote servers" do
47
- subject { EY::Serverside::Propagator.new(test_servers, config, shell) }
48
-
49
- it "returns without doing anything" do
50
- shell.should_not_receive(:logged_system)
51
- subject.call
52
- end
53
- end
54
-
55
- context "all servers have the gem" do
56
- before do
57
- stub_shell_command(check_command, true)
58
- shell.should_not_receive(:logged_system).with(scp_command)
59
- shell.should_not_receive(:logged_system).with(install_command)
60
- end
61
-
62
- it "finds no servers" do
63
- subject.servers.should be_empty
64
- subject.call
65
- end
66
- end
67
-
68
- context "with a server missing the gem" do
69
- before do
70
- stub_shell_command(check_command, false)
71
- end
72
-
73
- it "finds servers that need the gem installed and installs it" do
74
- stub_shell_command(scp_command, true)
75
- stub_shell_command(install_command, true)
76
-
77
- subject.servers.to_a.should == [util]
78
- subject.call
79
- end
80
-
81
- it "raises if the scp fails" do
82
- stub_shell_command(scp_command, false)
83
- shell.should_not_receive(:logged_system).with(install_command)
84
-
85
- lambda { subject.call }.should raise_error(EY::Serverside::RemoteFailure)
86
- end
87
-
88
- it "raises if the install fails" do
89
- stub_shell_command(scp_command, true)
90
- stub_shell_command(install_command, false)
91
-
92
- lambda { subject.call }.should raise_error(EY::Serverside::RemoteFailure)
93
- end
94
- end
95
- end