-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
183 lines (147 loc) · 5.52 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
$:.unshift File.expand_path 'lib'
require 'rdoc'
require 'hoe'
ENV['BENCHMARK'] = 'yes'
task :docs => :generate
task :test => :generate
PARSER_FILES = %w[
lib/rdoc/rd/block_parser.rb
lib/rdoc/rd/inline_parser.rb
lib/rdoc/markdown.rb
lib/rdoc/markdown/literals_1_8.rb
lib/rdoc/markdown/literals_1_9.rb
]
Hoe.plugin :git
Hoe.plugin :kpeg
Hoe.plugin :minitest
Hoe.plugin :travis
$rdoc_rakefile = true
hoe = Hoe.spec 'rdoc' do
developer 'Eric Hodel', '[email protected]'
developer 'Dave Thomas', ''
developer 'Phil Hagelberg', '[email protected]'
developer 'Tony Strauss', '[email protected]'
self.rsync_args = '-avz'
rdoc_locations << 'docs.seattlerb.org:/data/www/docs.seattlerb.org/rdoc/'
rdoc_locations << '[email protected]:/var/www/gforge-projects/rdoc/'
spec_extras[:post_install_message] = <<-MESSAGE
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
MESSAGE
self.licenses << 'Ruby'
self.readme_file = 'README.rdoc'
self.history_file = 'History.rdoc'
self.testlib = :minitest
self.extra_rdoc_files += %w[
CVE-2013-0256.rdoc
CONTRIBUTING.rdoc
ExampleMarkdown.md
ExampleRDoc.rdoc
History.rdoc
LEGAL.rdoc
LICENSE.rdoc
README.rdoc
RI.rdoc
TODO.rdoc
]
self.clean_globs += PARSER_FILES
self.kpeg_flags = '-fsv' if self.respond_to? :kpeg_flags= # no plugin
require_ruby_version '>= 1.8.7'
extra_deps << ['json', '~> 1.4']
extra_dev_deps << ['racc', '~> 1.4', '> 1.4.10']
extra_dev_deps << ['minitest', '~> 4']
extra_rdoc_files << 'Rakefile'
spec_extras['required_rubygems_version'] = '>= 1.3'
spec_extras['homepage'] = 'http://docs.seattlerb.org/rdoc'
end
hoe.test_prelude = 'gem "minitest", "~> 4.0"'
def rake(*args)
sh $0, *args
end
need_racc = PARSER_FILES.any? do |rb_file|
ry_file = rb_file.gsub(/\.rb\z/, ".ry")
not File.exist?(rb_file) or
(File.exist?(ry_file) and File.mtime(rb_file) < File.mtime(ry_file))
end
if need_racc
Rake::Task["default"].prerequisites.clear
task :default do
rake "check_extra_deps"
rake "install_plugins"
rake "newb"
end
end
Rake::Task['docs'].actions.clear
task :docs do
$LOAD_PATH.unshift 'lib'
require 'rdoc'
options = RDoc::Options.new
options.title = "rdoc #{RDoc::VERSION} Documentation"
options.op_dir = 'doc'
options.main_page = 'README.rdoc'
options.files = hoe.spec.extra_rdoc_files + %w[lib]
options.setup_generator 'darkfish'
RDoc::RDoc.new.document options
end
# requires ruby 1.8 and ruby 1.8 to build
hoe.clean_globs -= PARSER_FILES.grep(/literals_/)
task :generate => :isolate
task :generate => PARSER_FILES
task :check_manifest => :generate
rule '.rb' => '.ry' do |t|
racc = Gem.bin_path 'racc', 'racc'
ruby "-rubygems #{racc} -l -o #{t.name} #{t.source}"
end
path = "pkg/#{hoe.spec.full_name}"
package_parser_files = PARSER_FILES.map do |parser_file|
package_parser_file = "#{path}/#{parser_file}"
file package_parser_file => parser_file # ensure copy runs before racc
package_parser_file
end
task "#{path}.gem" => package_parser_files
# These tasks expect to have the following directory structure:
#
# git/git.rubini.us/code # Rubinius git HEAD checkout
# svn/ruby/trunk # ruby subversion HEAD checkout
# svn/rdoc/trunk # RDoc subversion HEAD checkout
#
# If you don't have this directory structure, set RUBY_PATH and/or
# RUBINIUS_PATH.
diff_options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
rsync_options = "-avP --exclude '*svn*' --exclude '*swp' --exclude '*rbc' --exclude '*.rej' --exclude '*.orig' --exclude '*.kpeg' --exclude '*.ry' --exclude 'literals_1_8.rb' --exclude 'gauntlet_rdoc.rb'"
rubinius_dir = ENV['RUBINIUS_PATH'] || '../../../git/git.rubini.us/code'
ruby_dir = ENV['RUBY_PATH'] || '../../svn/ruby/trunk'
desc "Updates Ruby HEAD with the currently checked-out copy of RDoc."
task :update_ruby do
sh "rsync #{rsync_options} bin/rdoc #{ruby_dir}/bin/rdoc"
sh "rsync #{rsync_options} bin/ri #{ruby_dir}/bin/ri"
sh "rsync #{rsync_options} lib/ #{ruby_dir}/lib"
sh "rsync #{rsync_options} test/ #{ruby_dir}/test/rdoc"
end
desc "Diffs Ruby HEAD with the currently checked-out copy of RDoc."
task :diff_ruby do
options = "-urpN --exclude '*svn*' --exclude '*swp' --exclude '*rbc'"
sh "diff #{diff_options} bin/rdoc #{ruby_dir}/bin/rdoc; true"
sh "diff #{diff_options} bin/ri #{ruby_dir}/bin/ri; true"
sh "diff #{diff_options} lib/rdoc.rb #{ruby_dir}/lib/rdoc.rb; true"
sh "diff #{diff_options} lib/rdoc #{ruby_dir}/lib/rdoc; true"
sh "diff #{diff_options} test #{ruby_dir}/test/rdoc; true"
end
desc "Updates Rubinius HEAD with the currently checked-out copy of RDoc."
task :update_rubinius do
sh "rsync #{rsync_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb"
sh "rsync #{rsync_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb"
sh "rsync #{rsync_options} lib/ #{rubinius_dir}/lib"
sh "rsync #{rsync_options} test/ #{rubinius_dir}/test/rdoc"
end
desc "Diffs Rubinius HEAD with the currently checked-out copy of RDoc."
task :diff_rubinius do
sh "diff #{diff_options} bin/rdoc #{rubinius_dir}/lib/bin/rdoc.rb; true"
sh "diff #{diff_options} bin/ri #{rubinius_dir}/lib/bin/ri.rb; true"
sh "diff #{diff_options} lib/rdoc.rb #{rubinius_dir}/lib/rdoc.rb; true"
sh "diff #{diff_options} lib/rdoc #{rubinius_dir}/lib/rdoc; true"
sh "diff #{diff_options} test #{rubinius_dir}/test/rdoc; true"
end