diff --git a/README.md b/README.md index 2878ef3..372f8ad 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 2b37ff0..c4bedf1 100644 --- a/lib/penchant/version.rb +++ b/lib/penchant/version.rb @@ -1,3 +1,3 @@ module Penchant - VERSION = "0.0.6" + VERSION = "0.1.1" end 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 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 -