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_filesObject



35
36
37
38
39
40
41
# File 'lib/operations/base/generators/base_generator.rb', line 35

def generate_files
  @root_file_path = "app"
  @root_file_path = "components/#{options[:component]}" if options[:component]

  @root_test_file_path = "test"
  @root_test_file_path = "test/components/#{options[:component]}" if options[:component]
end

#initialize(args, *options) ⇒ Object



13
14
15
16
17
# File 'lib/operations/base/generators/base_generator.rb', line 13

def initialize(args, *options)
  super

  parse_fields!
end

#validate_verb_argumentObject

Raises:

  • (Thor::Error)


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