roll 0.8.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/{LICENSE → COPYING} +1 -1
  2. data/HISTORY +62 -0
  3. data/README.rdoc +169 -0
  4. data/TODO +4 -0
  5. data/bin/roll +3 -44
  6. data/lib/oll.rb +1 -2
  7. data/lib/roll.rb +87 -0
  8. data/lib/roll/command.rb +207 -0
  9. data/lib/roll/config.rb +80 -0
  10. data/lib/roll/environment.rb +317 -0
  11. data/lib/roll/errors.rb +13 -0
  12. data/lib/roll/kernel.rb +41 -0
  13. data/lib/roll/ledger.rb +299 -0
  14. data/lib/roll/library.rb +241 -558
  15. data/lib/roll/locals.rb +96 -0
  16. data/lib/roll/metadata.rb +112 -0
  17. data/lib/roll/original.rb +10 -0
  18. data/lib/roll/version.rb +91 -101
  19. data/meta/active +1 -0
  20. data/meta/authors +1 -0
  21. data/meta/contact +1 -0
  22. data/meta/created +1 -0
  23. data/meta/description +5 -0
  24. data/meta/homepage +1 -0
  25. data/meta/maintainer +1 -0
  26. data/meta/name +1 -0
  27. data/meta/repository +1 -0
  28. data/meta/ruby +2 -0
  29. data/meta/suite +1 -0
  30. data/meta/summary +1 -0
  31. data/meta/version +1 -0
  32. data/script/rdoc +4 -0
  33. data/script/setup +1344 -0
  34. data/script/test +23 -0
  35. data/test/benchmarks/vsgems.rb +11 -0
  36. data/test/benchmarks/vsgems_bm.rb +17 -0
  37. data/test/demonstrations/01_library.rdoc +33 -0
  38. data/test/demonstrations/04_version.rdoc +56 -0
  39. data/test/fixtures/env.list +1 -0
  40. data/{demo/sample → test/fixtures}/inspect.rb +0 -0
  41. data/test/fixtures/tryme/1.0/lib/tryme.rb +1 -0
  42. data/test/fixtures/tryme/1.0/meta/homepage +1 -0
  43. data/test/fixtures/tryme/1.0/meta/name +1 -0
  44. data/test/fixtures/tryme/1.0/meta/version +1 -0
  45. data/test/fixtures/tryme/1.1/lib/tryme.rb +1 -0
  46. data/test/fixtures/tryme/1.1/meta/homepage +1 -0
  47. data/test/fixtures/tryme/1.1/meta/name +1 -0
  48. data/test/fixtures/tryme/1.1/meta/version +1 -0
  49. data/test/{test_version.rb → unit/version_test.rb} +21 -21
  50. data/test/unitcases/version_case.rb +69 -0
  51. metadata +102 -65
  52. data/README +0 -17
  53. data/demo/bench/bench_load.rb +0 -7
  54. data/demo/sample/tryme/1.0/lib/tryme.rb +0 -1
  55. data/demo/sample/tryme/1.1/lib/tryme.rb +0 -1
  56. data/lib/roll/attributes.rb +0 -72
  57. data/lib/roll/package.rb +0 -300
  58. data/lib/roll/remote.rb +0 -37
  59. data/meta/ROLL-0.8.0.roll +0 -21
  60. data/task/rdoc +0 -9
  61. data/task/setup +0 -1616
  62. data/task/test +0 -5
  63. data/test/test_library.rb +0 -10
@@ -1,7 +1,7 @@
1
1
 
2
2
  ROLL
3
3
 
4
- Copyright (c) 2006, 2007 Psi T. Corporation
4
+ Copyright (c) 2006, 2007 Thomas Sawyer
5
5
 
6
6
 
7
7
  THE RUBY LICENSE
