hoe 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/Manifest.txt +5 -0
- data/README.txt +86 -0
- data/Rakefile +10 -0
- data/lib/hoe.rb +200 -0
- metadata +59 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
Hoe
|
2
|
+
http://rubyforge.org/projects/seattlerb/
|
3
|
+
ryand-ruby@zenspider.com
|
4
|
+
|
5
|
+
** DESCRIPTION:
|
6
|
+
|
7
|
+
Hoe is a simple rake/rubygems helper for project Rakefiles. It
|
8
|
+
generates all the usual tasks for projects including rdoc generation,
|
9
|
+
testing, packaging, and deployment.
|
10
|
+
|
11
|
+
As an example:
|
12
|
+
|
13
|
+
require './lib/hoe.rb'
|
14
|
+
|
15
|
+
Hoe.new("Hoe", Hoe::VERSION) do |p|
|
16
|
+
p.rubyforge_name = "seattlerb"
|
17
|
+
p.summary = "Hoe is a way to write Rakefiles much easier and cleaner."
|
18
|
+
end
|
19
|
+
|
20
|
+
generates:
|
21
|
+
|
22
|
+
% rake -T
|
23
|
+
rake audit # Run ZenTest against the package
|
24
|
+
rake clean # Clean up all the extras
|
25
|
+
rake clobber_docs # Remove rdoc products
|
26
|
+
rake clobber_package # Remove package products
|
27
|
+
rake default # Run the default tasks
|
28
|
+
rake docs # Build the docs HTML Files
|
29
|
+
rake install # Install the package. Uses PREFIX and RUBYLIB
|
30
|
+
rake multi # Run the test suite using multiruby
|
31
|
+
rake package # Build all the packages
|
32
|
+
rake redocs # Force a rebuild of the RDOC files
|
33
|
+
rake repackage # Force a rebuild of the package files
|
34
|
+
rake test # Run the test suite. Use FILTER to add to the command line.
|
35
|
+
rake uninstall # Uninstall the package.
|
36
|
+
rake upload # Upload RDoc to RubyForge
|
37
|
+
|
38
|
+
** FEATURES/PROBLEMS:
|
39
|
+
|
40
|
+
+ Really basic and rather specific to Seattle.rb/ZenSpider projects
|
41
|
+
+ Will become cleaner/better very quickly.
|
42
|
+
+ At some point it will have tests and stuff.
|
43
|
+
|
44
|
+
** SYNOPSYS:
|
45
|
+
|
46
|
+
require './lib/hoe.rb'
|
47
|
+
|
48
|
+
Hoe.new(projectname, version) do |p|
|
49
|
+
# ... project specific data ...
|
50
|
+
end
|
51
|
+
|
52
|
+
# ... project specific tasks ...
|
53
|
+
|
54
|
+
** REQUIREMENTS:
|
55
|
+
|
56
|
+
+ rake
|
57
|
+
+ rubygems
|
58
|
+
|
59
|
+
** INSTALL:
|
60
|
+
|
61
|
+
+ sudo gem install hoe
|
62
|
+
|
63
|
+
** LICENSE:
|
64
|
+
|
65
|
+
(The MIT License)
|
66
|
+
|
67
|
+
Copyright (c) 2006 Ryan Davis, Zen Spider Software
|
68
|
+
|
69
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
70
|
+
a copy of this software and associated documentation files (the
|
71
|
+
"Software"), to deal in the Software without restriction, including
|
72
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
73
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
74
|
+
permit persons to whom the Software is furnished to do so, subject to
|
75
|
+
the following conditions:
|
76
|
+
|
77
|
+
The above copyright notice and this permission notice shall be
|
78
|
+
included in all copies or substantial portions of the Software.
|
79
|
+
|
80
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
81
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
82
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
83
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
84
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
85
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
86
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/hoe.rb
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
begin require 'rubygems'; rescue LoadError; end
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/contrib/sshpublisher'
|
6
|
+
require 'rake/gempackagetask'
|
7
|
+
require 'rake/rdoctask'
|
8
|
+
require 'rake/testtask'
|
9
|
+
require 'rbconfig'
|
10
|
+
|
11
|
+
class Hoe
|
12
|
+
VERSION = '1.0.0'
|
13
|
+
|
14
|
+
rubyprefix = Config::CONFIG['prefix']
|
15
|
+
sitelibdir = Config::CONFIG['sitelibdir']
|
16
|
+
|
17
|
+
PREFIX = ENV['PREFIX'] || rubyprefix
|
18
|
+
RUBYLIB = if PREFIX == rubyprefix then
|
19
|
+
sitelibdir
|
20
|
+
else
|
21
|
+
File.join(PREFIX, sitelibdir[rubyprefix.size..-1])
|
22
|
+
end
|
23
|
+
RUBY_DEBUG = ENV['RUBY_DEBUG']
|
24
|
+
RUBY_FLAGS = ENV['RUBY_FLAGS'] ||
|
25
|
+
"-w -I#{%w(lib bin ../../RubyInline/dev).join(File::PATH_SEPARATOR)}" +
|
26
|
+
(RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
|
27
|
+
FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
|
28
|
+
|
29
|
+
attr_accessor :author, :bin_files, :clean_globs, :email, :lib_files, :name, :rubyforge_name, :spec, :summary, :test_files, :url, :version
|
30
|
+
|
31
|
+
def initialize(name, version)
|
32
|
+
self.name = name
|
33
|
+
self.version = version
|
34
|
+
|
35
|
+
# Defaults
|
36
|
+
self.rubyforge_name = name.downcase
|
37
|
+
self.url = "http://www.zenspider.com/ZSS/Products/#{name}/"
|
38
|
+
self.author = "Ryan Davis"
|
39
|
+
self.email = "ryand-ruby@zenspider.com"
|
40
|
+
self.clean_globs = %w(diff diff.txt demo.rb *.gem **/*~)
|
41
|
+
|
42
|
+
yield self if block_given?
|
43
|
+
|
44
|
+
define_tasks
|
45
|
+
end
|
46
|
+
|
47
|
+
def define_tasks
|
48
|
+
desc 'Run the default tasks'
|
49
|
+
task :default => :test
|
50
|
+
|
51
|
+
desc 'Run the test suite. Use FILTER to add to the command line.'
|
52
|
+
task :test do
|
53
|
+
run_tests
|
54
|
+
end
|
55
|
+
|
56
|
+
desc 'Run the test suite using multiruby'
|
57
|
+
task :multi do
|
58
|
+
run_tests :multi
|
59
|
+
end
|
60
|
+
|
61
|
+
############################################################
|
62
|
+
# Packaging and Installing
|
63
|
+
|
64
|
+
self.spec = Gem::Specification.new do |s|
|
65
|
+
s.name = name
|
66
|
+
s.version = version
|
67
|
+
s.summary = summary
|
68
|
+
s.author = author
|
69
|
+
s.email = email
|
70
|
+
s.homepage = url
|
71
|
+
s.rubyforge_project = rubyforge_name
|
72
|
+
|
73
|
+
paragraphs = File.read("README.txt").split(/\n\n+/)
|
74
|
+
s.description = paragraphs[2]
|
75
|
+
|
76
|
+
s.add_dependency('RubyInline', '>= 3.2.0')
|
77
|
+
s.files = File.read("Manifest.txt").split
|
78
|
+
s.executables = s.files.grep(/bin/) { |f| File.basename(f) }
|
79
|
+
|
80
|
+
s.bindir = "bin"
|
81
|
+
s.require_paths = ['lib', 'test']
|
82
|
+
s.has_rdoc = true
|
83
|
+
s.test_suite_file = "test/test_all.rb" if test ?f, "test/test_all.rb"
|
84
|
+
|
85
|
+
if $DEBUG then
|
86
|
+
puts "Gem Info:"
|
87
|
+
puts
|
88
|
+
puts "Summary = #{s.summary}"
|
89
|
+
puts
|
90
|
+
puts "Description = #{s.description}"
|
91
|
+
puts
|
92
|
+
puts "Executables = #{s.executables.join(", ")}"
|
93
|
+
puts
|
94
|
+
puts "Files = #{s.files.join(", ")}"
|
95
|
+
puts
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
self.lib_files = spec.files.grep(/^lib/)
|
100
|
+
self.bin_files = spec.files.grep(/^bin/)
|
101
|
+
self.test_files = %w(test/test_sexp_processor.rb) # for ruby_to_c's tests.
|
102
|
+
|
103
|
+
Rake::GemPackageTask.new spec do |pkg|
|
104
|
+
pkg.need_tar = true
|
105
|
+
end
|
106
|
+
|
107
|
+
desc 'Install the package. Uses PREFIX and RUBYLIB'
|
108
|
+
task :install do
|
109
|
+
[
|
110
|
+
[lib_files + test_files, RUBYLIB, 0444],
|
111
|
+
[bin_files, file.join(PREFIX, 'bin'), 0555]
|
112
|
+
].each do |files, dest, mode|
|
113
|
+
FileUtils.mkdir_p dest unless test ?d, dest
|
114
|
+
files.each do |file|
|
115
|
+
install file, dest, :mode => mode
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
desc 'Uninstall the package.'
|
121
|
+
task :uninstall do
|
122
|
+
Dir.chdir RUBYLIB do
|
123
|
+
rm_f((lib_files + test_files).map { |f| File.basename f })
|
124
|
+
end
|
125
|
+
Dir.chdir File.join(PREFIX, 'bin') do
|
126
|
+
rm_f bin_files.map { |f| File.basename f }
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
desc 'Deploy the package to rubyforge.'
|
131
|
+
task :deploy => [:clean, :package] do |t|
|
132
|
+
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
|
133
|
+
abort "Versions don't match #{v} vs #{version}" if v != version
|
134
|
+
puts "Releasing #{name} v. #{version}"
|
135
|
+
require 'rubyforge'
|
136
|
+
pkg = "pkg/#{name}-#{version}"
|
137
|
+
|
138
|
+
if $DEBUG then
|
139
|
+
puts "release_id = rf.add_release #{rubyforge_name.inspect}, #{name.inspect}, #{version.inspect}, \"#{pkg}.gem\""
|
140
|
+
puts "rf.add_file #{rubyforge_name.inspect}, #{name.inspect}, release_id, \"#{pkg}.tgz\""
|
141
|
+
else
|
142
|
+
rf = RubyForge.new
|
143
|
+
rf.login
|
144
|
+
release_id = rf.add_release rubyforge_name, name, version, "#{pkg}.gem"
|
145
|
+
rf.add_file rubyforge_name, name, release_id, "#{pkg}.tgz"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
############################################################
|
150
|
+
# Doco
|
151
|
+
|
152
|
+
Rake::RDocTask.new(:docs) do |rd|
|
153
|
+
rd.main = "README.txt"
|
154
|
+
rd.options << '-d' if `which dot` =~ /\/dot/ and RUBY_PLATFORM !~ /win32/
|
155
|
+
rd.rdoc_dir = 'doc'
|
156
|
+
rd.rdoc_files.push(*spec.files.grep(/^(lib|bin|READ|Hist)/))
|
157
|
+
end
|
158
|
+
|
159
|
+
desc 'Upload RDoc to RubyForge'
|
160
|
+
task :upload => [:clean, :docs] do
|
161
|
+
config = YAML.load(File.read(File.expand_path("~/.rubyforge/config.yml")))
|
162
|
+
user = "#{config["username"]}rubyforge.org"
|
163
|
+
project = "/var/www/gforge-projects/#{rubyforge_name}"
|
164
|
+
local_dir = 'doc'
|
165
|
+
pub = Rake::SshDirPublisher.new user, project, local_dir
|
166
|
+
pub.upload
|
167
|
+
end
|
168
|
+
|
169
|
+
############################################################
|
170
|
+
# Misc/Maintenance:
|
171
|
+
|
172
|
+
desc 'Run ZenTest against the package'
|
173
|
+
task :audit do
|
174
|
+
libs = %w(lib test).join(File::PATH_SEPARATOR)
|
175
|
+
sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
|
176
|
+
end
|
177
|
+
|
178
|
+
desc 'Clean up all the extras'
|
179
|
+
task :clean => [ :clobber_docs, :clobber_package ] do
|
180
|
+
clean_globs.each do |pattern|
|
181
|
+
files = Dir[pattern]
|
182
|
+
rm_rf files unless files.empty?
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end # end define
|
186
|
+
|
187
|
+
def run_tests(multi=false)
|
188
|
+
msg = multi ? :sh : :ruby
|
189
|
+
cmd = if test ?f, 'test/test_all.rb' then
|
190
|
+
"#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
|
191
|
+
else
|
192
|
+
tests = (Dir.glob("test/**/test_*.rb") + ['test/unit']).map { |f|
|
193
|
+
"require \"#{f}\""
|
194
|
+
}
|
195
|
+
"#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
|
196
|
+
end
|
197
|
+
cmd = "multiruby #{cmd}" if multi
|
198
|
+
send msg, cmd
|
199
|
+
end
|
200
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.0
|
3
|
+
specification_version: 1
|
4
|
+
name: hoe
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2006-09-19 00:00:00 -07:00
|
8
|
+
summary: Hoe is a way to write Rakefiles much easier and cleaner.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
- test
|
12
|
+
email: ryand-ruby@zenspider.com
|
13
|
+
homepage: http://www.zenspider.com/ZSS/Products/hoe/
|
14
|
+
rubyforge_project: seattlerb
|
15
|
+
description: Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment.
|
16
|
+
autorequire:
|
17
|
+
default_executable:
|
18
|
+
bindir: bin
|
19
|
+
has_rdoc: true
|
20
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.0.0
|
25
|
+
version:
|
26
|
+
platform: ruby
|
27
|
+
signing_key:
|
28
|
+
cert_chain:
|
29
|
+
post_install_message:
|
30
|
+
authors:
|
31
|
+
- Ryan Davis
|
32
|
+
files:
|
33
|
+
- History.txt
|
34
|
+
- Manifest.txt
|
35
|
+
- README.txt
|
36
|
+
- Rakefile
|
37
|
+
- lib/hoe.rb
|
38
|
+
test_files: []
|
39
|
+
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
executables: []
|
45
|
+
|
46
|
+
extensions: []
|
47
|
+
|
48
|
+
requirements: []
|
49
|
+
|
50
|
+
dependencies:
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: RubyInline
|
53
|
+
version_requirement:
|
54
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 3.2.0
|
59
|
+
version:
|