kumade 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Kumade [![Build Status](https://secure.travis-ci.org/thoughtbot/kumade.png)](http://travis-ci.org/thoughtbot/kumade)
1
+ # Kumade 熊手 [![Build Status](https://secure.travis-ci.org/thoughtbot/kumade.png)](http://travis-ci.org/thoughtbot/kumade)
2
2
  Kumade is a set of basic Rake tasks for deploying to Heroku. It aims to
3
3
  provide most of what you want. Unlike other Heroku deploy gems, it is
4
4
  well-tested.
@@ -22,31 +22,35 @@ gem 'kumade'
22
22
  ```
23
23
 
24
24
  ## Usage
25
- kumade will deploy to any remote in the repo.
25
+
26
+ kumade will deploy to any Heroku remote in the repo.
26
27
  For example, if you have a remote named "bamboo":
27
28
 
28
- $ kumade deploy bamboo
29
+ $ bundle exec kumade bamboo
29
30
 
30
31
  which will autodetect the name of the Heroku app that the bamboo remote points
31
- to, and deploy to it.
32
+ to and deploy to it.
32
33
 
33
- To run in pretend mode, which just prints what would be done:
34
+ To run in pretend mode, which prints what would be done without actually doing
35
+ any of it:
34
36
 
35
- $ kumade deploy bamboo -p
37
+ $ bundle exec kumade bamboo -p
36
38
 
37
- The default task is to deploy to staging:
39
+ The default is to deploy to staging:
38
40
 
39
- $ kumade # equivalent to "kumade deploy staging"
41
+ $ bundle exec kumade # equivalent to "bundle exec kumade staging"
40
42
 
41
43
  ## Does it support the Cedar stack?
42
44
 
43
- Yes.
45
+ Yes. To indicate that a particular app is using Cedar, run with the -c flag:
46
+
47
+ bundle exec kumade bamboo -c
44
48
 
45
49
  ## Sample Output
46
50
 
47
51
  ### Normal mode
48
52
 
49
- $ kumade deploy heroku-staging
53
+ $ kumade heroku-staging
50
54
  ==> Deploying to: heroku-staging
51
55
  ==> heroku-staging is a Heroku remote
52
56
  ==> Git repo is clean
@@ -104,7 +108,7 @@ Yes.
104
108
 
105
109
  ### Pretend mode
106
110
 
107
- $ kumade deploy heroku-staging -p
111
+ $ kumade heroku-staging -p
108
112
  ==> In Pretend Mode
109
113
  ==> Deploying to: heroku-staging
110
114
  ==> heroku-staging is a Heroku remote
@@ -118,7 +122,7 @@ Yes.
118
122
 
119
123
  ### Pretend Mode with a non-Heroku remote
120
124
 
121
- $ kumade deploy origin -p
125
+ $ kumade origin -p
122
126
  ==> In Pretend Mode
123
127
  ==> Deploying to: origin
124
128
  ==> ! Cannot deploy: "origin" remote does not point to Heroku
@@ -131,6 +135,20 @@ Tested against:
131
135
  * MRI 1.9.2
132
136
  * REE 1.8.7
133
137
 
138
+ ## Misc Features
139
+
140
+ Want to run a task before bundling your assets on deploy? In your rails app's rake tasks, drop in:
141
+
142
+ ``` ruby
143
+ namespace :deploy do
144
+ task :assets do
145
+ puts "This runs before assets are committed and pushed to the remote"
146
+ end
147
+ end
148
+ ```
149
+
150
+ You can hook in any custom code you want to run there before deploying!
151
+
134
152
  ## What's with the name?
135
153
 
136
154
  Kumade ([pronunciation here](http://translate.google.com/#ja|en|熊手)) means
@@ -1,4 +1,4 @@
1
- @extra-timeout @creates-remote
1
+ @extra-timeout @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
@@ -7,16 +7,16 @@ Feature: Kumade executable
7
7
  Background:
8
8
  Given a directory named "executable"
9
9
  And I cd to "executable"
10
- When I successfully run `git init`
11
- And I successfully run `touch .gitkeep`
12
- And I successfully run `git add .`
13
- And I successfully run `git commit -am First`
10
+ And I set up the Gemfile with kumade
11
+ And I add "jammit" to the Gemfile
12
+ And I bundle
13
+ When I set up a git repo
14
14
  And I create a Heroku remote for "pretend-staging-app" named "pretend-staging"
15
15
  And I create a Heroku remote for "app-two" 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
19
- When I run `kumade pretend-staging -p`
19
+ When I run kumade with "pretend-staging -p"
20
20
  Then the output should contain "In Pretend Mode"
21
21
  And the output should contain:
22
22
  """
@@ -24,6 +24,7 @@ Feature: Kumade executable
24
24
  ==> Packaged assets with Jammit
25
25
  run git push origin master
26
26
  ==> Pushed master -> origin
27
+ run git branch deploy
27
28
  run git push -f pretend-staging deploy:master
28
29
  ==> Force pushed master -> pretend-staging
29
30
  ==> Migrated pretend-staging-app
@@ -33,30 +34,53 @@ Feature: Kumade executable
33
34
  But the output should not contain "==> Packaged assets with More"
34
35
 
35
36
  Scenario: Default environment is staging
36
- When I run `kumade -p`
37
+ When I run kumade with "-p"
37
38
  Then the output should contain "==> Deployed to: staging"
38
39
 
39
40
  Scenario: Can deploy to arbitrary environment
40
- When I run `kumade bamboo`
41
+ When I run kumade with "bamboo"
41
42
  Then the output should contain "==> Deploying to: bamboo"
42
- Then the output should match /Cannot deploy: /
43
+ And the output should match /Cannot deploy: /
43
44
 
44
45
  Scenario: Deploying to a non-Heroku remote fails
45
- When I run `kumade bad-remote`
46
+ When I run kumade with "bad-remote"
46
47
  Then the output should match /==> ! Cannot deploy: "bad-remote" remote does not point to Heroku/
47
48
 
48
49
  Scenario: Deploy from another branch
49
50
  When I run `git checkout -b new_branch`
50
- When I run `kumade pretend-staging -p`
51
+ And I run kumade with "pretend-staging -p"
51
52
  Then the output should contain:
52
53
  """
53
54
  ==> Git repo is clean
54
55
  ==> Packaged assets with Jammit
55
56
  run git push origin new_branch
56
57
  ==> Pushed new_branch -> origin
58
+ run git branch deploy
57
59
  run git push -f pretend-staging deploy:master
58
60
  ==> Force pushed new_branch -> pretend-staging
59
61
  ==> Migrated pretend-staging-app
60
62
  run git checkout new_branch && git branch -D deploy
61
63
  ==> Deployed to: pretend-staging
62
64
  """
65
+
66
+ Scenario: Git is clean if there are untracked files
67
+ Given I write to "new-file" with:
68
+ """
69
+ clean
70
+ """
71
+ When I run kumade with "pretend-staging"
72
+ Then the output from "bundle exec kumade pretend-staging" should not contain "==> ! Cannot deploy: repo is not clean"
73
+
74
+ Scenario: Git is not clean if a tracked file is modified
75
+ Given I write to "new-file" with:
76
+ """
77
+ clean
78
+ """
79
+ And I commit everything in the current repo
80
+ When I append to "new-file" with "dirty it up"
81
+ And I run kumade with "pretend-staging"
82
+ Then the output from "bundle exec kumade pretend-staging" should contain "==> ! Cannot deploy: repo is not clean"
83
+
84
+ Scenario: Jammit packager runs if Jammit is installed
85
+ When I run kumade with "pretend-staging"
86
+ Then the output from "bundle exec kumade pretend-staging" should contain "==> ! Error: Jammit::MissingConfiguration"
@@ -0,0 +1,40 @@
1
+ @extra-timeout @creates-remote @disable-bundler
2
+ Feature: Kumade without jammit
3
+
4
+ Background:
5
+ Given a directory named "executable"
6
+ And I cd to "executable"
7
+ And I set up the Gemfile with kumade
8
+ And I bundle
9
+ When I set up a git repo
10
+ And I create a Heroku remote for "pretend-staging-app" named "pretend-staging"
11
+
12
+ Scenario: Jammit packager does not run if Jammit is not installed
13
+ When I run kumade with "pretend-staging"
14
+ Then the output should not contain "==> ! Error: Jammit::MissingConfiguration"
15
+
16
+ Scenario: Run custom task if it exists
17
+ Given I write to "Rakefile" with:
18
+ """
19
+ namespace :deploy do
20
+ task :assets do
21
+ puts 'Hi!'
22
+ end
23
+ end
24
+ """
25
+ When I run kumade with "pretend-staging"
26
+ Then the output should contain "Running deploy:assets task"
27
+ And the output should contain "Hi!"
28
+
29
+ Scenario: Don't run rake task in pretend mode
30
+ Given I write to "Rakefile" with:
31
+ """
32
+ namespace :deploy do
33
+ task :assets do
34
+ puts 'Hi!'
35
+ end
36
+ end
37
+ """
38
+ When I run kumade with "pretend-staging -p"
39
+ Then the output should contain "Running deploy:assets task"
40
+ And the output should not contain "Hi!"
@@ -0,0 +1,33 @@
1
+ When /^I bundle$/ do
2
+ When %{I successfully run `bundle --gemfile=./Gemfile --local || bundle --gemfile=./Gemfile`}
3
+ end
4
+
5
+ When /^I rebundle$/ do
6
+ steps %{
7
+ When I bundle
8
+ And I commit everything in the current repo
9
+ }
10
+ end
11
+
12
+ Given /^an empty Gemfile$/ do
13
+ When %{I write to "Gemfile" with:}, ""
14
+ end
15
+
16
+ When /^I set up the Gemfile with kumade$/ do
17
+ steps %{
18
+ When I write to "Gemfile" with:
19
+ """
20
+ gem 'kumade', :path => '../../..'
21
+ """
22
+ }
23
+ end
24
+
25
+ When /^I add "([^"]+)" to the Gemfile$/ do |gem|
26
+ steps %{
27
+ When I append to "Gemfile" with:
28
+ """
29
+
30
+ gem '#{gem}'
31
+ """
32
+ }
33
+ end
@@ -1,9 +1,25 @@
1
1
  When /^I create a Heroku remote for "([^"]*)" named "([^"]*)"$/ do |app_name, remote_name|
2
- When %{I run `git remote add #{remote_name} git@heroku.com:#{app_name}.git`}
2
+ When %{I successfully run `git remote add #{remote_name} git@heroku.com:#{app_name}.git`}
3
3
  end
4
4
 
5
5
  When /^I create a non-Heroku remote named "([^"]*)"$/ do |remote_name|
