roll 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/HISTORY +28 -4
  2. data/PACKAGE +6 -0
  3. data/PROFILE +22 -0
  4. data/README.rdoc +66 -59
  5. data/bin/roll +7 -1
  6. data/lib/oll.rb +1 -1
  7. data/lib/roll.rb +30 -9
  8. data/lib/roll/command.rb +40 -177
  9. data/lib/roll/commands/env.rb +24 -0
  10. data/lib/roll/commands/help.rb +30 -0
  11. data/lib/roll/commands/in.rb +26 -0
  12. data/lib/roll/commands/index.rb +20 -0
  13. data/lib/roll/commands/list.rb +33 -0
  14. data/lib/roll/commands/out.rb +22 -0
  15. data/lib/roll/commands/path.rb +50 -0
  16. data/lib/roll/commands/sync.rb +29 -0
  17. data/lib/roll/commands/use.rb +25 -0
  18. data/lib/roll/commands/verify.rb +22 -0
  19. data/lib/roll/config.rb +8 -3
  20. data/lib/roll/environment.rb +84 -42
  21. data/lib/roll/kernel.rb +9 -2
  22. data/lib/roll/library.rb +360 -21
  23. data/lib/roll/metadata.rb +282 -51
  24. data/lib/roll/original.rb +3 -3
  25. data/lib/roll/version.rb +6 -7
  26. data/script/setup +14 -18
  27. data/script/setup.old +1344 -0
  28. data/test/{unitcases/version_case.rb → version_case.rb} +1 -1
  29. metadata +30 -47
  30. data/TODO +0 -4
  31. data/lib/roll/errors.rb +0 -13
  32. data/lib/roll/ledger.rb +0 -299
  33. data/lib/roll/locals.rb +0 -96
  34. data/meta/active +0 -1
  35. data/meta/authors +0 -1
  36. data/meta/contact +0 -1
  37. data/meta/created +0 -1
  38. data/meta/description +0 -5
  39. data/meta/homepage +0 -1
  40. data/meta/maintainer +0 -1
  41. data/meta/name +0 -1
  42. data/meta/repository +0 -1
  43. data/meta/ruby +0 -2
  44. data/meta/suite +0 -1
  45. data/meta/summary +0 -1
  46. data/meta/version +0 -1
  47. data/script/test +0 -23
  48. data/test/benchmarks/vsgems.rb +0 -11
  49. data/test/benchmarks/vsgems_bm.rb +0 -17
  50. data/test/demonstrations/01_library.rdoc +0 -33
  51. data/test/demonstrations/04_version.rdoc +0 -56
  52. data/test/fixtures/env.list +0 -1
  53. data/test/fixtures/inspect.rb +0 -12
  54. data/test/fixtures/tryme/1.0/lib/tryme.rb +0 -1
  55. data/test/fixtures/tryme/1.0/meta/homepage +0 -1
  56. data/test/fixtures/tryme/1.0/meta/name +0 -1
  57. data/test/fixtures/tryme/1.0/meta/version +0 -1
  58. data/test/fixtures/tryme/1.1/lib/tryme.rb +0 -1
  59. data/test/fixtures/tryme/1.1/meta/homepage +0 -1
  60. data/test/fixtures/tryme/1.1/meta/name +0 -1
  61. data/test/fixtures/tryme/1.1/meta/version +0 -1
  62. data/test/unit/version_test.rb +0 -71
@@ -1,4 +1,4 @@
1
- require 'roll/version'
1
+ Covers 'roll/version'
2
2
 
3
3
  Case Roll::Version do
4
4
 
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roll
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 31
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
- - 1
8
+ - 2
8
9
  - 0
9
- version: 1.1.0
10
+ version: 1.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Thomas Sawyer
@@ -14,70 +15,46 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-06 00:00:00 -04:00
18
+ date: 2010-06-15 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies: []
20
21
 
