File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,6 +39,15 @@ def self.load_spec(gemspec)
3939 gem_mod . const_set ( :Specification , spec_cls )
4040
4141 gem_mod . define_singleton_method ( :win_platform? , &Jim ::Platform . method ( :windows? ) )
42+
43+ # Add `Gem::Platform::RUBY`, and raise an exception for all other platforms.
44+ gem_mod . const_set ( :Platform , Class . new { |c |
45+ c . const_set ( :UnsupportedPlatformError , Class . new ( StandardError ) )
46+ c . const_set ( :RUBY , "ruby" )
47+ c . define_method ( :const_missing ) { |name |
48+ c . const_get ( :UnsupportedPlatformError ) . new ( "Unsupported platform: #{ name } " )
49+ }
50+ } )
4251 } )
4352 # Summon an eldritch being, hoping that `wrap=self` contains some of
4453 # the impending disaster.
Original file line number Diff line number Diff line change @@ -34,9 +34,9 @@ def check(val)
3434 val
3535 end
3636
37- def initialize ( ary )
37+ def initialize ( ary = nil )
3838 super ( )
39- ary . each { |v | self . push ( v ) }
39+ ary . each { |v | self . push ( v ) } unless ary . nil?
4040 end
4141 def []=( key , val ) ; super ( key , check ( val ) ) ; end
4242
Original file line number Diff line number Diff line change @@ -76,15 +76,20 @@ def self.array_of_strings_accessor(name)
7676 array_accessor :executables
7777 array_accessor :require_paths
7878 string_accessor :required_ruby_version
79+ string_accessor :required_rubygems_version
7980 string_accessor :version
8081 array_of_strings_accessor :extra_rdoc_files
8182 array_of_strings_accessor :rdoc_options
83+ string_accessor :platform
84+ string_accessor :require_path
8285
8386 def initialize ( &block )
8487 @specification_version = 4
8588 @metadata = HashOfStringToString . new
8689 @runtime_dependencies = HashOfStringToAOS . new
8790 @dev_dependencies = HashOfStringToAOS . new
91+ @extra_rdoc_files = ArrayOfStrings . new
92+ @rdoc_options = ArrayOfStrings . new
8893
8994 yield self
9095 self . class . class_variable_get ( :@@extract_spec_fn ) . call ( self )
@@ -119,6 +124,7 @@ def to_h
119124 @@accessors . map { |k , v |
120125 value = instance_variable_get ( :"@#{ k } " )
121126 value = value . to_h if value . is_a? ( Hash )
127+ value = value . to_a if value . is_a? ( Array )
122128
123129 if [ :required_ruby_version , :required_rubygems_version ] . include? ( k ) && value . is_a? ( String )
124130 operator , version = value . strip . split ( ' ' , 2 ) . map ( &:strip )
You can’t perform that action at this time.
0 commit comments