6
- When %{I run `git remote add #{remote_name} git@github.com:gabebw/kumade.git`}
6
+ When %{I successfully run `git remote add #{remote_name} git@github.com:gabebw/kumade.git`}
7
+ end
8
+
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
+ }
16
+ end
17
+
18
+ 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
+ }
7
23
  end
8
24
 
9
25
  After("@creates-remote") do
@@ -0,0 +1,9 @@
1
+ When /^I run kumade with "([^"]+)"$/ do |args|
2
+ When %{I run `bundle exec kumade #{args}`}
3
+ end
4
+
5
+ Given /^I have loaded "([^"]+)"$/ do |file|
6
+ in_current_dir do
7
+ load(file)
8
+ end
9
+ end
@@ -2,5 +2,5 @@ require 'aruba/cucumber'
2
2
  require 'kumade'
3
3
 
4
4
  Before('@extra-timeout') do
5
- @aruba_timeout_seconds = 10
5
+ @aruba_timeout_seconds = 15
6
6
  end
@@ -1,6 +1,9 @@
1
+ require 'rake'
1
2
  require 'thor'
3
+
2
4
  require 'kumade/deployer'
3
5
  require 'kumade/runner'
6
+ require 'kumade/railtie'
4
7
 
5
8
  module Kumade
6
9
  def self.app_for(environment)
