diff options
-rw-r--r-- | lib/rubygems/specification.rb | 83 |
1 files changed, 64 insertions, 19 deletions
@@ -339,7 +339,8 @@ class Gem::Specification # List of dependencies that will automatically be activated at runtime. def runtime_dependencies - dependencies.select { |d| d.type == :runtime || d.type == nil } end ## @@ -542,8 +543,8 @@ class Gem::Specification def self.normalize_yaml_input(input) result = input.respond_to?(:read) ? input.read : input - result = "--- " + result unless result =~ /^--- / - result end ## @@ -685,6 +686,14 @@ class Gem::Specification alias eql? == # :nodoc: ## # True if this gem has the same attributes as +other+. def same_attributes?(other) @@ -726,11 +735,13 @@ class Gem::Specification end def to_yaml(opts = {}) # :nodoc: - return super if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck? - - YAML.quick_emit object_id, opts do |out| - out.map taguri, to_yaml_style do |map| - encode_with map end end end @@ -795,21 +806,17 @@ class Gem::Specification result << " if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then" - unless dependencies.empty? then - dependencies.each do |dep| - version_reqs_param = dep.requirements_list.inspect - dep.instance_variable_set :@type, :runtime if dep.type.nil? # HACK - result << " s.add_#{dep.type}_dependency(%q<#{dep.name}>, #{version_reqs_param})" - end end result << " else" - unless dependencies.empty? then - dependencies.each do |dep| - version_reqs_param = dep.requirements_list.inspect - result << " s.add_dependency(%q<#{dep.name}>, #{version_reqs_param})" - end end result << ' end' @@ -827,6 +834,15 @@ class Gem::Specification result.join "\n" end ## # Checks that the specification contains all required fields, and does a # very basic sanity check. @@ -835,6 +851,7 @@ class Gem::Specification # checks.. def validate extend Gem::UserInteraction normalize @@ -1523,4 +1540,32 @@ class Gem::Specification @extensions, ].flatten.uniq.compact end end |