Class: Gem::Commands::GemspecCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
CommandOptions, GemRelease, Helpers
Defined in:
lib/rubygems/commands/gemspec_command.rb

Constant Summary collapse

DEFAULTS =
{
  :strategy => 'git',
  :quiet    => false
}

Constants included from GemRelease

GemRelease::VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ GemspecCommand

Returns a new instance of GemspecCommand.



12
13
14
15
16
17
# File 'lib/rubygems/commands/gemspec_command.rb', line 12

def initialize(options = {})
  super 'bootstrap', 'Bootstrap a new gem source repository', DEFAULTS.merge(options)

  option :strategy, '-f', 'Strategy for collecting files [glob|git] in .gemspec'
  option :quiet,    '-q', 'Do not output status messages'
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



10
11
12
# File 'lib/rubygems/commands/gemspec_command.rb', line 10

def arguments
  @arguments
end

#usageObject (readonly)

Returns the value of attribute usage.



10
11
12
# File 'lib/rubygems/commands/gemspec_command.rb', line 10

def usage
  @usage
end

Instance Method Details

#executeObject



19
20
21
22
23
24
25
26
27
# File 'lib/rubygems/commands/gemspec_command.rb', line 19

def execute
  gemspec = GemspecTemplate.new(options)
  if gemspec.exists?
    say "Skipping #{gemspec.filename}: already exists" unless quiet?
  else
    say "Creating #{gemspec.filename}" unless quiet?
    gemspec.write
  end
end