libgems 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/libgems.rb +30 -5
  2. data/lib/libgems/requirement.rb +7 -36
  3. metadata +3 -3
@@ -95,11 +95,38 @@ require 'thread'
95
95
  #
96
96
  # -The SlimGems Team
97
97
 
98
+
99
+
100
+ # Hack to handle syck's DefaultKey bug with psych
101
+ #
102
+ # Quick note! If/when psych loads in 1.9, it will redefine
103
+ # YAML to point to Psych by removing the YAML constant.
104
+ # Thusly, over in LibGems.load_yaml, we define DefaultKey again
105
+ # after proper yaml library has been loaded.
106
+ #
107
+ # All this is so that there is always a YAML::Syck::DefaultKey
108
+ # class no matter if the full yaml library has loaded or not.
109
+ #
110
+ unless defined?(Syck)
111
+ module Syck
112
+ end
113
+ end
114
+
115
+ unless defined?(Syck::DefaultKey)
116
+ class Syck::DefaultKey
117
+ end
118
+ end
119
+
120
+ if defined?(YAML) && !defined?(YAML::Syck)
121
+ YAML::Syck = Syck
122
+ end
123
+
124
+
98
125
  module LibGems
99
126
  NAME = 'LibGems'
100
127
  GEM_NAME = 'libgems'
101
128
  VERSION = '1.3.9.2'
102
- LIBGEMS_VERSION = '0.1.2'
129
+ LIBGEMS_VERSION = '0.1.3'
103
130
 
104
131
  ##
105
132
  # Raised when SlimGems is unable to load or activate a gem. Contains the
@@ -681,10 +708,8 @@ module LibGems
681
708
  # why we end up defining DefaultKey more than once.
682
709
  if !defined? YAML::Syck
683
710
  YAML.module_eval do
684
- const_set 'Syck', Module.new {
685
- const_set 'DefaultKey', Class.new
686
- }
687
- end
711
+ const_set 'Syck', Syck
712
+ end
688
713
  end
689
714
  end
690
715
 
@@ -1,24 +1,5 @@
1
1
  require "libgems/version"
2
2
 
3
- # Hack to handle syck's DefaultKey bug with psych
4
- #
5
- # Quick note! If/when psych loads in 1.9, it will redefine
6
- # YAML to point to Psych by removing the YAML constant.
7
- # Thusly, over in LibGems.load_yaml, we define DefaultKey again
8
- # after proper yaml library has been loaded.
9
- #
10
- # All this is so that there is always a YAML::Syck::DefaultKey
11
- # class no matter if the full yaml library has loaded or not.
12
- #
13
- module YAML
14
- if !defined? Syck
15
- module Syck
16
- class DefaultKey
17
- end
18
- end
19
- end
20
- end
21
-
22
3
  ##
23
4
  # A Requirement is a set of one or more version restrictions. It supports a
24
5
  # few (<tt>=, !=, >, <, >=, <=, ~></tt>) different restriction operators.
@@ -94,6 +75,12 @@ class LibGems::Requirement
94
75
  [$1 || "=", LibGems::Version.new($2)]
95
76
  end
96
77
 
78
+ ##
79
+ # An array of requirement pairs. The first element of the pair is
80
+ # the op, and the second is the LibGems::Version.
81
+
82
+ attr_reader :requirements #:nodoc:
83
+
97
84
  ##
98
85
  # Constructs a requirement from +requirements+. Requirements can be
99
86
  # Strings, LibGems::Versions, or Arrays of those. +nil+ and duplicate
@@ -114,22 +101,6 @@ class LibGems::Requirement
114
101
  # An array of requirement pairs. The first element of the pair is
115
102
  # the op, and the second is the LibGems::Version.
116
103
 
117
- def requirements
118
- # This is an ugly hack to work around issues with Syck.
119
- # There are fixes in other places but since we sometimes
120
- # load from YAML, which bypasses any initialization and
121
- # other callbacks, this seems the most reliable place to
122
- # fix things.
123
- if !defined?(YAML::ENGINE) || YAML::ENGINE.syck?
124
- @requirements.each do |r|
125
- if r[0].kind_of?(Syck::DefaultKey)
126
- r[0] = '='
127
- end
128
- end
129
- end
130
- @requirements
131
- end
132
-
133
104
  def none?
134
105
  @none ||= (to_s == ">= 0")
135
106
  end
@@ -151,7 +122,7 @@ class LibGems::Requirement
151
122
 
152
123
  # Fixup the Syck DefaultKey bug
153
124
  @requirements.each do |r|
154
- if r[0].kind_of? YAML::Syck::DefaultKey
125
+ if r[0].kind_of?(Syck::DefaultKey) || r[0].kind_of?(YAML::Syck::DefaultKey)
155
126
  r[0] = "="
156
127
  end
157
128
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libgems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2011-08-15 00:00:00.000000000Z
16
+ date: 2011-09-05 00:00:00.000000000Z
17
17
  dependencies: []
18
18
  description: LibGems is essentially a clone of RubyGems but with a unique namespace
19
19
  to run side-by-side with it.
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  version: '0'
217
217
  requirements: []
218
218
  rubyforge_project:
219
- rubygems_version: 1.8.5
219
+ rubygems_version: 1.8.6
220
220
  signing_key:
221
221
  specification_version: 3
222
222
  summary: LibGems is a package management framework for Ruby