class Ecko::Plugins::Sponsor::DonationPackageGenerator
Constants
- DATA_TYPES
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 23 def initialize(*args) super if DATA_TYPES.exclude?(options.fetch(:data_type)) raise Error, "Invalid value for --data-type option. Supported for options are: #{DATA_TYPES.join(", ")}." end end
Public Instance Methods
create_migration()
click to toggle source
THis will help in generating new templates for donations service.
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 32 def create_migration template 'create_donation_package_template.rb', "db/migrate/#{timestamp}_create_donation_packages.rb" template 'donation_package.rb', 'app/models/donation_package.rb' template 'donation.rb', 'app/models/donation.rb' end
Private Instance Methods
data_type()
click to toggle source
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 40 def data_type options.fetch('data_type') end
migration_version()
click to toggle source
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 48 def migration_version return nil if Gem::Version.new(rails_version) < Gem::Version.new('5.0.0') '[6.0]' end
rails_version()
click to toggle source
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 44 def rails_version Rails::VERSION::STRING end
timestamp()
click to toggle source
# File lib/ecko/plugins/sponsor/generator/donation_package_generator.rb, line 53 def timestamp Time.now.strftime('%Y%m%d%H%M%S') end