Class: DemoGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- DemoGenerator
- Defined in:
- lib/generators/demo/demo_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
6 7 8 |
# File 'lib/generators/demo/demo_generator.rb', line 6 def self.source_root @source_root ||= File.("../../templates", __FILE__) end |
Instance Method Details
#make_canable_able ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/demo/demo_generator.rb', line 10 def make_canable_able if File.exist?(model_file_name) @model_file_txt = File.open(model_file_name).read after_txt = find_after_txt(model_file_txt) inject_into_file(model_file_name, canable_include_txt, :after => after_txt) if after_txt else say "#{model_file_name} does not exist. Please create it first before you can make it Canable:Able", :red end end |
#post_log ⇒ Object
20 21 22 |
# File 'lib/generators/demo/demo_generator.rb', line 20 def post_log say "Your model #{model_class_name} is now Canable:Able. Please define your permission login in #{model_file_name}", :green end |