echoe 2.5 → 2.6

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
 
2
+ v2.6. Unify pattern handling; changelog accessor, version accessor, expand paths of keys and certificates; support verbose (Rails-style) changelogs.
3
+
2
4
  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
5
 
4
6
  v2.4.1. Manifest doesn't require itself (willcodeforwork).
data/Manifest CHANGED
@@ -1,9 +1,8 @@
1
1
  TODO
2
- test/test_echoe.rb
3
2
  README
4
3
  Rakefile
5
4
  MIT-LICENSE
5
+ Manifest
6
6
  LICENSE
7
7
  lib/echoe.rb
8
8
  CHANGELOG
9
- Manifest
data/README CHANGED
@@ -47,7 +47,6 @@ This way Echoe can parse the latest version and changeset message automatically.
47
47
 
48
48
  Your <tt>Rakefile</tt> needs the following minimal contents:
49
49
 
50
- require 'rubygems'
51
50
  require 'echoe'
52
51
  Echoe.new('gem_name')
53
52
 
@@ -80,6 +79,8 @@ Packaging:
80
79
  Testing:
81
80
 
82
81
  * <tt>test</tt> - Run the test suite.
82
+ * <tt>compile</tt> - Compile C extensions, if available.
83
+ * <tt>clean</tt> - Clean up generated documentation, packaging, and build files.
83
84
  * <tt>install</tt> - Install the gem locally.
84
85
  * <tt>uninstall</tt> - Uninstall the gem.
85
86
 
@@ -18,6 +18,8 @@ Echoe includes some optional accessors for more advanced gem configuration.
18
18
 
19
19
  For example, a simple <tt>Rakefile</tt> might look like this:
20
20
 
21
+ require 'echoe'
22
+
21
23
  Echoe.new("uncapitalizer") do |p|
22
24
  p.author = "Evan Weaver"
23
25
  p.summary = "A library that uncapitalizes strings. It's awesome."
@@ -25,6 +27,8 @@ For example, a simple <tt>Rakefile</tt> might look like this:
25
27
  p.docs_host = "uncapitalizer.com:~/www/files/doc/"
26
28
  p.dependencies = ["string_tools >=1.4.0"]
27
29
  end
30
+
31
+ See below for the full list.
28
32
 
29
33
  == Signing gems
30
34
 
@@ -70,23 +74,24 @@ Versioning options:
70
74
 
71
75
  Common packaging options:
72
76
 
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>).
77
+ * <tt>dependencies</tt> - An array of dependencies for this gem. For example, <tt>['mongrel', 'rake >=0.7.1']</tt>.
78
+ * <tt>extension_pattern</tt> - A filename array, glob array, or regex for extension files that need to be run at install time. Defaults to <tt>"ext/**/extconf.rb"</tt>.
75
79
  * <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.
80
+ * <tt>test_pattern</tt> - A filename array, glob array, or regex for test runners. Overridden by <tt>"test/test_all.rb"</tt>, if it exists.
77
81
 
78
82
  Uncommon packaging options:
79
83
  * <tt>platform</tt> - What platform this gem is for.
