Sha256: 6d3bd00f5932eb63fb0d032e0a15bdfff05148940b4c28324f9d84239ba4a88d
Contents?: true
Size: 1.04 KB
Versions: 7
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require "rails/generators" module Tanshuku # A generator class for Tanshuku configuration files. # # @api private class InstallGenerator < Rails::Generators::Base # Assign `_ = __dir__` because Steep reports `__dir__` which can be a `nil` but I don’t want to care about that. source_root File.expand_path("../templates", _ = __dir__) # Generates a configuration file +config/initializers/tanshuku.rb+. # # @return [void] def copy_initializer_file copy_file "initializer.rb", "config/initializers/tanshuku.rb" end # Generates a migration file +db/migrate/20230220123456_create_tanshuku_urls.rb+. # # @return [void] 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 end end
Version data entries
7 entries across 7 versions & 1 rubygems