Permalink
Browse files

rename git_force_push to sync_heroku, push deploy branch to master

  • Loading branch information...
1 parent b5716af commit 2e112586acd764b354be4c3fc83d2a24e430074a @nickrivadeneira nickrivadeneira committed Aug 2, 2011
Showing with 19 additions and 19 deletions.
  1. +1 −1 features/kumade_executable.feature
  2. +5 −5 lib/kumade/deployer.rb
  3. +13 −13 spec/kumade/deployer_spec.rb
@@ -19,7 +19,7 @@ Feature: Kumade executable
==> Packaged assets with Jammit
run git push origin master
==> Pushed master -> origin
- run git push -f pretend-staging master
+ run git push -f pretend-staging deploy:master
==> Force pushed master -> pretend-staging
run bundle exec heroku rake db:migrate --app pretend-staging-app
==> Migrated pretend-staging-app
View
@@ -12,7 +12,7 @@ def deploy_to(environment)
string_environment = environment.to_s
ensure_heroku_remote_exists_for(string_environment)
pre_deploy
- git_force_push(string_environment)
+ sync_heroku(string_environment)
heroku_migrate(string_environment)
post_deploy
end
@@ -29,10 +29,10 @@ def sync_github
success("Pushed master -> origin")
end
- def git_force_push(remote)
- run_or_error("git push -f #{remote} master",
- "Failed to force push master -> #{remote}")
- success("Force pushed master -> #{remote}")
+ def sync_heroku(environment)
+ run_or_error("git push -f #{environment} #{DEPLOY_BRANCH}:master",
+ "Failed to force push #{DEPLOY_BRANCH} -> #{environment}/master")
+ success("Force pushed master -> #{environment}")
end
def heroku_migrate(environment)
@@ -50,7 +50,7 @@
ordered.
and_return(true)
- subject.should_receive(:git_force_push).
+ subject.should_receive(:sync_heroku).
ordered.
and_return(true)
@@ -69,7 +69,7 @@
:on_cedar? => false,
:run => true)
- subject.should_receive(:git_force_push).with(remote_name)
+ subject.should_receive(:sync_heroku).with(remote_name)
subject.deploy_to(remote_name)
end
@@ -113,44 +113,44 @@
end
end
-describe Kumade::Deployer, "#git_force_push" do
- let(:remote){ 'origin' }
+describe Kumade::Deployer, "#sync_heroku" do
+ let(:environment) { 'staging' }
before { subject.stub(:say) }
it "calls `git push -f`" do
subject.should_receive(:run).
- with("git push -f #{remote} master").
+ with("git push -f #{environment} deploy:master").
and_return(true)
- subject.git_force_push(remote)
+ subject.sync_heroku(environment)
end
- context "when `git push -f` fails" do
+ context "when syncing to heroku fails" do
before do
subject.stub(:run => false)
end
it "prints an error" do
- subject.should_receive(:error).with("Failed to force push master -> #{remote}")
- subject.git_force_push(remote)
+ subject.should_receive(:error)
+ subject.sync_heroku(environment)
end
end
- context "when `git push -f` succeeds" do
+ context "when syncing to heroku succeeds" do
before do
subject.stub(:run => true)
subject.stub(:say)
end
it "does not raise an error" do
subject.should_not_receive(:error)
- subject.git_force_push(remote)
+ subject.sync_heroku(environment)
end
it "prints a success message" do
subject.should_receive(:success).
- with("Force pushed master -> #{remote}")
+ with("Force pushed master -> #{environment}")
- subject.git_force_push(remote)
+ subject.sync_heroku(environment)
end
end
end

0 comments on commit 2e11258

Please sign in to comment.