80
- * <tt>manifest_name</tt> - The name of the manifest file (defaults to <tt>Manifest</tt>).
81
- * <tt>need_gem</tt> - Whether to generate a gem package (default <tt>true</tt>).
82
- * <tt>need_tar_gz</tt> - Whether to generate a <tt>.tar.gz</tt> package (default <tt>true</tt>).
83
- * <tt>need_tgz</tt> - Whether to generate a <tt>.tgz</tt> package (default <tt>false</tt>).
84
- * <tt>need_zip</tt> - Whether to generate a <tt>.zip</tt> package (default <tt>false</tt>).
85
- * <tt>include_rakefile</tt> - Include the Rakefile directly within the package. Default <tt>false</tt>.
86
- * <tt>include_gemspec</tt> - Include the generated gemspec file within the package. Default <tt>true</tt>.
87
- * <tt>ruby_version</tt> - Version string for which Ruby to require (for example, <tt>'>= 1.8.4'</tt>).
84
+ * <tt>manifest_name</tt> - The name of the manifest file. Defaults to <tt>Manifest</tt>.
85
+ * <tt>need_gem</tt> - Whether to generate a gem package. Defaults to <tt>true</tt>.
86
+ * <tt>need_tar_gz</tt> - Whether to generate a <tt>.tar.gz</tt> package. Defaults to <tt>true</tt>.
87
+ * <tt>need_tgz</tt> - Whether to generate a <tt>.tgz</tt> package. Defaults to <tt>false</tt>.
88
+ * <tt>need_zip</tt> - Whether to generate a <tt>.zip</tt> package. Defaults to <tt>false</tt>.
89
+ * <tt>include_rakefile</tt> - Include the Rakefile directly within the package. Defaults to <tt>false</tt>.
90
+ * <tt>include_gemspec</tt> - Include the generated gemspec file within the package. Defaults to <tt>true</tt>.
91
+ * <tt>ruby_version</tt> - Version string for which Ruby to require (for example, <tt>'>= 1.8.4'</tt>.
88
92
  * <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.
93
+ * <tt>ignore_pattern</tt> - A filename array, glob array, or regex for pathnames that should be ignored when building the manifest.
94
+ * <tt>executable_pattern</tt> - A filename array, glob array, or regex for files that should be installed as wrapped executables.
90
95
 
91
96
  Security options:
92
97
 
@@ -96,13 +101,13 @@ Security options:
96
101
 
97
102
  Publishing options:
98
103
 
99
- * <tt>project</tt> - The name of the Rubyforge project to upload to (defaults to the name of the gem).
100
- * <tt>docs_host</tt> - A host and filesystem path to publish the documentation to (defaults to the Rubyforge project).
104
+ * <tt>project</tt> - The name of the Rubyforge project to upload to. Defaults to the name of the gem.
105
+ * <tt>docs_host</tt> - A host and filesystem path to publish the documentation to. Defaults to the Rubyforge project.
101
106
 
102
107
  Documentation options:
103
108
 
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>.
105
- * <tt>rdoc_template</tt> - A path to an RDoc template (defaults to the generic template).
109
+ * <tt>rdoc_pattern</tt> - A filename array, glob array, or regex for filenames that should be passed to RDoc.
110
+ * <tt>rdoc_template</tt> - A path to an RDoc template. Defaults to the generic template.
106
111
 
107
112
  =end
108
113
 
@@ -124,48 +129,47 @@ class Echoe
124
129
  FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
125
130
 
126
131
  # user-configurable
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
132
+ attr_accessor :author, :changes, :clean_pattern, :description, :email, :dependencies, :need_tgz, :need_tar_gz, :need_gem, :need_zip, :rdoc_pattern, :project, :summary, :test_pattern, :url, :version, :docs_host, :rdoc_template, :manifest_name, :install_message, :extension_pattern, :private_key, :certificate_chain, :require_signed, :ruby_version, :platform, :ignore_pattern, :executable_pattern, :changelog
128
133
 
129
134
  # best left alone
130
- attr_accessor :name, :lib_files, :test_files, :bin_files, :spec, :rdoc_options, :rubyforge_name, :has_rdoc, :include_gemspec, :include_rakefile, :gemspec_name, :eval
135
+ attr_accessor :name, :lib_files, :test_files, :bin_files, :spec, :rdoc_options, :rubyforge_name, :has_rdoc, :include_gemspec, :include_rakefile, :gemspec_name, :eval, :files, :changelog_patterns
131
136
 
132
137
  # legacy
133
- attr_accessor :extra_deps, :rdoc_pattern
138
+ attr_accessor :extra_deps, :rdoc_files, :extensions
134
139
 
135
- def initialize(name, version = nil)
140
+ def initialize(name, _version = nil)
136
141
  # Defaults
137
142
 
138
143
  self.name = name
139
144
  self.project = name.downcase
145
+ self.changelog = "CHANGELOG"
140
146
  self.url = ""
141
147
  self.author = ""
142
148
  self.email = ""
143
- self.clean_pattern = ["pkg", "doc", "lib/*.#{Config::CONFIG['DLEXT']}", "ext/**/*.#{Config::CONFIG['DLEXT']}", ".config"]
149
+ self.clean_pattern = ["pkg", "doc", 'build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log', "ext/*.{bundle,so,obj,pdb,lib,def,exp}", "ext/Makefile", "ext/**/*.{bundle,so,obj,pdb,lib,def,exp}", "ext/**/Makefile", "pkg", "lib/*.bundle", "*.gem", ".config"]
144
150
  self.test_pattern = ['test/**/test_*.rb']
145
151
 
146
- self.version = if version
147
- version
148
- elsif File.exist? "CHANGELOG"
149
- open("CHANGELOG").read[/^\s*v([\d\.]+)\. /, 1]
150
- else
151
- raise "No version supplied in Rakefile"
152
- end
153
-
154
- self.changes = if File.exist? "CHANGELOG"
155
- open("CHANGELOG").read[/^\s*v([\d\.]+\. .*)/, 1]
156
- else
157
- ""
158
- end
159
-
152
+ self.changelog_patterns = {
153
+ :version => [
154
+ /^\s*v([\d\.]+)(\.|\s|$)/,
155
+ /\s*\*\s*([\d\.]+)\s*\*\s*$/
156
+ ],
157
+ :changes => [
158
+ /^\s*v([\d\.]+\. .*)/,
159
+ /\*\s*[\d\.]+\s*\*\s*(.*)\*\s*[\d\.]+\s*\*$/m
160
+ ]
161
+ }
162
+
160
163
  self.description = ""
161
164
  self.summary = ""
162
165
  self.install_message = nil
163
166
  self.has_rdoc = true
164
- self.rdoc_files = /^(lib|bin|tasks)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
167
+ self.rdoc_pattern = /^(lib|bin|tasks|ext)|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
168
+ self.executable_pattern = /^bin\//
165
169
  self.rdoc_options = ['--line-numbers', '--inline-source']
166
170
  self.dependencies = []
167
171
  self.manifest_name = "Manifest"
168
- self.extensions = "ext/**/extconf.rb"
172
+ self.extension_pattern = ["ext/**/extconf.rb", "ext/extconf.rb"]
169
173
  self.private_key = ENV['GEM_PRIVATE_KEY']
170
174
  self.require_signed = false
171
175
  self.certificate_chain = ENV['GEM_CERTIFICATE_CHAIN'].to_s.split(/\,\s*/).compact
@@ -178,23 +182,80 @@ class Echoe
178
182
  self.include_rakefile = false
179
183
  self.include_gemspec = true
180
184
  self.gemspec_name = "#{name}.gemspec"
181
-
185
+
182
186
  yield self if block_given?
187
+
188
+ # legacy compatibility
189
+ self.dependencies = extra_deps if extra_deps and dependencies.empty?
190
+ self.project = rubyforge_name if rubyforge_name
191
+ self.rdoc_pattern = rdoc_files if rdoc_files
192
+ self.extension_pattern = extensions if extensions
193
+
194
+ # read manifest
195
+ begin
196
+ self.files = File.read(manifest_name).split +
197
+ [(gemspec_name if include_gemspec)] +
198
+ [("Rakefile" if include_rakefile)]
199
+ self.files = files.compact.uniq
200
+ rescue Errno::ENOENT
201
+ unless ARGV.include? "manifest"
202
+ puts "Missing manifest. You can build one with 'rake manifest'."
203
+ exit
204
+ end
205
+ end
206
+
207
+ # snag version and changeset
208
+ self.version ||= _version
209
+ unless version
210
+ if File.exist? changelog
211
+ parsed = Array(changelog_patterns[:version]).map do |pattern|
212
+ open(changelog).read[pattern, 1]
213
+ end.compact.first
214
+ raise "Could not parse version from #{changelog}" unless parsed
215
+ self.version = parsed.chomp(".").strip
216
+ else
217
+ raise "No #{changelog} found, and no version supplied in Rakefile."
218
+ end
219
+ end
220
+
221
+ self.changes = if File.exist? changelog
222
+ Array(changelog_patterns[:changes]).map do |pattern|
223
+ open(changelog).read[pattern, 1]
224
+ end.compact.first or ""
225
+ else
226
+ ""
227
+ end
183
228
 
184
229
  # set some post-defaults
185
- self.certificate_chain = Array(certificate_chain)
230
+ self.certificate_chain = Array(certificate_chain).map {|file| File.expand_path(file)}
231
+ self.private_key = File.expand_path(private_key) if private_key
186
232
  self.description = summary if description.empty?
187
233
  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
190
-
191
- # legacy compatibility
192
- self.dependencies = extra_deps if extra_deps and dependencies.empty?
193
- self.project = rubyforge_name if rubyforge_name
194
- self.rdoc_files = rdoc_pattern if rdoc_pattern
234
+ self.clean_pattern = apply_pattern(clean_pattern)
235
+ self.extension_pattern = apply_pattern(extension_pattern, files)
236
+ self.ignore_pattern = apply_pattern(ignore_pattern)
237
+ self.rdoc_pattern = apply_pattern(rdoc_pattern, files)
238
+ self.executable_pattern = apply_pattern(executable_pattern, files)
239
+
195
240
 
196
241
  define_tasks
197
242
  end
243
+
244
+ def apply_pattern(pattern, files = nil)
245
+ files ||= Dir['**/**']
246
+ case pattern
247
+ when String, Array
248
+ files & (Array(pattern).map do |p|
249
+ Dir.glob(p)
250
+ end.flatten)
251
+ when Regexp
252
+ files.select do |file|
253
+ file =~ pattern
254
+ end
255
+ else
256
+ []
257
+ end
258
+ end
198
259
 
199
260
  def define_tasks
200
261
 
@@ -223,22 +284,20 @@ class Echoe
223
284
  s.add_dependency(*dep)
224
285
  end
225
286
 
226
- begin
227
- s.files = File.read(manifest_name).split
228
- s.files += [gemspec_name] if include_gemspec
229
- s.files += ["Rakefile"] if include_rakefile
230
- s.files.uniq! # not really necessary
231
- rescue Errno::ENOENT
232
- unless ARGV.include? "manifest"
233
- puts "Missing manifest. You can build one with 'rake manifest'."
234
- exit
235
- end
287
+ s.files = files
288
+
289
+ s.bindir = if executable_pattern.any?
290
+ executable_pattern[0].split("/")[0]
291
+ else
292
+ "bin"
236
293
  end
237
- s.executables = s.files.grep(/bin/) { |f| File.basename(f) }
238
-
239
- s.bindir = "bin"
294
+
295
+ s.executables = executable_pattern.map do |file|
296
+ file[(s.bindir.length)..-1]
297
+ end
298
+
240
299
  dirs = Dir['{lib,ext}']
241
- s.extensions = extensions if extensions.any?
300
+ s.extensions = extension_pattern if extension_pattern.any?
242
301
  s.require_paths = dirs unless dirs.empty?
243
302
  s.has_rdoc = has_rdoc
244
303
 
@@ -356,10 +415,10 @@ class Echoe
356
415
  directory "lib"
357
416
  end
358
417
 
359
- if extensions.any?
418
+ if extension_pattern.any?
360
419
 
361
420
  task :compile => [:lib] do
362
- extensions.each do |extension|
421
+ extension_pattern.each do |extension|
363
422
  directory = File.dirname(extension)
364
423
  Dir.chdir(directory) do
365
424
  ruby File.basename(extension)
@@ -383,17 +442,7 @@ class Echoe
383
442
 
384
443
  rd.rdoc_dir = 'doc'
385
444
 
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
-
445
+ files = rdoc_pattern
397
446
  files -= [manifest_name]
398
447
 
399
448
  rd.rdoc_files.push(*files)
@@ -489,13 +538,10 @@ class Echoe
489
538
  desc 'Clean up auto-generated files'
490
539
  task :clean do
491
540
  puts "Cleaning"
492
- clean_pattern.each do |pattern|
493
- files = Dir[pattern]
494
- files.each do |file|
495
- if File.exist?(file)
496
- puts "- #{file}"
497
- rm_rf file
498
- end
541
+ clean_pattern.each do |file|
542
+ if File.exist?(file)
543
+ puts "- #{file}"
544
+ rm_rf file
499
545
  end
500
546
  end
501
547
  end
@@ -504,6 +550,8 @@ class Echoe
504
550
 
505
551
  desc "Build a Manifest list"
506
552
  task :manifest => [:clean] do
553
+ puts "Building Manifest"
554
+ old_files = files
507
555
  files = []
508
556
  Find.find '.' do |file|
509
557
  file = file[2..-1]
@@ -520,7 +568,9 @@ class Echoe
520
568
  files.uniq!
521
569
 
522
570
  File.open(manifest_name, 'w').puts(files)
523
- puts(files)
571
+ puts(files.map do |file|
572
+ (old_files.include?(file) ? " " : "+") + " " + file
573
+ end)
524
574
  end
525
575
 
526
576
  task :build_manifest => [:manifest]
@@ -533,7 +583,7 @@ class Echoe
533
583
  ruby(if File.exist? 'test/test_all.rb'
534
584
  "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
535
585
  else
536
- tests = test_pattern.map { |g| Dir.glob(g) }.flatten << 'test/unit'
586
+ tests = apply_pattern(test_pattern) << 'test/unit'
537
587
  tests.map! {|f| %Q(require "#{f}")}
538
588
  "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
539
589
  end)
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.5"
7
- date: 2007-09-22 00:00:00 -04:00
6
+ version: "2.6"
7
+ date: 2007-09-24 00:00:00 -04:00
8
8
  summary: A tool for packaging Ruby gems.
9
9
  require_paths:
10
10
  - lib
@@ -52,16 +52,15 @@ authors:
52
52
  - Evan Weaver
53
53
  files:
54
54
  - TODO
55
- - test/test_echoe.rb
56
55
  - README
57
56
  - Rakefile
58
57
  - MIT-LICENSE
58
+ - Manifest
59
59
  - LICENSE
60
60
  - lib/echoe.rb
61
61
  - CHANGELOG
62
- - Manifest
63
- test_files:
64
- - test/test_echoe.rb
62
+ test_files: []
63
+
65
64
  rdoc_options: []
66
65
 
67
66
  extra_rdoc_files: []
metadata.gz.sig CHANGED
Binary file
@@ -1,20 +0,0 @@
1
-
2
- require 'test/unit/testcase'
3
- require 'echoe'
4
-
5
- $rakefile = nil # Avoids a warning in rdoctask.rb
6
-
7
- class TestEchoe < Test::Unit::TestCase
8
- def setup
9
- Rake.application.clear
10
- end
11
-
12
- def test_basics
13
- expected = ["announce", "blah.gemspec", "build_gemspec", "build_manifest", "clean", "clobber", "clobber_docs", "clobber_package", "default", "doc", "doc/index.html", "docs", "gem", "install", "manifest", "package", "pkg", "pkg/blah-1.0.0", "pkg/blah-1.0.0.gem", "pkg/blah-1.0.0.tar.gz", "publish_docs", "redocs", "release", "repackage", "test", "uninstall"]
14
-
15
- Echoe.new('blah', '1.0.0')
16
- tasks = Rake.application.tasks.map { |t| t.name }
17
- assert((expected - tasks).empty?)
18
- assert((tasks - expected).empty?)
19
- end
20
- end