data/HISTORY ADDED
@@ -0,0 +1,62 @@
1
+ = RELEASE HISTORY
2
+
3
+ == 1.0.0 / 2010-02-11
4
+
5
+ Roll is finally ready for the masses. This release overhauls
6
+ the underlying system, which is now blazing fast, supports
7
+ customizable library environments, and banashes all traces
8
+ of package management to the domain of other tools.
9
+
10
+ Changes:
11
+
12
+ * Overhauled the entire underlying system.
13
+ * Start-up time is blazing fast, loading's is pretty good too.
14
+ * Metadata uses POM standard, although not dependent (yet?).
15
+ * Environments provide selectable sets of available libraries.
16
+
17
+
18
+ == 0.9.4 / 2008-06-05
19
+
20
+ The .roll file is no longer used. Instead Rolls is now
21
+ using a VERSION file combined with meta/ entries for
22
+ loadpath and dependencies (ie. requires).
23
+
24
+ Changes:
25
+
26
+ * VERSION and meta/ entries are used instead of '.roll'.
27
+
28
+
29
+ == 0.9.3 / 2007-02-10
30
+
31
+ Changes:
32
+
33
+ * Change roll file format and name. It is now .roll.
34
+ * Relative require with #use should now work.
35
+
36
+
37
+ == 0.9.2 / 2007-12-17
38
+
39
+ Changes:
40
+
41
+ * Changed roll file format from ROLLRC to {name}.roll.
42
+ * The name change enabled an order of magnitude increase in startup time!
43
+
44
+
45
+ == 0.9.1 / 2007-11-27
46
+
47
+ Changes:
48
+
49
+ * Standard metadate file is now ROLLRC.
50
+ * Improved parsing of ROLLRC file, #release is now a Time object.
51
+
52
+
53
+ == 0.9.0 / 2007-11-12
54
+
55
+ Changes:
56
+
57
+ * Removed Roll namespace. Library and VersionNumber are now in toplevel.
58
+ * Fixed spelling of 'version' in Library#<=>.
59
+ * Kernel#require and load now route to Library meta-methods.
60
+ * @roll and related methods have been renamed to @package.
61
+ * Reduced scan glob to single pattern. Scanning is over 3x faster!
62
+
@@ -0,0 +1,169 @@
1
+ = ROLLING WITH RUBY
2
+
3
+ ____
4
+ ,dP9CGG88@b,
5
+ ,IP""YICCG888@@b,
6
+ dIi ,IICGG8888@b
7
+ dCIIiciIICCGG8888@@b
8
+ ________GCCIIIICCCGGG8888@@@________________
9
+ GGCCCCCCCGGG88888@@@
10
+ GGGGCCCGGGG88888@@@@...
11
+ Y8GGGGGG8888888@@@@P.....
12
+ Y88888888888@@@@@P......
13
+ `Y8888888@@@@@@@P'......
14
+ `@@@@@@@@@P'.......
15
+ """"........
16
+
17
+ * home: http://proutils.github.com/roll
18
+
19
+
20
+ == DESCRIPTION
21
+
22
+ Roll is a library manager for Ruby. With Rolls developers can run there
23
+ programs in real time --no install phase is required for one program
24
+ to depend on another. This makes it very easy to work on a set of
25
+ interdependent projects.
26
+
27
+
28
+ == HOW TO USE
29
+
30
+ === Setting Up
31
+
32
+ To use roll regularly you first need to add it your RUBYOPT environment
33
+ variable.
34
+
35
+ $ export RUBYOPT="-roll"
36
+
37
+ I suspect you will be using RubyGems too, in which case do:
38
+
39
+ $ export RUBYOPT="-rubygems -roll"
40
+
41
+ To support executables you will also need to add a line to your startup
42
+ .bashrc (or equivalent) file.
43
+
44
+ export PATH="$PATH:$(roll path)"
45
+
46
+ This will add the +bin+ locations of the programs encompassed by your
47
+ current roll environment.
48
+
49
+ (NOTE: The way bin paths are handled will probably change in the future
50
+ b/c it has some shortcomings.)
51
+
52
+ === Preparing your Projects
53
+
54
+ For your projects to be detected by Rolls they must conform to a
55
+ minimal POM[http://proutils.github.com/pom] setup. In particular
56
+ the project must contain a +meta/+ directory with a +name+ and +version+
57
+ entry. That is the bare minimum for a project to to be loadable via
58
+ Rolls. Optionally you may provide a +loadpath+ entry if the load path
59
+ is not the +lib/+ default, as well as a +released+ date entry.
60
+
61
+ (NOTE: +meta/+ can be named +.meta/+ if you would prefer to hide the
62
+ directory, though we recommend keeping it visible.)
63
+
64
+ Here are examples of Ruby Facets +meta/+ entries.
65
+
66
+ $ cat facets/meta/name
67
+ facets
68
+
69
+ $ cat facets/meta/version
70
+ 2.8.0
71
+
72
+ $ cat facets/meta/loadpath
73
+ lib/core
74
+ lib/more
75
+
76
+ $ cat facets/meta/ruby
77
+ 1.8+
78
+
79
+ The +ruby+ entry informs Rolls of the particular implementations and versions
80
+ of Ruby the project should operate under successfully.
81
+ (NOTE: Rolls doesn't actually do anything with the ruby entry yet.)
82
+
83
+ Lastly, an +active+ entry can be set to +false+ to tell Rolls to skip the
84
+ project when searching for library files. See POM[http://proutils.github.com/pom]
85
+ for more information.
86
+
87
+
88
+ === Library Management
89
+
90
+ Next you need to setup an roll *environment*. The default environment
91
+ is call +production+. You can add a library search location to it
92
+ using +roll in+. Eg.
93
+
94
+ $ roll in /opt/ruby/
95
+
96
+ As a developer you will often want to use a +development+ environment.
97
+ To change or add and environment, modify the RUBYENV environment variable.
98
+
99
+ $ export RUBYENV="development"
100
+
101
+ Then you can add the paths you want. For instance my development
102
+ environment is basically constructed like this:
103
+
104
+ $ roll in ~/programs/proutils
105
+ $ roll in ~/programs/rubyworks
106
+ $ roll in ~/programs/thedeadly
107
+ $ roll in ~/programs/transcode
108
+
109
+ By default these paths will be searched for POM conforming projects
110
+ up to a depth of three sub-directories. That's suitable for
111
+ most needs. You can specify the the depth explicitly with the
112
+ <tt>--depth</tt> or <tt>-d</tt> option. For example, lets say you
113
+ just want to add a single ruby project to the current environment.
114
+ You can do so by navigating to the root directory of a project and
115
+ executing:
116
+
117
+ $ roll in --depth 1
118
+
119
+ That's it. Your project is *READY-TO-ROLL*!
120
+
121
+
122
+ == LEARNING MORE
123
+
124
+ The above provides a brief overview of using roll. But there is more to
125
+ it. To get a deeper understanding of the system and how to use +roll+ to
126
+ it fullest extent, please visit http://proutils.github.org/roll/.
127
+
128
+
129
+ == HOW TO INSTALL
130
+
131
+ === Manual Installation
132
+
133
+ You will need Ruby Setup, the standalone setup.rb script, in order
134
+ to install Roll. See: http://setup.rubyforge.org.
135
+
136
+ Once you have setup.rb, download the Roll tarball and install
137
+ it manually as follows:
138
+
139
+ $ tar -xvzf roll-1.0.0
140
+ $ cd roll-1.0.0
141
+ $ sudo setup.rb all
142
+
143
+ On Windows, this last line needs to be 'ruby setup.rb all'.
144
+
145
+ === RubyGems Installation
146
+
147
+ We strongly recommend installing Rolls manually b/c
148
+ Rolls is a peer to RubyGems. However, you can use Gems to
149
+ install it; and this is a convenient way to try it out.
150
+
151
+ gem install roll
152
+
153
+ If you like Rolls, then later you can uninstall the gem and
154
+ install manually.
155
+
156
+
157
+ == BY THE WAY
158
+
159
+ Roll was RubyForge project #1004. She's been around a while! ;)
160
+
161
+
162
+ == LICENSE & COPYRIGHT
163
+
164
+ Roll, Copyright (c) 2006,2007 Thomas Sawyer
165
+
166
+ Rolls is distributed under the same terms as Ruby.
167
+
168
+ See the LICENSE file details.
169
+
data/TODO ADDED
@@ -0,0 +1,4 @@
1
+ = TODO List
2
+
3
+ * Is there a way to directly support plugins?
4
+
data/bin/roll CHANGED
@@ -1,44 +1,3 @@
1
- #! /usr/bin/ruby1.8
2
-
3
- # This script builds alist of all roll-redy bin locations
4
- # and writes that list as an environment setting shell script.
5
- # On Linux a call to this to you .bashrc file. Eg.
6
- #
7
- # if [ -f ~/.rollrc ]; then
8
- # . roll --bin
9
- # fi
10
- #
11
- # Currently this only supports bash.
12
- #
13
- # TODO Is this the best way to do it, or would it be better
14
- # to "install" executables to an appropriate bin dir,
15
- # suing links (soft if possible).
16
-
17
- require 'roll/library'
18
-
19
- def windows
20
- processor, platform, *rest = RUBY_PLATFORM.split("-")
21
- platform == 'mswin32'
22
- end
23
-
24
- div = (windows ? ';' : ':')
25
-
26
- env_path = ENV['PATH'].split(/[#{div}]/)
27
-
28
- # Go thru each roll lib and make sure bin
29
- # path in path.
30
-
31
- new_path = []
32
-
33
- Library.list.each do |libname|
34
- path = Library[libname].bin_path
35
- if path
36
- new_path = new_path | path
37
- end
38
- end
39
-
40
- bin_path = (["$PATH"] + new_path).join(div)
41
-
42
- puts %{export PATH="#{bin_path}";}
43
-
44
-
1
+ #!/usr/bin/env ruby
2
+ require 'roll/command'
3
+ Roll::Command.main(*ARGV)
data/lib/oll.rb CHANGED
@@ -1,2 +1 @@
1
- require 'roll/library'
2
-
1
+ require 'roll'
@@ -0,0 +1,87 @@
1
+ require 'roll/kernel'
2
+
3
+ module Roll
4
+ VERSION = "1.0.0" #:till: VERSION = "<%= version %>"
5
+
6
+ # Get environment.
7
+
8
+ def self.env(name=nil)
9
+ if name
10
+ env = Environment.new(name)
11
+ else
12
+ env = Environment.new
13
+ end
14
+ env
15
+ end
16
+
17
+ def self.index(name=nil)
18
+ #if name
19
+ # env = Environment.new(name)
20
+ #else
21
+ # env = Environment.new
22
+ #end
23
+ env(name).index.to_s
24
+ end
25
+
26
+ # Synchronize an environment by +name+. If a +name+
27
+ # is not given the current environment is synchronized.
28
+
29
+ def self.sync(name=nil)
30
+ env = env(name)
31
+ env.sync
32
+ env.save
33
+ end
34
+
35
+ # Add path to current environment.
36
+
37
+ def self.in(path, depth=3)
38
+ env = Environment.new
39
+
40
+ lookup = env.lookup
41
+ lookup.append(path, depth)
42
+ lookup.save
43
+
44
+ env.sync
45
+ env.save
46
+
47
+ return path, lookup.file
48
+ end
49
+
50
+ # Remove path from current environment.
51
+
52
+ def self.out(path)
53
+ env = Environment.new
54
+
55
+ lookup = env.lookup
56
+ lookup.delete(path)
57
+ lookup.save
58
+
59
+ env.sync
60
+ env.save
61
+
62
+ return path, lookup.file
63
+ end
64
+
65
+ # Go thru each roll lib and collect bin paths.
66
+
67
+ def self.path
68
+ binpaths = []
69
+ Library.list.each do |name|
70
+ lib = Library[name]
71
+ if lib.bindir?
72
+ binpaths << lib.bindir
73
+ end
74
+ end
75
+ binpaths
76
+ end
77
+
78
+ # Verify dependencies are in current environment.
79
+ #--
80
+ # TODO: Instead of Dir.pwd, lookup project root.
81
+ #++
82
+ def self.verify(root=Dir.pwd)
83
+ Library.new(root).verify
84
+ end
85
+
86
+ end
87
+
@@ -0,0 +1,207 @@
1
+ require 'roll'
2
+ #require 'roll/platform'
3
+ require 'optparse'
4
+
5
+ #--
6
+ # TODO: clean command to remove dead directories from environment
7
+ #++
8
+
9
+ module Roll
10
+
11
+ # = Command-line Interface
12
+ #
13
+ class Command
14
+
15
+ # Initialize and execute command.
16
+ def self.main(*argv)
17
+ new(*argv).execute
18
+ end
19
+
20
+ # New Command.
21
+ def initialize(*argv)
22
+ @argv = argv
23
+ end
24
+
25
+ #
26
+ def execute
27
+ cmd = @argv.find{ |e| e !~ /^\-/ }
28
+
29
+ options = {}
30
+
31
+ parser = OptionParser.new
32
+
33
+ parser.banner = "Usage: roll [COMMAND]"
34
+
35
+ __send__("#{cmd}_optparse", parser, options) if cmd
36
+
37
+ if !cmd
38
+ parser.separator "Commands:"
39
+ parser.separator " in [DIR] " + (" " * 23) + "Roll directory into current environment."
40
+ parser.separator " out [DIR] " + (" " * 23) + "Remove directory from current environment."
41
+ parser.separator " env " + (" " * 23) + "Show current environment."
42
+ parser.separator " index " + (" " * 23) + "Show current environment index."
43
+ parser.separator " sync " + (" " * 23) + "Synchronize environment indexes."
44
+ parser.separator " path " + (" " * 23) + "Output bin PATH list."
45
+ parser.separator " verify " + (" " * 23) + "Verify project dependencies in current environment."
46
+ parser.separator "Options:"
47
+ end
48
+
49
+ parser.on_tail("--help", "-h", "Display this help message.") do
50
+ puts parser
51
+ exit
52
+ end
53
+
54
+ parser.parse!
55
+
56
+ ARGV.shift # remove command
57
+
58
+ if cmd
59
+ __send__(cmd, ARGV, options)
60
+ else
61
+ # no command ?
62
+ end
63
+ end
64
+
65
+ #
66
+ def env_optparse(op, options)
67
+ op.banner = "Usage: roll env [NAME]"
68
+ op.separator "Show current environment."
69
+ op
70
+ end
71
+
72
+ #
73
+ def index_optparse(op, options)
74
+ op.banner = "Usage: roll index [NAME]"
75
+ op.separator "Show current environment index."
76
+ op
77
+ end
78
+
79
+ #
80
+ def sync_optparse(op, options)
81
+ op.banner = "Usage: roll sync [NAME]"
82
+ op.separator "Synchronize ledger(s) to their respective environment(s)."
83
+ op
84
+ end
85
+
86
+ #
87
+ def in_optparse(op, options)
88
+ op.banner = "Usage: roll in [PATH]"
89
+ op.separator "Insert path into current environment."
90
+ op.separator "Options:"
91
+ op.on("--depth", "-d [INTEGER]") do |int|
92
+ options[:depth] = int
93
+ end
94
+ end
95
+
96
+ #
97
+ def out_optparse(op, options)
98
+ op.banner = "Usage: roll out [PATH]"
99
+ op.separator "Remove path from current environment."
100
+ op
101
+ end
102
+
103
+ #
104
+ def path_optparse(op, options)
105
+ op.banner = "Usage: roll path"
106
+ op.separator "Generate executable PATH list."
107
+ op
108
+ end
109
+
110
+ #
111
+ def verify_optparse(op, options)
112
+ op.banner = "Usage: roll verify"
113
+ op.separator "Verify dependencies in current environment."
114
+ op
115
+ end
116
+
117
+ # Show/Change current environment.
118
+ #
119
+ def env(args, opts)
120
+ puts Roll.env(*args)
121
+ end
122
+
123
+ # Show/Change current environment.
124
+ #
125
+ def index(args, opts)
126
+ puts Roll.index(*args)
127
+ end
128
+
129
+ # Synchronize ledgers.
130
+ #
131
+ def sync(args, opts)
132
+ name = args.first
133
+ list = name ? [name] : Environment.list
134
+ list.each do |name|
135
+ result = Roll.sync(name)
136
+ if result
137
+ puts " saved #{name}"
138
+ else
139
+ puts " current #{name}"
140
+ end
141
+ end
142
+ end
143
+
144
+ #
145
+ def in(args, opts)
146
+ path = File.expand_path(args.first || Dir.pwd)
147
+ depth = opts[:depth]
148
+ path, file = *Roll.in(path, depth)
149
+ puts "#{path}"
150
+ puts " '-> #{file}"
151
+ end
152
+
153
+ #
154
+ def out(args, opts)
155
+ path = File.expand_path(args.first || Dir.pwd)
156
+ path, file = *Roll.out(path)
157
+ puts "#{file}"
158
+ puts " '-> #{path} -> [x]"
159
+ end
160
+
161
+ #
162
+ def verify(args, opts)
163
+ list = Roll.verify
164
+ list.each do |(name, constraint)|
165
+ puts "#{name} #{constraint}"
166
+ end
167
+ end
168
+
169
+ # This script builds a list of all roll-ready bin locations
170
+ # and writes that list as an environment setting shell script.
171
+ # On Linux a call to this to you .bashrc file. Eg.
172
+ #
173
+ # if [ -f ~/.rollrc ]; then
174
+ # . roll
175
+ # fi
176
+ #
177
+ # Currently this only supports bash.
178
+ #
179
+ # TODO: It would be better to "install" executables
180
+ # to an appropriate bin dir, using links (soft if possible).
181
+ # There could go in ~/.bin or .config/roll/<ledger>.bin/
182
+ #
183
+ def path(args, opts)
184
+ case RUBY_PLATFORM
185
+ when /mswin/, /wince/
186
+ div = ';'
187
+ else
188
+ div = ':'
189
+ end
190
+ env_path = ENV['PATH'].split(/[#{div}]/)
191
+ # Go thru each roll lib and make sure bin path is in path.
192
+ binpaths = []
193
+ Library.list.each do |name|
194
+ lib = Library[name]
195
+ if lib.bindir?
196
+ binpaths << lib.bindir
197
+ end
198
+ end
199
+ #pathenv = (["$PATH"] + binpaths).join(div)
200
+ pathenv = binpaths.join(div)
201
+ #puts %{export PATH="#{pathenv}"}
202
+ puts pathenv
203
+ end
204
+
205
+ end
206
+
207
+ end