update things and docs and stuff
This commit is contained in:
parent
5fe4778e6b
commit
bf69d6ee6d
27
README.md
27
README.md
@ -31,6 +31,10 @@ Yeah, it's a `Gemfile` with ERB in it:
|
||||
<% env :remote do %>
|
||||
gem 'guard', :git => 'git://github.com/johnbintz/guard.git'
|
||||
<% end %>
|
||||
|
||||
<% no_deployment do %>
|
||||
gem 'os-specific-things'
|
||||
<% end %>
|
||||
```
|
||||
|
||||
Use `script/gemfile local` to get at the local ones, and `script/gemfile remote` to get at the remote ones.
|
||||
@ -38,6 +42,29 @@ It then runs `bundle install`.
|
||||
|
||||
You can also run `penchant gemfile ENV`.
|
||||
|
||||
### Deployment mode
|
||||
|
||||
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:
|
||||
|
||||
``` erb
|
||||
<% no_deployment do %>
|
||||
require 'rbconfig'
|
||||
case RbConfig::CONFIG['host_os']
|
||||
when /darwin/
|
||||
gem 'growl_notify'
|
||||
gem 'growl'
|
||||
gem 'rb-fsevent'
|
||||
when /linux/
|
||||
gem 'libnotify', :require => nil
|
||||
end
|
||||
<% end %>
|
||||
```
|
||||
|
||||
Run `penchant gemfile ENV --deployment` to get this behavior. This is run by default when the
|
||||
pre-commit git hook runs.
|
||||
|
||||
## initialize-environment
|
||||
|
||||
Get new developers up to speed fast! `script/initialize-environment` does the following when run:
|
||||
|
@ -24,11 +24,12 @@ class PenchantCLI < Thor
|
||||
gemfile(:remote)
|
||||
end
|
||||
|
||||
method_options :deployment => false
|
||||
desc "gemfile ENV", "Switch the gemfile environment, or rebuild the current environment if not given"
|
||||
def gemfile(env = get_current_env)
|
||||
if env
|
||||
puts "[penchant] Rebunding for #{env} environment..."
|
||||
Penchant::Gemfile.do_full_env_switch!(env)
|
||||
puts "[penchant] Rebunding for #{env} environment#{options[:deployment] ? ", deployment mode" : ''}..."
|
||||
Penchant::Gemfile.do_full_env_switch!(env, options[:deployment])
|
||||
end
|
||||
|
||||
gemfile = Penchant::Gemfile.new
|
||||
|
@ -1,14 +1,14 @@
|
||||
module Penchant
|
||||
class DotPenchant
|
||||
class << self
|
||||
def run(env = nil)
|
||||
def run(env = nil, deployment = false)
|
||||
dot_penchant = new
|
||||
dot_penchant.run(env)
|
||||
dot_penchant
|
||||
end
|
||||
end
|
||||
|
||||
def run(env = nil)
|
||||
def run(env = nil, deployment = false)
|
||||
instance_eval(File.read('.penchant'))
|
||||
end
|
||||
|
||||
@ -22,7 +22,6 @@ module Penchant
|
||||
def gemfile?
|
||||
File.file?('Gemfile')
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -7,13 +7,13 @@ module Penchant
|
||||
class << self
|
||||
def do_full_env_switch!(env, deployment = false)
|
||||
gemfile = Penchant::Gemfile.new
|
||||
gemfile.run_dot_penchant!(env)
|
||||
gemfile.run_dot_penchant!(env, deployment)
|
||||
|
||||
if !gemfile.has_gemfile_erb?
|
||||
return false
|
||||
end
|
||||
|
||||
gemfile.switch_to!(env)
|
||||
gemfile.switch_to!(env, deployment)
|
||||
end
|
||||
end
|
||||
|
||||
@ -56,8 +56,8 @@ module Penchant
|
||||
end
|
||||
end
|
||||
|
||||
def run_dot_penchant!(env)
|
||||
DotPenchant.run(env || environment) if has_dot_penchant?
|
||||
def run_dot_penchant!(env, deployment)
|
||||
DotPenchant.run(env || environment, deployment) if has_dot_penchant?
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -1,3 +1,3 @@
|
||||
module Penchant
|
||||
VERSION = "0.0.4"
|
||||
VERSION = "0.0.5"
|
||||
end
|
||||
|
@ -3,9 +3,9 @@
|
||||
require 'rubygems'
|
||||
require 'penchant'
|
||||
|
||||
if Penchant::Gemfile.do_full_env_switch!(ARGV[0], true)
|
||||
if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
|
||||
system %{bundle}
|
||||
puts "Gemfile switched to #{ARGV[0]} in deployment mode"
|
||||
puts "Gemfile switched to #{ARGV[0]}"
|
||||
else
|
||||
exit 0
|
||||
end
|
||||
|
@ -4,7 +4,7 @@ OLD_GIT_DIR=$GIT_DIR
|
||||
|
||||
if [ "$(penchant gemfile-env)" != "remote" ]; then
|
||||
unset GIT_DIR
|
||||
penchant gemfile remote
|
||||
penchant gemfile remote --deployment
|
||||
GIT_DIR=$OLD_GIT_DIR
|
||||
git add Gemfile*
|
||||
fi
|
||||
|
@ -4,7 +4,7 @@ OLD_GIT_DIR=$GIT_DIR
|
||||
|
||||
if [ "$(penchant gemfile-env)" != "remote" ]; then
|
||||
unset GIT_DIR
|
||||
penchant gemfile remote
|
||||
penchant gemfile remote --deployment
|
||||
GIT_DIR=$OLD_GIT_DIR
|
||||
git add Gemfile*
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user