summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/specification_command.rb
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/specification_command.rb59
1 files changed, 53 insertions, 6 deletions
@@ -12,7 +12,8 @@ class Gem::Commands::SpecificationCommand < Gem::Command
def initialize
super 'specification', 'Display gem specification (in yaml)',
- :domain => :local, :version => Gem::Requirement.default
add_version_option('examine')
add_platform_option
@@ -22,26 +23,62 @@ class Gem::Commands::SpecificationCommand < Gem::Command
options[:all] = true
end
add_local_remote_options
end
def arguments # :nodoc:
- "GEMFILE name of gem to show the gemspec for"
end
def defaults_str # :nodoc:
- "--local --version '#{Gem::Requirement.default}'"
end
def usage # :nodoc:
- "#{program_name} [GEMFILE]"
end
def execute
specs = []
- gem = get_one_gem_name
dep = Gem::Dependency.new gem, options[:version]
if local? then
if File.exist? gem then
specs << Gem::Format.from_file_by_path(gem).spec rescue nil
@@ -63,7 +100,17 @@ class Gem::Commands::SpecificationCommand < Gem::Command
terminate_interaction 1
end
- output = lambda { |s| say s.to_yaml; say "\n" }
if options[:all] then
specs.each(&output)