kumade 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,9 @@
1
+ ## 0.8.0 (2011-10-21)
2
+ * Kumade now has working (and autoloaded!) Rake tasks. `rake deploy:staging`
3
+ will Just Work.
4
+
5
+ * Removed Less::More packager. The only included packager is now Jammit.
6
+
1
7
  ## 0.7.0 (2011-10-15)
2
8
  * Kumade now has a working check for the Cedar stack.
3
9
 
data/README.md CHANGED
@@ -11,8 +11,8 @@ rebase against master a couple times before your pull request can be merged.
11
11
  ## What does Kumade do?
12
12
  Before deploying, Kumade ensures the git repo is clean.
13
13
  After that, it packages assets using
14
- [Jammit](http://documentcloud.github.com/jammit/) and/or
15
- [More](https://github.com/cloudhead/more), commits them, and pushes to origin.
14
+ [Jammit](http://documentcloud.github.com/jammit/) (if it's installed), commits
15
+ them, and pushes to origin.
16
16
  Then it force pushes to the correct Heroku remote, runs `rake db:migrate` on the
17
17
  Heroku app, and then restarts the app.
18
18
 
@@ -43,15 +43,12 @@ The default is to deploy to staging:
43
43
 
44
44
  ## Rake
45
45
 
46
- Kumade auto-generates a deploy:ENV task for every Heroku environment.
47
-
48
- # in your Rakefile:
49
- require 'kumade'
46
+ Kumade auto-generates a deploy:ENV task for every Heroku environment. You don't
47
+ need to do anything to get the Rake tasks, they're automatically set up for you.
48
+ If you have a "staging" remote, you would run:
50
49
 
51
50
  $ rake deploy:staging
52
51
 
53
- If you use rake tasks, you can't pass in options (like -p/--pretend).
54
-
55
52
  ## Does it support the Cedar stack?
56
53
 
57
54
  Yes. Kumade will automatically detect if your app is running on Cedar.
@@ -1,4 +1,4 @@
1
- @extra-timeout @creates-remote @disable-bundler
1
+ @slow @creates-remote @disable-bundler
2
2
  Feature: Kumade executable
3
3
  As a user
4
4
  I want to be able to use the kumade executable
@@ -11,8 +11,8 @@ Feature: Kumade executable
11
11
  And I add "jammit" to the Gemfile
12
12
  And I bundle
13
13
  When I set up a git repo
14
- And I create a Heroku remote for "pretend-staging-app" named "pretend-staging"
15
- And I create a Heroku remote for "app-two" named "staging"
14
+ And I create a Heroku remote named "pretend-staging"
15
+ And I create a Heroku remote named "staging"
16
16
  And I create a non-Heroku remote named "bad-remote"
17
17
 
18
18
  Scenario: Pretend mode with a Heroku remote
@@ -31,7 +31,6 @@ Feature: Kumade executable
31
31
  ==> Restarted pretend-staging
32
32
  ==> Deployed to: pretend-staging
33
33
  """
34
- But the output should not contain "==> Packaged with Kumade::MorePackager"
35
34
 
36
35
  Scenario: Default environment is staging
37
36
  When I run kumade with "-p"
@@ -1,4 +1,4 @@
1
- @extra-timeout @creates-remote @disable-bundler
1
+ @slow @creates-remote @disable-bundler
2
2
  Feature: Kumade without jammit
3
3
 
4
4
  Background:
@@ -7,7 +7,7 @@ Feature: Kumade without jammit
7
7
  And I set up the Gemfile with kumade
8
8
  And I bundle
9
9
  When I set up a git repo
10
- And I create a Heroku remote for "pretend-staging-app" named "pretend-staging"
10
+ And I create a Heroku remote named "pretend-staging"
11
11
 
12
12
  Scenario: Jammit packager does not run if Jammit is not installed
13
13
  When I run kumade with "pretend-staging"
@@ -0,0 +1,12 @@
1
+ Feature: Railtie
2
+ As a Rake user
3
+ I want Kumade to autoload Rake tasks for my Rails application
4
+ So that I can integrate Kumade with other Rake tasks
5
+
6
+ @creates-remote @disable-bundler @slow
7
+ Scenario: Rake tasks are loaded
8
+ Given a new Rails application with Kumade
9
+ When I create a Heroku remote named "staging"
10
+ And I create a non-Heroku remote named "bad_remote"
11
+ Then the rake tasks should include "deploy:staging" with a description of "Deploy to staging environment"
12
+ But the rake tasks should not include "deploy:bad_remote"
@@ -1,5 +1,5 @@
1
1
  When /^I bundle$/ do
2
- When %{I successfully run `bundle --gemfile=./Gemfile --local || bundle --gemfile=./Gemfile`}
2
+ run_bundler
3
3
  end
4
4
 
5
5
  When /^I rebundle$/ do
@@ -1,28 +1,23 @@
1
- When /^I create a Heroku remote for "([^"]*)" named "([^"]*)"$/ do |app_name, remote_name|
2
- When %{I successfully run `git remote add #{remote_name} git@heroku.com:#{app_name}.git`}
1
+ When /^I create a Heroku remote named "([^"]*)"$/ do |remote_name|
2
+ add_heroku_remote_named(remote_name)
3
3
  end
4
4
 
5
5
  When /^I create a non-Heroku remote named "([^"]*)"$/ do |remote_name|
6
- When %{I successfully run `git remote add #{remote_name} git@github.com:gabebw/kumade.git`}
6
+ add_non_heroku_remote_named(remote_name)
7
7
  end
8
8
 
9
9
  When /^I set up a git repo$/ do
10
- steps %{
11
- When I successfully run `git init`
12
- And I successfully run `touch .gitkeep`
13
- And I successfully run `git add .`
14
- And I successfully run `git commit -am First`
15
- }
10
+ ["git init", "touch .gitkeep", "git add .", "git commit -am First"].each do |git_command|
11
+ run_simple(git_command)
12
+ end
16
13
  end
17
14
 
18
15
  When /^I commit everything in the current repo$/ do
19
- steps %{
20
- When I successfully run `git add .`
21
- And I successfully run `git commit -am MY_MESSAGE`
22
- }
16
+ ['git add .', 'git commit -am MY_MESSAGE'].each do |git_command|
17
+ run_simple(git_command)
18
+ end
23
19
  end
24
20
 
25
21
  After("@creates-remote") do
26
- heroku_remotes = `git remote -v show | grep heroku | grep fetch | cut -f1`.strip.split
27
- heroku_remotes.each { |remote| `git remote rm #{remote} 2> /dev/null` }
22
+ remove_all_created_remotes
28
23
  end
@@ -0,0 +1,6 @@
1
+ Given /^a new Rails application with Kumade$/ do
2
+ run_simple("rails new rake-tasks")
3
+ cd('rake-tasks')
4
+ append_to_file('Gemfile', "gem 'kumade', :path => '#{PROJECT_PATH}'")
5
+ run_bundler
6
+ end
@@ -0,0 +1,26 @@
1
+ When /^I require the kumade railtie in the Rakefile$/ do
2
+ rakefile_content = prep_for_fs_check { IO.readlines("Rakefile") }
3
+ new_rakefile_content = rakefile_content.map do |line|
4
+ if line.include?('load_tasks')
5
+ ["require 'kumade/railtie'", line].join("\n")
6
+ else
7
+ line
8
+ end
9
+ end.join
10
+
11
+ overwrite_file("Rakefile", new_rakefile_content)
12
+ end
13
+
14
+ Then /^the rake tasks should include "([^"]+)" with a description of "([^"]+)"$/ do |task_name, task_description|
15
+ steps %{
16
+ When I run `bundle exec rake -T`
17
+ Then the output should match /#{task_name}.+#{task_description}/
18
+ }
19
+ end
20
+
21
+ Then /^the rake tasks should not include "([^"]+)"/ do |task_name|
22
+ steps %{
23
+ When I run `bundle exec rake -T`
24
+ Then the output from "bundle exec rake -T" should not contain "#{task_name}"
25
+ }
26
+ end
@@ -0,0 +1,7 @@
1
+ module BundlerHelpers
2
+ def run_bundler
3
+ run_simple('bundle --gemfile=./Gemfile --local || bundle --gemfile=./Gemfile')
4
+ end
5
+ end
6
+
7
+ World(BundlerHelpers)
@@ -6,6 +6,6 @@ end
6
6
  require 'aruba/cucumber'
7
7
  require 'kumade'
8
8
 
9
- Before('@extra-timeout') do
9
+ Before('@slow') do
10
10
  @aruba_timeout_seconds = 15
11
11
  end
@@ -0,0 +1,25 @@
1
+ module GitRemoteHelpers
2
+ @@created_remotes = []
3
+
4
+ def remove_all_created_remotes
5
+ in_current_dir do
6
+ @@created_remotes.each do |remote|
7
+ run_simple("git remote rm #{remote}")
8
+ end
9
+ end
10
+
11
+ @@created_remotes = []
12
+ end
13
+
14
+ def add_heroku_remote_named(remote_name)
15
+ run_simple("git remote add #{remote_name} git@heroku.com:#{remote_name}_app.git")
16
+ @@created_remotes << remote_name
17
+ end
18
+
19
+ def add_non_heroku_remote_named(remote_name)
20
+ run_simple("git remote add #{remote_name} git@github.com:gabebw/kumade.git")
21
+ @@created_remotes << remote_name
22
+ end
23
+ end
24
+
25
+ World(GitRemoteHelpers)
@@ -0,0 +1 @@
1
+ PROJECT_PATH = File.expand_path("../../..", __FILE__)
@@ -1,13 +1,13 @@
1
+ require 'kumade/railtie'
2
+
1
3
  module Kumade
2
4
  autoload :Git, "kumade/git"
3
5
  autoload :Deployer, "kumade/deployer"
4
6
  autoload :CLI, "kumade/cli"
5
- autoload :Railtie, "kumade/railtie"
6
7
  autoload :DeploymentError, "kumade/deployment_error"
7
8
  autoload :Configuration, "kumade/configuration"
8
9
  autoload :Heroku, "kumade/heroku"
9
10
  autoload :Packager, "kumade/packager"
10
- autoload :MorePackager, "kumade/packagers/more_packager"
11
11
  autoload :JammitPackager, "kumade/packagers/jammit_packager"
12
12
  autoload :NoopPackager, "kumade/packagers/noop_packager"
13
13
  autoload :PackagerList, "kumade/packager_list"
@@ -2,7 +2,7 @@ module Kumade
2
2
  class PackagerList
3
3
  include Enumerable
4
4
 
5
- PACKAGERS = [MorePackager, JammitPackager]
5
+ PACKAGERS = [JammitPackager]
6
6
 
7
7
  def initialize
8
8
  @packagers = build_packagers_list
@@ -1,10 +1,9 @@
1
- # add rake tasks if we are inside Rails
2
1
  if defined?(Rails::Railtie)
3
- class Module
2
+ module Kumade
4
3
  class Railtie < ::Rails::Railtie
5
4
  rake_tasks do
6
- load File.expand_path("../../tasks/deploy.rake", __FILE__)
5
+ load "kumade/tasks/deploy.rake"
7
6
  end
8
7
  end
9
8
  end
10
- end
9
+ end
@@ -5,4 +5,4 @@ namespace :deploy do
5
5
  Kumade::CLI.run([environment])
6
6
  end
7
7
  end
8
- end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Kumade
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -3,28 +3,12 @@ require 'spec_helper'
3
3
  describe Kumade::PackagerList, "detecting packages", :with_mock_outputter do
4
4
  it "returns an array containing the Jammit packager if Jammit is installed" do
5
5
  Kumade::JammitPackager.stubs(:installed? => true)
6
- Kumade::MorePackager.stubs(:installed? => false)
7
6
 
8
7
  Kumade::PackagerList.new.to_a.should == [Kumade::JammitPackager]
9
8
  end
10
9
 
11
- it "returns an array containing the More packager if More is installed" do
12
- Kumade::JammitPackager.stubs(:installed? => false)
13
- Kumade::MorePackager.stubs(:installed? => true)
14
-
15
- Kumade::PackagerList.new.to_a.should == [Kumade::MorePackager]
16
- end
17
-
18
- it "returns multiple packagers if they are installed" do
19
- Kumade::JammitPackager.stubs(:installed? => true)
20
- Kumade::MorePackager.stubs(:installed? => true)
21
-
22
- Kumade::PackagerList.new.to_a.should =~ [Kumade::JammitPackager, Kumade::MorePackager]
23
- end
24
-
25
10
  it "returns an array containing the no-op packager if no other packagers are found" do
26
11
  Kumade::JammitPackager.stubs(:installed? => false)
27
- Kumade::MorePackager.stubs(:installed? => false)
28
12
 
29
13
  Kumade::PackagerList.new.to_a.should == [Kumade::NoopPackager]
30
14
  end
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.7.0
4
+ version: 0.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-10-21 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: heroku
17
- requirement: &70180072865600 !ruby/object:Gem::Requirement
17
+ requirement: &70235434208420 !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: *70180072865600
25
+ version_requirements: *70235434208420
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70180072864740 !ruby/object:Gem::Requirement
28
+ requirement: &70235434207920 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 0.8.7
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70180072864740
36
+ version_requirements: *70235434207920
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: cocaine
39
- requirement: &70180072862960 !ruby/object:Gem::Requirement
39
+ requirement: &70235434207460 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.2.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70180072862960
47
+ version_requirements: *70235434207460
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: rake
50
- requirement: &70180072854560 !ruby/object:Gem::Requirement
50
+ requirement: &70235434207000 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.8.7
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70180072854560
58
+ version_requirements: *70235434207000
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rspec
61
- requirement: &70180072853060 !ruby/object:Gem::Requirement
61
+ requirement: &70235434206540 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ~>
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: 2.6.0
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70180072853060
69
+ version_requirements: *70235434206540
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: cucumber
72
- requirement: &70180072851460 !ruby/object:Gem::Requirement
72
+ requirement: &70235434206080 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ~>
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 1.0.2
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70180072851460
80
+ version_requirements: *70235434206080
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: aruba
83
- requirement: &70180072850160 !ruby/object:Gem::Requirement
83
+ requirement: &70235434205620 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ~>
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: 0.4.3
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70180072850160
91
+ version_requirements: *70235434205620
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: jammit
94
- requirement: &70180072849500 !ruby/object:Gem::Requirement
94
+ requirement: &70235434205160 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: 0.6.3
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70180072849500
102
+ version_requirements: *70235434205160
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: less
105
- requirement: &70180072848760 !ruby/object:Gem::Requirement
105
+ requirement: &70235434204700 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ~>
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '2.0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70180072848760
113
+ version_requirements: *70235434204700
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: bourne
116
- requirement: &70180072848100 !ruby/object:Gem::Requirement
116
+ requirement: &70235434204320 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70180072848100
124
+ version_requirements: *70235434204320
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: simplecov
127
- requirement: &70180072840840 !ruby/object:Gem::Requirement
127
+ requirement: &70235434203820 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,7 +132,7 @@ dependencies:
132
132
  version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70180072840840
135
+ version_requirements: *70235434203820
136
136
  description: A well-tested script for easy deploying to Heroku
137
137
  email:
138
138
  - gabe@thoughtbot.com
@@ -153,11 +153,17 @@ files:
153
153
  - bin/kumade
154
154
  - features/kumade_executable.feature
155
155
  - features/kumade_without_jammit.feature
156
+ - features/railtie.feature
156
157
  - features/step_definitions/bundler_steps.rb
157
158
  - features/step_definitions/dependency_steps.rb
158
159
  - features/step_definitions/git_steps.rb
159
160
  - features/step_definitions/kumade_steps.rb
161
+ - features/step_definitions/rails_steps.rb
162
+ - features/step_definitions/rake_steps.rb
163
+ - features/support/bundler.rb
160
164
  - features/support/env.rb
165
+ - features/support/git_remotes.rb
166
+ - features/support/project_path.rb
161
167
  - kumade.gemspec
162
168
  - lib/kumade.rb
163
169
  - lib/kumade/cli.rb
@@ -171,12 +177,11 @@ files:
171
177
  - lib/kumade/packager.rb
172
178
  - lib/kumade/packager_list.rb
173
179
  - lib/kumade/packagers/jammit_packager.rb
174
- - lib/kumade/packagers/more_packager.rb
175
180
  - lib/kumade/packagers/noop_packager.rb
176
181
  - lib/kumade/railtie.rb
177
182
  - lib/kumade/rake_task_runner.rb
183
+ - lib/kumade/tasks/deploy.rake
178
184
  - lib/kumade/version.rb
179
- - lib/tasks/deploy.rake
180
185
  - spec/kumade/cli_spec.rb
181
186
  - spec/kumade/command_line_spec.rb
182
187
  - spec/kumade/configuration_spec.rb
@@ -187,7 +192,6 @@ files:
187
192
  - spec/kumade/packager_list_spec.rb
188
193
  - spec/kumade/packager_spec.rb
189
194
  - spec/kumade/packagers/jammit_packager_spec.rb
190
- - spec/kumade/packagers/more_packager_spec.rb
191
195
  - spec/kumade/packagers/noop_packager_spec.rb
192
196
  - spec/kumade/rake_task_runner_spec.rb
193
197
  - spec/kumade_spec.rb
@@ -211,7 +215,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
215
  version: '0'
212
216
  segments:
213
217
  - 0
214
- hash: -2390276882750566623
218
+ hash: 216053856628192471
215
219
  required_rubygems_version: !ruby/object:Gem::Requirement
216
220
  none: false
217
221
  requirements:
@@ -220,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
224
  version: '0'
221
225
  segments:
222
226
  - 0
223
- hash: -2390276882750566623
227
+ hash: 216053856628192471
224
228
  requirements: []
225
229
  rubyforge_project:
226
230
  rubygems_version: 1.8.11
@@ -230,11 +234,17 @@ summary: A well-tested script for easy deploying to Heroku
230
234
  test_files:
231
235
  - features/kumade_executable.feature
232
236
  - features/kumade_without_jammit.feature
237
+ - features/railtie.feature
233
238
  - features/step_definitions/bundler_steps.rb
234
239
  - features/step_definitions/dependency_steps.rb
235
240
  - features/step_definitions/git_steps.rb
236
241
  - features/step_definitions/kumade_steps.rb
242
+ - features/step_definitions/rails_steps.rb
243
+ - features/step_definitions/rake_steps.rb
244
+ - features/support/bundler.rb
237
245
  - features/support/env.rb
246
+ - features/support/git_remotes.rb
247
+ - features/support/project_path.rb
238
248
  - spec/kumade/cli_spec.rb
239
249
  - spec/kumade/command_line_spec.rb
240
250
  - spec/kumade/configuration_spec.rb
@@ -245,7 +255,6 @@ test_files:
245
255
  - spec/kumade/packager_list_spec.rb
246
256
  - spec/kumade/packager_spec.rb
247
257
  - spec/kumade/packagers/jammit_packager_spec.rb
248
- - spec/kumade/packagers/more_packager_spec.rb
249
258
  - spec/kumade/packagers/noop_packager_spec.rb
250
259
  - spec/kumade/rake_task_runner_spec.rb
251
260
  - spec/kumade_spec.rb
@@ -1,20 +0,0 @@
1
- begin
2
- require "less/more"
3
- rescue LoadError
4
- end
5
-
6
- module Kumade
7
- class MorePackager
8
- def self.assets_path
9
- File.join("public", ::Less::More.destination_path)
10
- end
11
-
12
- def self.installed?
13
- !!defined?(Less::More)
14
- end
15
-
16
- def self.package
17
- ::Less::More.generate_all
18
- end
19
- end
20
- end
@@ -1,37 +0,0 @@
1
- require "spec_helper"
2
-
3
- require "less"
4
-
5
- describe Kumade::MorePackager, :with_mock_outputter do
6
- subject { Kumade::MorePackager }
7
-
8
- before do
9
- define_constant "Less::More" do
10
- def self.destination_path
11
- "awesome_destination"
12
- end
13
- end
14
- end
15
-
16
- it_should_behave_like "packager"
17
-
18
- its(:assets_path) { should == File.join('public', ::Less::More.destination_path) }
19
-
20
- it "knows how to package itself" do
21
- Less::More.stubs(:generate_all)
22
-
23
- subject.package
24
-
25
- Less::More.should have_received(:generate_all).once
26
- end
27
-
28
- context "when More is defined" do
29
- before { Less::More }
30
- it { should be_installed }
31
- end
32
-
33
- context "when Less::More is not defined" do
34
- before { Less.send(:remove_const, :More) }
35
- it { should_not be_installed }
36
- end
37
- end