@@ -11,4 +14,16 @@ module Kumade
11
14
  nil
12
15
  end
13
16
  end
17
+ def self.environments
18
+ url_remotes = `git remote`.strip.split("\n").map{|remote| [remote, `git config --get remote.#{remote}.url`.strip] }.select{|remote| remote.last =~ /^git@heroku\.com:(.+)\.git$/}.map{|remote| remote.first}
19
+ end
20
+
21
+ def self.on_cedar!(app)
22
+ @cedar_apps ||= []
23
+ @cedar_apps << app
24
+ end
25
+
26
+ def self.cedar?(app)
27
+ @cedar_apps.include?(app)
28
+ end
14
29
  end
@@ -3,11 +3,12 @@ module Kumade
3
3
  DEPLOY_BRANCH = "deploy"
4
4
  attr_reader :environment, :pretending
5
5
 
6
- def initialize(environment = 'staging', pretending = false)
6
+ def initialize(environment = 'staging', pretending = false, cedar = false)
7
7
  super()
8
8
  @environment = environment
9
9
  @pretending = pretending
10
10
  @branch = current_branch
11
+ @cedar = cedar
11
12
  end
12
13
 
13
14
  def deploy
@@ -31,6 +32,9 @@ module Kumade
31
32
  end
32
33
 