21
- description: |-
22
- Roll is a library manager for Ruby. Code repositories
23
- can be made visible to Ruby just by setting an
24
- environment variable. Rolls effectively trivializes
25
- Ruby package management.
22
+ description: Roll is a library manager for Ruby. Code repositories can be made visible to Ruby just by setting an environment variable. Rolls effectively trivializes Ruby package management.
26
23
  email: transfire@gmail.com
27
24
  executables:
28
25
  - roll
29
26
  extensions: []
30
27
 
31
- extra_rdoc_files: []
32
-
28
+ extra_rdoc_files:
29
+ - README.rdoc
33
30
  files:
34
31
  - bin/roll
35
32
  - lib/oll.rb
36
33
  - lib/roll/command.rb
34
+ - lib/roll/commands/env.rb
35
+ - lib/roll/commands/help.rb
36
+ - lib/roll/commands/in.rb
37
+ - lib/roll/commands/index.rb
38
+ - lib/roll/commands/list.rb
39
+ - lib/roll/commands/out.rb
40
+ - lib/roll/commands/path.rb
41
+ - lib/roll/commands/sync.rb
42
+ - lib/roll/commands/use.rb
43
+ - lib/roll/commands/verify.rb
37
44
  - lib/roll/config.rb
38
45
  - lib/roll/environment.rb
39
- - lib/roll/errors.rb
40
46
  - lib/roll/kernel.rb
41
- - lib/roll/ledger.rb
42
47
  - lib/roll/library.rb
43
- - lib/roll/locals.rb
44
48
  - lib/roll/metadata.rb
45
49
  - lib/roll/original.rb
46
50
  - lib/roll/version.rb
47
51
  - lib/roll.rb
48
- - meta/active
49
- - meta/authors
50
- - meta/contact
51
- - meta/created
52
- - meta/description
53
- - meta/homepage
54
- - meta/maintainer
55
- - meta/name
56
- - meta/repository
57
- - meta/ruby
58
- - meta/suite
59
- - meta/summary
60
- - meta/version
61
52
  - script/rdoc
62
53
  - script/setup
63
- - script/test
64
- - test/benchmarks/vsgems.rb
65
- - test/benchmarks/vsgems_bm.rb
66
- - test/demonstrations/01_library.rdoc
67
- - test/demonstrations/04_version.rdoc
68
- - test/fixtures/env.list
69
- - test/fixtures/inspect.rb
70
- - test/fixtures/tryme/1.0/lib/tryme.rb
71
- - test/fixtures/tryme/1.0/meta/homepage
72
- - test/fixtures/tryme/1.0/meta/name
73
- - test/fixtures/tryme/1.0/meta/version
74
- - test/fixtures/tryme/1.1/lib/tryme.rb
75
- - test/fixtures/tryme/1.1/meta/homepage
76
- - test/fixtures/tryme/1.1/meta/name
77
- - test/fixtures/tryme/1.1/meta/version
78
- - test/unit/version_test.rb
79
- - test/unitcases/version_case.rb
80
- - TODO
54
+ - script/setup.old
55
+ - test/version_case.rb
56
+ - PROFILE
57
+ - PACKAGE
81
58
  - README.rdoc
82
59
  - HISTORY
83
60
  - COPYING
@@ -89,28 +66,34 @@ post_install_message:
89
66
  rdoc_options:
90
67
  - --title
91
68
  - Roll API
69
+ - --main
70
+ - README.rdoc
92
71
  require_paths:
93
72
  - lib
94
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
+ none: false
95
75
  requirements:
96
76
  - - ">="
97
77
  - !ruby/object:Gem::Version
78
+ hash: 3
98
79
  segments:
99
80
  - 0
100
81
  version: "0"
101
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
102
84
  requirements:
103
85
  - - ">="
104
86
  - !ruby/object:Gem::Version
87
+ hash: 3
105
88
  segments:
106
89
  - 0
107
90
  version: "0"
108
91
  requirements: []
109
92
 
110
93
  rubyforge_project: roll
111
- rubygems_version: 1.3.6
94
+ rubygems_version: 1.3.7
112
95
  signing_key:
113
96
  specification_version: 3
114
97
  summary: Ruby Object-Oriented Library Ledger
