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,96 +0,0 @@
1
- module Roll
2
-
3
- #
4
- class Locals
5
-
6
- include Enumerable
7
-
8
- #
9
- DIR = XDG.config_home, 'roll', 'locals'
10
-
11
- #
12
- #def self.save(name)
13
- # File.open(file, 'w'){ |f| f << "#{name}" }
14
- #end
15
-
16
- # List of available environments.
17
- def self.list
18
- Dir[File.join(DIR, '*')].map do |file|
19
- File.basename(file)
20
- end
21
- end
22
-
23
- #
24
- def initialize(name=nil)
25
- @name = name || self.class.current
26
- reload
27
- end
28
-
29
- #
30
- def name
31
- @name
32
- end
33
-
34
- #
35
- def file
36
- @file ||= File.join(DIR, name)
37
- end
38
-
39
- #
40
- def reload
41
- t = []
42
- if File.exist?(file)
43
- lines = File.readlines(file)
44
- lines.each do |line|
45
- line = line.strip
46
- path, depth = *line.split(/\s+/)
47
- next if line =~ /^\s*$/ # blank
48
- next if line =~ /^\#/ # comment
49
- dir, depth = *line.split(/\s+/)
50
- t << [path, (depth || 3).to_i]
51
- end
52
- else
53
- t = []
54
- end
55
- @table = t
56
- end
57
-
58
- #
59
- def each(&block)
60
- @table.each(&block)
61
- end
62
-
63
- #
64
- def size
65
- @table.size
66
- end
67
-
68
- #
69
- def append(path, depth=3)
70
- path = File.expand_path(path)
71
- depth = (depth || 3).to_i
72
- @table = @table.reject{ |(p, d)| path == p }
73
- @table.push([path, depth])
74
- end
75
-
76
- #
77
- def delete(path)
78
- @table.reject!{ |p,d| path == p }
79
- end
80
-
81
- #
82
- def save
83
- out = @table.map do |(path, depth)|
84
- "#{path} #{depth}"
85
- end
86
- dir = File.dirname(file)
87
- FileUtils.mkdir_p(dir) unless File.exist?(dir)
88
- File.open(file, 'w') do |f|
89
- f << out.join("\n")
90
- end
91
- end
92
-
93
- end
94
-
95
- end
96
-
@@ -1 +0,0 @@
1
- false
@@ -1 +0,0 @@
1
- Thomas Sawyer
@@ -1 +0,0 @@
1
- http://groups.google.com/group/proutils
@@ -1 +0,0 @@
1
- 2006-12-10
@@ -1,5 +0,0 @@
1
- Roll is a library manager for Ruby. Code repositories
2
- can be made visible to Ruby just by setting an
3
- environment variable. Rolls effectively trivializes
4
- Ruby package management.
5
-
@@ -1 +0,0 @@
1
- http://proutils.github.com/roll
@@ -1 +0,0 @@
1
- 7rans <transfire@gmail.com>
data/meta/name DELETED
@@ -1 +0,0 @@
1
- roll
@@ -1 +0,0 @@
1
- git://github.com/proutils/roll.git
data/meta/ruby DELETED
@@ -1,2 +0,0 @@
1
- - 1.8.6
2
- - 1.8.7
data/meta/suite DELETED
@@ -1 +0,0 @@
1
- proutils
@@ -1 +0,0 @@
1
- Ruby Object-Oriented Library Ledger
@@ -1 +0,0 @@
1
- 1.1.0
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # Run unit tests
4
-
5
- live = ARGV.delete('--live')
6
-
7
- unless live
8
- $LOAD_PATH.unshift(File.expand_path('lib'))
9
- end
10
-
11
- if find = ARGV[0]
12
- unless File.file?(find)
13
- find = File.join(find, '**', 'test_*.rb')
14
- end
15
- else
16
- find = 'test/**/test_*.rb'
17
- end
18
-
19
- Dir.glob(find).each do |file|
20
- next if File.directory?(file)
21
- load file
22
- end
23
-
@@ -1,11 +0,0 @@
1
-
2
- time_roll_init = `export RUBYOPT=""; ruby -e't=Time.now; require "roll"; puts Time.now - t'`.strip
3
- time_roll_reqs = `export RUBYOPT=""; ruby -e'require "roll"; t=Time.now; require "facets"; puts Time.now - t'`.strip
4
-
5
- time_gems_init = `export RUBYOPT=""; ruby -e't=Time.now; require "rubygems"; puts Time.now - t'`.strip
6
- time_gems_reqs = `export RUBYOPT=""; ruby -e'require "rubygems"; t=Time.now; require "facets"; puts Time.now - t'`.strip
7
-
8
- puts " %20s %20s" % [ 'Roll', 'Gems' ]
9
- puts "Init: %20s %20s" % [ time_roll_init, time_gems_init ]
10
- puts "Reqs: %20s %20s" % [ time_roll_reqs, time_gems_reqs ]
11
-
@@ -1,17 +0,0 @@
1
- require 'benchmark'
2
-
3
- puts "Ruby Roll"
4
-
5
- Benchmark.bmbm do |x|
6
- x.report("Reqiure Roll: ") { system "ruby -roll -e'nil'" }
7
- x.report("Require Facets via Roll: ") { system %[export RUBYOPT=""; ruby -roll -e'require "facets"'] }
8
- end
9
-
10
- puts; puts
11
- puts "RubyGems"
12
-
13
- Benchmark.bmbm do |x|
14
- x.report("Require Gems: ") { system "ruby -rubygems -e'nil'" }
15
- x.report("Require Facets via Gems: ") { system %[export RUBYOPT=""; ruby -rubygems -e'require "facets"'] }
16
- end
17
-
@@ -1,33 +0,0 @@
1
- = Library Instances
2
-
3
- To demonstrate the Library instance, we first need to load the Library library ;)
4
-
5
- require 'roll/library'
6
-
7
- A Library class can be initialized given the location of the "project".
8
-
9
- tryme10 = Roll::Library.new('../fixtures/tryme/1.0')
10
- tryme11 = Roll::Library.new('../fixtures/tryme/1.1')
11
-
12
- With a library instance in hand we can query it for primary information, or
13
- metadata, about itself.
14
-
15
- tryme10.name.assert == "tryme"
16
- tryme11.name.assert == "tryme"
17
-
18
- tryme10.version.to_s.assert == "1.0"
19
- tryme11.version.to_s.assert == "1.1"
20
-
21
- Secondary and arbitrary information can be queried vie the #metadata method.
22
-
23
- tryme10.metadata.homepage.assert == "http://proutils.github.com/roll/"
24
- tryme11.metadata.homepage.assert == "http://proutils.github.com/roll/"
25
-
26
- Of course, the most important function of a library is to load/require a file.
27
-
28
- tryme10.load('tryme.rb')
29
- $message.assert == "Try Me v1.0"
30
-
31
- tryme11.load('tryme.rb')
32
- $message.assert == "Try Me v1.1"
33
-
@@ -1,56 +0,0 @@
1
- = Version Class
2
-
3
- Load the library.
4
-
5
- require 'roll/version'
6
-
7
- Test #to_s:
8
-
9
- v = Roll::Version.new('1.2.3')
10
- '1.2.3'.assert == v.to_s
11
-
12
- Test #to_str:
13
-
14
- v = Roll::Version.new('1.2.3')
15
- '1.2.3'.assert == v.to_str
16
-
17
- Test #[]:
18
-
19
- v = Roll::Version.new('1.2.3')
20
- 1.assert == v[0]
21
- 2.assert == v[1]
22
- 3.assert == v[2]
23
-
24
- Test #<=>:
25
-
26
- v1 = Roll::Version.new('1.2.3')
27
- v2 = Roll::Version.new('1.2.4')
28
- 1.assert == (v2 <=> v1)
29
-
30
- Test #=~ (pessimistic constraint):
31
-
32
- v1 = Roll::Version.new('1.2.4')
33
- v2 = Roll::Version.new('1.2')
34
- assert(v1 =~ v2)
35
-
36
- Test #major:
37
-
38
- v = Roll::Version.new('1.2.3')
39
- 1.assert == v.major
40
-
41
- Test #minor:
42
-
43
- v = Roll::Version.new('1.2.3')
44
- 2.assert == v.minor
45
-
46
- Test #teeny:
47
-
48
- v = Roll::Version.new('1.2.3')
49
- 3.assert == v.teeny
50
-
51
- Test #parse_constraint:
52
-
53
- a = Roll::Version.parse_constraint("~> 1.0.0")
54
- e = [ "=~", Roll::Version['1.0.0'] ]
55
- e.assert == a
56
-
@@ -1 +0,0 @@
1
- tryme
@@ -1,12 +0,0 @@
1
- require 'roll/library'
2
-
3
- p Library.list
4
-
5
-
6
- foolib = Library.open('foo')
7
-
8
- p foolib
9
-
10
- foolib.require 'tryme'
11
- foolib.require 'trymetoo'
12
-
@@ -1 +0,0 @@
1
- $message = "Try Me v1.0"
@@ -1 +0,0 @@
1
- http://proutils.github.com/roll/
@@ -1 +0,0 @@
1
- tryme
@@ -1 +0,0 @@
1
- $message = "Try Me v1.1"
@@ -1 +0,0 @@
1
- http://proutils.github.com/roll/
@@ -1 +0,0 @@
1
- tryme
@@ -1,71 +0,0 @@
1
- require 'roll/version'
2
- require 'test/unit'
3
-
4
- class TestVersion < Test::Unit::TestCase
5
-
6
- #def initialize(*args)
7
- # args = args.join('.').split(/\W+/)
8
- # @self = args.collect { |i| i.to_i }
9
- #end
10
-
11
- def test_to_s
12
- v = Roll::Version.new('1.2.3')
13
- assert_equal('1.2.3', v.to_s)
14
- end
15
-
16
- def test_to_str
17
- v = Roll::Version.new('1.2.3')
18
- assert_equal('1.2.3', v.to_str)
19
- end
20
-
21
- #def test_inspect
22
- # v = Roll::Version.new('1.2.3')
23
- # assert_equal('1.2.3', v.inspect)
24
- #end
25
-
26
- def test_op_fetch
27
- v = Roll::Version.new('1.2.3')
28
- assert_equal(1, v[0])
29
- assert_equal(2, v[1])
30
- assert_equal(3, v[2])
31
- end
32
-
33
- def test_spaceship
34
- v1 = Roll::Version.new('1.2.3')
35
- v2 = Roll::Version.new('1.2.4')
36
- assert_equal(1, v2 <=> v1)
37
- end
38
-
39
- # def =~( other )
40
- # #other = other.to_t
41
- # upver = other.dup
42
- # upver[0] += 1
43
- # @self >= other and @self < upver
44
- # end
45
-
46
- def test_pessimistic
47
- v1 = Roll::Version.new('1.2.4')
48
- v2 = Roll::Version.new('1.2')
49
- assert_equal(true, v1 =~ v2)
50
- end
51
-
52
- def test_major
53
- v = Roll::Version.new('1.2.3')
54
- assert_equal(1, v.major)
55
- end
56
-
57
- def test_minor
58
- v = Roll::Version.new('1.2.3')
59
- assert_equal(2, v.minor)
60
- end
61
-
62
- def test_teeny
63
- v = Roll::Version.new('1.2.3')
64
- assert_equal(3, v.teeny)
65
- end
66
-
67
- def test_parse_constraint
68
- assert_equal(["=~", Roll::Version['1.0.0']], Roll::Version.parse_constraint("~> 1.0.0"))
69
- end
70
-
71
- end