kumade 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kumade::Git, "#heroku_remote?" do
4
+ let(:environment) { 'staging' }
5
+ let(:another_heroku_environment) { 'another_staging' }
6
+ let(:not_a_heroku_env) { 'fake_heroku' }
7
+ let(:not_a_heroku_url) { 'git@github.com:gabebw/kumade.git' }
8
+ let(:another_heroku_url) { 'git@heroku.work:my-app.git' }
9
+
10
+ before do
11
+ force_add_heroku_remote(environment)
12
+ `git remote add #{not_a_heroku_env} #{not_a_heroku_url}`
13
+ `git remote add #{another_heroku_environment} #{another_heroku_url}`
14
+ end
15
+
16
+ after do
17
+ remove_remote(environment)
18
+ remove_remote(not_a_heroku_env)
19
+ remove_remote(another_heroku_environment)
20
+ end
21
+
22
+ it "returns true when the remote is a heroku repository" do
23
+ Kumade::Git.new(false, environment).heroku_remote?.should be_true
24
+ Kumade::Git.new(false, another_heroku_environment).heroku_remote?.should be_true
25
+ end
26
+
27
+ it "returns false when the remote is not a heroku repository" do
28
+ Kumade::Git.new(false, 'kumade').heroku_remote?.should be_false
29
+ end
30
+
31
+ end
32
+
33
+ describe Kumade::Git, ".environments" do
34
+ let(:environment) { 'staging' }
35
+ let(:not_a_heroku_env) { 'fake_heroku' }
36
+ let(:not_a_heroku_url) { 'git@github.com:gabebw/kumade.git' }
37
+
38
+ before do
39
+ force_add_heroku_remote(environment)
40
+ `git remote add #{not_a_heroku_env} #{not_a_heroku_url}`
41
+ end
42
+
43
+ after do
44
+ remove_remote(environment)
45
+ remove_remote(not_a_heroku_env)
46
+ end
47
+
48
+ it "returns all environments" do
49
+ Kumade::Git.environments.should == ["staging"]
50
+ end
51
+ end
@@ -26,14 +26,41 @@ describe Kumade::Runner do
26
26
  subject.run([environment], out)
27
27
  end
28
28
 
29
- %w(-c --cedar).each do |cedar_arg|
30
- it "uses cedar when run with #{cedar_arg}" do
31
- deployer = double("deployer").as_null_object
32
- Kumade::Deployer.should_receive(:new).
33
- with(anything, anything, true).
34
- and_return(deployer)
35
-
36
- subject.run([environment, cedar_arg], out)
29
+ end
30
+
31
+ describe Kumade::Runner do
32
+ it 'does not let anything get printed' do
33
+ stdout = $stdout
34
+ stdout.should_not_receive(:print)
35
+ output = StringIO.new
36
+
37
+ Kumade::Runner.swapping_stdout_for(output) do
38
+ $stdout.puts "Hello, you can't see me."
39
+ end
40
+
41
+ output.rewind
42
+ output.read.should == "Hello, you can't see me.\n"
43
+ end
44
+
45
+ it 'dumps the output stash to real stdout when an error happens' do
46
+ stdout = $stdout
47
+ stdout.should_receive(:print)
48
+ output = StringIO.new
49
+
50
+ Kumade::Runner.swapping_stdout_for(output) do
51
+ $stdout.puts "Hello, you can see me!"
52
+ raise Kumade::DeploymentError.new("error")
53
+ end
54
+ end
55
+
56
+ it 'prints everything in pretend mode' do
57
+ stdout = $stdout
58
+ stdout.should_receive(:puts)
59
+ output = StringIO.new
60
+ Kumade::Runner.should_receive(:pretending?).and_return(true)
61
+
62
+ Kumade::Runner.swapping_stdout_for(output) do
63
+ $stdout.puts "Hello, you can see me!"
37
64
  end
38
65
  end
39
66
  end