115
- test_files:
116
- - test/unit/version_test.rb
98
+ test_files: []
99
+
data/TODO DELETED
@@ -1,4 +0,0 @@
1
- = TODO List
2
-
3
- * Is there a way to directly support plugins?
4
-
@@ -1,13 +0,0 @@
1
- module Roll
2
-
3
- # VersionError is raised when a requested version cannot be found.
4
- class VersionError < ::RangeError # :nodoc:
5
- end
6
-
7
- # VersionConflict is raised when selecting another version
8
- # of a library when a previous version has already been selected.
9
- class VersionConflict < ::LoadError # :nodoc:
10
- end
11
-
12
- end
13
-
@@ -1,299 +0,0 @@
1
- module Roll
2
- require 'roll/original'
3
- require 'roll/environment'
4
- require 'roll/library'
5
-
6
- # = Ledger class
7
- #
8
- class Ledger
9
-
10
- include Enumerable
11
-
12
- #
13
- def initialize
14
- @index = Hash.new{|h,k| h[k] = []}
15
-
16
- @environment = Environment.new
17
-
18
- @environment.each do |name, paths|
19
- paths.each do |path|
20
- unless File.directory?(path)
21
- warn "roll: invalid path for #{name} -- #{path}"
22
- next
23
- end
24
- lib = Library.new(path, name)
25
- @index[name] << lib if lib.active?
26
- end
27
- end
28
-
29
- @load_stack = []
30
- @load_monitor = Hash.new{ |h,k| h[k]=[] }
31
- end
32
-
33
- #
34
- def enironment
35
- @environment
36
- end
37
-
38
- #
39
- def [](name)
40
- @index[name]
41
- end
42
-
43
- #
44
- def []=(name, value)
45
- @index[name] = value
46
- end
47
-
48
- #
49
- def include?(name)
50
- @index.include?(name)
51
- end
52
-
53
- #
54
- def names
55
- @index.keys
56
- end
57
-
58
- #
59
- def each(&block)
60
- @index.each(&block)
61
- end
62
-
63
- #
64
- def size
65
- @index.size
66
- end
67
-
68
- #
69
- def load_stack
70
- @load_stack
71
- end
72
-
73
- # NOTE: Not used yet.
74
- def load_monitor
75
- @load_monitor
76
- end
77
-
78
- #--
79
- # TODO: Should Ruby's underlying require be tried first,
80
- # then fallback to Rolls. Or vice-versa?
81
- #++
82
-
83
- #
84
- def require(path)
85
- #begin
86
- # original_require(path)
87
- #rescue LoadError => load_error
88
- # lib, file = *match(path)
89
- # if lib && file
90
- # constrain(lib)
91
- # lib.require_absolute(file)
92
- # else
93
- # raise clean_backtrace(load_error)
94
- # end
95
- #end
96
- lib, file = *match(path)
97
- if lib && file
98
- constrain(lib)
99
- lib.require_absolute(file)
100
- else
101
- begin
102
- original_require(path)
103
- rescue LoadError => load_error
104
- raise clean_backtrace(load_error)
105
- end
106
- end
107
-
108
- end
109
-
110
- #
111
- def load(path, wrap=nil)
112
- lib, file = *match(path, false)
113
- if lib && file
114
- constrain(lib)
115
- lib.load_absolute(file, wrap)
116
- else
117
- begin
118
- original_load(path, wrap)
119
- rescue LoadError => load_error
120
- raise clean_backtrace(load_error)
121
- end
122
- end
123
- end
124
-
125
- # Use acquire to use Roll-style loading. This first
126
- # looks for a specific library via ':'. If ':' is
127
- # not present it then tries the current library.
128
- # Failing that it fallsback to Ruby itself.
129
- #
130
- # acquire('facets:string/margin')
131
- #
132
- # To "load" the library, rather than "require" it set
133
- # the +:load+ option to true.
134
- #
135
- # acquire('facets:string/margin', :load=>true)
136
- #
137
- def acquire(file, opts={})
138
- if file.index(':') # a specific library
139
- name, file = file.split(':')
140
- lib = Library.open(name)
141
- else # try the current library
142
- cur = load_stack.last
143
- if cur && cur.include?(file)
144
- lib = cur
145
- elsif !file.index('/') # is this a library name?
146
- if cur = Library.instance(file)
147
- lib = cur
148
- file = lib.default # default file to load
149
- end
150
- end
151
- end
152
- if opts[:load]
153
- lib ? lib.load(file) : original_load(file)
154
- else
155
- lib ? lib.require(file) : original_require(file)
156
- end
157
- end
158
-
159
- #
160
- def constrain(lib)
161
- cmp = self[lib.name]
162
- if Array === cmp
163
- self[lib.name] = lib
164
- else
165
- if lib.version != cmp.version
166
- raise VersionError
167
- end
168
- end
169
- end
170
-
171
- private
172
-
173
- # Find require matches.
174
- def match(path, suffix=true)
175
- path = path.to_s
176
-
177
- return nil if /^\// =~ path # absolute path
178
-
179
- if path.index(':') # a specified library
180
- name, path = path.split(':')
181
- lib = Library.open(name)
182
- if lib.active?
183
- file = lib.find(path, suffix)
184
- return lib, file
185
- end
186
- end
187
-
188
- matches = []
189
-
190
- # try the load stack first
191
- load_stack.reverse_each do |lib|
192
- if file = lib.find(path, suffix)
193
- return [lib, file] unless $VERBOSE
194
- matches << [lib, file]
195
- end
196
- end
197
-
198
- # TODO: Perhaps the selected and unselected should be kept in separate lists?
199
- unselected, selected = *@index.partition{ |name, libs| Array === libs }
200
-
201
- selected.each do |(name, lib)|
202
- if file = lib.find(path, suffix)
203
- #matches << [lib, file]
204
- #return matches.first unless $VERBOSE
205
- return [lib, file] unless $VERBOSE
206
- matches << [lib, file]
207
- end
208
- end
209
-
210
- unselected.each do |(name, libs)|
211
- pos = []
212
- libs.each do |lib|
213
- if file = lib.find(path, suffix)
214
- pos << [lib, file]
215
- end
216
- end
217
- unless pos.empty?
218
- latest = pos.sort{ |a,b| b[0].version <=> a[0].version }.first
219
- return latest unless $VERBOSE
220
- matches << latest
221
- #return matches.first unless $VERBOSE
222
- end
223
- end
224
-
225
- matches.uniq!
226
-
227
- if matches.size > 1
228
- warn_multiples(path, matches)
229
- end
230
-
231
- matches.first
232
- end
233
-
234
- #
235
- def warn_multiples(path, matches)
236
- warn "multiple matches for same request -- #{path}"
237
- matches.each do |lib, file|
238
- warn " #{file}"
239
- end
240
- end
241
-
242
- #
243
- def clean_backtrace(error)
244
- if $DEBUG
245
- error
246
- else
247
- bt = error.backtrace
248
- bt = bt.reject{ |e| /roll/ =~ e }
249
- error.set_backtrace(bt)
250
- error
251
- end
252
- end
253
-
254
- end#class Ledger
255
-
256
- #--
257
- # Ledger augments the Library metaclass.
258
- #++
259
- class << Library
260
-
261
- #
262
- def ledger
263
- @ledger ||= Ledger.new
264
- end
265
-
266
- # Current environment
267
- def environment
268
- ledger.environment
269
- end
270
-
271
- # List of library names.
272
- def list
273
- ledger.names
274
- end
275
-
276
- #
277
- def require(path)
278
- ledger.require(path)
279
- end
280
-
281
- #
282
- def load(path, wrap=nil)
283
- ledger.load(path, wrap)
284
- end
285
-
286
- #
287
- def load_stack
288
- ledger.load_stack
289
- end
290
-
291
- # NOTE: Not used yet.
292
- def load_monitor
293
- ledger.load_monitor
294
- end
295
-
296
- end
297
-
298
- end#module Roll
299
-