echoe 2.4.1 → 2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data.tar.gz.sig +0 -0
  2. data/CHANGELOG +2 -0
  3. data/README +2 -2
  4. data/lib/echoe.rb +95 -38
  5. metadata +2 -2
  6. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v2.5. Add some extension building tasks; adjust clean behavior; rdoc inclusions definitely depend on Manifest now; ruby_version accessor; ignore_pattern for skipping files during the manifest build; bugfixes.
3
+
2
4
  v2.4.1. Manifest doesn't require itself (willcodeforwork).
3
5
 
4
6
  v2.4. Sign gems automatically if ENV['GEM_PRIVATE_KEY'] is present; add certificate_chain and private_key accessors.
data/README CHANGED
@@ -28,13 +28,13 @@ The public certificate for this gem is at http://rubyforge.org/frs/download.php/
28
28
  Organize your gem according to the usual structure:
29
29
 
30
30
  lib/
31
- bin/
32
- ext/
33
31
  README
34
32
  LICENSE
35
33
  CHANGELOG
36
34
  Rakefile
37
35
 
36
+ You can add the <tt>bin/</tt> or <tt>ext/</tt> folders if you have executables or extensions, respectively.
37
+
38
38
  Your <tt>CHANGELOG</tt> should be formatted as follows (including newlines):
39
39
 
40
40
  v2.1. newest change
data/lib/echoe.rb CHANGED
@@ -68,17 +68,25 @@ Versioning options:
68
68
  * <tt>version</tt> - A string for the version number. Parsed from CHANGELOG otherwise.
69
69
  * <tt>changes</tt> - A string describing the most recent changes. Parsed from CHANGELOG otherwise.
70
70
 
71
- Packaging options:
71
+ Common packaging options:
72
72
 
73
73
  * <tt>dependencies</tt> - An array of dependencies for this gem, in 'gem_name [= version]' format.
74
+ * <tt>extensions</tt> - Any extension files that need to be run at install time (defaults to <tt>"ext/**/extconf.rb"</tt>).
75
+ * <tt>clean_pattern</tt> - A filename array, glob array, or regex for files that should be removed when <tt>rake clean</tt> is run.
76
+ * <tt>test_pattern</tt> - A filename array, glob array, or regex for test runners. Defaults to <tt>"test/test_all.rb"</tt> if it exists.
77
+
78
+ Uncommon packaging options:
79
+ * <tt>platform</tt> - What platform this gem is for.
74
80
  * <tt>manifest_name</tt> - The name of the manifest file (defaults to <tt>Manifest</tt>).
75
81
  * <tt>need_gem</tt> - Whether to generate a gem package (default <tt>true</tt>).
76
82
  * <tt>need_tar_gz</tt> - Whether to generate a <tt>.tar.gz</tt> package (default <tt>true</tt>).
77
83
  * <tt>need_tgz</tt> - Whether to generate a <tt>.tgz</tt> package (default <tt>false</tt>).
78
84
  * <tt>need_zip</tt> - Whether to generate a <tt>.zip</tt> package (default <tt>false</tt>).
79
- * <tt>extensions</tt> - Any extension files that need to be executed (defaults to <tt>"ext/extconf.rb"</tt> if it exists).
85
+ * <tt>include_rakefile</tt> - Include the Rakefile directly within the package. Default <tt>false</tt>.
80
86
  * <tt>include_gemspec</tt> - Include the generated gemspec file within the package. Default <tt>true</tt>.
81
- * <tt>include_rakefile</tt> - Include the Rakefile within the package. Default <tt>false</tt>.
87
+ * <tt>ruby_version</tt> - Version string for which Ruby to require (for example, <tt>'>= 1.8.4'</tt>).
88
+ * <tt>eval</tt> - Accepts a proc to be evaluated in the context of the Gem::Specification object. This allows you to set more unusual gemspec options.
89
+ * <tt>ignore_pattern</tt> - A regex for pathnames that should be ignored when building the manifest.
82
90
 
