Class: JayZ::Generators::ModelGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- JayZ::Generators::ModelGenerator
- Defined in:
- lib/generators/jay_z/model/model_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_blueprint ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/generators/jay_z/model/model_generator.rb', line 6 def create_blueprint file_name = if File.exists?(File.join(Rails.root, 'test', 'blueprint.rb')) "test/blueprint.rb" elsif File.exists?(File.join(Rails.root, 'spec', 'blueprint.rb')) "spec/blueprint.rb" else raise "Cannot find the blueprint file" end gsub_file(file_name, /.end\s*\Z/mx) { |match| "#{code}\n#{match}" } end |