Sha256: 0f42013211fd69505a9863b8c41b9458789d6e1f6395646f2f5f6cad03bcdb05

Contents?: true

Size: 1.62 KB

Versions: 7

Compression:

Stored size: 1.62 KB

Contents

require 'rbconfig'

# This generator bootstraps a Rails project for use with RSpec
class RspecGenerator < Rails::Generator::Base
  DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
                              Config::CONFIG['ruby_install_name'])

  def initialize(runtime_args, runtime_options = {})
    if test ?f, 'spec/spec_helper.rb'
      
      puts <<-HELPFUL_INSTRUCTIONS

It looks like you are upgrading rspec-rails in this application. Please let
this script overwrite everything it wants to with the following exceptions,
*if* you have customized any of these files:

  * spec/spec.opts
  * spec/rcov.opts
  * spec/spec_helper.rb
  
If you have customized spec/spec_helper.rb, please set aside a copy of that
file so that it can be updated and you can manually restore your changes.

HELPFUL_INSTRUCTIONS
    end
    Dir.mkdir('lib/tasks') unless File.directory?('lib/tasks')
    super
  end

  def manifest
    record do |m|
      script_options     = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }

      m.directory 'lib/tasks'
      m.file      'rspec.rake',                    'lib/tasks/rspec.rake'

      m.file      'script/autospec',               'script/autospec',    script_options
      m.file      'script/spec',                   'script/spec',        script_options

      m.directory 'spec'
      m.file      'rcov.opts',                     'spec/rcov.opts'
      m.file      'spec.opts',                     'spec/spec.opts'
      m.template  'spec_helper.rb',                'spec/spec_helper.rb'
    end
  end

protected

  def banner
    "Usage: #{$0} rspec"
  end

end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
exception2db-0.0.1 test/rspec-rails/generators/rspec/rspec_generator.rb
hubbub-0.0.11 lib/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
hubbub-0.0.10 lib/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
hubbub-0.0.9 lib/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
hubbub-0.0.8 lib/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
hubbub-0.0.6 lib/vendor/plugins/rspec-rails/generators/rspec/rspec_generator.rb
rspec-rails-1.2.9 generators/rspec/rspec_generator.rb