lib/baldwin/installer.rb in baldwin-0.0.2 vs lib/baldwin/installer.rb in baldwin-0.1.0

- old
+ new

@@ -3,19 +3,17 @@ module Baldwin class Installer < Thor::Group include Thor::Actions def ignore_dummy_rails_apps - append_file '.gitignore', <<-EOS -#{byline} + append_to_file '.gitignore', <<-EOS spec/support/rails-* EOS end def create_appraisals_file create_file 'Appraisals', <<-EOS -#{byline} # add your rails configurations to test against here, like: # # appraise 'rails-3.1.0' do # gem 'rails', '3.1.0' # end @@ -26,14 +24,20 @@ # see https://github.com/thoughtbot/appraisal for more info EOS end def add_appraisal_rake_task - comment_lines 'Rakefile', /RSpec::Core::RakeTask/ + # TODO figure out why this isn't in Thor 0.15 + + # TODO also, ask those guys why they haven't + # updated their version.rb in two years. wtf. + # comment_lines 'Rakefile', /RSpec::Core::RakeTask/ + flag = 'RSpec::Core::RakeTask.new' + gsub_file 'Rakefile', /^(\s*)([^#|\n]*#{flag})/, '\1# \2' - append_file 'Rakefile', <<-EOS -#{byline} + append_to_file 'Rakefile', <<-EOS +require 'baldwin/tasks' + RSpec::Core::RakeTask.new :spec => [ :'baldwin:env', :'baldwin:rails' ] desc "Run specs for all supported rails versions" task :all do exec 'rake appraisal spec' @@ -42,16 +46,23 @@ desc "Default: Clean, install dependencies, and run specs" task :default => [ :'baldwin:clean', :'appraisal:install', :all ] EOS end - def baz - say "Did baz", :blue + def add_baldwin_setup_to_spec_helper + prepend_to_file 'spec/spec_helper.rb', <<-EOS +require 'baldwin/setup' +# require test helpers _after_ baldwin/setup +# require 'rspec/rails' +# require 'shoulda' +EOS end - protected + def copy_example_rails_template + copy_file 'rails_template.rb', 'spec/rails/rails_template.rb' + end - def byline - "# added by baldwin #{Baldwin::VERSION}" + def self.source_root + File.dirname __FILE__ end end end