Module: Operations::Base::Generators::BaseGenerator
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/operations/base/generators/base_generator.rb
Instance Method Summary collapse
Instance Method Details
#generate_files ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/operations/base/generators/base_generator.rb', line 35 def generate_files @root_file_path = "app" @root_file_path = "components/#{[:component]}" if [:component] @base_test_dir = "test" case Rails.application.config.generators.test_framework when :rspec @base_test_dir = "spec" when :test_unit @base_test_dir = "test" else raise Thor::Error, "Unknown test framework: '#{Rails.application.config.generators.test_framework}', please specify --test_framework=test_unit or --test_framework=rspec." end @root_test_file_path = base_test_dir @root_test_file_path = "#{base_test_dir}/components/#{[:component]}" if [:component] end |
#initialize(args, *options) ⇒ Object
13 14 15 16 17 |
# File 'lib/operations/base/generators/base_generator.rb', line 13 def initialize(args, *) super parse_fields! end |
#validate_verb_argument ⇒ Object
29 30 31 32 33 |
# File 'lib/operations/base/generators/base_generator.rb', line 29 def validate_verb_argument return if %w[create update destroy].include?(verb) raise Thor::Error, "Invalid verb: '#{verb}'. It should be either 'create', 'update' or 'destroy'." end |