83
91
  Security options:
84
92
 
@@ -93,7 +101,7 @@ Publishing options:
93
101
 
94
102
  Documentation options:
95
103
 
96
- * <tt>rdoc_files</tt> - An array or regex for filenames that should be passed to RDoc.
104
+ * <tt>rdoc_files</tt> - A filename array, glob array, or regex for filenames that should be passed to RDoc. Also can be referred to as <tt>rdoc_pattern</tt>.
97
105
  * <tt>rdoc_template</tt> - A path to an RDoc template (defaults to the generic template).
98
106
 
99
107
  =end
@@ -116,7 +124,7 @@ class Echoe
116
124
  FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
117
125
 
118
126
  # user-configurable
119
- attr_accessor :author, :changes, :clean_pattern, :description, :email, :dependencies, :need_tgz, :need_tar_gz, :need_gem, :need_zip, :rdoc_files, :project, :summary, :test_pattern, :url, :version, :docs_host, :rdoc_template, :manifest_name, :install_message, :extensions, :private_key, :certificate_chain, :require_signed
127
+ attr_accessor :author, :changes, :clean_pattern, :description, :email, :dependencies, :need_tgz, :need_tar_gz, :need_gem, :need_zip, :rdoc_files, :project, :summary, :test_pattern, :url, :version, :docs_host, :rdoc_template, :manifest_name, :install_message, :extensions, :private_key, :certificate_chain, :require_signed, :ruby_version, :platform, :ignore_pattern
120
128
 
121
129
  # best left alone
122
130
  attr_accessor :name, :lib_files, :test_files, :bin_files, :spec, :rdoc_options, :rubyforge_name, :has_rdoc, :include_gemspec, :include_rakefile, :gemspec_name, :eval
@@ -132,7 +140,7 @@ class Echoe
132
140
  self.url = ""
133
141
  self.author = ""
134
142
  self.email = ""
