Skip to content

Commit

Permalink
dont deploy unless on the correct branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldon committed Nov 29, 2011
1 parent 2272e53 commit 7ebbaca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion lib/obbistrano_tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,18 @@

task :git_deploy, :roles =>[:web] do
logger.level = 2
logger.info "Deploying application from #{repository} on branch #{branch}"

set :local_branch, $1 if `git branch` =~ /\* (\S+)\s/m
if !local_branch.eql? branch
logger.info "You are on branch #{local_branch}, not #{branch}, please check out there before deploying to be able to combine the correct js and css files."
exit
end

if defined? "#{commit}"
logger.info "Deploying application from #{repository} on commit #{commit}"
else
logger.info "Deploying application from #{repository} on branch #{branch}"
end
logger.level = -1
begin
run "ls #{deploy_to}/.git"
Expand All @@ -159,7 +170,9 @@
run "cd #{deploy_to} && git remote add origin #{repository}"
end
logger.level = 2

run "cd #{deploy_to} && git fetch"

if defined? "#{commit}"
run "cd #{deploy_to} && git checkout #{commit} && git submodule update --init --recursive"
else
Expand Down
2 changes: 1 addition & 1 deletion obbistrano.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |s|
s.name = %q{obbistrano}
s.version = "1.1.69"
s.version = "1.1.70"
s.authors = ["Ross Riley", "One Black Bear"]
s.date = Time.now
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
Expand Down

0 comments on commit 7ebbaca

Please sign in to comment.