Class: Mdwa::Generators::EntityGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mdwa::Generators::EntityGenerator
- Defined in:
- lib/generators/mdwa/entity/entity_generator.rb
Instance Method Summary collapse
Instance Method Details
#code_generation ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/mdwa/entity/entity_generator.rb', line 17 def code_generation file_name = "#{MDWA::DSL::STRUCTURAL_PATH}#{MDWA::DSL::Entity.new(name).file_name}.rb" # if file doesn't exist, create it # if file exists, include the in_requirements clause if !File.exist?( Rails.root + file_name ) template 'entity.rb', file_name else append_to_file( file_name, "\nMDWA::DSL.entity('#{name.singularize.camelize}').in_requirements << '#{.requirement}'" ) unless .requirement.blank? end end |