class Swgr2rb::Main

Main is being called from bin/swgr2rb.

Public Class Methods

new(args) click to toggle source
# File lib/swgr2rb.rb, line 11
def initialize(args)
  @args = args
end

Public Instance Methods

execute() click to toggle source
# File lib/swgr2rb.rb, line 15
def execute
  @url, @params = parse_cli_arguments
  generate_scaffold if @params[:from_scratch]
  generate_endpoint_object_models
  generate_example_feature_file if @params[:from_scratch]
  format_target_dir_with_rubocop
end

Private Instance Methods

format_target_dir_with_rubocop() click to toggle source
# File lib/swgr2rb.rb, line 47
def format_target_dir_with_rubocop
  puts 'Formatting generated endpoint object models with rubocop...'
  `rubocop -x #{File.join(@params[:target_dir], @params[:component])}`
  puts 'Done!'
end
generate_endpoint_object_models() click to toggle source
# File lib/swgr2rb.rb, line 37
def generate_endpoint_object_models
  puts "Generating endpoint classes in #{@params[:target_dir]}..."
  EndpointClassesGenerator.new(@url, @params).generate_endpoint_classes
end
generate_example_feature_file() click to toggle source
# File lib/swgr2rb.rb, line 42
def generate_example_feature_file
  puts 'Generating example feature file...'
  ScaffoldGenerator.generate_example_feature_file(@params)
end
generate_scaffold() click to toggle source
# File lib/swgr2rb.rb, line 29
def generate_scaffold
  @params.merge!(target_dir: File.join(ScaffoldGeneratorConstants::HARNESS_DIR,
                                       ScaffoldGeneratorConstants::ENDPOINT_MODELS_DIR),
                 update_only: false)
  puts 'Generating scaffold of the testing framework...'
  ScaffoldGenerator.generate_scaffold
end
parse_cli_arguments() click to toggle source
# File lib/swgr2rb.rb, line 25
def parse_cli_arguments
  CliOptionsParser.new.parse(@args)
end