Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
Create Kumade::Git#ensure_clean_git
Browse files Browse the repository at this point in the history
  • Loading branch information
tapajos committed Aug 29, 2011
1 parent d5ddc13 commit 535b1f6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
13 changes: 2 additions & 11 deletions lib/kumade/deployer.rb
Expand Up @@ -57,11 +57,7 @@ def heroku(command, app)
end

def ensure_clean_git
if ! pretending && git_dirty?
error("Cannot deploy: repo is not clean.")
else
success("Git repo is clean")
end
@git.ensure_clean_git
end

def package_assets
Expand Down Expand Up @@ -94,7 +90,7 @@ def package_with_more
else
begin
run "bundle exec rake more:generate"
if git_dirty?
if @git.git_dirty?
success(success_message)
git_add_and_commit_all_assets_in(more_assets_path)
end
Expand Down Expand Up @@ -151,11 +147,6 @@ def custom_task?
Rake::Task.task_defined?("kumade:before_asset_compilation")
end

def git_dirty?
`git diff --exit-code`
!$?.success?
end

def run_or_error(commands, error_message)
all_commands = [commands].flatten.join(' && ')
if pretending
Expand Down
13 changes: 13 additions & 0 deletions lib/kumade/git.rb
Expand Up @@ -26,6 +26,19 @@ def delete(branch_to_delete, branch_to_checkout)
run_or_error(["git checkout #{branch_to_checkout}", "git branch -D #{branch_to_delete}"],
"Failed to clean up #{branch_to_delete} branch")
end

def git_dirty?
`git diff --exit-code`
!$?.success?
end

def ensure_clean_git
if ! @pretending && git_dirty?
error("Cannot deploy: repo is not clean.")
else
success("Git repo is clean")
end
end

def run_or_error(commands, error_message)
all_commands = [commands].flatten.join(' && ')
Expand Down

0 comments on commit 535b1f6

Please sign in to comment.