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
data/README DELETED
@@ -1,17 +0,0 @@
1
- = YOUR PROJECT
2
-
3
- Tells us all about your project here.
4
-
5
- == How to Install
6
-
7
- Describe your installation procedure here.
8
-
9
- === RubyGems.
10
-
11
- gem install _package_
12
-
13
- === Manual installation.
14
-
15
- tar -xvvzf _package_name_
16
- cd _package_name_
17
- ruby package.rb install
@@ -1,7 +0,0 @@
1
-
2
- t = Time.now
3
-
4
- require 'roll/library'
5
-
6
- puts "Load Time: #{Time.now - t} seconds"
7
-
@@ -1 +0,0 @@
1
- puts "Try Me v1.0"
@@ -1 +0,0 @@
1
- puts "Try Me v1.1"
@@ -1,72 +0,0 @@
1
- module Roll
2
-
3
- # Attributes DSL
4
- module Attributes
5
-
6
- def self.included(base)
7
- base.extend(ClassMethods)
8
- end
9
-
10
- #
11
- def valid?
12
- begin
13
- validate
14
- return true
15
- rescue ValidationError
16
- return false
17
- end
18
- end
19
-
20
- #
21
- def validate
22
- self.class.validation.each do |message, block|
23
- raise(ValidationError, message) unless instance_eval(&block)
24
- end
25
- end
26
-
27
- alias_method :assert_valid, :validate
28
-
29
- #
30
-
31
- module ClassMethods
32
-
33
- def instance_attributes
34
- @@attributes ||= []
35
- end
36
-
37
- # Define an attribute.
38
-
39
- def attr_accessor(name, *aliases)
40
- instance_attributes << name.to_s
41
- instance_attributes.uniq!
42
- super(name)
43
- aliases.each{ |aliaz| alias_accessor(aliaz, name) }
44
- end
45
-
46
- # Define an attribute alias.
47
-
48
- def alias_accessor(aliaz, name)
49
- alias_method aliaz, name
50
- alias_method "#{aliaz}=", "#{name}="
51
- end
52
-
53
- def validation
54
- @@validation ||= []
55
- end
56
-
57
- # # Does this class provide open access?
58
- # def open_access?
59
- # false
60
- # end
61
-
62
- def validate(message, &block)
63
- validation << [message, block]
64
- end
65
-
66
- end
67
- end
68
- end
69
-
70
- #
71
- class ValidationError < Exception
72
- end
@@ -1,300 +0,0 @@
1
- require 'yaml'
2
- require 'roll/attributes'
3
-
4
- module Roll
5
-
6
- class Package
7
- include Attributes
8
-
9
- # Read package information from a YAML file.
10
- def self.open(file=nil, options={})
11
- unless file
12
- file = Dir.glob(filename, File::FNM_CASEFOLD).first
13
- raise "Manifest file is required." unless file
14
- end
15
- data = YAML::load(File.open(file))
16
- data.update(options)
17
- data.update(:file => file)
18
- new(data)
19
- end
20
-
21
- # Possible file name (was for Fileable).
22
- def self.filename
23
- '{,meta/}*.roll'
24
- end
25
-
26
- # New Package. Pass in a data hash to populate the object.
27
- # TODO Support self setter block?
28
- def initialize(data={}) #, &yld)
29
- data.each do |k,v|
30
- send( "#{k}=", v ) rescue nil
31
- end
32
- #if yld
33
- # yld.to_h.each do |k,v|
34
- # send( "#{k}=", v ) rescue nil
35
- # end
36
- #end
37
-
38
- base = File.basename(file).chomp('.roll')
39
- if base.index('-') # Just in case you want to load ir from a non-conforming file.
40
- name, version = base.split('-')
41
- name = name.downcase # TODO Is this too restrictive?
42
- @name = name
43
- @version = version
44
- end
45
-
46
- self
47
- end
48
-
49
- # Name of the package file (if used).
50
- attr_accessor :file
51
-
52
- # Path to the project file (if used).
53
- def location
54
- File.dirname(@file) if @file
55
- end
56
-
57
- # Indicates if this project information was read from a file.
58
- # Returns the file's name if so.
59
- def read? ; file ; end
60
-
61
- #---------------------#
62
- # GENERAL INFORMATION #
63
- #---------------------#
64
-
65
- # The title of the project (free-form, defaults to name).
66
- attr_accessor :title
67
-
68
- # One-line description of the package (Max 60 chars.)
69
- attr_accessor :subtitle, :brief
70
-
71
- # More detailed description of the package.
72
- attr_accessor :description, :summary
73
-
74
- # "Unix" name of the project.
75
- attr_accessor :name, :project
76
-
77
- # The date the project was started.
78
- attr_accessor :created
79
-
80
- # Copyright notice.
81
- attr_accessor :copyright
82
-
83
- # Distribution License.
84
- attr_accessor :license
85
-
86
- # Project slogan or "trademark" phrase.
87
- attr_accessor :slogan
88
-
89
- # General one-word software category.
90
- attr_accessor :category
91
-
92
- # Author(s) of this project.
93
- # (Usually in "name <email>" format.)
94
- attr_accessor :author
95
-
96
- # Contact(s) (defaults to authors).
97
- attr_accessor :contact
98
-
99
- # Gerenal Email address (defaults to first contact's address, if given).
100
- attr_accessor :email
101
-
102
- # Official domain associated with this package.
103
- attr_accessor :domain
104
-
105
- # Project's homepage.
106
- attr_accessor :homepage
107
-
108
- # Project's development site.
109
- attr_accessor :development, :devsite
110
-
111
- # Internet address(es) to documentation pages.
112
- attr_accessor :documentation, :docs
113
-
114
- # Internet address(es) to downloadable packages.
115
- attr_accessor :download
116
-
117
- # Internet address for project wiki.
118
- attr_accessor :wiki
119
-
120
- # Project's mailing list or other contact email.
121
- attr_accessor :list
122
-
123
- # Generate documentation on installation?
124
- attr_accessor :document
125
-
126
- def name ; @name || project ; end
127
- def title ; @title || project ; end
128
- def contact ; @contact || author ; end
129
- def email ; @email || contact ; end
130
- def license ; @license || 'Ruby' ; end
131
-
132
- # Subtitle is limited to 60 characters.
133
- def subtitle ; @subtitle.to_s[0..59] ; end
134
-
135
- # Returns a standard taguri id for the library and release.
136
- def project_taguri
137
- "tag:#{name}.#{domain},#{created}" # or released?
138
- end
139
-
140
- # Version Information
141
-
142
- module Version
143
- include Attributes
144
-
145
- # Version number (eg. '1.0.0').
146
- attr_accessor :version
147
-
148
- # Status of this release: alpha, beta, RC1, etc.
149
- attr_accessor :status
150
-
151
- # Date of release (defaults to Time.now).
152
- attr_accessor :released
153
-
154
- # Build number (if true, defaults to a number based on current date-time).
155
- attr_accessor :buildno
156
-
157
- # Current release code name.
158
- attr_accessor :codename
159
-
160
- # If buildno is set to true, than returns a time stamp.
161
- def buildno
162
- bn = stamp.buildno if stamp
163
- unless bn
164
- if TrueClass === @buildno
165
- bn = Time.now.strftime("%H*60+%M")
166
- else
167
- bn = @buildno
168
- end
169
- end
170
- return bn
171
- end
172
- end
173
-
174
- include Version
175
-
176
- # Content Descriptions
177
-
178
- module Contents
179
- include Attributes
180
-
181
- # Files in this package that are executables.
182
- attr_accessor :executable, :executables
183
-
184
- # Library files in this package that are *public*.
185
- # This is akin to load_path but specifies specific files
186
- # that can be loaded from the outside --where as those
187
- # not listed are considerd *private*.
188
- #
189
- # NOTE: This is not enforced --and may never be. It
190
- # complicates library loading. Ie. how to distinguish public
191
- # loading from external loading. But it something that can be
192
- # consider more carfully in the future. For now it can serve
193
- # as an optional reference.
194
- attr_accessor :library, :libraries
195
-
196
- # Location(s) of executables.
197
- attr_accessor :bin_path, :bin_paths
198
-
199
- # Root location(s) of libraries (used by Rolls).
200
- # If you plan to support Gems, this would be something like:
201
- #
202
- # 'lib/facets'
203
- #
204
- # If not, then the default ('lib') is nice b/c it means one less
205
- # layer in your project heirarchy.
206
- attr_accessor :lib_path, :lib_paths, :load_path, :load_paths
207
-
208
- # Traditional load path (used by RubyGems).
209
- # The default is 'lib', which is usually fine.
210
- attr_accessor :gem_path, :gem_paths
211
-
212
- # Default lib to load when requiring only on a package name. Eg.
213
- #
214
- # require 'facets'
215
- #
216
- attr_accessor :index_library
217
-
218
- # Root location(s) of libraries.
219
- #--
220
- # TODO This is an intersting idea. Instead of fixed locations in
221
- # the file system one could register "virtual locations" which map
222
- # to real locations. Worth the added flexability?
223
- #++
224
- #attr_accessor :register
225
-
226
- def executable ; [@executable || 'bin/**/*'].flatten ; end
227
- def library ; [@library || 'lib/**/*'].flatten ; end
228
-
229
- def gem_path ; [@gem_path || 'lib'].flatten ; end
230
- def lib_path ; [@lib_path || 'lib'].flatten ; end
231
-
232
- def index_library ; @index_library || 'index.rb' ; end
233
-
234
- #def register ; @register || { name => 'lib' } ; end
235
- end
236
-
237
- include Contents
238
-
239
- # Security Information
240
-
241
- module Security
242
- include Attributes
243
-
244
- # Encryption digest type used.
245
- # (md5, sha1, sha128, sha256, sha512).
246
- attr_accessor :digest
247
-
248
- # Public key file associated with this library. This is useful
249
- # for security purposes especially remote loading. [pubkey.pem]
250
- attr_accessor :public_key
251
-
252
- # Private key file associated with this library. This is useful
253
- # for security purposes especially remote loading. [_privkey.pem]
254
- attr_accessor :private_key
255
-
256
- def digest ; @digest || 'md5' ; end
257
- def public_key ; @public_key || 'pubkey.pem' ; end
258
- def private_key ; @private_key || '_privkey.pem' ; end
259
- end
260
-
261
- include Security
262
-
263
- # Source Control Managment Information
264
-
265
- module Control
266
- include Attributes
267
-
268
- # Specifices the type of revision control system used.
269
- # darcs, svn, cvs, etc.
270
- attr_accessor :scm
271
-
272
- # Files that are tracked under revision control.
273
- # Default is all less standard exceptions.
274
- # '+' and '-' prefixes can be used to augment the list
275
- # rather than fully override it.
276
- attr_accessor :track, :scm_files
277
-
278
- # Internet address to source code repository.
279
- # (http://, ftp://, etc.)
280
- attr_accessor :repository, :repo
281
-
282
- # Changelog file.
283
- attr_accessor :changelog
284
- end
285
-
286
- include Control
287
-
288
- # Validation
289
-
290
- validate "name is required" do
291
- name
292
- end
293
-
294
- validate "version is required" do
295
- version
296
- end
297
-
298
- end
299
-
300
- end
@@ -1,37 +0,0 @@
1
- module Roll
2
-
3
- # Remote install cache (hmmm...should this be optional feature?)
4
- REMOTE_CACHE = File.expand_path( '~/.lib/site_ruby/1.8/' )
5
- FileUtils.mkdir_p REMOTE_CACHE unless File.directory? REMOTE_CACHE
6
- $:.unshift REMOTE_CACHE
7
-
8
- #
9
-
10
- def remote_install(fname)
11
- # Bit of a shortcoming here since it's not very efficient to
12
- # be searching a remote location for multiple matches.
13
- # .so suffix must be specified explicity on the remote end.
14
- fname = fname + '.rb' unless fname =~ /\.rb$/ or fname =~ /\.so$/
15
-
16
- # get signiture
17
- url = File.join( source, 'meta', 'signitures', fname )
18
- $stderr << "remote signiture -- " + url if $DEBUG
19
- sig = URI.parse( url ).read
20
-
21
- # get file
22
- url = File.join( source, fname )
23
- $stderr << "remote file -- " + url if $DEBUG
24
- file = URI.parse( url ).read
25
-
26
- # verify file and signiture
27
- if Signer.verify?( pubkey, sig, file )
28
- infile = File.join( REMOTE_CACHE, fname )
29
- indir = File.dirname( infile )
30
- FileUtils.mkdir_p indir
31
- File.open( infile, 'w' ) { |f| f << file }
32
- else
33
- raise
34
- end
35
- end
36
-
37
- end
@@ -1,21 +0,0 @@
1
- --- %YAML:1.0
2
-
3
- title : Roll
4
- brief : Ruby Object-Oriented Library Ledger
5
- author : Thomas Sawyer
6
- email : transfire@gmail.com
7
- homepage : "http://roll.rubyforge.org"
8
- created : 2006-12-10
9
- summary :
10
- Roll is a library manager for Ruby. Code repositories
11
- can be made visible to Ruby just by setting an
12
- environment variable. Rolls effectively trivializes
13
- Ruby package management.
14
-
15
- formats: [ tar.gz, gem ]
16
-
17
- lib_path:
18
- - lib/roll
19
-
20
- bin_path:
21
- - bin