Class: Application::Makegit
- Inherits:
-
Object
- Object
- Application::Makegit
- Defined in:
- lib/makegit.rb
Instance Attribute Summary collapse
-
#git_token ⇒ Object
readonly
Returns the value of attribute git_token.
-
#git_user ⇒ Object
readonly
Returns the value of attribute git_user.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
Instance Method Summary collapse
-
#initialize(argv) ⇒ Makegit
constructor
A new instance of Makegit.
- #parse_options(argv) ⇒ Object
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#git_token ⇒ Object (readonly)
Returns the value of attribute git_token.
11 12 13 |
# File 'lib/makegit.rb', line 11 def git_token @git_token end |
#git_user ⇒ Object (readonly)
Returns the value of attribute git_user.
11 12 13 |
# File 'lib/makegit.rb', line 11 def git_user @git_user end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
11 12 13 |
# File 'lib/makegit.rb', line 11 def params @params end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
11 12 13 |
# File 'lib/makegit.rb', line 11 def project_name @project_name end |
Instance Method Details
#parse_options(argv) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/makegit.rb', line 24 def (argv) argv << '-h' if argv.empty? params = {} OptionParser.new do |opts| opts. = "Usage: [project_name] [options]" opts.on("-h", "--help", "Prints this help") do puts opts exit end opts.on("--rubygem", "Creates RubyGem project template") do params[:template] = "rubygem" end end.parse! project_name = argv[0] raise ArgumentError, "No Project Name Given", caller if project_name == nil || project_name.empty? [params, project_name] end |