class EffectiveCpd::Generators::InstallGenerator
Public Class Methods
next_migration_number(dirname)
click to toggle source
# File lib/generators/effective_cpd/install_generator.rb, line 10 def self.next_migration_number(dirname) if not ActiveRecord::Base.timestamped_migrations Time.new.utc.strftime("%Y%m%d%H%M%S") else '%.3d' % (current_migration_number(dirname) + 1) end end
Public Instance Methods
copy_initializer()
click to toggle source
# File lib/generators/effective_cpd/install_generator.rb, line 18 def copy_initializer template ('../' * 3) + 'config/effective_cpd.rb', 'config/initializers/effective_cpd.rb' end
copy_mailer_preview()
click to toggle source
# File lib/generators/effective_cpd/install_generator.rb, line 49 def copy_mailer_preview mailer_preview_path = (Rails.application.config.action_mailer.preview_path rescue nil) if mailer_preview_path.present? template 'effective_cpd_mailer_preview.rb', File.join(mailer_preview_path, 'effective_cpd_mailer_preview.rb') else puts "couldn't find action_mailer.preview_path. Skipping effective_cpd_mailer_preview." end end
create_migration_file()
click to toggle source
# File lib/generators/effective_cpd/install_generator.rb, line 22 def create_migration_file @cpd_categories_table_name = ':' + EffectiveCpd.cpd_categories_table_name.to_s @cpd_activities_table_name = ':' + EffectiveCpd.cpd_activities_table_name.to_s @cpd_cycles_table_name = ':' + EffectiveCpd.cpd_cycles_table_name.to_s @cpd_rules_table_name = ':' + EffectiveCpd.cpd_rules_table_name.to_s @cpd_special_rules_table_name = ':' + EffectiveCpd.cpd_special_rules_table_name.to_s @cpd_special_rule_mates_table_name = ':' + EffectiveCpd.cpd_special_rule_mates_table_name.to_s @cpd_statements_table_name = ':' + EffectiveCpd.cpd_statements_table_name.to_s @cpd_statement_activities_table_name = ':' + EffectiveCpd.cpd_statement_activities_table_name.to_s @cpd_audit_levels_table_name = ':' + EffectiveCpd.cpd_audit_levels_table_name.to_s @cpd_audit_level_sections_table_name = ':' + EffectiveCpd.cpd_audit_level_sections_table_name.to_s @cpd_audit_level_questions_table_name = ':' + EffectiveCpd.cpd_audit_level_questions_table_name.to_s @cpd_audit_level_question_options_table_name = ':' + EffectiveCpd.cpd_audit_level_question_options_table_name.to_s @cpd_audits_table_name = ':' + EffectiveCpd.cpd_audits_table_name.to_s @cpd_audit_responses_table_name = ':' + EffectiveCpd.cpd_audit_responses_table_name.to_s @cpd_audit_response_options_table_name = ':' + EffectiveCpd.cpd_audit_response_options_table_name.to_s @cpd_audit_reviews_table_name = ':' + EffectiveCpd.cpd_audit_reviews_table_name.to_s @cpd_audit_review_items_table_name = ':' + EffectiveCpd.cpd_audit_review_items_table_name.to_s migration_template ('../' * 3) + 'db/migrate/01_create_effective_cpd.rb.erb', 'db/migrate/create_effective_cpd.rb' end