Class: Tanshuku::InstallGenerator Private
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Tanshuku::InstallGenerator
- Defined in:
- lib/generators/tanshuku/install_generator.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A generator class for Tanshuku configuration files.
Instance Method Summary collapse
-
#copy_initializer_file ⇒ void
private
Generates a configuration file
config/initializers/tanshuku.rb
. -
#copy_migration_file ⇒ void
private
Generates a migration file
db/migrate/20230220123456_create_tanshuku_urls.rb
.
Instance Method Details
#copy_initializer_file ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Generates a configuration file config/initializers/tanshuku.rb
.
16 17 18 |
# File 'lib/generators/tanshuku/install_generator.rb', line 16 def copy_initializer_file copy_file "initializer.rb", "config/initializers/tanshuku.rb" end |
#copy_migration_file ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Generates a migration file db/migrate/20230220123456_create_tanshuku_urls.rb
.
23 24 25 26 27 28 29 |
# File 'lib/generators/tanshuku/install_generator.rb', line 23 def copy_migration_file # rubocop:disable Rails/TimeZone old_filename = "20230220123456_create_tanshuku_urls.rb" new_filename = old_filename.sub("20230220123456", Time.now.strftime("%Y%m%d%H%M%S")) copy_file "../../../db/migrate/#{old_filename}", "db/migrate/#{new_filename}" # rubocop:enable Rails/TimeZone end |