@@ -5,9 +5,9 @@ require 'stringio'
5
5
  require 'aruba/api'
6
6
 
7
7
  module GitRemoteHelpers
8
- def force_add_heroku_remote(remote_name, app_name)
8
+ def force_add_heroku_remote(remote_name)
9
9
  remove_remote(remote_name)
10
- `git remote add #{remote_name} git@heroku.com:#{app_name}.git`
10
+ `git remote add #{remote_name} git@heroku.com:#{remote_name}.git`
11
11
  end
12
12
 
13
13
  def remove_remote(remote_name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-08-19 00:00:00.000000000Z
13
+ date: 2011-09-07 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: heroku
17
- requirement: &2152458640 !ruby/object:Gem::Requirement
17
+ requirement: &70363385430900 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '2.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152458640
25
+ version_requirements: *70363385430900
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: thor
28
- requirement: &2152458140 !ruby/object:Gem::Requirement
28
+ requirement: &70363385430400 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,21 +33,32 @@ dependencies:
33
33
  version: '0.14'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152458140
36
+ version_requirements: *70363385430400
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: rake
39
- requirement: &2152457680 !ruby/object:Gem::Requirement
39
+ requirement: &70363385429940 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
- - - ~>
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: 0.8.7
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70363385429940
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: &70363380426460 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
43
54
  - !ruby/object:Gem::Version
44
55
  version: 0.8.7
45
56
  type: :development
46
57
  prerelease: false
47
- version_requirements: *2152457680
58
+ version_requirements: *70363380426460
48
59
  - !ruby/object:Gem::Dependency
49
60
  name: rspec
50
- requirement: &2152457220 !ruby/object:Gem::Requirement
61
+ requirement: &70363380426000 !ruby/object:Gem::Requirement
51
62
  none: false
52
63
  requirements:
53
64
  - - ~>
@@ -55,10 +66,10 @@ dependencies:
55
66
  version: 2.6.0
56
67
  type: :development
57
68
  prerelease: false
58
- version_requirements: *2152457220
69
+ version_requirements: *70363380426000
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: cucumber
61
- requirement: &2152456760 !ruby/object:Gem::Requirement
72
+ requirement: &70363380425540 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ~>
@@ -66,10 +77,10 @@ dependencies:
66
77
  version: 1.0.2
67
78
  type: :development
68
79
  prerelease: false
69
- version_requirements: *2152456760
80
+ version_requirements: *70363380425540
70
81
  - !ruby/object:Gem::Dependency
71
82
  name: aruba
72
- requirement: &2152456300 !ruby/object:Gem::Requirement
83
+ requirement: &70363380425080 !ruby/object:Gem::Requirement
73
84
  none: false
74
85
  requirements:
75
86
  - - ~>
@@ -77,10 +88,10 @@ dependencies:
77
88
  version: 0.4.3
78
89
  type: :development
79
90
  prerelease: false
80
- version_requirements: *2152456300
91
+ version_requirements: *70363380425080
81
92
  - !ruby/object:Gem::Dependency
82
93
  name: jammit
83
- requirement: &2152455840 !ruby/object:Gem::Requirement
94
+ requirement: &70363380424620 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ~>
@@ -88,8 +99,8 @@ dependencies:
88
99
  version: 0.6.3
89
100
  type: :development
90
101
  prerelease: false
91
- version_requirements: *2152455840
92
- description: Simple rake tasks for deploying to Heroku
102
+ version_requirements: *70363380424620
103
+ description: A well-tested script for easy deploying to Heroku
93
104
  email:
94
105
  - gabe@thoughtbot.com
95
106
  - support@thoughtbot.com
@@ -114,16 +125,20 @@ files:
114
125
  - features/support/env.rb
115
126
  - kumade.gemspec
116
127
  - lib/kumade.rb
128
+ - lib/kumade/base.rb
117
129
  - lib/kumade/deployer.rb
130
+ - lib/kumade/deployment_error.rb
131
+ - lib/kumade/git.rb
118
132
  - lib/kumade/railtie.rb
119
133
  - lib/kumade/runner.rb
120
134
  - lib/kumade/version.rb
121
135
  - lib/tasks/deploy.rake
136
+ - spec/kumade/base_spec.rb
122
137
  - spec/kumade/deployer_spec.rb
138
+ - spec/kumade/git_spec.rb
123
139
  - spec/kumade/runner_spec.rb
124
- - spec/kumade_spec.rb
125
140
  - spec/spec_helper.rb
126
- homepage: ''
141
+ homepage: http://thoughtbot.com/community/
127
142
  licenses: []
128
143
  post_install_message:
129
144
  rdoc_options: []
@@ -135,24 +150,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
150
  - - ! '>='
136
151
  - !ruby/object:Gem::Version
137
152
  version: '0'
138
- segments:
139
- - 0
140
- hash: -2894600274935515438
141
153
  required_rubygems_version: !ruby/object:Gem::Requirement
142
154
  none: false
143
155
  requirements:
144
156
  - - ! '>='
145
157
  - !ruby/object:Gem::Version
146
158
  version: '0'
147
- segments:
148
- - 0
149
- hash: -2894600274935515438
150
159
  requirements: []
151
160
  rubyforge_project:
152
161
  rubygems_version: 1.8.6
153
162
  signing_key:
154
163
  specification_version: 3
155
- summary: Simple rake tasks for deploying to Heroku
164
+ summary: A well-tested script for easy deploying to Heroku
156
165
  test_files:
157
166
  - features/kumade_executable.feature
158
167
  - features/kumade_without_jammit.feature
@@ -161,7 +170,8 @@ test_files:
161
170
  - features/step_definitions/git_steps.rb
162
171
  - features/step_definitions/kumade_steps.rb
163
172
  - features/support/env.rb
173
+ - spec/kumade/base_spec.rb
164
174
  - spec/kumade/deployer_spec.rb
175
+ - spec/kumade/git_spec.rb
165
176
  - spec/kumade/runner_spec.rb
166
- - spec/kumade_spec.rb
167
177
  - spec/spec_helper.rb
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Kumade, ".app_for" do
4
- let(:environment){ 'staging' }
5
- let(:app_name){ 'staging_test' }
6
- let(:not_a_heroku_env){ 'fake_heroku' }
7
- let(:not_a_heroku_url){ 'git@github.com:gabebw/kumade.git' }
8
-
9
- before do
10
- force_add_heroku_remote(environment, app_name)
11
- `git remote add #{not_a_heroku_env} #{not_a_heroku_url}`
12
- end
13
- after do
14
- remove_remote(environment)
15
- remove_remote(not_a_heroku_env)
16
- end
17
-
18
- it "autodetects the Heroku app name" do
19
- Kumade.app_for(environment).should == app_name
20
- end
21
-
22
- it "is nil if the app cannot be found" do
23
- Kumade.app_for('xyz').should be_nil
24
- end
25
-
26
- it "is nil if the remote is not a Heroku remote" do
27
- Kumade.app_for(not_a_heroku_env).should be_nil
28
- end
29
- end
30
-
31
- describe Kumade, ".environments" do
32
- let(:environment){ 'staging' }
33
- let(:app_name){ 'staging_test' }
34
- let(:not_a_heroku_env){ 'fake_heroku' }
35
- let(:not_a_heroku_url){ 'git@github.com:gabebw/kumade.git' }
36
-
37
- before do
38
- force_add_heroku_remote(environment, app_name)
39
- `git remote add #{not_a_heroku_env} #{not_a_heroku_url}`
40
- end
41
- after do
42
- remove_remote(environment)
43
- remove_remote(not_a_heroku_env)
44
- end
45
-
46
- it "should return all environments" do
47
- Kumade.environments.should == ["staging"]
48
- end
49
- end