From be94106a1156a213e5aa2e8e917a7fa5efb331fc Mon Sep 17 00:00:00 2001 From: John Bintz Date: Tue, 16 Aug 2011 11:11:11 -0400 Subject: [PATCH] more cleanup --- Guardfile | 20 ++++++++++++++++++++ spec/lib/penchant_spec.rb | 0 spec/spec_helper.rb | 0 template/script/initialize-environment | 10 ++++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 Guardfile create mode 100644 spec/lib/penchant_spec.rb create mode 100644 spec/spec_helper.rb diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..ae6decc --- /dev/null +++ b/Guardfile @@ -0,0 +1,20 @@ +# A sample Guardfile +# More info at https://github.com/guard/guard#readme + +guard 'rspec', :version => 2 do + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch('spec/spec_helper.rb') { "spec" } + + # Rails example + watch(%r{^spec/.+_spec\.rb$}) + watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } + watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } + watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] } + watch(%r{^spec/support/(.+)\.rb$}) { "spec" } + watch('spec/spec_helper.rb') { "spec" } + watch('config/routes.rb') { "spec/routing" } + watch('app/controllers/application_controller.rb') { "spec/controllers" } + # Capybara request specs + watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" } +end diff --git a/spec/lib/penchant_spec.rb b/spec/lib/penchant_spec.rb new file mode 100644 index 0000000..e69de29 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..e69de29 diff --git a/template/script/initialize-environment b/template/script/initialize-environment index a702166..222c8f1 100755 --- a/template/script/initialize-environment +++ b/template/script/initialize-environment @@ -22,8 +22,14 @@ end puts "Installing git hooks" system %{script/install-git-hooks} -puts "Trying to run rake bootstrap..." -system %{rake bootstrap} +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!"