echoe 2 → 2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +8 -6
- data/README +32 -9
- data/Rakefile +6 -6
- data/lib/echoe.rb +73 -49
- data/test/test_echoe.rb +5 -9
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
|
2
|
-
v2.
|
2
|
+
v2.1. Adjust default RDoc include pattern; extra_deps now dependencies; rubyforge_name now project; support install messages; manifest instead of build_manifest.
|
3
3
|
|
4
|
-
|
4
|
+
v2. Support documentation hosts other than rubyforge; switch to Snax-style gem versioning; auto-load CHANGELOG contents; remove bin/echoe which doesn't work anyway. Incompatible changes.
|
5
5
|
|
6
|
-
v1.
|
6
|
+
v1.4. Auto-detect readme file; make rdoc default pattern compatible with manifest generator; fix publish_docs task.
|
7
7
|
|
8
|
-
v1.
|
8
|
+
v1.3. Avoid rubyforge gem multi-activation conflict.
|
9
9
|
|
10
|
-
v1.
|
10
|
+
v1.2. build_manifest Rake task.
|
11
11
|
|
12
|
-
v1.
|
12
|
+
v1.1. Sane error messages on releasing new or duplicate gems; allow Manifest to not end in .txt.
|
13
|
+
|
14
|
+
v1.0.0. Fork from Hoe.
|
data/README
CHANGED
@@ -7,9 +7,22 @@ Echoe is a simple tool for working with Rubygems. It generates Rake tasks for do
|
|
7
7
|
|
8
8
|
Copyright 2007 Cloudburst, LLC. See included LICENSE file. Portions copyright 2006 Ryan Davis, Zen Spider Software, and used with permission. See included MIT-LICENSE file.
|
9
9
|
|
10
|
-
==
|
10
|
+
== Features
|
11
11
|
|
12
|
-
|
12
|
+
* simple configuration
|
13
|
+
* comprehensive gem deployment
|
14
|
+
* automatic changeset parsing
|
15
|
+
* documentation upload to any host
|
16
|
+
|
17
|
+
= Usage
|
18
|
+
|
19
|
+
== Installation
|
20
|
+
|
21
|
+
sudo gem install echoe
|
22
|
+
|
23
|
+
== Project configuration
|
24
|
+
|
25
|
+
Organize your gem according to the usual structure:
|
13
26
|
|
14
27
|
lib/
|
15
28
|
bin/
|
@@ -31,19 +44,25 @@ This way Echoe can parse the latest version and changeset message automatically.
|
|
31
44
|
|
32
45
|
Your <tt>Rakefile</tt> needs the following minimal contents:
|
33
46
|
|
34
|
-
require
|
35
|
-
require
|
36
|
-
Echoe.new(
|
47
|
+
require 'rubygems'
|
48
|
+
require 'echoe'
|
49
|
+
Echoe.new('gem_name')
|
37
50
|
|
38
51
|
More advanced configuration is described in the Echoe class.
|
39
52
|
|
40
53
|
== Deploying your gem
|
41
54
|
|
42
|
-
|
55
|
+
First, run <tt>rubyforge setup</tt> and <tt>rubyforge config</tt> if you haven't already. Make sure your Rubyforge password is correctly set.
|
43
56
|
|
44
|
-
|
45
|
-
|
57
|
+
Now, to deploy the gem and documentation:
|
58
|
+
|
59
|
+
rake manifest
|
46
60
|
rake release
|
61
|
+
rake publish_docs
|
62
|
+
|
63
|
+
Once you've built your manifest, you only need to rebuild it if you add or remove files from the package structure.
|
64
|
+
|
65
|
+
= Extras
|
47
66
|
|
48
67
|
== All Rake tasks
|
49
68
|
|
@@ -51,7 +70,7 @@ The following tasks are made available to your gem.
|
|
51
70
|
|
52
71
|
Packaging:
|
53
72
|
|
54
|
-
* <tt>
|
73
|
+
* <tt>manifest</tt> - Build a manifest list.
|
55
74
|
* <tt>docs</tt> - Build the documentation.
|
56
75
|
* <tt>package</tt> - Build all the packages.
|
57
76
|
|
@@ -72,3 +91,7 @@ Cleaning:
|
|
72
91
|
* <tt>redocs</tt> - Force a rebuild of the Rdoc files.
|
73
92
|
* <tt>repackage</tt> - Force a rebuild of the package files.
|
74
93
|
|
94
|
+
== Further resources
|
95
|
+
|
96
|
+
* http://blog.evanweaver.com/pages/code#echoe
|
97
|
+
* http://rubyforge.org/forum/forum.php?forum_id=13986
|
data/Rakefile
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
require 'lib/echoe'
|
3
3
|
|
4
4
|
Echoe.new('echoe') do |p|
|
5
|
-
p.
|
6
|
-
p.author =
|
7
|
-
p.summary =
|
8
|
-
p.url =
|
9
|
-
p.docs_host =
|
10
|
-
p.
|
5
|
+
p.project = 'fauna'
|
6
|
+
p.author = 'Evan Weaver'
|
7
|
+
p.summary = 'A tool for packaging Ruby gems.'
|
8
|
+
p.url = 'http://blog.evanweaver.com/pages/code#echoe'
|
9
|
+
p.docs_host = 'blog.evanweaver.com:~/www/snax/public/files/doc/'
|
10
|
+
p.dependencies = ['rake', 'rubyforge >= 0.4.0', 'highline']
|
11
11
|
end
|
12
12
|
|
data/lib/echoe.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'rubygems'
|
3
3
|
require 'rake'
|
4
|
+
require 'rake/clean'
|
4
5
|
require 'rake/contrib/sshpublisher'
|
5
6
|
require 'rake/gempackagetask'
|
6
7
|
require 'rake/rdoctask'
|
@@ -17,15 +18,15 @@ Echoe includes some optional accessors for more advanced gem configuration.
|
|
17
18
|
For example, Echoe's own <tt>Rakefile</tt> looks like this:
|
18
19
|
|
19
20
|
Echoe.new('echoe') do |p|
|
20
|
-
p.
|
21
|
-
p.author =
|
22
|
-
p.summary =
|
23
|
-
p.url =
|
24
|
-
p.docs_host =
|
25
|
-
p.
|
21
|
+
p.project = 'fauna'
|
22
|
+
p.author = 'Evan Weaver'
|
23
|
+
p.summary = 'A tool for packaging Ruby gems.'
|
24
|
+
p.url = 'http://blog.evanweaver.com/pages/code#echoe'
|
25
|
+
p.docs_host = 'blog.evanweaver.com:~/www/snax/public/files/doc/'
|
26
|
+
p.dependencies = ['rake', 'rubyforge >= 0.4.0', 'highline']
|
26
27
|
end
|
27
28
|
|
28
|
-
==
|
29
|
+
== Accessor options
|
29
30
|
|
30
31
|
Descriptive options:
|
31
32
|
|
@@ -34,15 +35,16 @@ Descriptive options:
|
|
34
35
|
* <tt>description</tt> - A more detailed description of the library.
|
35
36
|
* <tt>summary</tt> - A shorter description of the library.
|
36
37
|
* <tt>url</tt> - A url for the library.
|
38
|
+
* <tt>install_message</tt> - A message to display after the gem is installed.
|
37
39
|
|
38
|
-
|
40
|
+
Versioning options:
|
39
41
|
|
40
42
|
* <tt>version</tt> - A string for the version number. Parsed from CHANGELOG otherwise.
|
41
43
|
* <tt>changes</tt> - A string describing the most recent changes. Parsed from CHANGELOG otherwise.
|
42
44
|
|
43
45
|
Packaging options:
|
44
46
|
|
45
|
-
* <tt>
|
47
|
+
* <tt>dependencies</tt> - An array of dependencies for this gem, in 'gem_name [= version]' format.
|
46
48
|
* <tt>manifest_name</tt> - The name of the manifest file (defaults to <tt>Manifest</tt>).
|
47
49
|
* <tt>need_tar</tt> - Whether to generate a <tt>.tgz</tt> package (default <tt>false</tt>).
|
48
50
|
* <tt>need_tar_gz</tt> - Whether to generate a <tt>.tar.gz</tt> package (default <tt>true</tt>).
|
@@ -50,7 +52,7 @@ Packaging options:
|
|
50
52
|
|
51
53
|
Publishing options:
|
52
54
|
|
53
|
-
* <tt>
|
55
|
+
* <tt>project</tt> - The name of the Rubyforge project to upload to (defaults to the name of the gem).
|
54
56
|
* <tt>docs_host</tt> - A host and path to publish the documentation to (defaults to the Rubyforge project).
|
55
57
|
|
56
58
|
Documentation options:
|
@@ -78,21 +80,24 @@ class Echoe
|
|
78
80
|
FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
|
79
81
|
|
80
82
|
# user-configurable
|
81
|
-
attr_accessor :author, :changes, :clean_pattern, :description, :email, :
|
83
|
+
attr_accessor :author, :changes, :clean_pattern, :description, :email, :dependencies, :need_tar, :need_tar_gz, :need_zip, :rdoc_pattern, :project, :summary, :test_pattern, :url, :version, :docs_host, :rdoc_template, :manifest_name, :install_message
|
82
84
|
|
83
85
|
# best left alone
|
84
|
-
attr_accessor :lib_files, :test_files, :bin_files, :spec
|
86
|
+
attr_accessor :name, :lib_files, :test_files, :bin_files, :spec, :rdoc_options, :rubyforge_name
|
87
|
+
|
88
|
+
# legacy
|
89
|
+
attr_accessor :extra_deps
|
85
90
|
|
86
91
|
def initialize(name, version = nil)
|
87
92
|
# Defaults
|
88
93
|
|
89
94
|
self.name = name
|
90
|
-
self.
|
95
|
+
self.project = name.downcase
|
91
96
|
self.url = ""
|
92
97
|
self.author = ""
|
93
98
|
self.email = ""
|
94
99
|
self.clean_pattern = %w(diff diff.txt email.txt ri *.gem **/*~)
|
95
|
-
self.
|
100
|
+
self.test_pattern = ['test/**/test_*.rb']
|
96
101
|
|
97
102
|
self.version = if version
|
98
103
|
version
|
@@ -110,8 +115,10 @@ class Echoe
|
|
110
115
|
|
111
116
|
self.description = ""
|
112
117
|
self.summary = ""
|
113
|
-
self.
|
114
|
-
self.
|
118
|
+
self.install_message = nil
|
119
|
+
self.rdoc_pattern = /^(lib|bin|tasks)|^README|^CHANGELOG|^TODO|^LICENSE$/
|
120
|
+
self.rdoc_options = ['--line-numbers', '--inline-source']
|
121
|
+
self.dependencies = []
|
115
122
|
self.manifest_name = "Manifest"
|
116
123
|
|
117
124
|
self.need_tar = false
|
@@ -119,21 +126,22 @@ class Echoe
|
|
119
126
|
self.need_zip = false
|
120
127
|
|
121
128
|
yield self if block_given?
|
129
|
+
|
130
|
+
# set some post-defaults
|
131
|
+
self.description = summary if description.empty?
|
132
|
+
self.summary = description if summary.empty?
|
133
|
+
|
134
|
+
# legacy compatibility
|
135
|
+
self.dependencies = extra_deps if extra_deps and dependencies.empty?
|
136
|
+
self.project = rubyforge_name if rubyforge_name
|
122
137
|
|
123
138
|
define_tasks
|
124
139
|
end
|
125
140
|
|
126
141
|
def define_tasks
|
127
|
-
task :default => :test
|
128
|
-
|
129
|
-
desc 'Run the test suite'
|
130
|
-
task :test do
|
131
|
-
run_tests
|
132
|
-
end
|
133
|
-
|
134
|
-
############################################################
|
135
|
-
# Packaging and Installing
|
136
142
|
|
143
|
+
### Packaging and Installing
|
144
|
+
|
137
145
|
self.spec = Gem::Specification.new do |s|
|
138
146
|
s.name = name
|
139
147
|
s.version = version
|
@@ -141,11 +149,12 @@ class Echoe
|
|
141
149
|
s.author = Array(author).join(", ")
|
142
150
|
s.email = email
|
143
151
|
s.homepage = url
|
144
|
-
s.rubyforge_project =
|
152
|
+
s.rubyforge_project = project
|
153
|
+
s.post_install_message = install_message if install_message
|
145
154
|
|
146
155
|
s.description = description
|
147
156
|
|
148
|
-
|
157
|
+
dependencies.each do |dep|
|
149
158
|
dep = dep.split(" ") if dep.is_a? String
|
150
159
|
s.add_dependency(*dep)
|
151
160
|
end
|
@@ -165,7 +174,7 @@ class Echoe
|
|
165
174
|
if File.exist? "test/test_all.rb"
|
166
175
|
s.test_file = "test/test_all.rb"
|
167
176
|
else
|
168
|
-
s.test_files = Dir[*
|
177
|
+
s.test_files = Dir[*test_pattern]
|
169
178
|
end
|
170
179
|
|
171
180
|
end
|
@@ -219,20 +228,23 @@ class Echoe
|
|
219
228
|
self.version = self.version.ljust(3)
|
220
229
|
|
221
230
|
begin
|
222
|
-
rf.add_release
|
231
|
+
rf.add_release project, name, version, *files
|
223
232
|
rescue NoMethodError
|
224
233
|
end
|
225
234
|
end
|
226
235
|
|
227
236
|
end
|
237
|
+
|
238
|
+
### RDoc
|
228
239
|
|
229
240
|
Rake::RDocTask.new(:docs) do |rd|
|
230
241
|
rd.main = Dir['*'].detect {|f| f =~ /^readme/i}
|
231
|
-
rd.options
|
242
|
+
rd.options += Array(rdoc_options)
|
243
|
+
|
232
244
|
rd.rdoc_dir = 'doc'
|
233
245
|
|
234
246
|
files = (spec.files.grep(rdoc_pattern) - [manifest_name]).uniq
|
235
|
-
rd.rdoc_files.push
|
247
|
+
rd.rdoc_files.push(*files)
|
236
248
|
|
237
249
|
if rdoc_template
|
238
250
|
rd.template = rdoc_template
|
@@ -243,20 +255,22 @@ class Echoe
|
|
243
255
|
title = name.downcase == name ? name.capitalize : name
|
244
256
|
rd.options << "-t #{title}"
|
245
257
|
end
|
258
|
+
|
259
|
+
task :doc => [:redocs]
|
246
260
|
|
247
261
|
desc "Publish documentation to #{docs_host ? "'#{docs_host}'" : "rubyforge"}"
|
248
262
|
task :publish_docs => [:clean, :docs] do
|
249
263
|
|
250
264
|
local_dir = 'doc'
|
251
|
-
remote_dir_name =
|
252
|
-
remote_dir_name += "/#{name}" if
|
265
|
+
remote_dir_name = project
|
266
|
+
remote_dir_name += "/#{name}" if project != name
|
253
267
|
|
254
268
|
unless docs_host
|
255
269
|
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
256
270
|
pub = Rake::SshDirPublisher.new "#{config["username"]}@rubyforge.org",
|
257
271
|
"/var/www/gforge-projects/#{remote_dir_name}",
|
258
272
|
local_dir
|
259
|
-
if
|
273
|
+
if project != name then
|
260
274
|
def pub.upload
|
261
275
|
begin
|
262
276
|
super
|
@@ -275,8 +289,8 @@ class Echoe
|
|
275
289
|
sh("scp -qr #{local_dir} #{host}:#{dir}/#{remote_dir_name}")
|
276
290
|
end
|
277
291
|
end
|
278
|
-
|
279
|
-
|
292
|
+
|
293
|
+
### Clean
|
280
294
|
|
281
295
|
desc 'Delete the generated documentation and packages'
|
282
296
|
task :clean => [ :clobber_docs, :clobber_package ] do
|
@@ -285,13 +299,15 @@ class Echoe
|
|
285
299
|
rm_rf files unless files.empty?
|
286
300
|
end
|
287
301
|
end
|
302
|
+
|
303
|
+
### Manifest
|
288
304
|
|
289
305
|
desc "Build a Manifest list"
|
290
|
-
task :
|
306
|
+
task :manifest do
|
291
307
|
files = []
|
292
308
|
Find.find '.' do |file|
|
293
309
|
file = file[2..-1]
|
294
|
-
unless !file or file =~ /^(pkg|doc)|\.svn|CVS|\.bzr/ or File.directory? file
|
310
|
+
unless !file or file =~ /^(pkg|doc)|\.svn|CVS|\.bzr|\.DS/ or File.directory? file
|
295
311
|
files << file
|
296
312
|
end
|
297
313
|
end
|
@@ -299,18 +315,26 @@ class Echoe
|
|
299
315
|
File.open(manifest_name, 'w').puts files
|
300
316
|
puts files
|
301
317
|
end
|
318
|
+
|
319
|
+
task :build_manifest => [:manifest]
|
320
|
+
|
321
|
+
### Tests
|
322
|
+
|
323
|
+
# XXX unreadable
|
324
|
+
desc 'Run the test suite'
|
325
|
+
task :test do
|
326
|
+
ruby(if File.exist? 'test/test_all.rb'
|
327
|
+
"#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
|
328
|
+
else
|
329
|
+
tests = test_pattern.map { |g| Dir.glob(g) }.flatten << 'test/unit'
|
330
|
+
tests.map! {|f| %Q(require "#{f}")}
|
331
|
+
"#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
|
332
|
+
end)
|
333
|
+
end
|
334
|
+
|
335
|
+
task :default => :test
|
336
|
+
|
302
337
|
end
|
303
|
-
|
304
|
-
def run_tests # :nodoc:
|
305
|
-
ruby(if File.exist? 'test/test_all.rb'
|
306
|
-
"#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
|
307
|
-
else
|
308
|
-
tests = test_patterns.map { |g| Dir.glob(g) }.flatten << 'test/unit'
|
309
|
-
tests.map! {|f| %Q(require "#{f}")}
|
310
|
-
"#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
|
311
|
-
end)
|
312
|
-
end
|
313
|
-
|
314
338
|
end
|
315
339
|
|
316
340
|
class ::Rake::SshDirPublisher # :nodoc:
|
data/test/test_echoe.rb
CHANGED
@@ -9,18 +9,14 @@ class TestEchoe < Test::Unit::TestCase
|
|
9
9
|
Rake.application.clear
|
10
10
|
end
|
11
11
|
|
12
|
-
##
|
13
|
-
# Yes, these tests suck, but it is damn hard to test this since
|
14
|
-
# everything is forked out.
|
15
|
-
|
16
12
|
def test_basics
|
17
|
-
boring
|
18
|
-
expected = %w(
|
13
|
+
boring = %w(clobber clobber_docs clobber_package doc doc/index.html pkg pkg/blah-1.0.0 pkg/blah-1.0.0.gem pkg/blah-1.0.0.tar.gz redocs repackage default)
|
14
|
+
expected = %w(clean clobber clobber_docs clobber_package docs gem install manifest package publish_docs redocs release repackage test uninstall build_manifest)
|
19
15
|
expected += boring
|
20
16
|
|
21
17
|
Echoe.new('blah', '1.0.0')
|
22
|
-
tasks = Rake.application.tasks.map { |t| t.name }
|
23
|
-
|
24
|
-
|
18
|
+
tasks = Rake.application.tasks.map { |t| t.name }
|
19
|
+
assert((expected - tasks).empty?)
|
20
|
+
assert((tasks - expected).empty?)
|
25
21
|
end
|
26
22
|
end
|
metadata
CHANGED
@@ -3,15 +3,15 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: echoe
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: "2"
|
7
|
-
date: 2007-08-
|
8
|
-
summary:
|
6
|
+
version: "2.1"
|
7
|
+
date: 2007-08-06 00:00:00 -04:00
|
8
|
+
summary: A tool for packaging Ruby gems.
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: ""
|
12
12
|
homepage: http://blog.evanweaver.com/pages/code#echoe
|
13
13
|
rubyforge_project: fauna
|
14
|
-
description:
|
14
|
+
description: A tool for packaging Ruby gems.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|