Class: ParlezGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ParlezGenerator
- Includes:
- Rails::Generators::Migration, Thor::Actions
- Defined in:
- lib/generators/parlez_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #generate_initialization ⇒ Object
- #generate_migration ⇒ Object
- #generate_public_assets ⇒ Object
- #show_readme ⇒ Object
Class Method Details
.next_migration_number(dirname) ⇒ Object
33 34 35 36 37 |
# File 'lib/generators/parlez_generator.rb', line 33 def self.next_migration_number(dirname) orm = Rails.configuration.generators.[:rails][:orm] require "rails/generators/#{orm}" "#{orm.to_s.camelize}::Generators::Base".constantize.next_migration_number(dirname) end |
Instance Method Details
#generate_initialization ⇒ Object
25 26 27 |
# File 'lib/generators/parlez_generator.rb', line 25 def generate_initialization copy_file 'config/initializers/parlez.rb', 'config/initializers/parlez.rb' end |
#generate_migration ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/parlez_generator.rb', line 8 def generate_migration destination = File.('db/migrate/01_setup_parlez.rb', self.destination_root) migration_dir = File.dirname(destination) destination = self.class.migration_exists?(migration_dir, 'setup_parlez') if destination puts "\e[0m\e[31mFound an existing setup_parlez.rb migration. Manually remove it to re-create it.\e[0m" else migration_template 'db/migrate/01_setup_parlez.rb', 'db/migrate/setup_parlez.rb' end end |
#generate_public_assets ⇒ Object
20 21 22 23 |
# File 'lib/generators/parlez_generator.rb', line 20 def generate_public_assets directory 'public/stylesheets/sass/parlez' directory 'public/javascripts/parlez' end |
#show_readme ⇒ Object
29 30 31 |
# File 'lib/generators/parlez_generator.rb', line 29 def show_readme readme 'lib/generators/README' end |