bump version, eat own dog food, and fix a problem

This commit is contained in:
John Bintz 2011-08-18 17:45:59 -04:00
parent 7d90d5fd47
commit f59463d31a
8 changed files with 81 additions and 2 deletions

View File

@ -8,3 +8,4 @@ gem 'guard-rspec'
gem 'mocha' gem 'mocha'
gem 'fakefs' gem 'fakefs'
gem 'rspec', '~> 2.6.0' gem 'rspec', '~> 2.6.0'
gem 'rake'

View File

@ -1,2 +1,13 @@
require 'bundler' require 'bundler'
Bundler::GemHelper.install_tasks Bundler::GemHelper.install_tasks
begin
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError
"#$! - no rspec"
end
task :default => :spec

View File

@ -1,3 +1,3 @@
module Penchant module Penchant
VERSION = "0.0.1" VERSION = "0.0.2"
end end

11
script/gemfile Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env ruby
require 'rubygems'
require 'penchant'
if Penchant::Gemfile.do_full_env_switch!(ARGV[0])
puts "Gemfile switched to #{ARGV[0]}"
else
exit 0
end

15
script/hooks/pre-commit Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
OLD_GIT_DIR=$GIT_DIR
if [ "$(penchant gemfile-env)" != "remote" ]; then
unset GIT_DIR
penchant gemfile remote
GIT_DIR=$OLD_GIT_DIR
git add Gemfile*
fi
bundle exec rake
R=$?
if [ $R -ne 0 ]; then exit $R; fi

35
script/initialize-environment Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env ruby
if File.file?('Gemfile.erb')
pwd = Dir.pwd
Dir.chdir '..' do
File.readlines(File.join(pwd, 'Gemfile.erb')).find_all { |line| line[':git'] }.each do |line|
repo = line[%r{:git => (['"])(.*)\1}, 2]
puts "Installing #{repo}"
system %{git clone #{repo}}
end
end
puts "Bundling for local environment"
system %{script/gemfile local}
else
puts "Bundling..."
system %{bundle}
end
puts "Installing git hooks"
system %{script/install-git-hooks}
bundle = File.file?('Gemfile') ? 'bundle exec' : ''
command = [ bundle, 'rake', '-s', '-T', 'bootstrap' ]
if !(%x{#{command.join(' ')}}).empty?
puts "Trying to run rake bootstrap..."
system %{#{bundle} rake bootstrap}
end
puts "Done!"

6
script/install-git-hooks Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
for hook in script/hooks/* ; do
ln -sf $PWD/$hook .git/hooks/${hook##*/}
done

View File

@ -2,7 +2,7 @@
OLD_GIT_DIR=$GIT_DIR OLD_GIT_DIR=$GIT_DIR
if [ $(penchant gemfile-env) != "remote" ]; then if [ "$(penchant gemfile-env)" != "remote" ]; then
unset GIT_DIR unset GIT_DIR
penchant gemfile remote penchant gemfile remote
GIT_DIR=$OLD_GIT_DIR GIT_DIR=$OLD_GIT_DIR