33
34
  def sync_heroku
35
+ unless branch_exist?(DEPLOY_BRANCH)
36
+ run_or_error("git branch deploy", "Failed to create #{DEPLOY_BRANCH}")
37
+ end
34
38
  run_or_error("git push -f #{environment} #{DEPLOY_BRANCH}:master",
35
39
  "Failed to force push #{DEPLOY_BRANCH} -> #{environment}/master")
36
40
  success("Force pushed #{@branch} -> #{environment}")
@@ -49,7 +53,7 @@ module Kumade
49
53
  end
50
54
 
51
55
  def heroku(command, app)
52
- heroku_command = if on_cedar?(app)
56
+ heroku_command = if @cedar
53
57
  "bundle exec heroku run"
54
58
  else
55
59
  "bundle exec heroku"
@@ -58,11 +62,6 @@ module Kumade
58
62
  "Failed to run #{command} on Heroku")
59
63
  end
60
64
 
61
- def on_cedar?(app)
62
- selected_stack = run("heroku stack --app '#{app}'", :capture => true).split("\n").grep(/^\*/).first
63
- selected_stack && selected_stack.include?('cedar')
64
- end
65
-
66
65
  def ensure_clean_git
67
66
  if ! pretending && git_dirty?
68
67
  error("Cannot deploy: repo is not clean.")
@@ -74,6 +73,7 @@ module Kumade
74
73
  def package_assets
75
74
  package_with_jammit if jammit_installed?
76
75
  package_with_more if more_installed?
76
+ invoke_custom_task if custom_task?
77
77
  end
78
78
 
79
79
  def package_with_jammit
@@ -110,6 +110,11 @@ module Kumade
110
110
  end
111
111
  end
112
112
 
113
+ def invoke_custom_task
114
+ success "Running deploy:assets task"
115
+ Rake::Task["deploy:assets"].invoke unless pretending
116
+ end
117
+
113
118
  def git_add_and_commit_all_assets_in(dir)
114
119
  run_or_error ["git checkout -b #{DEPLOY_BRANCH}", "git add -f #{dir}", "git commit -m 'Compiled assets'"],
115
120
  "Cannot deploy: couldn't commit assets"
@@ -147,6 +152,11 @@ module Kumade
147
152
  end)
148
153
  end
149
154
 
155
+ def custom_task?
156
+ load("Rakefile") if File.exist?("Rakefile")
157
+ Rake::Task.task_defined?("deploy:assets")
158
+ end
159
+
150
160
  def git_dirty?
151
161
  `git diff --exit-code`
152
162
  !$?.success?
