Skip to content
Browse files

Add preflight check for Toolbelt (CLI)

  • Loading branch information...
1 parent af68e72 commit e5b537f4c2a0eb9cc91e3579d25b68ac11895cc8 @kmayer kmayer committed Nov 13, 2012
Showing with 12 additions and 4 deletions.
  1. +1 −0 .gitignore
  2. +3 −3 Gemfile.lock
  3. +0 −1 Rakefile
  4. +5 −0 lib/heroku_san/stage.rb
  5. +3 −0 spec/heroku_san/stage_spec.rb
View
1 .gitignore
@@ -5,3 +5,4 @@ Thumbs.db
tmp
.idea/**
*.swp
+.rspec
View
6 Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
- heroku_san (4.0.1)
+ heroku_san (4.0.2)
activesupport
heroku-api (>= 0.1.2)
rake
@@ -60,8 +60,8 @@ GEM
git-smart (0.1.9)
colorize
godot (0.1.0)
- heroku-api (0.3.5)
- excon (~> 0.16.1)
+ heroku-api (0.3.6)
+ excon (~> 0.16.7)
hike (1.2.1)
i18n (0.6.0)
journey (1.0.3)
View
1 Rakefile
@@ -10,5 +10,4 @@ task :default => :spec
desc "Run all specs"
RSpec::Core::RakeTask.new do |t|
t.pattern = 'spec/**/*_spec.rb'
- t.rspec_opts = ["-c", "-f progress"]
end
View
5 lib/heroku_san/stage.rb
@@ -139,12 +139,17 @@ def auth_token
end
def sh_heroku(*command)
+ preflight_check_for_cli
cmd = (command + ['--app', app]).compact
show_command = cmd.join(' ')
$stderr.puts show_command if @debug
ok = system "heroku", *cmd
status = $?
ok or fail "Command failed with status (#{status.exitstatus}): [heroku #{show_command}]"
end
+
+ def preflight_check_for_cli
+ raise "The Heroku Toolbelt is required for this action. http://toolbelt.heroku.com" if system('heroku version') == nil
+ end
end
end
View
3 spec/heroku_san/stage_spec.rb
@@ -4,6 +4,9 @@
include Git
subject { HerokuSan::Stage.new('production', {"app" => "awesomeapp", "stack" => "cedar"})}
STOCK_CONFIG = {"BUNDLE_WITHOUT"=>"development:test", "LANG"=>"en_US.UTF-8", "RACK_ENV"=>"production"}
+ before do
+ HerokuSan::Stage.any_instance.stub(:preflight_check_for_cli)
+ end
context "initializes" do
subject { HerokuSan::Stage.new('production',

0 comments on commit e5b537f

Please sign in to comment.
Something went wrong with that request. Please try again.