stickler 0.1.1 → 2.0.0a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. data/HISTORY.rdoc +5 -2
  2. data/Rakefile +31 -0
  3. data/examples/config.ru +9 -0
  4. data/examples/gemcutter_repo.ru +19 -0
  5. data/examples/index_repo.ru +15 -0
  6. data/examples/local_repo.ru +14 -0
  7. data/examples/mirror_repo.ru +16 -0
  8. data/examples/not_found.ru +8 -0
  9. data/lib/stickler/error.rb +3 -0
  10. data/lib/stickler/middleware/compression.rb +30 -0
  11. data/lib/stickler/middleware/gemcutter.rb +62 -0
  12. data/lib/stickler/middleware/helpers.rb +84 -0
  13. data/lib/stickler/middleware/index.rb +137 -0
  14. data/lib/stickler/middleware/local.rb +38 -0
  15. data/lib/stickler/middleware/mirror.rb +60 -0
  16. data/lib/stickler/middleware/not_found.rb +62 -0
  17. data/lib/stickler/middleware.rb +4 -0
  18. data/lib/stickler/repository/api.rb +167 -0
  19. data/lib/stickler/repository/index.rb +97 -0
  20. data/lib/stickler/repository/local.rb +251 -0
  21. data/lib/stickler/repository/mirror.rb +48 -0
  22. data/lib/stickler/repository/null.rb +58 -0
  23. data/lib/stickler/repository/remote.rb +235 -0
  24. data/lib/stickler/repository.rb +7 -499
  25. data/lib/stickler/spec_lite.rb +60 -14
  26. data/lib/stickler/version.rb +6 -6
  27. data/lib/stickler/web.rb +19 -0
  28. data/spec/data/gems/bar-1.0.0.gem +0 -0
  29. data/spec/data/gems/foo-1.0.0.gem +0 -0
  30. data/spec/data/specifications/bar-1.0.0.gemspec +31 -0
  31. data/spec/data/specifications/foo-1.0.0.gemspec +31 -0
  32. data/spec/middleware/common_gem_server_helpers.rb +67 -0
  33. data/spec/middleware/index_spec.rb +26 -0
  34. data/spec/middleware/legacy_gem_server_behavior.rb +33 -0
  35. data/spec/middleware/local_spec.rb +25 -0
  36. data/spec/middleware/modern_gem_server_behavior.rb +20 -0
  37. data/spec/middleware/not_found_spec.rb +25 -0
  38. data/spec/repository/api_behavior.rb +162 -0
  39. data/spec/repository/api_spec.rb +38 -0
  40. data/spec/repository/index_spec.rb +32 -0
  41. data/spec/repository/local_spec.rb +36 -0
  42. data/spec/repository/null_spec.rb +17 -0
  43. data/spec/repository/remote_spec.rb +49 -0
  44. data/spec/spec.opts +2 -0
  45. data/spec/spec_helper.rb +15 -3
  46. data/spec/spec_lite_spec.rb +62 -0
  47. data/stickler.gemspec +60 -0
  48. data/views/index.erb +19 -0
  49. data/views/layout.erb +39 -0
  50. metadata +93 -63
  51. data/COPYING +0 -339
  52. data/bin/stickler +0 -58
  53. data/data/stickler.yml +0 -14
  54. data/gemspec.rb +0 -62
  55. data/lib/stickler/cli.rb +0 -302
  56. data/lib/stickler/configuration.rb +0 -74
  57. data/lib/stickler/console.rb +0 -72
  58. data/lib/stickler/paths.rb +0 -62
  59. data/lib/stickler/source.rb +0 -75
  60. data/lib/stickler/source_group.rb +0 -365
  61. data/lib/stickler.rb +0 -19
  62. data/spec/configuration_spec.rb +0 -68
  63. data/spec/paths_spec.rb +0 -25
  64. data/spec/repository_spec.rb +0 -55
  65. data/spec/version_spec.rb +0 -17
  66. data/tasks/announce.rake +0 -39
  67. data/tasks/config.rb +0 -107
  68. data/tasks/distribution.rake +0 -45
  69. data/tasks/documentation.rake +0 -31
  70. data/tasks/rspec.rake +0 -29
  71. data/tasks/rubyforge.rake +0 -51
  72. data/tasks/utils.rb +0 -80
