Class: Gem::Commands::NewgemCommand
- Inherits:
-
Gem::Command
- Object
- Gem::Command
- Gem::Commands::NewgemCommand
- Defined in:
- lib/rubygems/commands/newgem_command.rb
Instance Method Summary collapse
- #arguments ⇒ Object
- #defaults_str ⇒ Object
- #execute ⇒ Object
-
#initialize ⇒ NewgemCommand
constructor
A new instance of NewgemCommand.
- #usage ⇒ Object
Constructor Details
#initialize ⇒ NewgemCommand
Returns a new instance of NewgemCommand.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rubygems/commands/newgem_command.rb', line 11 def initialize super('newgem', GemNewgem::SUMMARY) @config = GemNewgem::Newgem::Configuration.instance add_option('-t', '--template TEMPLATE_NAME', @config.option_template_desc) do |template, | [:template] = template end add_option('-s', '--summary "SUMMARY_TEXT"', @config.option_summary_desc) do |summary, | [:summary] = summary end end |
Instance Method Details
#arguments ⇒ Object
25 26 27 |
# File 'lib/rubygems/commands/newgem_command.rb', line 25 def arguments %Q|GEMNAME name of the gem skeleton to generate.| end |
#defaults_str ⇒ Object
33 34 35 |
# File 'lib/rubygems/commands/newgem_command.rb', line 33 def defaults_str %Q|--template #{@config.default_template} --summary "#{@config.default_summary}"| end |
#execute ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/rubygems/commands/newgem_command.rb', line 37 def execute @newgem = GemNewgem::Newgem.new( get_one_optional_argument, [:summary], [:template] ) @newgem.validate @newgem.generate! end |
#usage ⇒ Object
29 30 31 |
# File 'lib/rubygems/commands/newgem_command.rb', line 29 def usage %Q|#{program_name} GEMNAME| end |