buildr 1.3.5-x86-mswin32
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/CHANGELOG +998 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +45 -0
- data/_buildr +29 -0
- data/_jbuildr +29 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/cobertura.rb +22 -0
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +22 -0
- data/addon/buildr/hibernate.rb +142 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jdepend.rb +60 -0
- data/addon/buildr/jetty.rb +248 -0
- data/addon/buildr/jibx.rb +86 -0
- data/addon/buildr/nailgun.rb +221 -0
- data/addon/buildr/openjpa.rb +90 -0
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +65 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +88 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +211 -0
- data/doc/building.textile +244 -0
- data/doc/contributing.textile +252 -0
- data/doc/css/default.css +236 -0
- data/doc/css/print.css +101 -0
- data/doc/css/syntax.css +23 -0
- data/doc/download.textile +79 -0
- data/doc/extending.textile +186 -0
- data/doc/images/1442160941-frontcover.jpg +0 -0
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/asf-logo.png +0 -0
- data/doc/images/buildr-hires.png +0 -0
- data/doc/images/buildr.png +0 -0
- data/doc/images/favicon.png +0 -0
- data/doc/images/growl-icon.tiff +0 -0
- data/doc/images/note.png +0 -0
- data/doc/images/project-structure.png +0 -0
- data/doc/images/tip.png +0 -0
- data/doc/images/zbuildr.png +0 -0
- data/doc/images/zbuildr.tif +0 -0
- data/doc/index.textile +69 -0
- data/doc/installing.textile +266 -0
- data/doc/languages.textile +459 -0
- data/doc/mailing_lists.textile +25 -0
- data/doc/more_stuff.textile +457 -0
- data/doc/packaging.textile +430 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +271 -0
- data/doc/quick_start.textile +210 -0
- data/doc/scripts/buildr-git.rb +512 -0
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +44 -0
- data/doc/scripts/install-linux.sh +72 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +280 -0
- data/doc/testing.textile +222 -0
- data/etc/KEYS +151 -0
- data/lib/buildr.rb +36 -0
- data/lib/buildr/core.rb +35 -0
- data/lib/buildr/core/application.rb +656 -0
- data/lib/buildr/core/build.rb +452 -0
- data/lib/buildr/core/checks.rb +254 -0
- data/lib/buildr/core/common.rb +150 -0
- data/lib/buildr/core/compile.rb +608 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +362 -0
- data/lib/buildr/core/generate.rb +195 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +156 -0
- data/lib/buildr/core/project.rb +866 -0
- data/lib/buildr/core/shell.rb +198 -0
- data/lib/buildr/core/test.rb +723 -0
- data/lib/buildr/core/transports.rb +559 -0
- data/lib/buildr/core/util.rb +449 -0
- data/lib/buildr/groovy.rb +19 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +138 -0
- data/lib/buildr/groovy/shell.rb +48 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +334 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +68 -0
- data/lib/buildr/ide/eclipse/scala.rb +66 -0
- data/lib/buildr/ide/idea.ipr.template +300 -0
- data/lib/buildr/ide/idea.rb +190 -0
- data/lib/buildr/ide/idea7x.ipr.template +290 -0
- data/lib/buildr/ide/idea7x.rb +212 -0
- data/lib/buildr/java.rb +23 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +459 -0
- data/lib/buildr/java/cobertura.rb +274 -0
- data/lib/buildr/java/commands.rb +213 -0
- data/lib/buildr/java/compiler.rb +349 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/jruby.rb +117 -0
- data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
- data/lib/buildr/java/packaging.rb +716 -0
- data/lib/buildr/java/pom.rb +174 -0
- data/lib/buildr/java/rjb.rb +155 -0
- data/lib/buildr/java/test_result.rb +353 -0
- data/lib/buildr/java/tests.rb +333 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +24 -0
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +749 -0
- data/lib/buildr/packaging/artifact_namespace.rb +972 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +102 -0
- data/lib/buildr/packaging/package.rb +238 -0
- data/lib/buildr/packaging/tar.rb +186 -0
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +73 -0
- data/lib/buildr/packaging/ziptask.rb +316 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +25 -0
- data/lib/buildr/scala/bdd.rb +109 -0
- data/lib/buildr/scala/compiler.rb +195 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
- data/lib/buildr/scala/shell.rb +55 -0
- data/lib/buildr/scala/tests.rb +157 -0
- data/lib/buildr/shell.rb +180 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +92 -0
- data/rakelib/jekylltask.rb +120 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +149 -0
- data/rakelib/rspec.rake +73 -0
- data/rakelib/setup.rake +54 -0
- data/rakelib/stage.rake +213 -0
- data/rakelib/stage.rake~ +213 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +502 -0
- data/spec/core/build_spec.rb +677 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +583 -0
- data/spec/core/extension_spec.rb +93 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +762 -0
- data/spec/core/test_spec.rb +1098 -0
- data/spec/core/transport_spec.rb +537 -0
- data/spec/core/util_spec.rb +67 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +240 -0
- data/spec/ide/eclipse_spec.rb +501 -0
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant_spec.rb +33 -0
- data/spec/java/bdd_spec.rb +382 -0
- data/spec/java/cobertura_spec.rb +85 -0
- data/spec/java/compiler_spec.rb +446 -0
- data/spec/java/emma_spec.rb +119 -0
- data/spec/java/java_spec.rb +124 -0
- data/spec/java/packaging_spec.rb +1134 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +493 -0
- data/spec/packaging/archive_spec.rb +527 -0
- data/spec/packaging/artifact_namespace_spec.rb +654 -0
- data/spec/packaging/artifact_spec.rb +795 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +684 -0
- data/spec/sandbox.rb +142 -0
- data/spec/scala/bdd_spec.rb +119 -0
- data/spec/scala/compiler_spec.rb +284 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +261 -0
- data/spec/spec_helpers.rb +340 -0
- data/spec/version_requirement_spec.rb +129 -0
- metadata +383 -0
data/lib/buildr/shell.rb
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
module Buildr
|
18
|
+
module ShellProviders
|
19
|
+
class << self
|
20
|
+
def add(p)
|
21
|
+
@providers ||= {}
|
22
|
+
|
23
|
+
if p.lang == :none
|
24
|
+
@providers[:none] ||= []
|
25
|
+
@providers[:none] << p
|
26
|
+
else
|
27
|
+
@providers[p.lang] = p
|
28
|
+
end
|
29
|
+
end
|
30
|
+
alias :<< :add
|
31
|
+
|
32
|
+
def providers
|
33
|
+
@providers ||= {}
|
34
|
+
end
|
35
|
+
|
36
|
+
def each
|
37
|
+
providers.each do |lang, p|
|
38
|
+
if lang == :none
|
39
|
+
p.each do |x|
|
40
|
+
yield x
|
41
|
+
end
|
42
|
+
else
|
43
|
+
yield p
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Shell
|
51
|
+
class Base
|
52
|
+
attr_reader :project
|
53
|
+
|
54
|
+
class << self
|
55
|
+
def lang
|
56
|
+
:none
|
57
|
+
end
|
58
|
+
|
59
|
+
def to_sym
|
60
|
+
@symbol ||= name.split('::').last.downcase.to_sym
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def initialize(project)
|
65
|
+
@project = project
|
66
|
+
end
|
67
|
+
|
68
|
+
def build?
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
def launch
|
73
|
+
fail 'Not implemented'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
module JavaRebel
|
78
|
+
def rebel_home
|
79
|
+
unless @rebel_home
|
80
|
+
@rebel_home = ENV['REBEL_HOME'] or ENV['JAVA_REBEL'] or ENV['JAVAREBEL'] or ENV['JAVAREBEL_HOME']
|
81
|
+
|
82
|
+
if @rebel_home and File.directory? @rebel_home
|
83
|
+
@rebel_home += File::SEPARATOR + 'javarebel.jar'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if @rebel_home and File.exists? @rebel_home
|
88
|
+
@rebel_home
|
89
|
+
else
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def rebel_args
|
95
|
+
if rebel_home
|
96
|
+
[
|
97
|
+
'-noverify',
|
98
|
+
"-javaagent:#{rebel_home}"
|
99
|
+
]
|
100
|
+
else
|
101
|
+
[]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def rebel_props(project)
|
106
|
+
{}
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
module ShellExtension
|
112
|
+
include Extension
|
113
|
+
|
114
|
+
first_time do
|
115
|
+
Project.local_task 'shell'
|
116
|
+
|
117
|
+
ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
|
118
|
+
end
|
119
|
+
|
120
|
+
before_define do |project|
|
121
|
+
ShellProviders.each do |p|
|
122
|
+
name = p.to_sym
|
123
|
+
|
124
|
+
trace "Defining task #{project.name}:shell:#{name}"
|
125
|
+
|
126
|
+
p_inst = p.new project
|
127
|
+
deps = if p_inst.build? then [:compile] else [] end
|
128
|
+
|
129
|
+
project.task "shell:#{name}" => deps do
|
130
|
+
trace "Launching #{name} shell"
|
131
|
+
p_inst.launch
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
after_define do |project|
|
137
|
+
default_shell = project.shell.using
|
138
|
+
|
139
|
+
if default_shell
|
140
|
+
dep = "shell:#{default_shell.to_sym}"
|
141
|
+
|
142
|
+
trace "Defining task shell based on #{dep}"
|
143
|
+
project.task :shell => dep
|
144
|
+
else
|
145
|
+
project.task :shell do
|
146
|
+
fail "No shell provider defined for language '#{project.compile.language}'"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class ShellConfig
|
152
|
+
def initialize(project)
|
153
|
+
@project = project
|
154
|
+
end
|
155
|
+
|
156
|
+
def using(*args)
|
157
|
+
if args.size > 0
|
158
|
+
@using ||= args.first
|
159
|
+
else
|
160
|
+
@using ||= find_shell_task
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
def find_shell_task
|
166
|
+
lang = @project.compile.language
|
167
|
+
ShellProviders.providers[lang]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# TODO temporary hack
|
172
|
+
def shell
|
173
|
+
@shell ||= ShellConfig.new self
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
class Project
|
178
|
+
include ShellExtension
|
179
|
+
end
|
180
|
+
end
|
data/rakelib/checks.rake
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
desc "Check that source files contain the Apache license"
|
18
|
+
task :license=>FileList["**/*.{rb,rake,java,gemspec,buildfile}", 'Rakefile'] do |task|
|
19
|
+
puts "Checking that files contain the Apache license ... "
|
20
|
+
required = task.prerequisites.select { |fn| File.file?(fn) }
|
21
|
+
missing = required.reject { |fn|
|
22
|
+
comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|^-#\s+(.*?)$|<!--(.*?)-->/m).
|
23
|
+
map { |match| match.compact }.flatten.join("\n")
|
24
|
+
comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
|
25
|
+
}
|
26
|
+
fail "#{missing.join(', ')} missing Apache License, please add it before making a release!" unless missing.empty?
|
27
|
+
puts "[x] Source files contain the Apache license"
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
desc "Look for new dependencies, check transitive dependencies"
|
32
|
+
task :dependency do
|
33
|
+
puts "Checking that all dependencies are up to date ..."
|
34
|
+
# Find if anything has a more recent dependency. These are not errors, just reports.
|
35
|
+
spec.dependencies.each do |dep|
|
36
|
+
current = Gem::SourceInfoCache.search(dep).last
|
37
|
+
latest = Gem::SourceInfoCache.search(Gem::Dependency.new(dep.name, '>0')).last
|
38
|
+
puts "A new version of #{dep.name} is available, #{latest.version} replaces #{current.version}" if (current && latest && latest.version > current.version)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Returns orderd list of transitive dependencies for the given dependency.
|
42
|
+
transitive = lambda { |depend|
|
43
|
+
dep_spec = Gem::SourceIndex.from_installed_gems.search(depend).last
|
44
|
+
fail "No specification for dependency #{depend}" unless dep_spec
|
45
|
+
dep_spec.runtime_dependencies.map { |trans| transitive[trans].push(trans) }.flatten.uniq }
|
46
|
+
# For each dependency, make sure *all* its transitive dependencies are listed
|
47
|
+
# as a Buildr dependency, and order is preserved.
|
48
|
+
spec.dependencies.each_with_index do |dep, index|
|
49
|
+
puts "checking #{dep.name}"
|
50
|
+
transitive[dep].each do |trans|
|
51
|
+
matching = spec.dependencies.find { |existing| trans =~ existing }
|
52
|
+
fail "#{trans} required by #{dep} and missing from spec" unless matching
|
53
|
+
fail "#{trans} must come before #{dep} in dependency list" unless spec.dependencies.index(matching) < index
|
54
|
+
end
|
55
|
+
end
|
56
|
+
puts "[X] Checked all dependencies are up to date and transitive dependencies are correctly ordered"
|
57
|
+
end
|
data/rakelib/doc.rake
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
task 'doc:setup'
|
18
|
+
begin # For the Web site, we use the SDoc RDoc generator/theme (http://github.com/voloko/sdoc/)
|
19
|
+
require 'sdoc'
|
20
|
+
rescue LoadError
|
21
|
+
puts "Buildr uses the SDoc RDoc generator/theme. You can install it by running rake doc:setup"
|
22
|
+
task('doc:setup') { install_gem 'voloko-sdoc', :source=>'http://gems.github.com' }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
require 'rake/rdoctask'
|
27
|
+
|
28
|
+
desc "Generate RDoc documentation in rdoc/"
|
29
|
+
Rake::RDocTask.new :rdoc do |rdoc|
|
30
|
+
rdoc.rdoc_dir = 'rdoc'
|
31
|
+
rdoc.title = spec.name
|
32
|
+
rdoc.options = spec.rdoc_options.clone
|
33
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
34
|
+
rdoc.rdoc_files.include spec.extra_rdoc_files
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
begin
|
39
|
+
require 'rakelib/jekylltask'
|
40
|
+
|
41
|
+
desc "Generate Buildr documentation in _site/"
|
42
|
+
JekyllTask.new :jekyll do |task|
|
43
|
+
task.source = 'doc'
|
44
|
+
task.target = '_site'
|
45
|
+
end
|
46
|
+
|
47
|
+
rescue LoadError
|
48
|
+
puts "Buildr uses the mojombo-jekyll to generate the Web site. You can install it by running rake doc:setup"
|
49
|
+
task 'doc:setup' do
|
50
|
+
install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.5.4'
|
51
|
+
if `pygmentize -V`.empty?
|
52
|
+
args = %w{easy_install Pygments}
|
53
|
+
args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
|
54
|
+
sh *args
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
desc "Generate Buildr documentation as buildr.pdf"
|
61
|
+
file 'buildr.pdf'=>'_site' do |task|
|
62
|
+
pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
|
63
|
+
sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "Build a copy of the Web site in the ./_site"
|
67
|
+
task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf'] do
|
68
|
+
cp_r 'rdoc', '_site'
|
69
|
+
fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
|
70
|
+
cp '_reports/specs.html', '_site'
|
71
|
+
cp_r '_reports/coverage', '_site'
|
72
|
+
fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
|
73
|
+
cp 'CHANGELOG', '_site'
|
74
|
+
cp 'buildr.pdf', '_site'
|
75
|
+
fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
|
76
|
+
puts 'OK'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Publish prerequisites to Web site.
|
80
|
+
task 'publish'=>:site do
|
81
|
+
target = "people.apache.org:/www/#{spec.name}.apache.org/"
|
82
|
+
puts "Uploading new site to #{target} ..."
|
83
|
+
sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
|
84
|
+
sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
|
85
|
+
puts "Done"
|
86
|
+
end
|
87
|
+
|
88
|
+
task :clobber do
|
89
|
+
rm_rf '_site'
|
90
|
+
rm_f 'buildr.pdf'
|
91
|
+
rm_f 'prince_errors.log'
|
92
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
3
|
+
# work for additional information regarding copyright ownership. The ASF
|
4
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
5
|
+
# "License"); you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
12
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
13
|
+
# License for the specific language governing permissions and limitations under
|
14
|
+
# the License.
|
15
|
+
|
16
|
+
|
17
|
+
gem 'mojombo-jekyll', '~> 0.5.2' # skip past some buggy versions
|
18
|
+
require 'rake/tasklib'
|
19
|
+
require 'jekyll'
|
20
|
+
|
21
|
+
|
22
|
+
class JekyllTask < Rake::TaskLib
|
23
|
+
def initialize(name=:jekyll) # :yield: self
|
24
|
+
@name = name
|
25
|
+
@source = name
|
26
|
+
@target = name
|
27
|
+
yield self if block_given?
|
28
|
+
task name, :auto, :needs=>[@source] do |task, args|
|
29
|
+
generate args.auto
|
30
|
+
end
|
31
|
+
if @source != @target
|
32
|
+
file @target=>FileList["#{@source}/**/*"] do
|
33
|
+
generate
|
34
|
+
end
|
35
|
+
task 'clobber' do
|
36
|
+
rm_rf @target
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
attr_accessor :source
|
42
|
+
attr_accessor :target
|
43
|
+
|
44
|
+
def generate(auto = false)
|
45
|
+
options = { 'source'=>source, 'destination'=>target }
|
46
|
+
options = Jekyll.configuration(options)
|
47
|
+
site = Jekyll::Site.new(options)
|
48
|
+
|
49
|
+
if auto
|
50
|
+
require 'directory_watcher'
|
51
|
+
puts "Auto generating: just edit a page and save, watch the console to see when we're done regenerating pages"
|
52
|
+
dw = DirectoryWatcher.new(source)
|
53
|
+
dw.interval = 1
|
54
|
+
dw.glob = Dir.chdir(source) do
|
55
|
+
dirs = Dir['*'].select { |x| File.directory?(x) }
|
56
|
+
dirs -= [target]
|
57
|
+
dirs = dirs.map { |x| "#{x}/**/*" }
|
58
|
+
dirs += ['*']
|
59
|
+
end
|
60
|
+
dw.start
|
61
|
+
dw.add_observer do |*args|
|
62
|
+
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
63
|
+
puts "[#{t}] regeneration: #{args.size} files changed"
|
64
|
+
site.process
|
65
|
+
puts "Done"
|
66
|
+
end
|
67
|
+
loop { sleep 1 }
|
68
|
+
else
|
69
|
+
puts "Generating documentation in #{target}"
|
70
|
+
site.process
|
71
|
+
touch target
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
module TocFilter
|
78
|
+
def toc(input)
|
79
|
+
input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
|
80
|
+
id = entry[1][/^id=(['"])(.*)\1$/, 2]
|
81
|
+
title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
|
82
|
+
toc << %{<li><a href="##{id}">#{title}</a></li>}
|
83
|
+
} << "</ol>"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
Liquid::Template.register_filter(TocFilter)
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
# Under Ruby 1.9 [a,b,c].to_s doesn't join the array first. (Jekyll 0.5.2 requires this)
|
91
|
+
module Jekyll
|
92
|
+
class HighlightBlock < Liquid::Block
|
93
|
+
def render(context)
|
94
|
+
if context.registers[:site].pygments
|
95
|
+
render_pygments(context, super.join)
|
96
|
+
else
|
97
|
+
render_codehighlighter(context, super.join)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# Ruby 1.9 has sane closure scoping which manages to mess Liquid filters. (Liquid 2.0.0 requires this)
|
104
|
+
module Liquid
|
105
|
+
class Variable
|
106
|
+
def render(context)
|
107
|
+
return '' if @name.nil?
|
108
|
+
@filters.inject(context[@name]) do |output, filter|
|
109
|
+
filterargs = filter[1].to_a.collect do |a|
|
110
|
+
context[a]
|
111
|
+
end
|
112
|
+
begin
|
113
|
+
context.invoke(filter[0], output, *filterargs)
|
114
|
+
rescue FilterNotFound
|
115
|
+
raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|