135
- self.clean_pattern = %w(diff diff.txt email.txt ri *.gem **/*~)
143
+ self.clean_pattern = ["pkg", "doc", "lib/*.#{Config::CONFIG['DLEXT']}", "ext/**/*.#{Config::CONFIG['DLEXT']}", ".config"]
136
144
  self.test_pattern = ['test/**/test_*.rb']
137
145
 
138
146
  self.version = if version
@@ -153,11 +161,11 @@ class Echoe
153
161
  self.summary = ""
154
162
  self.install_message = nil
155
163
  self.has_rdoc = true
156
- self.rdoc_files = /^(lib|bin|tasks)|^README|^CHANGELOG|^TODO|^LICENSE$/
164
+ self.rdoc_files = /^(lib|bin|tasks)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
157
165
  self.rdoc_options = ['--line-numbers', '--inline-source']
158
166
  self.dependencies = []
159
167
  self.manifest_name = "Manifest"
160
- self.extensions = ["ext/extconf.rb"] if File.exist?("ext/extconf.rb")
168
+ self.extensions = "ext/**/extconf.rb"
161
169
  self.private_key = ENV['GEM_PRIVATE_KEY']
162
170
  self.require_signed = false
163
171
  self.certificate_chain = ENV['GEM_CERTIFICATE_CHAIN'].to_s.split(/\,\s*/).compact
@@ -177,6 +185,8 @@ class Echoe
177
185
  self.certificate_chain = Array(certificate_chain)
178
186
  self.description = summary if description.empty?
179
187
  self.summary = description if summary.empty?
188
+ self.clean_pattern = Array(clean_pattern) if clean_pattern
189
+ self.extensions = Array(extensions).map {|ext| Dir[ext]}.flatten
180
190
 
181
191
  # legacy compatibility
182
192
  self.dependencies = extra_deps if extra_deps and dependencies.empty?
@@ -199,22 +209,15 @@ class Echoe
199
209
  s.homepage = url
200
210
  s.rubyforge_project = project
201
211
  s.post_install_message = install_message if install_message
202
-
212
+ s.description = description
213
+ s.required_ruby_version = ruby_version
214
+ s.platform = platform if platform
215
+
203
216
  if private_key and File.exist? private_key
204
217
  s.signing_key = private_key
205
218
  s.cert_chain = certificate_chain
206
- puts "Signing gem."
207
- puts "Certificate chain is:"
208
- certificate_chain.each do |cert|
209
- puts " #{cert}"
210
- end
211
- else
212
- puts "Missing private key; gem will not be signed."
213
- raise "Signed gem required. Maybe you forget to set ENV['GEM_PRIVATE_KEY']." if require_signed
214
219
  end
215
220
 
216
- s.description = description
217
-
218
221
  dependencies.each do |dep|
219
222
  dep = dep.split(" ") if dep.is_a? String
220
223
  s.add_dependency(*dep)
@@ -235,7 +238,7 @@ class Echoe
235
238
 
236
239
  s.bindir = "bin"
237
240
  dirs = Dir['{lib,ext}']
238
- s.extensions = Array(extensions) if extensions
241
+ s.extensions = extensions if extensions.any?
239
242
  s.require_paths = dirs unless dirs.empty?
240
243
  s.has_rdoc = has_rdoc
241
244
 
@@ -246,7 +249,7 @@ class Echoe
246
249
  end
247
250
 
248
251
  if eval
249
- self.instance_eval &eval
252
+ s.instance_eval &eval
250
253
  end
251
254
 
252
255
  end
@@ -294,16 +297,24 @@ class Echoe
294
297
  if include_gemspec and File.exist? gemspec_name
295
298
  File.delete gemspec_name
296
299
  end
300
+
301
+ # Test signing status
302
+ if private_key and File.exist? private_key
303
+ puts "Signing gem."
304
+ else
305
+ raise "Key required, but not found. Maybe you forget to set ENV['GEM_PRIVATE_KEY']?" if require_signed
306
+ puts "Private key not found; gem will not be signed."
307
+ end
297
308
  end
298
309
 
299
310
  desc 'Install the gem'
300
311
  task :install => [:clean, :package] do
301
- sh "sudo gem install pkg/*.gem -P MediumSecurity"
312
+ system "sudo gem install pkg/*.gem -P MediumSecurity"
302
313
  end
303
314
 
304
315
  desc 'Uninstall the gem'
305
316
  task :uninstall do
306
- sh "sudo gem uninstall #{name} -a -i -x"
317
+ system "sudo gem uninstall #{name} -a -i -x"
307
318
  end
308
319
 
309
320
  desc 'Package and upload the release to Rubyforge'
@@ -339,6 +350,31 @@ class Echoe
339
350
 
340
351
  end
341
352
 
353
+ ### Extension building
354
+
355
+ task :lib do
356
+ directory "lib"
357
+ end
358
+
359
+ if extensions.any?
360
+
361
+ task :compile => [:lib] do
362
+ extensions.each do |extension|
363
+ directory = File.dirname(extension)
364
+ Dir.chdir(directory) do
365
+ ruby File.basename(extension)
366
+ system(PLATFORM =~ /win32/ ? 'nmake' : 'make')
367
+ end
368
+ Dir["#{directory}/*.#{Config::CONFIG['DLEXT']}"].each do |file|
369
+ cp file, "lib"
370
+ end
371
+ end
372
+ end
373
+
374
+ task :test => [:compile]
375
+
376
+ end
377
+
342
378
  ### Documentation
343
379
 
344
380
  Rake::RDocTask.new(:docs) do |rd|
@@ -347,13 +383,18 @@ class Echoe
347
383
 
348
384
  rd.rdoc_dir = 'doc'
349
385
 
350
- files = (if rdoc_files.is_a? Array
351
- rdoc_files
352
- elsif rdoc_pattern.is_a? Regexp
353
- spec.files.grep(rdoc_pattern).uniq
354
- else
355
- []
356
- end) - [manifest_name]
386
+ files = case rdoc_files
387
+ when Array
388
+ rdoc_files.map do |pattern|
389
+ Dir[pattern].select { |file| spec.files.include? file }
390
+ end.flatten
391
+ when Regexp
392
+ spec.files.grep(rdoc_files).uniq
393
+ else
394
+ []
395
+ end
396
+
397
+ files -= [manifest_name]
357
398
 
358
399
  rd.rdoc_files.push(*files)
359
400
 
@@ -387,7 +428,9 @@ class Echoe
387
428
  super
388
429
  rescue
389
430
  # project directory probably doesn't exist, transfer as a whole
390
- sh("scp -qr #{local_dir} #{host}:#{remote_dir}")
431
+ cmd = "scp -qr #{local_dir} #{host}:#{remote_dir}"
432
+ puts "Uploading: #{cmd}"
433
+ system(cmd)
391
434
  end
392
435
  end
393
436
  end
@@ -396,8 +439,15 @@ class Echoe
396
439
  # you may need ssh keys configured for this to work
397
440
  host, dir = docs_host.split(":")
398
441
  dir.chomp!("/")
399
- sh("ssh #{host} 'rm -rf #{dir}/#{remote_dir_name}'") # XXX too dangerous?
400
- sh("scp -qr #{local_dir} #{host}:#{dir}/#{remote_dir_name}")
442
+
443
+ # XXX too dangerous?
444
+ cmd = "ssh #{host} 'rm -rf #{dir}/#{remote_dir_name}'"
445
+ puts "Deleting existing docs: #{cmd}"
446
+ system(cmd)
447
+
448
+ cmd = "scp -qr #{local_dir} #{host}:#{dir}/#{remote_dir_name}"
449
+ puts "Uploading: #{cmd}"
450
+ system(cmd)
401
451
  end
402
452
  end
403
453
 
@@ -436,23 +486,30 @@ class Echoe
436
486
 
437
487
  ### Clean
438
488
 
439
- desc 'Delete the generated documentation and packages'
440
- task :clean => [ :clobber_docs, :clobber_package ] do
489
+ desc 'Clean up auto-generated files'
490
+ task :clean do
491
+ puts "Cleaning"
441
492
  clean_pattern.each do |pattern|
442
493
  files = Dir[pattern]
443
- rm_rf files unless files.empty?
494
+ files.each do |file|
495
+ if File.exist?(file)
496
+ puts "- #{file}"
497
+ rm_rf file
498
+ end
499
+ end
444
500
  end
445
501
  end
446
502
 
447
503
  ### Manifest
448
504
 
449
505
  desc "Build a Manifest list"
450
- task :manifest do
506
+ task :manifest => [:clean] do
451
507
  files = []
452
508
  Find.find '.' do |file|
453
509
  file = file[2..-1]
454
510
  next unless file
455
- next if file =~ /^(pkg|doc)|\.svn|CVS|\.bzr|\.DS/
511
+ next if file =~ /^(pkg|doc)|\.svn|CVS|\.bzr|\.DS|\.git/
512
+ next if file =~ ignore_pattern and ignore_pattern
456
513
  next if File.directory?(file)
457
514
  next if !include_rakefile and file == "Rakefile"
458
515
  files << file
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: echoe
5
5
  version: !ruby/object:Gem::Version
6
- version: 2.4.1
7
- date: 2007-09-21 00:00:00 -04:00
6
+ version: "2.5"
7
+ date: 2007-09-22 00:00:00 -04:00
8
8
  summary: A tool for packaging Ruby gems.
9
9
  require_paths:
10
10
  - lib
metadata.gz.sig CHANGED
Binary file