1require 'rbconfig'
2
3# This generator bootstraps a Rails project for use with RSpec
4class RspecGenerator < Rails::Generator::Base
5 DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
6 Config::CONFIG['ruby_install_name'])
7
8 def initialize(runtime_args, runtime_options = {})
9 super
10 end
11
12 def manifest
13 record do |m|
14 script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
15
16 m.directory 'spec'
17 m.template 'spec_helper.rb', 'spec/spec_helper.rb'
18 m.file 'spec.opts', 'spec/spec.opts'
19 m.file 'rcov.opts', 'spec/rcov.opts'
20 m.file 'script/spec_server', 'script/spec_server', script_options
21 m.file 'script/spec', 'script/spec', script_options
22
23 m.directory 'stories'
24 m.file 'all_stories.rb', 'stories/all.rb'
25 m.file 'stories_helper.rb', 'stories/helper.rb'
26 end
27 end
28
29protected
30
31 def banner
32 "Usage: #{$0} rspec"
33 end
34
35end