ludy 0.1.11 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +9 -0
- data/README +3 -1
- data/Rakefile +28 -10
- data/TODO +1 -1
- data/lib/ludy/paginator.rb +17 -0
- data/lib/ludy.rb +1 -1
- data/ludy.gemspec +25 -0
- data/spec/spec_helper.rb +1 -1
- data/tasks/ann.rake +19 -14
- data/tasks/bones.rake +6 -25
- data/tasks/gem.rake +46 -36
- data/tasks/git.rake +41 -0
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +18 -11
- data/tasks/{doc.rake → rdoc.rake} +10 -7
- data/tasks/rubyforge.rake +12 -12
- data/tasks/setup.rb +121 -80
- data/tasks/spec.rake +12 -13
- data/tasks/svn.rake +15 -11
- data/tasks/test.rake +6 -6
- data/test/ludy/test_paginator.rb +11 -1
- metadata +69 -26
- data/Manifest.txt +0 -121
- data/tasks/annotations.rake +0 -22
data/CHANGES
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
= ludy changes history
|
2
2
|
|
3
|
+
== ludy 0.1.13, 2008-06-14
|
4
|
+
|
5
|
+
* fixed the package... i am so dumb
|
6
|
+
|
7
|
+
== ludy 0.1.12, 2008-06-14
|
8
|
+
|
9
|
+
* added NullPaginator and NullPage for represent 0 page.
|
10
|
+
* changed repository from svn to git.
|
11
|
+
|
3
12
|
== ludy 0.1.11, 2008-03-25
|
4
13
|
|
5
14
|
* fixed tasks function into private method of Kernel.
|
data/README
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
= ludy 0.1.
|
1
|
+
= ludy 0.1.13
|
2
2
|
by Lin Jen-Shin (a.k.a. godfat-真常[http://godfat.org])
|
3
3
|
strip any number: 18god29fat7029 (at] godfat32 -dooot- 20org
|
4
4
|
* rdoc[http://ludy.rubyforge.org]
|
5
5
|
* rubyforge-project[http://rubyforge.org/projects/ludy]
|
6
|
+
* github-project[http://github.com/godfat/ludy]
|
7
|
+
* redmine-project[https://redmine.godfat.org/projects/show/ludy]
|
6
8
|
|
7
9
|
== DESCRIPTION:
|
8
10
|
|
data/Rakefile
CHANGED
@@ -15,24 +15,42 @@ task :default do
|
|
15
15
|
Rake.application.display_tasks_and_comments
|
16
16
|
end
|
17
17
|
|
18
|
+
namespace :gem do
|
19
|
+
desc 'create ludy.gemspec'
|
20
|
+
task 'gemspec' do
|
21
|
+
puts 'rake gem:debug > ludy.gemspec'
|
22
|
+
File.open('ludy.gemspec', 'w'){|spec| spec << `rake gem:debug`.sub(/.*/, '')}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
namespace :git do
|
27
|
+
desc 'push to rubyforge and github'
|
28
|
+
task 'push' do
|
29
|
+
sh 'git push rubyforge master'
|
30
|
+
puts
|
31
|
+
sh 'git push github master'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
18
35
|
PROJ.name = 'ludy'
|
19
36
|
PROJ.authors = 'Lin Jen-Shin (a.k.a. godfat 真常)'
|
20
37
|
PROJ.email = 'strip any number: 18god29fat7029 (at] godfat32 -dooot- 20org'
|
21
38
|
PROJ.url = 'http://ludy.rubyforge.org/'
|
22
39
|
PROJ.description = PROJ.summary = paragraphs_of('README', 'description').join("\n\n")
|
23
40
|
PROJ.changes = paragraphs_of('CHANGES', 0..1).join("\n\n")
|
24
|
-
PROJ.
|
25
|
-
|
41
|
+
PROJ.rubyforge.name = 'ludy'
|
26
42
|
PROJ.version = paragraphs_of('README', 0).first.split("\n").first[7..-1]
|
27
|
-
PROJ.exclude << '.DS_Store' << '^tmp' << '\.rbc$'
|
28
|
-
# PROJ.dependencies << 'rake'
|
29
43
|
|
30
|
-
PROJ.
|
31
|
-
PROJ.
|
32
|
-
PROJ.
|
33
|
-
|
34
|
-
PROJ.
|
44
|
+
PROJ.gem.executables = 'bin/ludy'
|
45
|
+
PROJ.gem.files = []
|
46
|
+
Dir.glob('**/*'){ |file| PROJ.gem.files << file if file !~ /^pkg|^tmp|^doc/ }
|
47
|
+
|
48
|
+
PROJ.rdoc.main = 'README'
|
49
|
+
PROJ.rdoc.exclude << 'Manifest' << 'Rakefile' << 'tmp$' << '^tmp'
|
50
|
+
PROJ.rdoc.include << '\w+'
|
51
|
+
PROJ.rdoc.opts << '--diagram' if !WIN32 and `which dot` =~ %r/\/dot/
|
52
|
+
PROJ.rdoc.opts << '--charset=utf-8' << '--inline-source' << '--line-numbers' << '--promiscuous'
|
35
53
|
|
36
|
-
PROJ.
|
54
|
+
PROJ.spec.opts << '--color'
|
37
55
|
|
38
56
|
# EOF
|
data/TODO
CHANGED
data/lib/ludy/paginator.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
|
2
2
|
require 'ludy/version'
|
3
3
|
require 'ludy/kernel/public_send'
|
4
|
+
require 'singleton'
|
4
5
|
|
5
6
|
module Ludy
|
6
7
|
# which was produced by Paginator#page / Paginator#[],
|
@@ -15,6 +16,8 @@ module Ludy
|
|
15
16
|
attr_reader :pager, :page
|
16
17
|
# don't create a page instance yourself unless you have to
|
17
18
|
def initialize pager, page; @pager, @page = pager, page; end
|
19
|
+
# return a null page that stubs anything to 0
|
20
|
+
def self.null; NullPage.instance; end
|
18
21
|
# return the page instance next to this page
|
19
22
|
def next; @pager.page(@page+1); end
|
20
23
|
# return the page instance prev to this page
|
@@ -57,6 +60,8 @@ module Ludy
|
|
57
60
|
@fetcher = fetcher
|
58
61
|
@counter = counter
|
59
62
|
end
|
63
|
+
# return a null pager that stubs anything to 0
|
64
|
+
def self.null; NullPaginator.instance; end
|
60
65
|
# if two paginators are equal, then the properties of
|
61
66
|
# per_page, fetcher, counter are all equal.
|
62
67
|
def == rhs
|
@@ -125,4 +130,16 @@ module Ludy
|
|
125
130
|
})
|
126
131
|
end
|
127
132
|
end
|
133
|
+
|
134
|
+
# a null page that stubs anything to 0 or [], etc.
|
135
|
+
class NullPage < Page
|
136
|
+
include Singleton
|
137
|
+
def initialize; super(NullPaginator.instance, 0); end
|
138
|
+
end
|
139
|
+
# a null paginator that stubs any page into a null page.
|
140
|
+
class NullPaginator < Paginator
|
141
|
+
include Singleton
|
142
|
+
def initialize; super(lambda{|*a|[]}, lambda{0}); end
|
143
|
+
def page page; page == 0 ? NullPage.instance : nil; end
|
144
|
+
end
|
128
145
|
end
|
data/lib/ludy.rb
CHANGED
data/ludy.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.name = %q{ludy}
|
4
|
+
s.version = "0.1.13"
|
5
|
+
|
6
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
7
|
+
|
8
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
|
+
s.authors = ["Lin Jen-Shin (a.k.a. godfat \347\234\237\345\270\270)"]
|
10
|
+
s.date = %q{2008-06-14}
|
11
|
+
s.default_executable = %q{ludy}
|
12
|
+
s.description = %q{Aims to extend Ruby standard library, providing some useful tools that's not existed in the standard library, especially for functional programming.}
|
13
|
+
s.email = %q{strip any number: 18god29fat7029 (at] godfat32 -dooot- 20org}
|
14
|
+
s.executables = ["ludy"]
|
15
|
+
s.extra_rdoc_files = ["bin/ludy", "lib/ludy", "lib/ludy/array", "lib/ludy/class", "lib/ludy/deprecated", "lib/ludy/hash", "lib/ludy/helpers", "lib/ludy/kernel", "lib/ludy/proc", "lib/ludy/symbol", "lib/ludy/tasks", "lib/ludy/tasks/preprocess_cpp", "lib/ludy/test", "lib/puzzle_generator"]
|
16
|
+
s.files = ["bin", "bin/ludy", "CHANGES", "lib", "lib/ludy", "lib/ludy/all.rb", "lib/ludy/array", "lib/ludy/array/body.rb", "lib/ludy/array/choice.rb", "lib/ludy/array/combine.rb", "lib/ludy/array/combos.rb", "lib/ludy/array/count.rb", "lib/ludy/array/filter.rb", "lib/ludy/array/foldl.rb", "lib/ludy/array/foldr.rb", "lib/ludy/array/head.rb", "lib/ludy/array/map_with_index.rb", "lib/ludy/array/pad.rb", "lib/ludy/array/product.rb", "lib/ludy/array/rotate.rb", "lib/ludy/array/tail.rb", "lib/ludy/array.rb", "lib/ludy/blackhole.rb", "lib/ludy/class", "lib/ludy/class/undef_all_methods.rb", "lib/ludy/class.rb", "lib/ludy/deprecated", "lib/ludy/deprecated/aspect.rb", "lib/ludy/deprecated/callstack.rb", "lib/ludy/deprecated/curry.rb", "lib/ludy/deprecated/rambda.rb", "lib/ludy/deprecated/this.rb", "lib/ludy/deprecated/untranspose.rb", "lib/ludy/deprecated/unzip.rb", "lib/ludy/dices.rb", "lib/ludy/hash", "lib/ludy/hash/reverse_merge.rb", "lib/ludy/hash.rb", "lib/ludy/helpers", "lib/ludy/helpers/check_box.rb", "lib/ludy/kernel", "lib/ludy/kernel/deep_copy.rb", "lib/ludy/kernel/defun.rb", "lib/ludy/kernel/ergo.rb", "lib/ludy/kernel/id.rb", "lib/ludy/kernel/if_else.rb", "lib/ludy/kernel/m.rb", "lib/ludy/kernel/maybe.rb", "lib/ludy/kernel/public_send.rb", "lib/ludy/kernel/singleton_method.rb", "lib/ludy/kernel/tap.rb", "lib/ludy/kernel.rb", "lib/ludy/lazy.rb", "lib/ludy/list.rb", "lib/ludy/message_dispatcher.rb", "lib/ludy/namespace.rb", "lib/ludy/paginator.rb", "lib/ludy/pattern_matcher.rb", "lib/ludy/proc", "lib/ludy/proc/bind.rb", "lib/ludy/proc/chain.rb", "lib/ludy/proc/compose.rb", "lib/ludy/proc/curry.rb", "lib/ludy/proc.rb", "lib/ludy/symbol", "lib/ludy/symbol/curry.rb", "lib/ludy/symbol/to_msg.rb", "lib/ludy/symbol/to_proc.rb", "lib/ludy/symbol.rb", "lib/ludy/tasks", "lib/ludy/tasks/common.rb", "lib/ludy/tasks/preprocess_cpp", "lib/ludy/tasks/preprocess_cpp/attr_builder.rb", "lib/ludy/tasks/preprocess_cpp/debug_hook.rb", "lib/ludy/tasks/preprocess_cpp/header_guard.rb", "lib/ludy/tasks/preprocess_cpp/template_forward_parameters.rb", "lib/ludy/tasks/preprocess_cpp.rb", "lib/ludy/tasks.rb", "lib/ludy/test", "lib/ludy/timer.rb", "lib/ludy/variable.rb", "lib/ludy/version.rb", "lib/ludy/y_combinator.rb", "lib/ludy/z_combinator.rb", "lib/ludy.rb", "lib/puzzle_generator", "lib/puzzle_generator/chain.rb", "lib/puzzle_generator/chained_map.rb", "lib/puzzle_generator/colored_map.rb", "lib/puzzle_generator/map.rb", "lib/puzzle_generator/misc.rb", "lib/puzzle_generator/puzzle.rb", "lib/puzzle_generator.rb", "LICENSE", "ludy.gemspec", "NOTICE", "Rakefile", "README", "spec", "spec/ludy_spec.rb", "spec/spec_helper.rb", "tasks", "tasks/ann.rake", "tasks/bones.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/manifest.rake", "tasks/notes.rake", "tasks/post_load.rake", "tasks/rdoc.rake", "tasks/rubyforge.rake", "tasks/setup.rb", "tasks/spec.rake", "tasks/svn.rake", "tasks/test.rake", "test", "test/deprecated", "test/deprecated/callstack.rb", "test/deprecated/curry.rb", "test/deprecated/rambda.rb", "test/deprecated/this.rb", "test/deprecated/ts_ludy.rb", "test/deprecated/unzip_and_untranspose.rb", "test/example_puzzle.rb", "test/helper.rb", "test/ludy", "test/ludy/test_array.rb", "test/ludy/test_class.rb", "test/ludy/test_defun.rb", "test/ludy/test_dices.rb", "test/ludy/test_hash.rb", "test/ludy/test_kernel.rb", "test/ludy/test_lazy.rb", "test/ludy/test_paginator.rb", "test/ludy/test_proc.rb", "test/ludy/test_require_all.rb", "test/ludy/test_symbol.rb", "test/ludy/test_variable.rb", "test/ludy/test_y_combinator.rb", "test/ludy/test_z_combinator.rb", "test/multiruby.sh", "TODO"]
|
17
|
+
s.has_rdoc = true
|
18
|
+
s.homepage = %q{http://ludy.rubyforge.org/}
|
19
|
+
s.rdoc_options = ["--diagram", "--charset=utf-8", "--inline-source", "--line-numbers", "--promiscuous", "--main", "README"]
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.rubyforge_project = %q{ludy}
|
22
|
+
s.rubygems_version = %q{1.1.1}
|
23
|
+
s.summary = %q{Aims to extend Ruby standard library, providing some useful tools that's not existed in the standard library, especially for functional programming.}
|
24
|
+
s.test_files = ["test/ludy/test_array.rb", "test/ludy/test_class.rb", "test/ludy/test_defun.rb", "test/ludy/test_dices.rb", "test/ludy/test_hash.rb", "test/ludy/test_kernel.rb", "test/ludy/test_lazy.rb", "test/ludy/test_paginator.rb", "test/ludy/test_proc.rb", "test/ludy/test_require_all.rb", "test/ludy/test_symbol.rb", "test/ludy/test_variable.rb", "test/ludy/test_y_combinator.rb", "test/ludy/test_z_combinator.rb"]
|
25
|
+
end
|
data/spec/spec_helper.rb
CHANGED
data/tasks/ann.rake
CHANGED
@@ -9,12 +9,16 @@ require 'time'
|
|
9
9
|
|
10
10
|
namespace :ann do
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
# A prerequisites task that all other tasks depend upon
|
13
|
+
task :prereqs
|
14
|
+
|
15
|
+
file PROJ.ann.file do
|
16
|
+
ann = PROJ.ann
|
17
|
+
puts "Generating #{ann.file}"
|
18
|
+
File.open(ann.file,'w') do |fd|
|
15
19
|
fd.puts("#{PROJ.name} version #{PROJ.version}")
|
16
20
|
fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
|
17
|
-
fd.puts(" #{PROJ.url}") if PROJ.url
|
21
|
+
fd.puts(" #{PROJ.url}") if PROJ.url.valid?
|
18
22
|
fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
|
19
23
|
fd.puts
|
20
24
|
fd.puts("== DESCRIPTION")
|
@@ -23,23 +27,24 @@ namespace :ann do
|
|
23
27
|
fd.puts
|
24
28
|
fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
|
25
29
|
fd.puts
|
26
|
-
|
30
|
+
ann.paragraphs.each do |p|
|
27
31
|
fd.puts "== #{p.upcase}"
|
28
32
|
fd.puts
|
29
33
|
fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
|
30
34
|
fd.puts
|
31
35
|
end
|
32
|
-
fd.puts
|
36
|
+
fd.puts ann.text if ann.text
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
36
40
|
desc "Create an announcement file"
|
37
|
-
task :announcement => PROJ.
|
41
|
+
task :announcement => ['ann:prereqs', PROJ.ann.file]
|
38
42
|
|
39
43
|
desc "Send an email announcement"
|
40
|
-
task :email => PROJ.
|
41
|
-
|
42
|
-
|
44
|
+
task :email => ['ann:prereqs', PROJ.ann.file] do
|
45
|
+
ann = PROJ.ann
|
46
|
+
from = ann.email[:from] || PROJ.email
|
47
|
+
to = Array(ann.email[:to])
|
43
48
|
|
44
49
|
### build a mail header for RFC 822
|
45
50
|
rfc822msg = "From: #{from}\n"
|
@@ -49,11 +54,11 @@ namespace :ann do
|
|
49
54
|
rfc822msg << "\n"
|
50
55
|
rfc822msg << "Date: #{Time.new.rfc822}\n"
|
51
56
|
rfc822msg << "Message-Id: "
|
52
|
-
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{
|
53
|
-
rfc822msg << File.read(
|
57
|
+
rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
|
58
|
+
rfc822msg << File.read(ann.file)
|
54
59
|
|
55
60
|
params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
|
56
|
-
|
61
|
+
ann.email[key]
|
57
62
|
end
|
58
63
|
|
59
64
|
params[3] = PROJ.email if params[3].nil?
|
@@ -71,6 +76,6 @@ end # namespace :ann
|
|
71
76
|
desc 'Alias to ann:announcement'
|
72
77
|
task :ann => 'ann:announcement'
|
73
78
|
|
74
|
-
CLOBBER << PROJ.
|
79
|
+
CLOBBER << PROJ.ann.file
|
75
80
|
|
76
81
|
# EOF
|
data/tasks/bones.rake
CHANGED
@@ -1,40 +1,21 @@
|
|
1
1
|
# $Id$
|
2
2
|
|
3
|
-
|
4
|
-
require 'stringio'
|
3
|
+
if HAVE_BONES
|
5
4
|
|
6
5
|
namespace :bones do
|
7
6
|
|
8
7
|
desc 'Show the PROJ open struct'
|
9
8
|
task :debug do |t|
|
10
|
-
atr = if
|
9
|
+
atr = if t.application.top_level_tasks.length == 2
|
11
10
|
t.application.top_level_tasks.pop
|
12
11
|
end
|
13
|
-
sio = StringIO.new
|
14
|
-
sep = "\n" + ' '*27
|
15
|
-
fmt = "%23s => %s"
|
16
12
|
|
17
|
-
if atr
|
18
|
-
|
19
|
-
sio.seek 0
|
20
|
-
val = sio.read
|
21
|
-
val = val.split("\n").join(sep)
|
22
|
-
|
23
|
-
puts fmt % [atr, val]
|
24
|
-
else
|
25
|
-
h = PROJ.instance_variable_get(:@table)
|
26
|
-
h.keys.map {|k| k.to_s}.sort.each do |k|
|
27
|
-
sio.truncate 0
|
28
|
-
PP.pp(h[k.to_sym], sio, 49)
|
29
|
-
sio.seek 0
|
30
|
-
val = sio.read
|
31
|
-
val = val.split("\n").join(sep)
|
32
|
-
|
33
|
-
puts fmt % [k, val]
|
34
|
-
end
|
35
|
-
end
|
13
|
+
if atr then Bones::Debug.show_attr(PROJ, atr)
|
14
|
+
else Bones::Debug.show PROJ end
|
36
15
|
end
|
37
16
|
|
38
17
|
end # namespace :bones
|
39
18
|
|
19
|
+
end # HAVE_BONES
|
20
|
+
|
40
21
|
# EOF
|
data/tasks/gem.rake
CHANGED
@@ -4,84 +4,86 @@ require 'rake/gempackagetask'
|
|
4
4
|
|
5
5
|
namespace :gem do
|
6
6
|
|
7
|
-
PROJ.
|
7
|
+
PROJ.gem._spec = Gem::Specification.new do |s|
|
8
8
|
s.name = PROJ.name
|
9
9
|
s.version = PROJ.version
|
10
10
|
s.summary = PROJ.summary
|
11
11
|
s.authors = Array(PROJ.authors)
|
12
12
|
s.email = PROJ.email
|
13
13
|
s.homepage = Array(PROJ.url).first
|
14
|
-
s.rubyforge_project = PROJ.
|
15
|
-
s.post_install_message = PROJ.post_install_message
|
14
|
+
s.rubyforge_project = PROJ.rubyforge.name
|
16
15
|
|
17
16
|
s.description = PROJ.description
|
18
17
|
|
19
|
-
PROJ.dependencies.each do |dep|
|
18
|
+
PROJ.gem.dependencies.each do |dep|
|
20
19
|
s.add_dependency(*dep)
|
21
20
|
end
|
22
21
|
|
23
|
-
s.files = PROJ.files
|
24
|
-
s.executables = PROJ.executables.map {|fn| File.basename(fn)}
|
25
|
-
s.extensions = PROJ.files.grep %r/extconf\.rb$/
|
22
|
+
s.files = PROJ.gem.files
|
23
|
+
s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
|
24
|
+
s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
|
26
25
|
|
27
26
|
s.bindir = 'bin'
|
28
27
|
dirs = Dir["{#{PROJ.libs.join(',')}}"]
|
29
28
|
s.require_paths = dirs unless dirs.empty?
|
30
29
|
|
31
|
-
incl = Regexp.new(PROJ.
|
32
|
-
excl = PROJ.
|
30
|
+
incl = Regexp.new(PROJ.rdoc.include.join('|'))
|
31
|
+
excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
|
33
32
|
excl = Regexp.new(excl.join('|'))
|
34
|
-
rdoc_files = PROJ.files.find_all do |fn|
|
33
|
+
rdoc_files = PROJ.gem.files.find_all do |fn|
|
35
34
|
case fn
|
36
35
|
when excl; false
|
37
36
|
when incl; true
|
38
37
|
else false end
|
39
38
|
end
|
40
|
-
s.rdoc_options = PROJ.
|
39
|
+
s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
|
41
40
|
s.extra_rdoc_files = rdoc_files
|
42
41
|
s.has_rdoc = true
|
43
42
|
|
44
|
-
if test ?f, PROJ.
|
45
|
-
s.test_file = PROJ.
|
43
|
+
if test ?f, PROJ.test.file
|
44
|
+
s.test_file = PROJ.test.file
|
46
45
|
else
|
47
|
-
s.test_files = PROJ.
|
46
|
+
s.test_files = PROJ.test.files.to_a
|
48
47
|
end
|
49
48
|
|
50
49
|
# Do any extra stuff the user wants
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
50
|
+
PROJ.gem.extras.each do |msg, val|
|
51
|
+
case val
|
52
|
+
when Proc
|
53
|
+
val.call(s.send(msg))
|
54
|
+
else
|
55
|
+
s.send "#{msg}=", val
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end # Gem::Specification.new
|
59
|
+
|
60
|
+
# A prerequisites task that all other tasks depend upon
|
61
|
+
task :prereqs
|
60
62
|
|
61
63
|
desc 'Show information about the gem'
|
62
|
-
task :debug do
|
63
|
-
puts PROJ.
|
64
|
+
task :debug => 'gem:prereqs' do
|
65
|
+
puts PROJ.gem._spec.to_ruby
|
64
66
|
end
|
65
67
|
|
66
68
|
pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
|
67
|
-
pkg.need_tar = PROJ.need_tar
|
68
|
-
pkg.need_zip = PROJ.need_zip
|
69
|
-
pkg.package_files += PROJ.
|
69
|
+
pkg.need_tar = PROJ.gem.need_tar
|
70
|
+
pkg.need_zip = PROJ.gem.need_zip
|
71
|
+
pkg.package_files += PROJ.gem._spec.files
|
70
72
|
end
|
71
73
|
Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
|
72
74
|
|
73
|
-
gem_file = if PROJ.
|
75
|
+
gem_file = if PROJ.gem._spec.platform == Gem::Platform::RUBY
|
74
76
|
"#{pkg.package_name}.gem"
|
75
77
|
else
|
76
|
-
"#{pkg.package_name}-#{PROJ.
|
78
|
+
"#{pkg.package_name}-#{PROJ.gem._spec.platform}.gem"
|
77
79
|
end
|
78
80
|
|
79
81
|
desc "Build the gem file #{gem_file}"
|
80
|
-
task :package => "#{pkg.package_dir}/#{gem_file}"
|
82
|
+
task :package => ['gem:prereqs', "#{pkg.package_dir}/#{gem_file}"]
|
81
83
|
|
82
|
-
file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.
|
84
|
+
file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.gem._spec.files do
|
83
85
|
when_writing("Creating GEM") {
|
84
|
-
Gem::Builder.new(PROJ.
|
86
|
+
Gem::Builder.new(PROJ.gem._spec).build
|
85
87
|
verbose(true) {
|
86
88
|
mv gem_file, "#{pkg.package_dir}/#{gem_file}"
|
87
89
|
}
|
@@ -89,21 +91,29 @@ namespace :gem do
|
|
89
91
|
end
|
90
92
|
|
91
93
|
desc 'Install the gem'
|
92
|
-
task :install => [:clobber, :package] do
|
93
|
-
sh "#{SUDO} #{GEM} install pkg/#{PROJ.
|
94
|
+
task :install => [:clobber, 'gem:package'] do
|
95
|
+
sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
|
96
|
+
|
97
|
+
# use this version of the command for rubygems > 1.0.0
|
98
|
+
#sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
|
94
99
|
end
|
95
100
|
|
96
101
|
desc 'Uninstall the gem'
|
97
102
|
task :uninstall do
|
98
103
|
installed_list = Gem.source_index.find_name(PROJ.name)
|
99
104
|
if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
|
100
|
-
sh "#{SUDO} #{GEM} uninstall
|
105
|
+
sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
|
101
106
|
end
|
102
107
|
end
|
103
108
|
|
104
109
|
desc 'Reinstall the gem'
|
105
110
|
task :reinstall => [:uninstall, :install]
|
106
111
|
|
112
|
+
desc 'Cleanup the gem'
|
113
|
+
task :cleanup do
|
114
|
+
sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
|
115
|
+
end
|
116
|
+
|
107
117
|
end # namespace :gem
|
108
118
|
|
109
119
|
desc 'Alias to gem:package'
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_GIT
|
4
|
+
|
5
|
+
namespace :git do
|
6
|
+
|
7
|
+
# A prerequisites task that all other tasks depend upon
|
8
|
+
task :prereqs
|
9
|
+
|
10
|
+
desc 'Show tags from the Git repository'
|
11
|
+
task :show_tags => 'git:prereqs' do |t|
|
12
|
+
puts %x/git tag/
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Create a new tag in the Git repository'
|
16
|
+
task :create_tag => 'git:prereqs' do |t|
|
17
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
18
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
19
|
+
|
20
|
+
tag = "%s-%s" % [PROJ.name, PROJ.version]
|
21
|
+
msg = "Creating tag for #{PROJ.name} version #{PROJ.version}"
|
22
|
+
|
23
|
+
puts "Creating Git tag '#{tag}'"
|
24
|
+
unless system "git tag -a -m '#{msg}' #{tag}"
|
25
|
+
abort "Tag creation failed"
|
26
|
+
end
|
27
|
+
|
28
|
+
if %x/git remote/ =~ %r/^origin\s*$/
|
29
|
+
unless system "git push origin #{tag}"
|
30
|
+
abort "Could not push tag to remote Git repository"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end # namespace :git
|
36
|
+
|
37
|
+
task 'gem:release' => 'git:create_tag'
|
38
|
+
|
39
|
+
end # if HAVE_GIT
|
40
|
+
|
41
|
+
# EOF
|
data/tasks/notes.rake
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do |t|
|
7
|
+
id = if t.application.top_level_tasks.length > 1
|
8
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
9
|
+
end
|
10
|
+
Bones::AnnotationExtractor.enumerate(
|
11
|
+
PROJ, PROJ.notes.tags.join('|'), id, :tag => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
namespace :notes do
|
15
|
+
PROJ.notes.tags.each do |tag|
|
16
|
+
desc "Enumerate all #{tag} annotations"
|
17
|
+
task tag.downcase.to_sym do |t|
|
18
|
+
id = if t.application.top_level_tasks.length > 1
|
19
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
20
|
+
end
|
21
|
+
Bones::AnnotationExtractor.enumerate(PROJ, tag, id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end # if HAVE_BONES
|
27
|
+
|
28
|
+
# EOF
|
data/tasks/post_load.rake
CHANGED
@@ -3,14 +3,21 @@
|
|
3
3
|
# This file does not define any rake tasks. It is used to load some project
|
4
4
|
# settings if they are not defined by the user.
|
5
5
|
|
6
|
-
PROJ.
|
7
|
-
PROJ.exclude << "^#{Regexp.escape(PROJ.
|
8
|
-
|
9
|
-
PROJ.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
PROJ.rdoc.exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
|
7
|
+
PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
|
8
|
+
"^#{Regexp.escape(PROJ.rdoc.dir)}/",
|
9
|
+
"^#{Regexp.escape(PROJ.rcov.dir)}/"]
|
10
|
+
|
11
|
+
flatten_arrays = lambda do |this,os|
|
12
|
+
os.instance_variable_get(:@table).each do |key,val|
|
13
|
+
next if key == :dependencies
|
14
|
+
case val
|
15
|
+
when Array; val.flatten!
|
16
|
+
when OpenStruct; this.call(this,val)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
flatten_arrays.call(flatten_arrays,PROJ)
|
14
21
|
|
15
22
|
PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
|
16
23
|
|
@@ -18,15 +25,15 @@ PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
|
|
18
25
|
|
19
26
|
PROJ.summary ||= PROJ.description.split('.').first
|
20
27
|
|
21
|
-
PROJ.files ||=
|
28
|
+
PROJ.gem.files ||=
|
22
29
|
if test(?f, PROJ.manifest_file)
|
23
30
|
files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
|
24
31
|
files.delete ''
|
25
32
|
files
|
26
33
|
else [] end
|
27
34
|
|
28
|
-
PROJ.executables ||= PROJ.files.find_all {|fn| fn =~ %r/^bin/}
|
35
|
+
PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
|
29
36
|
|
30
|
-
PROJ.
|
37
|
+
PROJ.rdoc.main ||= PROJ.readme_file
|
31
38
|
|
32
39
|
# EOF
|
@@ -6,12 +6,13 @@ namespace :doc do
|
|
6
6
|
|
7
7
|
desc 'Generate RDoc documentation'
|
8
8
|
Rake::RDocTask.new do |rd|
|
9
|
-
|
10
|
-
rd.
|
9
|
+
rdoc = PROJ.rdoc
|
10
|
+
rd.main = rdoc.main
|
11
|
+
rd.rdoc_dir = rdoc.dir
|
11
12
|
|
12
|
-
incl = Regexp.new(
|
13
|
-
excl = Regexp.new(
|
14
|
-
files = PROJ.files.find_all do |fn|
|
13
|
+
incl = Regexp.new(rdoc.include.join('|'))
|
14
|
+
excl = Regexp.new(rdoc.exclude.join('|'))
|
15
|
+
files = PROJ.gem.files.find_all do |fn|
|
15
16
|
case fn
|
16
17
|
when excl; false
|
17
18
|
when incl; true
|
@@ -20,10 +21,12 @@ namespace :doc do
|
|
20
21
|
rd.rdoc_files.push(*files)
|
21
22
|
|
22
23
|
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
23
|
-
|
24
|
+
|
25
|
+
rf_name = PROJ.rubyforge.name
|
26
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
|
24
27
|
|
25
28
|
rd.options << "-t #{title}"
|
26
|
-
rd.options.concat(
|
29
|
+
rd.options.concat(rdoc.opts)
|
27
30
|
end
|
28
31
|
|
29
32
|
desc 'Generate ri locally for testing'
|