From b8e03e9acd9a6bdae60e34aae77e197df8b8b1d0 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 18 Apr 2012 13:22:38 -0400 Subject: [PATCH 1/3] only do deployment gemfile generation after successful remote-only generation. good for ripping out testing libraries from deploys, but still keeping them around for running the default rake task --- template/script/hooks/pre-commit | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/template/script/hooks/pre-commit b/template/script/hooks/pre-commit index fc9f07f..d5dc180 100755 --- a/template/script/hooks/pre-commit +++ b/template/script/hooks/pre-commit @@ -2,6 +2,14 @@ OLD_GIT_DIR=$GIT_DIR +if [ "$(penchant gemfile-env)" != "remote" ]; then + penchant gemfile remote +fi + +bundle exec rake +R=$? +if [ $R -ne 0 ]; then exit $R; fi + if [ "$(penchant gemfile-env)" != "remote deployment" ]; then unset GIT_DIR penchant gemfile remote --deployment @@ -9,7 +17,3 @@ if [ "$(penchant gemfile-env)" != "remote deployment" ]; then git add Gemfile* fi -bundle exec rake -R=$? -if [ $R -ne 0 ]; then exit $R; fi - From e465b3bbe47ae269f9424c865a0fa309daa9bef4 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 18 Apr 2012 15:46:47 -0400 Subject: [PATCH 2/3] bump version --- README.md | 9 +++++++-- lib/penchant/version.rb | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 999f94f..8f208eb 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,8 @@ You can also run `penchant gemfile ENV`. Use `no_deployment` blocks to indicate gems that shouldn't even appear in `Gemfiles` destined for remote servers. *Very* helpful when you have OS-specific gems and are developing on one platform -and deploying on another: +and deploying on another, or if you don't want to deal with the dependencies for your testing +frameworks: ``` erb <% no_deployment do %> @@ -59,11 +60,15 @@ and deploying on another: when /linux/ gem 'libnotify', :require => nil end + + group :test do + # ... all your testing libraries you won't need on the deployed end ... + end <% end %> ``` Run `penchant gemfile ENV --deployment` to get this behavior. This is run by default when the -pre-commit git hook runs. +pre-commit git hook runs, but only after the default Rake task passes. ## initialize-environment diff --git a/lib/penchant/version.rb b/lib/penchant/version.rb index 8733841..5654ec5 100644 --- a/lib/penchant/version.rb +++ b/lib/penchant/version.rb @@ -1,3 +1,3 @@ module Penchant - VERSION = "0.0.5" + VERSION = "0.1.0" end From 2112153b8540c232ce40f14c320d4ef05cc51132 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 18 Apr 2012 15:49:08 -0400 Subject: [PATCH 3/3] fix spec --- spec/lib/penchant/gemfile_spec.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spec/lib/penchant/gemfile_spec.rb b/spec/lib/penchant/gemfile_spec.rb index d851d7b..fe2bb87 100644 --- a/spec/lib/penchant/gemfile_spec.rb +++ b/spec/lib/penchant/gemfile_spec.rb @@ -10,6 +10,8 @@ describe Penchant::Gemfile do let(:gemfile_erb_path) { File.join(dir, 'Gemfile.erb') } def write_file(path, content = nil) + FileUtils.mkdir_p(File.dirname(path)) + File.open(path, 'wb') do |fh| content = yield if block_given? fh.print content