@@ -1,365 +0,0 @@
1
- module Stickler
2
- #
3
- # A source group contains a set of Source objects, and runs common operations
4
- # across all of them.
5
- #
6
- class SourceGroup
7
-
8
- # the repository this group belongs to
9
- attr_reader :repository
10
-
11
- def initialize( repository )
12
- @repository = repository
13
- @sources = {}
14
-
15
- @fetcher = ::Gem::RemoteFetcher.new( nil )
16
- @spec_fetcher = ::Gem::SpecFetcher.fetcher
17
- end
18
-
19
- #
20
- # The root directory of the repository
21
- #
22
- def root_dir
23
- @root_dir || repository.directory
24
- end
25
-
26
- #
27
- # The specification directory in the repository
28
- #
29
- def specification_dir
30
- @specification_dir ||= repository.specification_dir
31
- end
32
-
33
- #
34
- # The specification behavior
35
- #
36
- def requirement_satisfaction_behavior
37
- @requirement_satisfaction_behavior ||= repository.requirement_satisfaction_behavior
38
- end
39
-
40
- #
41
- # The directory housing the actual .gem files
42
- #
43
- def gems_dir
44
- @gems_dir ||= repository.gems_dir
45
- end
46
-
47
- #
48
- # logger for this class
49
- #
50
- def logger
51
- @logger ||= ::Logging::Logger[self]
52
- end
53
-
54
- #
55
- # Add a source to the source group
56
- #
57
- def add_source( source_uri )
58
- s = Source.new( source_uri, self )
59
- @sources[s.uri] = s
60
- end
61
-
62
- #
63
- # accessor for the available Source objects in this group
64
- #
65
- def sources
66
- @sources.values
67
- end
68
-
69
- #
70
- # Access all the gems that are in this gemspec This is a Hash of all gems in
71
- # the source group. The keys are spec.full_name and the values are
72
- # Gem::Specification instances
73
- #
74
- def gems
75
- unless @gems
76
- @gems = {}
77
- Dir.glob( File.join( specification_dir, "*.gemspec" ) ).each do |spec_file|
78
- begin
79
- logger.info "Loading spec file #{spec_file}"
80
- spec = eval( IO.read( spec_file ) )
81
- @gems[ spec.full_name ] = spec
82
- rescue => e
83
- logger.error "Failure loading specfile #{File.basename( spec_file )} : #{e}"
84
- end
85
- end
86
- end
87
- return @gems
88
- end
89
-
90
- #
91
- # Force a reload of the gem from the existing specs
92
- #
93
- def reload_gems!
94
- @gems = nil
95
- gems
96
- end
97
-
98
- #
99
- # Return a list of Gem::Specification instances corresponding to the
100
- # existing gems for a particular source
101
- #
102
- def existing_specs_for_source_uri( uri )
103
- unless @existing_specs_for_source_uri
104
- logger.debug "Loading existing_specs_for_source_uri"
105
- @existing_specs_for_source_uri = Hash.new{ |h,k| h[k] = Array.new }
106
- gems.values.each do |spec|
107
- @existing_specs_for_source_uri[ source_uri_for_spec( spec ) ] << spec
108
- end
109
- end
110
- @existing_specs_for_source_uri[ Source.normalize_uri( uri ) ]
111
- end
112
-
113
- #
114
- # Search through all sources for all gems that satisfy the given
115
- # Gem::Dependency
116
- #
117
- def search( dependency )
118
- results = []
119
- @sources.each_pair do |uri, src|
120
- results.concat( src.search( dependency ) )
121
- end
122
- return results
123
- end
124
-
125
- #
126
- # Search through all the existing specs for gemes that match the given
127
- # Gem::Dependency
128
- #
129
- def search_existing( dependency )
130
- results = gems.values.find_all do |spec|
131
- dependency =~ Gem::Dependency.new( spec.name, spec.version )
132
- end
133
- end
134
-
135
- #
136
- # Add the gem that satisfies the dependency based upon the current
137
- # satisfication method
138
- #
139
- def add_from_dependency( dep )
140
- Console.info "Resolving gem dependencies for #{dep.to_s} ..."
141
- specs_satisfying_dependency( dep ).each do |s|
142
- add( s )
143
- end
144
- end
145
-
146
- #
147
- # Add the gem given by the spec and all of its dependencies.
148
- #
149
- def add( spec )
150
- top_spec = spec
151
- unless spec.instance_of?( ::Gem::Specification )
152
- source_uri = source_uri_for_spec( spec )
153
- top_spec = @spec_fetcher.fetch_spec( spec.to_a, source_uri )
154
- end
155
-
156
- add_list = []
157
-
158
- todo = []
159
- todo.push top_spec
160
- seen = {}
161
-
162
- until todo.empty? do
163
- spec = todo.pop
164
- next if seen[ spec.full_name ] or gems[ spec.full_name ]
165
-
166
- logger.info "Queueing #{spec.full_name} for download"
167
- add_list << spec
168
-
169
- seen[ spec.full_name ] = true
170
-
171
- deps = spec.runtime_dependencies
172
- deps |= spec.development_dependencies
173
-
174
- deps.each do |dep|
175
- specs_satisfying_dependency( dep ).each do |s|
176
- todo.push s
177
- end
178
- end
179
- end
180
-
181
- add_gems_and_specs( add_list )
182
- reload_gems!
183
- end
184
-
185
-
186
- #
187
- # unisntall the gem given by the spec and all gems that depend on it.
188
- #
189
- def remove( spec_or_list )
190
- Console.info "Resolving remove dependencies..."
191
-
192
- todo = [ spec_or_list ].flatten
193
- remove_list = []
194
-
195
- until todo.empty? do
196
- spec = todo.pop
197
- next if remove_list.include?( spec )
198
-
199
- logger.info "queueing #{spec.full_name} for removal"
200
- remove_list << spec
201
-
202
- sibling_gems_of( spec ).each do |sspec|
203
- Console.debug "pushing #{sspec.full_name} onto todo list"
204
- todo.push sspec
205
- end
206
-
207
- specs_depending_on( spec ).each do |dspec|
208
- Console.debug "pushing #{dspec.full_name} onto todo list"
209
- todo.push dspec
210
- end
211
- end
212
-
213
- remove_gems_and_specs( remove_list )
214
- reload_gems!
215
- end
216
-
217
- #
218
- # Return the list of existing Specifications that have the same name as
219
- # then given spec
220
- #
221
- def sibling_gems_of( spec )
222
- sibs = []
223
- gems.values.each do |gspec|
224
- if spec.name == gspec.name and spec.full_name != gspec.full_name then
225
- sibs << gspec
226
- end
227
- end
228
- return sibs
229
- end
230
-
231
- #
232
- # Get the list of existing Specifications that have the input spec as
233
- # either a runtime or development dependency
234
- #
235
- def specs_depending_on( spec )
236
- deps = []
237
- gems.values.each do |gspec|
238
- gspec.dependencies.each do |dep|
239
- if spec.satisfies_requirement?( dep ) then
240
- deps << gspec
241
- break
242
- end
243
- end
244
- end
245
- return deps
246
- end
247
-
248
- #
249
- # Get the list of Specifications that satisfy the dependency
250
- # based upon the current requirement satisfaction method
251
- #
252
- def specs_satisfying_dependency( dep )
253
- unsorted = search( dep )
254
- sorted = unsorted.sort_by { |s| s.version }
255
-
256
- sorted.reverse! if requirement_satisfaction_behavior == :minimum
257
-
258
- satisfies = []
259
- matching_from_each_platform( sorted ).each do |spec|
260
- su = source_uri_for_spec( spec )
261
- satisfies << @spec_fetcher.fetch_spec( spec.to_a, su )
262
- end
263
-
264
- return satisfies
265
- end
266
-
267
- #
268
- # collect the highest version from each distinct platform in the results and
269
- # return that list
270
- #
271
- def matching_from_each_platform( results )
272
- by_platform = {}
273
- until results.empty?
274
- spec = results.pop
275
- if not by_platform.has_key?( spec.platform.to_s ) then
276
- by_platform[ spec.platform.to_s ] = spec
277
- end
278
- end
279
- return by_platform.values
280
- end
281
-
282
- #
283
- # return the URI of the Source object that houses the upstream gem
284
- #
285
- def source_uri_for_spec( key_spec )
286
- unless @source_uri_for_spec
287
- logger.debug "Loading source_uri_to_spec"
288
- @source_uri_for_spec = {}
289
- @sources.each_pair do |uri, src|
290
- src.source_specs.each do | s |
291
- @source_uri_for_spec[ s.name_version ] = uri
292
- end
293
- end
294
- end
295
- @source_uri_for_spec[ key_spec.name_version ]
296
- end
297
-
298
-
299
- #
300
- # remove the source from the source group
301
- #
302
- def remove_source( source_uri )
303
- ulist = existing_specs_for_source_uri( source_uri )
304
- remove( ulist )
305
- @sources.delete( source_uri )
306
- logger.info "removed #{source_uri}"
307
- end
308
-
309
- #
310
- # Remove a list of gems from specifications
311
- #
312
- def remove_gems_and_specs( remove_list )
313
- while spec = remove_list.pop do
314
- Console.info "Removing #{ spec.full_name }"
315
- delete_gem_files( spec )
316
- end
317
- end
318
-
319
- #
320
- # Remove all files from the repository related to this specification
321
- #
322
- def delete_gem_files( spec )
323
- FileUtils.rm_f( File.join( gems_dir, "#{spec.full_name}.gem" ) )
324
- FileUtils.rm_f( File.join( specification_dir, "#{spec.full_name}.gemspec" ))
325
- end
326
-
327
- #
328
- # Add the gem represented by the spec
329
- #
330
- def add_gem( spec )
331
-
332
- local_fetch_path = @fetcher.download( spec, source_uri_for_spec( spec ).to_s, root_dir )
333
- dest_gem_path = File.join( gems_dir, File.basename( local_fetch_path ) )
334
- logger.info "copying #{local_fetch_path} to #{dest_gem_path}"
335
- FileUtils.cp local_fetch_path, dest_gem_path
336
-
337
- return dest_gem_path
338
- end
339
-
340
-
341
- #
342
- # Add the specification
343
- #
344
- def add_spec( spec )
345
- rubycode = spec.to_ruby
346
- file_name = File.join( specification_dir, "#{spec.full_name}.gemspec" )
347
- logger.info "writing #{file_name}"
348
- File.open( file_name, "wb" ) do |file|
349
- file.puts rubycode
350
- end
351
- end
352
-
353
-
354
- #
355
- # Add all the gems and specifications in the add list
356
- #
357
- def add_gems_and_specs( add_list )
358
- while spec = add_list.pop do
359
- Console.info "Adding #{ spec.full_name }"
360
- add_gem( spec )
361
- add_spec( spec )
362
- end
363
- end
364
- end
365
- end
data/lib/stickler.rb DELETED
@@ -1,19 +0,0 @@
1
- #--
2
- # Copyright (c) 2008 Jeremy Hinegardner
3
- # All rights reserved. Licensed under the same terms as Ruby. No warranty is
4
- # provided. See LICENSE and COPYING for details.
5
- #++
6
-
7
- require 'logging'
8
-
9
- module Stickler
10
- end
11
-
12
- require 'stickler/paths'
13
- require 'stickler/version'
14
- require 'stickler/console'
15
- require 'stickler/source'
16
- require 'stickler/repository'
17
- require 'stickler/spec_lite'
18
- require 'stickler/configuration'
19
- require 'stickler/cli'
@@ -1,68 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
2
- require 'stickler'
3
-
4
- describe Stickler::Configuration do
5
- before( :each ) do
6
- @config_file_name = "/tmp/stickler.#{Process.pid}.yml"
7
- FileUtils.cp Stickler::Paths.data_path( "stickler.yml"), @config_file_name
8
- @config = Stickler::Configuration.new( @config_file_name )
9
- end
10
-
11
- after( :each ) do
12
- FileUtils.rm_f @config_file_name
13
- end
14
-
15
- %w[ downstream_source sources ].each do |key|
16
- it "has a value for #{key}" do
17
- @config.send( key ).should_not == nil
18
- end
19
- end
20
-
21
- it "has an array of sources" do
22
- @config.sources.should be_instance_of( Array )
23
- end
24
-
25
- it "can assign an arbitrary key/value pair like a hash" do
26
- @config[:foo] = 'bar'
27
- @config['foo'].should == 'bar'
28
- end
29
-
30
- it "lists its keys" do
31
- @config.keys.size.should > 0
32
- end
33
-
34
- it "can have gems added to it and reloaded" do
35
- d = ::Gem::Dependency.new( 'rake', ">= 0.8.0" )
36
- @config.gem_dependencies << d
37
- @config.write
38
-
39
- @config = Stickler::Configuration.new( @config_file_name )
40
- @config.gem_dependencies.size.should == 1
41
-
42
- @config.gem_dependencies.should be_include d
43
-
44
- end
45
-
46
- it "can have multiple requirements for each gem" do
47
- d1 = ::Gem::Dependency.new( 'rake', ">= 0.8.0" )
48
- @config.gem_dependencies << d1
49
- d2 = ::Gem::Dependency.new( 'rake', ">= 0.8.0" )
50
- @config.gem_dependencies << d2
51
- @config.write
52
-
53
- @config = Stickler::Configuration.new( @config_file_name )
54
- @config.gem_dependencies.size.should == 2
55
- @config.gem_dependencies.should be_include( d1 )
56
- @config.gem_dependencies.should be_include( d2 )
57
- end
58
-
59
-
60
- it "can write the configuration back out to a file" do
61
- @config.sources << "http://gems.github.com"
62
- @config.write
63
- @config = Stickler::Configuration.new( @config_file_name )
64
- @config.sources.size.should == 2
65
- @config.sources.should be_include( "http://gems.github.com/" )
66
- end
67
-
68
- end
data/spec/paths_spec.rb DELETED
@@ -1,25 +0,0 @@
1
- require File.expand_path( File.join( File.dirname( __FILE__ ), "spec_helper.rb" ) )
2
-
3
- describe Stickler::Paths do
4
- before(:each) do
5
- @root_dir = File.expand_path(File.join(File.dirname(__FILE__), ".."))
6
- @root_dir += "/"
7
- end
8
-
9
- it "root dir should be correct" do
10
- Stickler::Paths.root_dir.should == @root_dir
11
- end
12
-
13
- it "config_path should be correct" do
14
- Stickler::Paths.config_path.should == File.join(@root_dir, "config/")
15
- end
16
-
17
- it "data path should be correct" do
18
- Stickler::Paths.data_path.should == File.join(@root_dir, "data/")
19
- end
20
-
21
- it "lib path should be correct" do
22
- Stickler::Paths.lib_path.should == File.join(@root_dir, "lib/")
23
- end
24
-
25
- end
@@ -1,55 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
2
- require 'stickler'
3
-
4
- describe Stickler::Repository do
5
-
6
- before( :each ) do
7
- @top_dir = File.join( "/tmp/stickler" )
8
- @repo = Stickler::Repository.new( 'directory' => @top_dir )
9
- Stickler::Console.silent { @repo.setup }
10
- end
11
-
12
- after( :each ) do
13
- FileUtils.rm_rf( @top_dir )
14
- end
15
-
16
-
17
- describe "#setup" do
18
- %w[ gems log specifications dist cache].each do |sub_dir|
19
- it "creates #{sub_dir} directory" do
20
- new_dir = File.join( @top_dir , sub_dir )
21
- File.directory?( new_dir ).should == true
22
- end
23
- end
24
-
25
- it "setup creates a default stickler.yml file" do
26
- s_yml = File.join( @top_dir, 'stickler.yml' )
27
- s = YAML.load_file( s_yml )
28
- s['sources'].size.should == 1
29
- s['sources'].first.should == "http://gems.rubyforge.org"
30
- end
31
- end
32
-
33
- describe "validity checks" do
34
- %w[ gems log specifications dist cache].each do |sub_dir|
35
- it "raises error if #{sub_dir} is missing" do
36
- FileUtils.rmdir( File.join( @top_dir, sub_dir ) )
37
- lambda { Stickler::Console.silent { @repo.valid! } }.should raise_error( Stickler::Repository::Error )
38
- end
39
-
40
- it "return false if #{sub_dir} is missing" do
41
- FileUtils.rmdir( File.join( @top_dir, sub_dir ) )
42
- Stickler::Console.silent{ @repo.should_not be_valid }
43
- end
44
- end
45
-
46
- it "can create a valid directory system" do
47
- @repo.should be_valid
48
- end
49
- end
50
-
51
- it "creates a configuration" do
52
- @repo.configuration['sources'].size.should == 1
53
- @repo.configuration['sources'].first.should == "http://gems.rubyforge.org/"
54
- end
55
- end
data/spec/version_spec.rb DELETED
@@ -1,17 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__),"spec_helper.rb"))
2
- require 'stickler/version'
3
-
4
- describe "Stickler::Version" do
5
- it "should have a version string" do
6
- Stickler::Version.to_s.should =~ /\d+\.\d+\.\d+/
7
- Stickler::VERSION.should =~ /\d+\.\d+\.\d+/
8
- end
9
-
10
- describe "has the version accessible as a hash" do
11
- [ :major, :minor, :build ].each do |part|
12
- it "#{part}" do
13
- Stickler::Version.to_hash[ part ].to_s.should =~ /\d+/
14
- end
15
- end
16
- end
17
- end
data/tasks/announce.rake DELETED
@@ -1,39 +0,0 @@
1
- require 'tasks/config'
2
- #-------------------------------------------------------------------------------
3
- # announcement methods
4
- #-------------------------------------------------------------------------------
5
-
6
- proj_config = Configuration.for('project')
7
- namespace :announce do
8
- desc "create email for ruby-talk"
9
- task :email do
10
- info = Utils.announcement
11
-
12
- File.open("email.txt", "w") do |mail|
13
- mail.puts "From: #{proj_config.author} <#{proj_config.email}>"
14
- mail.puts "To: ruby-talk@ruby-lang.org"
15
- mail.puts "Date: #{Time.now.rfc2822}"
16
- mail.puts "Subject: [ANN] #{info[:subject]}"
17
- mail.puts
18
- mail.puts info[:title]
19
- mail.puts
20
- mail.puts " gem install #{Stickler::GEM_SPEC.name}"
21
- mail.puts
22
- mail.puts info[:urls]
23
- mail.puts
24
- mail.puts info[:description]
25
- mail.puts
26
- mail.puts "{{ Release notes for Version #{Stickler::VERSION} }}"
27
- mail.puts
28
- mail.puts info[:release_notes]
29
- mail.puts
30
- end
31
- puts "Created the following as email.txt:"
32
- puts "-" * 72
33
- puts File.read("email.txt")
34
- puts "-" * 72
35
- end
36
-
37
- CLOBBER << "email.txt"
38
- end
39
-
data/tasks/config.rb DELETED
@@ -1,107 +0,0 @@
1
- require 'configuration'
2
-
3
- require 'rake'
4
- require 'tasks/utils'
5
-
6
- #-----------------------------------------------------------------------
7
- # General project configuration
8
- #-----------------------------------------------------------------------
9
- Configuration.for('project') {
10
- name "stickler"
11
- version Stickler::Version.to_s
12
- author "Jeremy Hinegardner"
13
- email "jeremy at copiousfreetime dot org"
14
- homepage "http://copiousfreetime.rubyforge.org/stickler"
15
- description Utils.section_of("README.rdoc", "description")
16
- summary description.split(".").first
17
- history "HISTORY.rdoc"
18
- license FileList["LICENSE", "COPYING"]
19
- readme "README.rdoc"
20
- }
21
-
22
- #-----------------------------------------------------------------------
23
- # Packaging
24
- #-----------------------------------------------------------------------
25
- Configuration.for('packaging') {
26
- # files in the project
27
- proj_conf = Configuration.for('project')
28
- files {
29
- bin FileList["bin/*"]
30
- ext FileList["ext/*.{c,h,rb}"]
31
- lib FileList["lib/**/*.rb"]
32
- test FileList["spec/**/*.rb", "test/**/*.rb"]
33
- data FileList["data/**/*"]
34
- tasks FileList["tasks/**/*.r{ake,b}"]
35
- rdoc FileList[proj_conf.readme, proj_conf.history,
36
- proj_conf.license] + lib
37
- all bin + ext + lib + test + data + rdoc + tasks
38
- }
39
-
40
- # ways to package the results
41
- formats {
42
- tgz true
43
- zip true
44
- gem Configuration::Table.has_key?('gem')
45
- }
46
- }
47
-
48
- #-----------------------------------------------------------------------
49
- # Gem packaging
50
- #-----------------------------------------------------------------------
51
- Configuration.for("gem") {
52
- spec "gemspec.rb"
53
- Configuration.for('packaging').files.all << spec
54
- }
55
-
56
- #-----------------------------------------------------------------------
57
- # Testing
58
- # - change mode to 'testunit' to use unit testing
59
- #-----------------------------------------------------------------------
60
- Configuration.for('test') {
61
- mode "spec"
62
- files Configuration.for("packaging").files.test
63
- options %w[ --format specdoc --color ]
64
- ruby_opts %w[ ]
65
- }
66
-
67
- #-----------------------------------------------------------------------
68
- # Rcov
69
- #-----------------------------------------------------------------------
70
- Configuration.for('rcov') {
71
- output_dir "coverage"
72
- libs %w[ lib ]
73
- rcov_opts %w[ --html ]
74
- ruby_opts %w[ ]
75
- test_files Configuration.for('packaging').files.test
76
- }
77
-
78
- #-----------------------------------------------------------------------
79
- # Rdoc
80
- #-----------------------------------------------------------------------
81
- Configuration.for('rdoc') {
82
- files Configuration.for('packaging').files.rdoc
83
- main_page files.first
84
- title Configuration.for('project').name
85
- options %w[ --line-numbers --inline-source ]
86
- output_dir "doc"
87
- }
88
-
89
- #-----------------------------------------------------------------------
90
- # Extensions
91
- #-----------------------------------------------------------------------
92
- Configuration.for('extension') {
93
- configs Configuration.for('packaging').files.ext.find_all { |x|
94
- %w[ mkrf_conf.rb extconf.rb ].include?( File.basename(x) )
95
- }
96
- }
97
- #-----------------------------------------------------------------------
98
- # Rubyforge
99
- #-----------------------------------------------------------------------
100
- Configuration.for('rubyforge') {
101
- project "copiousfreetime"
102
- user "jjh"
103
- host "rubyforge.org"
104
- rdoc_location "#{user}@#{host}:/var/www/gforge-projects/#{project}/stickler"
105
- }
106
-
107
-