Permalink
Browse files

Create Kumade::Git#ensure_clean_git

  • Loading branch information...
tapajos committed Aug 29, 2011
1 parent d5ddc13 commit 535b1f6b74f0196d75a7264f361ee140e69845f9
Showing with 15 additions and 11 deletions.
  1. +2 −11 lib/kumade/deployer.rb
  2. +13 −0 lib/kumade/git.rb
View
@@ -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
@@ -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
@@ -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
View
@@ -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(' && ')

0 comments on commit 535b1f6

Please sign in to comment.