Class: Gutsy::Cli::Generator

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gutsy/generator.rb

Defined Under Namespace

Classes: ResourceState, State

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name, schema_path, output_path) ⇒ Generator

Returns a new instance of Generator.



55
56
57
58
59
# File 'lib/gutsy/generator.rb', line 55

def initialize(app_name, schema_path, output_path)
  @state = State.new(app_name)
  @schema_path = schema_path
  @output_path = output_path
end

Instance Attribute Details

#app_nameObject (readonly)

Returns the value of attribute app_name.



53
54
55
# File 'lib/gutsy/generator.rb', line 53

def app_name
  @app_name
end

Instance Method Details

#generate!Object



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/gutsy/generator.rb', line 61

def generate!
  create_output_dir

  schema = load_and_validate_schema!

  state.resources = map_schema_to_resources(schema)

  scaffold_gem

  generate_heroics_client

  puts "Generated client gem can be found in... #{output_path}"
end