Sha256: be5b7e9e2c230857446563566b148e8e87e4e7cf98a03fc8f3f79fa177d0530b
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
# for Rails 3 if Rails::VERSION::MAJOR >= 3 module Bin class BinGenerator < Rails::Generators::NamedBase source_root File.expand_path("../templates", __FILE__) def add_files file_name.sub!('_script', '') template "script.rb", "bin/#{file_path}" template "script_class.rb", "app/bins/#{file_path}_script.rb" template "spec.rb", "spec/bins/#{file_path}_script_spec.rb" chmod "bin/#{file_path}", 0755 end end end end # for Rails 2.3 if Rails::VERSION::MAJOR == 2 class BinGenerator < Rails::Generator::NamedBase def manifest record do |m| file_name.sub!('_script', '') m.template "script.rb", "bin/#{file_path}", :chmod => 0755 m.template "script_class.rb", "app/bins/#{file_path}_script.rb" m.directory "spec/bins" m.template "spec.rb", "spec/bins/#{file_path}_script_spec.rb" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bin_script-0.1.8 | lib/generators/bin/bin_generator.rb |