Skip to content

Commit e5b537f

Browse files
committed
Add preflight check for Toolbelt (CLI)
1 parent af68e72 commit e5b537f

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ Thumbs.db
55
tmp
66
.idea/**
77
*.swp
8+
.rspec

Gemfile.lock

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
heroku_san (4.0.1)
4+
heroku_san (4.0.2)
55
activesupport
66
heroku-api (>= 0.1.2)
77
rake
@@ -60,8 +60,8 @@ GEM
6060
git-smart (0.1.9)
6161
colorize
6262
godot (0.1.0)
63-
heroku-api (0.3.5)
64-
excon (~> 0.16.1)
63+
heroku-api (0.3.6)
64+
excon (~> 0.16.7)
6565
hike (1.2.1)
6666
i18n (0.6.0)
6767
journey (1.0.3)

Rakefile

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ task :default => :spec
1010
desc "Run all specs"
1111
RSpec::Core::RakeTask.new do |t|
1212
t.pattern = 'spec/**/*_spec.rb'
13-
t.rspec_opts = ["-c", "-f progress"]
1413
end

lib/heroku_san/stage.rb

+5
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,17 @@ def auth_token
139139
end
140140

141141
def sh_heroku(*command)
142+
preflight_check_for_cli
142143
cmd = (command + ['--app', app]).compact
143144
show_command = cmd.join(' ')
144145
$stderr.puts show_command if @debug
145146
ok = system "heroku", *cmd
146147
status = $?
147148
ok or fail "Command failed with status (#{status.exitstatus}): [heroku #{show_command}]"
148149
end
150+
151+
def preflight_check_for_cli
152+
raise "The Heroku Toolbelt is required for this action. http://toolbelt.heroku.com" if system('heroku version') == nil
153+
end
149154
end
150155
end

spec/heroku_san/stage_spec.rb

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
include Git
55
subject { HerokuSan::Stage.new('production', {"app" => "awesomeapp", "stack" => "cedar"})}
66
STOCK_CONFIG = {"BUNDLE_WITHOUT"=>"development:test", "LANG"=>"en_US.UTF-8", "RACK_ENV"=>"production"}
7+
before do
8+
HerokuSan::Stage.any_instance.stub(:preflight_check_for_cli)
9+
end
710

811
context "initializes" do
912
subject { HerokuSan::Stage.new('production',

0 commit comments

Comments
 (0)