This commit is contained in:
John Bintz 2012-04-20 11:13:43 -04:00
commit e23aae423d
4 changed files with 18 additions and 7 deletions

View File

@ -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 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 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 ``` erb
<% no_deployment do %> <% no_deployment do %>
@ -59,11 +60,15 @@ and deploying on another:
when /linux/ when /linux/
gem 'libnotify', :require => nil gem 'libnotify', :require => nil
end end
group :test do
# ... all your testing libraries you won't need on the deployed end ...
end
<% end %> <% end %>
``` ```
Run `penchant gemfile ENV --deployment` to get this behavior. This is run by default when the 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 ## initialize-environment

View File

@ -1,3 +1,3 @@
module Penchant module Penchant
VERSION = "0.0.6" VERSION = "0.1.1"
end end

View File

@ -10,6 +10,8 @@ describe Penchant::Gemfile do
let(:gemfile_erb_path) { File.join(dir, 'Gemfile.erb') } let(:gemfile_erb_path) { File.join(dir, 'Gemfile.erb') }
def write_file(path, content = nil) def write_file(path, content = nil)
FileUtils.mkdir_p(File.dirname(path))
File.open(path, 'wb') do |fh| File.open(path, 'wb') do |fh|
content = yield if block_given? content = yield if block_given?
fh.print content fh.print content

View File

@ -2,6 +2,14 @@
OLD_GIT_DIR=$GIT_DIR 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 if [ "$(penchant gemfile-env)" != "remote deployment" ]; then
unset GIT_DIR unset GIT_DIR
penchant gemfile remote --deployment penchant gemfile remote --deployment
@ -9,7 +17,3 @@ if [ "$(penchant gemfile-env)" != "remote deployment" ]; then
git add Gemfile* git add Gemfile*
fi fi
bundle exec rake
R=$?
if [ $R -ne 0 ]; then exit $R; fi