lib/generators/bin/bin_generator.rb in bin_script-0.1.7 vs lib/generators/bin/bin_generator.rb in bin_script-0.1.8
- old
+ new
@@ -4,10 +4,11 @@
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
@@ -20,9 +21,10 @@
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
\ No newline at end of file