@@ -166,6 +176,13 @@ module Kumade
166
176
  config[:capture] ? `#{command}` : system("#{command}")
167
177
  end
168
178
 
179
+ def branch_exist?(branch)
180
+ branches = `git branch`
181
+ regex = Regexp.new('[\\n\\s\\*]+' + Regexp.escape(branch.to_s) + '\\n')
182
+ result = ((branches =~ regex) ? true : false)
183
+ return result
184
+ end
185
+
169
186
  def error(message)
170
187
  say("==> ! #{message}", :red)
171
188
  exit 1
@@ -0,0 +1,10 @@
1
+ # add rake tasks if we are inside Rails
2
+ if defined?(Rails::Railtie)
3
+ class Module
4
+ class Railtie < ::Rails::Railtie
5
+ rake_tasks do
6
+ load File.expand_path("../../tasks/deploy.rake", __FILE__)
7
+ end
8
+ end
9
+ end
10
+ end
@@ -19,7 +19,7 @@ module Kumade
19
19
  @out.puts "==> In Pretend Mode"
20
20
  end
21
21
  @out.puts "==> Deploying to: #{environment}"
22
- Deployer.new(environment, pretending?).deploy
22
+ Deployer.new(environment, pretending?, @options[:cedar]).deploy
23
23
  @out.puts "==> Deployed to: #{environment}"
24
24
  end
25
25
 
@@ -32,6 +32,10 @@ module Kumade
32
32
  options[:pretend] = p
33
33
  end
34
34
 
35
+ opts.on("-c", "--cedar", "Use this if your app is on cedar") do |cedar|
36
+ options[:cedar] = cedar
37
+ end
38
+
35
39
  opts.on_tail('-v', '--version', 'Show version') do
36
40
  @out.puts "kumade #{Kumade::VERSION}"
37
41
  exit
@@ -1,3 +1,3 @@
1
1
  module Kumade
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -0,0 +1,8 @@
1
+ namespace :deploy do
2
+ Kumade.environments.each do |environment|
3
+ desc "Deploy to #{environment} environment"
4
+ task environment do
5
+ Kumade::Runner.run([environment])
6
+ end
7
+ end
8
+ end
@@ -15,7 +15,7 @@ describe Kumade::Deployer, "#pre_deploy" do
15
15
  subject.pre_deploy
16
16
  end
17
17
 
