Class: StartProject::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/start_project/options.rb

Overview

Read the arguments from the command line and parse them out

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Options

Initializes the options object, loads the config.yaml that stores all the frameworks available and sets a default framework: html5 boilerplate. Finally, it calls the parse method.



25
26
27
28
29
30
31
32
33
34
# File 'lib/start_project/options.rb', line 25

def initialize(argv)
  @frameworks = begin
  YAML.load_file(File.join(File.dirname(__FILE__),'config.yaml'))
  rescue ArgumentError => e
     puts "Could not parse YAML #{e.message}"
  end

  @project_uri = @frameworks[:html5]
  parse(argv)
end

Instance Attribute Details

#frameworksObject (readonly)

frameworks stores the framework details loaded from the config.yaml



19
20
21
# File 'lib/start_project/options.rb', line 19

def frameworks
  @frameworks
end

#project_nameObject (readonly)

project_name stores the name of the folder that the final project will live in



16
17
18
# File 'lib/start_project/options.rb', line 16

def project_name
  @project_name
end

#project_uriObject (readonly)

project_uri stores the url of the framework



13
14
15
# File 'lib/start_project/options.rb', line 13

def project_uri
  @project_uri
end