lib/vulcan/cli.rb in vulcan-0.3.0 vs lib/vulcan/cli.rb in vulcan-0.4.0
- old
+ new
@@ -60,19 +60,24 @@
error "Unknown error, no build output given" unless response["X-Make-Id"]
puts ">> Downloading build artifacts to: #{output}"
+ output_url = "#{server}/output/#{response["X-Make-Id"]}"
+ puts " (available at #{output_url})"
+
File.open(output, "w") do |output|
begin
- output.print RestClient.get("#{server}/output/#{response["X-Make-Id"]}")
+ output.print RestClient.get(output_url)
rescue Exception => ex
puts ex.inspect
end
end
end
end
+ rescue Interrupt
+ error "Aborted by user"
rescue Errno::EPIPE
error "Could not connect to build server: #{server}"
end
desc "create APP_NAME", <<-DESC
@@ -109,21 +114,24 @@
Heroku::Plugin.load!
api_key = Heroku::Auth.api_key
error "invalid api key detected, try running `heroku auth:token`" if api_key =~ / /
system "git init"
- system "git remote add heroku git@heroku.com:#{config[:app]}.git"
+ system "git remote add heroku git@#{heroku_git_domain}:#{config[:app]}.git"
FileUtils.cp_r "#{server_path}/.", "."
File.open(".gitignore", "w") do |file|
file.puts ".env"
file.puts "node_modules"
end
+
+ %x{ env BUNDLE_GEMFILE= heroku config:remove BUILDPACK_URL 2>&1 }
+
system "git add . >/dev/null"
system "git commit -m commit >/dev/null"
system "git push heroku -f master"
- %x{ env BUNDLE_GEMFILE= heroku config:add SECRET=#{config[:secret]} SPAWN_ENV=heroku HEROKU_APP=#{config[:app]} HEROKU_API_KEY=#{api_key} 2>&1 }
+ %x{ env BUNDLE_GEMFILE= heroku config:add SECRET=#{config[:secret]} SPAWN_ENV=heroku HEROKU_APP=#{config[:app]} HEROKU_API_KEY=#{api_key} NODE_PATH=lib 2>&1 }
%x{ env BUNDLE_GEMFILE= heroku addons:add cloudant:oxygen }
end
end
end
@@ -155,8 +163,19 @@
exit 1
end
def server_path
File.expand_path("../../../server", __FILE__)
+ end
+
+ #
+ # heroku_git_domain checks to see if the heroku-accounts plugin is present,
+ # and if so, it will set the domain to the one that matches the credentials
+ # for the currently set account
+ #
+ def heroku_git_domain
+ suffix = %x{ git config heroku.account }
+ suffix = "com" if suffix.nil? or suffix.strip == ""
+ "heroku.#{suffix.strip}"
end
end