18
- it "pushes to origin" do
18
+ it "syncs to github" do
19
19
  %w(
20
20
  ensure_clean_git
21
21
  package_assets
@@ -32,7 +32,6 @@ describe Kumade::Deployer, "#deploy" do
32
32
  let(:remote_name){ 'staging' }
33
33
  let(:app_name){ 'kumade-staging' }
34
34
 
35
-
36
35
  before do
37
36
  subject.stub(:say)
38
37
  force_add_heroku_remote(remote_name, app_name)
@@ -101,12 +100,28 @@ describe Kumade::Deployer, "#sync_heroku" do
101
100
  let(:environment) { 'my-env' }
102
101
  subject { Kumade::Deployer.new(environment) }
103
102
  before { subject.stub(:say) }
103
+
104
+ context "when deploy branch exists" do
105
+ it "should calls `git push -f`" do
106
+ subject.stub(:branch_exist?).with("deploy").and_return(true)
107
+ subject.should_receive(:run).
108
+ with("git push -f #{environment} deploy:master").
109
+ and_return(true)
110
+ subject.sync_heroku
111
+ end
112
+ end
104
113
 
105
- it "calls `git push -f`" do
106
- subject.should_receive(:run).
107
- with("git push -f #{environment} deploy:master").
108
- and_return(true)
109
- subject.sync_heroku
114
+ context "when deploy branch doesn't exists" do
115
+ it "should calls `git branch deploy` and `git push -f`" do
116
+ subject.stub(:branch_exist?).with("deploy").and_return(false)
117
+ subject.should_receive(:run).
118
+ with("git branch deploy").
119
+ and_return(true)
120
+ subject.should_receive(:run).
121
+ with("git push -f #{environment} deploy:master").
122
+ and_return(true)
123
+ subject.sync_heroku
124
+ end
110
125
  end
111
126
 
112
127
  context "when syncing to heroku fails" do
@@ -115,7 +130,7 @@ describe Kumade::Deployer, "#sync_heroku" do
115
130
  end
116
131
 
117
132
  it "prints an error" do
118
- subject.should_receive(:error)
133
+ subject.should_receive(:error).twice
119
134
  subject.sync_heroku
120
135
  end
121
136
  end
@@ -203,6 +218,34 @@ describe Kumade::Deployer, "#package_assets" do
203
218
  subject.package_assets
204
219
  end
205
220
  end
221
+
222
+ context "with custom rake task installed" do
223
+ before do
224
+ subject.stub(:jammit_installed? => false,
225
+ :more_installed? => false,
226
+ :invoke_custom_task => nil,
227
+ :custom_task? => true)
228
+ end
229
+
230
+ it "invokes custom task" do
231
+ subject.should_receive(:invoke_custom_task)
232
+ subject.package_assets
233
+ end
234
+ end
235
+
236
+ context "with custom rake task not installed" do
237
+ before do
238
+ subject.stub(:jammit_installed? => false,
239
+ :more_installed? => false,
240
+ :invoke_custom_task => nil,
241
+ :custom_task? => false)
242
+ end
243
+
244
+ it "does not invoke custom task" do
245
+ subject.should_not_receive(:invoke_custom_task)
246
+ subject.package_assets
247
+ end
248
+ end
206
249
  end
207
250
 
208
251
  describe Kumade::Deployer, "#package_with_jammit" do
@@ -246,6 +289,20 @@ describe Kumade::Deployer, "#package_with_jammit" do
246
289
  end
247
290
  end
248
291
 
292
+ describe Kumade::Deployer, "#invoke_custom_task" do
293
+ before do
294
+ Rake::Task.stub(:[] => task)
295
+ end
296
+
297
+ let(:task) { stub('task', :invoke => nil) }
298
+
299
+ it "calls deploy task" do
300
+ Rake::Task.should_receive(:[]).with("deploy:assets")
301
+ task.should_receive(:invoke)
302
+ subject.invoke_custom_task
303
+ end
304
+ end
305
+
249
306
  describe Kumade::Deployer, "#package_with_more" do
250
307
  before do
251
308
  subject.stub(:git_add_and_commit_all_assets_in => true,
@@ -388,6 +445,25 @@ describe Kumade::Deployer, "#more_installed?" do
388
445
  end
389
446
  end
390
447
 
448
+ describe Kumade::Deployer, "#custom_task?" do
449
+ before do
450
+ Rake::Task.clear
451
+ end
452
+
453
+ it "returns true if it task found" do
454
+ namespace :deploy do
455
+ task :assets do
456
+
457
+ end
458
+ end
459
+ Kumade::Deployer.new.custom_task?.should be_true
460
+ end
461
+
462
+ it "returns false if task not found" do
463
+ Kumade::Deployer.new.custom_task?.should be_false
464
+ end
465
+ end
466
+
391
467
  describe Kumade::Deployer, "#heroku_migrate" do
392
468
  let(:environment){ 'staging' }
393
469
  let(:app_name){ 'sushi' }
@@ -477,7 +553,8 @@ describe Kumade::Deployer, "#heroku" do
477
553
  let(:app_name){ 'sushi' }
478
554
 
479
555
  context "when on Cedar" do
480
- before { subject.stub(:on_cedar? => true) }
556
+ subject { Kumade::Deployer.new('staging', false, cedar = true) }
557
+
481
558
  it "runs commands with `run`" do
482
559
  subject.should_receive(:run_or_error).with("bundle exec heroku run rake --app #{app_name}", //)
483
560
  subject.heroku("rake", app_name)
@@ -485,7 +562,8 @@ describe Kumade::Deployer, "#heroku" do
485
562
  end
486
563
 
487
564
  context "when not on Cedar" do
488
- before { subject.stub(:on_cedar? => false) }
565
+ subject { Kumade::Deployer.new('staging', false, cedar = false) }
566
+
489
567
  it "runs commands without `run`" do
490
568
  subject.should_receive(:run_or_error).with("bundle exec heroku rake --app #{app_name}", //)
491
569
  subject.heroku("rake", app_name)
@@ -25,4 +25,15 @@ describe Kumade::Runner do
25
25
 
26
26
  subject.run([environment], out)
27
27
  end
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)
37
+ end
38
+ end
28
39
  end
@@ -27,3 +27,23 @@ describe Kumade, ".app_for" do
27
27
  Kumade.app_for(not_a_heroku_env).should be_nil
28
28
  end
29
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
metadata CHANGED
@@ -1,145 +1,103 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: kumade
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gabe Berke-Williams
14
9
  - thoughtbot
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-08-12 00:00:00 -04:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2011-08-19 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: heroku
24
- prerelease: false
25
- type: :runtime
26
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2152636140 !ruby/object:Gem::Requirement
27
18
  none: false
28
- requirements:
19
+ requirements:
29
20
  - - ~>
30
- - !ruby/object:Gem::Version
31
- hash: 3
32
- segments:
33
- - 2
34
- - 0
35
- version: "2.0"
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: thor
39
- prerelease: false
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
40
23
  type: :runtime
41
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ version_requirements: *2152636140
26
+ - !ruby/object:Gem::Dependency
27
+ name: thor
28
+ requirement: &2152635640 !ruby/object:Gem::Requirement
42
29
  none: false
43
- requirements:
30
+ requirements:
44
31
  - - ~>
45
- - !ruby/object:Gem::Version
46
- hash: 23
47
- segments:
48
- - 0
49
- - 14
50
- version: "0.14"
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rake
32
+ - !ruby/object:Gem::Version
33
+ version: '0.14'
34
+ type: :runtime
54
35
  prerelease: false
55
- type: :development
56
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2152635640
37
+ - !ruby/object:Gem::Dependency
38
+ name: rake
39
+ requirement: &2152635180 !ruby/object:Gem::Requirement
57
40
  none: false
58
- requirements:
41
+ requirements:
59
42
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 49
62
- segments:
63
- - 0
64
- - 8
65
- - 7
43
+ - !ruby/object:Gem::Version
66
44
  version: 0.8.7
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rspec
70
- prerelease: false
71
45
  type: :development
72
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ prerelease: false
47
+ version_requirements: *2152635180
48
+ - !ruby/object:Gem::Dependency
49
+ name: rspec
50
+ requirement: &2152634720 !ruby/object:Gem::Requirement
73
51
  none: false
74
- requirements:
52
+ requirements:
75
53
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 23
78
- segments:
79
- - 2
80
- - 6
81
- - 0
54
+ - !ruby/object:Gem::Version
82
55
  version: 2.6.0
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
85
- name: cucumber
86
- prerelease: false
87
56
  type: :development
88
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ prerelease: false
58
+ version_requirements: *2152634720
59
+ - !ruby/object:Gem::Dependency
60
+ name: cucumber
61
+ requirement: &2152634260 !ruby/object:Gem::Requirement
89
62
  none: false
90
- requirements:
63
+ requirements:
91
64
  - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 19
94
- segments:
95
- - 1
96
- - 0
97
- - 2
65
+ - !ruby/object:Gem::Version
98
66
  version: 1.0.2
99
- version_requirements: *id005
100
- - !ruby/object:Gem::Dependency
101
- name: aruba
102
- prerelease: false
103
67
  type: :development
104
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ prerelease: false
69
+ version_requirements: *2152634260
70
+ - !ruby/object:Gem::Dependency
71
+ name: aruba
72
+ requirement: &2152633800 !ruby/object:Gem::Requirement
105
73
  none: false
106
- requirements:
74
+ requirements:
107
75
  - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 9
110
- segments:
111
- - 0
112
- - 4
113
- - 3
76
+ - !ruby/object:Gem::Version
114
77
  version: 0.4.3
115
- version_requirements: *id006
116
- - !ruby/object:Gem::Dependency
117
- name: jammit
118
- prerelease: false
119
78
  type: :development
120
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ prerelease: false
80
+ version_requirements: *2152633800
81
+ - !ruby/object:Gem::Dependency
82
+ name: jammit
83
+ requirement: &2152633340 !ruby/object:Gem::Requirement
121
84
  none: false
122
- requirements:
85
+ requirements:
123
86
  - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 1
126
- segments:
127
- - 0
128
- - 6
129
- - 3
87
+ - !ruby/object:Gem::Version
130
88
  version: 0.6.3
131
- version_requirements: *id007
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *2152633340
132
92
  description: Simple rake tasks for deploying to Heroku
133
- email:
93
+ email:
134
94
  - gabe@thoughtbot.com
135
95
  - support@thoughtbot.com
136
- executables:
96
+ executables:
137
97
  - kumade
138
98
  extensions: []
139
-
140
99
  extra_rdoc_files: []
141
-
142
- files:
100
+ files:
143
101
  - .gitignore
144
102
  - .travis.yml
145
103
  - Gemfile
@@ -148,56 +106,60 @@ files:
148
106
  - Rakefile
149
107
  - bin/kumade
150
108
  - features/kumade_executable.feature
109
+ - features/kumade_without_jammit.feature
110
+ - features/step_definitions/bundler_steps.rb
151
111
  - features/step_definitions/dependency_steps.rb
152
112
  - features/step_definitions/git_steps.rb
113
+ - features/step_definitions/kumade_steps.rb
153
114
  - features/support/env.rb
154
115
  - kumade.gemspec
155
116
  - lib/kumade.rb
156
117
  - lib/kumade/deployer.rb
118
+ - lib/kumade/railtie.rb
157
119
  - lib/kumade/runner.rb
158
120
  - lib/kumade/version.rb
121
+ - lib/tasks/deploy.rake
159
122
  - spec/kumade/deployer_spec.rb
160
123
  - spec/kumade/runner_spec.rb
161
124
  - spec/kumade_spec.rb
162
125
  - spec/spec_helper.rb
163
- has_rdoc: true
164
- homepage: ""
126
+ homepage: ''
165
127
  licenses: []
166
-
167
128
  post_install_message:
168
129
  rdoc_options: []
169
-
170
- require_paths:
130
+ require_paths:
171
131
  - lib
172
- required_ruby_version: !ruby/object:Gem::Requirement
132
+ required_ruby_version: !ruby/object:Gem::Requirement
173
133
  none: false
174
- requirements:
175
- - - ">="
176
- - !ruby/object:Gem::Version
177
- hash: 3
178
- segments:
134
+ requirements:
135
+ - - ! '>='
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ segments:
179
139
  - 0
180
- version: "0"
181
- required_rubygems_version: !ruby/object:Gem::Requirement
140
+ hash: -616977314755429055
141
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
142
  none: false
183
- requirements:
184
- - - ">="
185
- - !ruby/object:Gem::Version
186
- hash: 3
187
- segments:
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ segments:
188
148
  - 0
189
- version: "0"
149
+ hash: -616977314755429055
190
150
  requirements: []
191
-
192
151
  rubyforge_project:
193
- rubygems_version: 1.6.1
152
+ rubygems_version: 1.8.6
194
153
  signing_key:
195
154
  specification_version: 3
196
155
  summary: Simple rake tasks for deploying to Heroku
197
- test_files:
156
+ test_files:
198
157
  - features/kumade_executable.feature
158
+ - features/kumade_without_jammit.feature
159
+ - features/step_definitions/bundler_steps.rb
199
160
  - features/step_definitions/dependency_steps.rb
200
161
  - features/step_definitions/git_steps.rb
162
+ - features/step_definitions/kumade_steps.rb
201
163
  - features/support/env.rb
202
164
  - spec/kumade/deployer_spec.rb
203
165
  - spec/kumade/runner_spec.rb