buildr 1.3.5-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- 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/rakelib/stage.rake~
ADDED
@@ -0,0 +1,213 @@
|
|
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
|
+
require 'digest/md5'
|
18
|
+
require 'digest/sha1'
|
19
|
+
|
20
|
+
begin # Releases upload Gems to RubyForge.
|
21
|
+
require 'rubyforge'
|
22
|
+
rescue LoadError
|
23
|
+
task(:setup) { install_gem 'rubyforge' }
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
task :prepare do |task, args|
|
28
|
+
# Make sure we're doing a release from checked code.
|
29
|
+
lambda do
|
30
|
+
puts "Checking there are no local changes ... "
|
31
|
+
svn = `svn status`
|
32
|
+
fail "Cannot release unless all local changes are in SVN:\n#{svn}" unless svn.empty?
|
33
|
+
git = `git status`
|
34
|
+
fail "Cannot release unless all local changes are in Git:\n#{git}" if git[/^#\t/]
|
35
|
+
puts "[X] There are no local changes, everything is in source control"
|
36
|
+
end.call
|
37
|
+
|
38
|
+
# Make sure we have a valid CHANGELOG entry for this release.
|
39
|
+
lambda do
|
40
|
+
puts "Checking that CHANGELOG indicates most recent version and today's date ... "
|
41
|
+
expecting = "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
|
42
|
+
header = File.readlines('CHANGELOG').first.chomp
|
43
|
+
fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
|
44
|
+
puts "[x] CHANGELOG indicates most recent version and today's date"
|
45
|
+
end.call
|
46
|
+
|
47
|
+
# Need GPG to sign the packages.
|
48
|
+
lambda do
|
49
|
+
args.gpg or fail "Please run with gpg=<argument for gpg --local-user>"
|
50
|
+
fail "No GPG user #{args.gpg}" if `gpg2 --list-keys #{args.gpg}`.empty?
|
51
|
+
end.call
|
52
|
+
|
53
|
+
task(:license).invoke
|
54
|
+
task(:dependency).invoke
|
55
|
+
|
56
|
+
# Need JRuby, Scala and Groovy installed to run all the specs.
|
57
|
+
lambda do
|
58
|
+
puts "Checking that we have JRuby, Scala and Groovy available ... "
|
59
|
+
sh 'jruby --version'
|
60
|
+
sh 'scala -version'
|
61
|
+
sh 'groovy -version'
|
62
|
+
puts "[X] We have JRuby, Scala and Groovy"
|
63
|
+
end.call
|
64
|
+
|
65
|
+
# Need Prince to generate PDF
|
66
|
+
lambda do
|
67
|
+
puts "Checking that we have prince available ... "
|
68
|
+
sh 'prince --version'
|
69
|
+
puts "[X] We have prince available"
|
70
|
+
end.call
|
71
|
+
|
72
|
+
# Need RubyForge to upload new release files.
|
73
|
+
lambda do
|
74
|
+
puts "[!] Make sure you have admin privileges to make a release on RubyForge"
|
75
|
+
rubyforge = RubyForge.new.configure
|
76
|
+
rubyforge.login
|
77
|
+
rubyforge.scrape_project(spec.name)
|
78
|
+
end.call
|
79
|
+
|
80
|
+
# We will be speccing in one platform, so also spec the other one.
|
81
|
+
task(RUBY_PLATFORM =~ /java/ ? 'spec:ruby' : 'spec:jruby').invoke # Test the *other* platform
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
task :stage=>['setup', 'doc:setup', :clobber, :prepare] do |task, args|
|
86
|
+
mkpath '_staged'
|
87
|
+
|
88
|
+
# Start by figuring out what has changed.
|
89
|
+
lambda do
|
90
|
+
puts "Looking for changes between this release and previous one ..."
|
91
|
+
pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
|
92
|
+
changes = File.read('CHANGELOG').scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
|
93
|
+
current = changes[spec.version.to_s]
|
94
|
+
fail "No changeset found for version #{spec.version}" unless current
|
95
|
+
File.open '_staged/CHANGES', 'w' do |file|
|
96
|
+
file.write "#{spec.version} (#{Time.now.strftime('%Y-%m-%d')})\n"
|
97
|
+
file.write current
|
98
|
+
end
|
99
|
+
puts "[X] Listed most recent changed in _staged/CHANGES"
|
100
|
+
end.call
|
101
|
+
|
102
|
+
# Create the packages (gem, tarball) and sign them. This requires user
|
103
|
+
# intervention so the earlier we do it the better.
|
104
|
+
lambda do
|
105
|
+
puts "Creating and signing release packages ..."
|
106
|
+
task(:package).invoke
|
107
|
+
mkpath '_staged/dist'
|
108
|
+
FileList['pkg/*.{gem,zip,tgz}'].each do |source|
|
109
|
+
pkg = source.pathmap('_staged/dist/%n%x')
|
110
|
+
cp source, pkg
|
111
|
+
bytes = File.open(pkg, 'rb') { |file| file.read }
|
112
|
+
File.open(pkg + '.md5', 'w') { |file| file.write Digest::MD5.hexdigest(bytes) << ' ' << File.basename(pkg) }
|
113
|
+
File.open(pkg + '.sha1', 'w') { |file| file.write Digest::SHA1.hexdigest(bytes) << ' ' << File.basename(pkg) }
|
114
|
+
sh 'gpg2', '--local-user', args.gpg, '--armor', '--output', pkg + '.asc', '--detach-sig', pkg, :verbose=>true
|
115
|
+
end
|
116
|
+
cp 'etc/KEYS', '_staged'
|
117
|
+
puts "[X] Created and signed release packages in _staged/dist"
|
118
|
+
end.call
|
119
|
+
|
120
|
+
# The download page should link to the new binaries/sources, and we
|
121
|
+
# want to do that before generating the site/documentation.
|
122
|
+
lambda do
|
123
|
+
puts "Updating download page with links to release packages ... "
|
124
|
+
url = "http://www.apache.org/dist/#{spec.name}/#{spec.version}"
|
125
|
+
rows = FileList['_staged/dist/*.{gem,tgz,zip}'].map { |pkg|
|
126
|
+
name, md5 = File.basename(pkg), Digest::MD5.file(pkg).to_s
|
127
|
+
%{| "#{name}":#{url}/#{name} | "#{md5}":#{url}/#{name}.md5 | "Sig":#{url}/#{name}.asc |}
|
128
|
+
}
|
129
|
+
textile = <<-TEXTILE
|
130
|
+
h3. #{spec.name} #{spec.version} (#{Time.now.strftime('%Y-%m-%d')})
|
131
|
+
|
132
|
+
|_. Package |_. MD5 Checksum |_. PGP |
|
133
|
+
#{rows.join("\n")}
|
134
|
+
|
135
|
+
p>. ("Release signing keys":#{url}/KEYS)
|
136
|
+
TEXTILE
|
137
|
+
file_name = 'doc/download.textile'
|
138
|
+
print "Adding download links to #{file_name} ... "
|
139
|
+
modified = File.read(file_name).sub(/^h2\(#dist\).*$/) { |header| "#{header}\n\n#{textile}" }
|
140
|
+
File.open file_name, 'w' do |file|
|
141
|
+
file.write modified
|
142
|
+
end
|
143
|
+
puts "[X] Updated #{file_name}"
|
144
|
+
end.call
|
145
|
+
|
146
|
+
|
147
|
+
# Now we can create the Web site, this includes running specs, coverage report, etc.
|
148
|
+
# This will take a while, so we want to do it as last step before upload.
|
149
|
+
lambda do
|
150
|
+
puts "Creating new Web site"
|
151
|
+
task(:site).invoke
|
152
|
+
cp_r '_site', '_staged/site'
|
153
|
+
puts "[X] Created new Web site in _staged/site"
|
154
|
+
end.call
|
155
|
+
|
156
|
+
|
157
|
+
# Move everything over to people.apache.org so we can vote on it.
|
158
|
+
lambda do
|
159
|
+
url = "people.apache.org:~/public_html/#{spec.name}/#{spec.version}"
|
160
|
+
puts "Uploading _staged directory to #{url} ..."
|
161
|
+
sh 'rsync', '--progress', '--recursive', '_staged/', url
|
162
|
+
puts "[X] Uploaded _staged directory to #{url}"
|
163
|
+
end.call
|
164
|
+
|
165
|
+
|
166
|
+
# Prepare a release vote email. In the distant future this will also send the
|
167
|
+
# email for you and vote on it.
|
168
|
+
lambda do
|
169
|
+
# Need to know who you are on Apache, local user may be different (see .ssh/config).
|
170
|
+
whoami = `ssh people.apache.org whoami`.strip
|
171
|
+
base_url = "http://people.apache.org/~#{whoami}/buildr/#{spec.version}"
|
172
|
+
# Need changes for this release only.
|
173
|
+
changelog = File.read('CHANGELOG').scan(/(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/)
|
174
|
+
changes = changelog[0][2]
|
175
|
+
previous_version = changelog[1][1]
|
176
|
+
|
177
|
+
email = <<-EMAIL
|
178
|
+
To: dev@buildr.apache.org
|
179
|
+
Subject: [VOTE] Buildr #{spec.version} release
|
180
|
+
|
181
|
+
We're voting on the source distributions available here:
|
182
|
+
#{base_url}/dist/
|
183
|
+
|
184
|
+
Specifically:
|
185
|
+
#{base_url}/dist/buildr-#{spec.version}.tgz
|
186
|
+
#{base_url}/dist/buildr-#{spec.version}.zip
|
187
|
+
|
188
|
+
The documentation generated for this release is available here:
|
189
|
+
#{base_url}/site/
|
190
|
+
#{base_url}/site/buildr.pdf
|
191
|
+
|
192
|
+
The official specification against which this release was tested:
|
193
|
+
#{base_url}/site/specs.html
|
194
|
+
|
195
|
+
Test coverage report:
|
196
|
+
#{base_url}/site/coverage/index.html
|
197
|
+
|
198
|
+
|
199
|
+
The following changes were made since #{previous_version}:
|
200
|
+
|
201
|
+
#{changes.gsub(/^/, ' ')}
|
202
|
+
EMAIL
|
203
|
+
File.open 'vote-email.txt', 'w' do |file|
|
204
|
+
file.write email
|
205
|
+
end
|
206
|
+
puts "[X] Created release vote email template in 'vote-email.txt'"
|
207
|
+
puts email
|
208
|
+
end.call
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
task(:clobber) { rm_rf '_staged' }
|
@@ -0,0 +1,328 @@
|
|
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
|
+
require File.expand_path('../spec_helpers', File.dirname(__FILE__))
|
18
|
+
require 'stringio'
|
19
|
+
Sandbox.require_optional_extension 'buildr/drb'
|
20
|
+
|
21
|
+
|
22
|
+
describe Buildr::DRbApplication do
|
23
|
+
|
24
|
+
module DRbHelper
|
25
|
+
attr_accessor :app, :drb, :cfg
|
26
|
+
|
27
|
+
def use_stdio(stdin = nil, stdout = nil, stderr = nil)
|
28
|
+
stdin ||= StringIO.new
|
29
|
+
stdout ||= StringIO.new
|
30
|
+
stderr ||= StringIO.new
|
31
|
+
cfg.update :in => stdin, :out => stdout, :err => stderr
|
32
|
+
end
|
33
|
+
|
34
|
+
def remote_run(*argv)
|
35
|
+
cfg.update :argv => argv
|
36
|
+
drb.remote_run(cfg)
|
37
|
+
end
|
38
|
+
|
39
|
+
def output
|
40
|
+
cfg[:out].string
|
41
|
+
end
|
42
|
+
|
43
|
+
def write_buildfile(content = nil)
|
44
|
+
write 'buildfile', content || %q{
|
45
|
+
define('foo') do
|
46
|
+
|
47
|
+
rule '.rbc' => '.rb' do |t|
|
48
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
49
|
+
end
|
50
|
+
|
51
|
+
task('hello') do
|
52
|
+
$stdout.puts 'hi'
|
53
|
+
end
|
54
|
+
|
55
|
+
task('empty')
|
56
|
+
|
57
|
+
task('no') do
|
58
|
+
task('empty').enhance ['delete_me']
|
59
|
+
task('empty') { $stdout.puts 'no' }
|
60
|
+
end
|
61
|
+
|
62
|
+
task('delete_me')
|
63
|
+
|
64
|
+
task('create') do
|
65
|
+
Rake::Task.define_task('created')
|
66
|
+
rule '.rbc' => '.rb' do |t|
|
67
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
task('exists') do
|
72
|
+
$stdout.puts !!Buildr.application.lookup('created')
|
73
|
+
end
|
74
|
+
|
75
|
+
task('setopt', :name, :value) do |task, args|
|
76
|
+
Buildr.application.options.send("#{args[:name]}=", args[:value])
|
77
|
+
end
|
78
|
+
end
|
79
|
+
}
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
include DRbHelper
|
84
|
+
|
85
|
+
before(:each) do
|
86
|
+
@in, @out, @err = $stdin, $stdout, $stderr
|
87
|
+
@cfg = {
|
88
|
+
:dir => Dir.pwd, :argv => [],
|
89
|
+
:in => @in, :out => @out, :err => @err
|
90
|
+
}
|
91
|
+
@drb = Buildr::DRbApplication.clone
|
92
|
+
@drb.send :setup
|
93
|
+
@app = Buildr.application
|
94
|
+
end
|
95
|
+
|
96
|
+
after(:each) do
|
97
|
+
$stdin, $stdout, $stderr = @in, @out, @err
|
98
|
+
end
|
99
|
+
|
100
|
+
describe '.run' do
|
101
|
+
it 'starts server if no server is running' do
|
102
|
+
drb.should_receive(:connect).and_raise DRb::DRbConnError
|
103
|
+
drb.should_receive(:run_server!)
|
104
|
+
drb.should_not_receive(:run_client)
|
105
|
+
drb.run
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'connects to an already started server' do
|
109
|
+
drb.should_receive(:connect).and_return "client"
|
110
|
+
drb.should_receive(:run_client).with "client"
|
111
|
+
drb.should_not_receive(:run_server!)
|
112
|
+
drb.run
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '.remote_run' do
|
117
|
+
|
118
|
+
describe 'stdout' do
|
119
|
+
it 'is redirected to client' do
|
120
|
+
use_stdio
|
121
|
+
Buildr.application.should_receive(:remote_run) do
|
122
|
+
$stdout.puts "HELLO"
|
123
|
+
end
|
124
|
+
remote_run
|
125
|
+
output.should eql("HELLO\n")
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe 'stderr' do
|
130
|
+
it 'is redirected to client' do
|
131
|
+
use_stdio
|
132
|
+
Buildr.application.should_receive(:remote_run) do
|
133
|
+
$stderr.puts "HELLO"
|
134
|
+
end
|
135
|
+
remote_run
|
136
|
+
cfg[:err].string.should eql("HELLO\n")
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
describe 'stdin' do
|
141
|
+
it 'is redirected to client' do
|
142
|
+
use_stdio
|
143
|
+
cfg[:in].should_receive(:gets).and_return("HELLO\n")
|
144
|
+
result = nil
|
145
|
+
Buildr.application.should_receive(:remote_run) do
|
146
|
+
result = $stdin.gets
|
147
|
+
end
|
148
|
+
remote_run
|
149
|
+
result.should eql("HELLO\n")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
describe 'server ARGV' do
|
154
|
+
it 'is replaced with client argv' do
|
155
|
+
Buildr.application.should_receive(:remote_run) do
|
156
|
+
ARGV.should eql(['hello'])
|
157
|
+
end
|
158
|
+
remote_run 'hello'
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
describe 'without buildfile loaded' do
|
163
|
+
before(:each) do
|
164
|
+
app.instance_eval { @rakefile = nil }
|
165
|
+
write_buildfile
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'should load the buildfile' do
|
169
|
+
app.should_receive(:top_level)
|
170
|
+
lambda { remote_run }.should run_task('foo')
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe 'with unmodified buildfile' do
|
175
|
+
|
176
|
+
before(:each) do
|
177
|
+
write_buildfile
|
178
|
+
app.options.rakelib = []
|
179
|
+
app.send :load_buildfile
|
180
|
+
drb.save_snapshot(app)
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'should not reload the buildfile' do
|
184
|
+
app.should_not_receive(:reload_buildfile)
|
185
|
+
app.should_receive(:top_level)
|
186
|
+
remote_run
|
187
|
+
end
|
188
|
+
|
189
|
+
it 'should not define projects again' do
|
190
|
+
use_stdio
|
191
|
+
lambda { 2.times { remote_run 'foo:hello' } }.should_not run_task('foo')
|
192
|
+
output.should eql("hi\nhi\n")
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should restore task actions' do
|
196
|
+
use_stdio
|
197
|
+
remote_run 'foo:empty'
|
198
|
+
output.should be_empty
|
199
|
+
2.times { remote_run 'foo:no' }
|
200
|
+
remote_run 'foo:empty'
|
201
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
202
|
+
actions.should be_empty # as originally defined
|
203
|
+
output.should be_empty
|
204
|
+
end
|
205
|
+
|
206
|
+
it 'should restore task prerequisites' do
|
207
|
+
use_stdio
|
208
|
+
remote_run 'foo:empty'
|
209
|
+
output.should be_empty
|
210
|
+
2.times { remote_run 'foo:no' }
|
211
|
+
remote_run 'foo:empty'
|
212
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
213
|
+
pres.should be_empty # as originally defined
|
214
|
+
output.should be_empty
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'should drop runtime created tasks' do
|
218
|
+
remote_run 'foo:create'
|
219
|
+
app.lookup('created').should_not be_nil
|
220
|
+
remote_run 'foo:empty'
|
221
|
+
app.lookup('created').should be_nil
|
222
|
+
end
|
223
|
+
|
224
|
+
it 'should restore options' do
|
225
|
+
remote_run 'foo:setopt[bar,baz]'
|
226
|
+
app.options.bar.should eql("baz")
|
227
|
+
remote_run 'foo:empty'
|
228
|
+
app.options.bar.should be_nil
|
229
|
+
end
|
230
|
+
|
231
|
+
it 'should restore rules' do
|
232
|
+
orig = app.instance_eval { @rules.size }
|
233
|
+
remote_run 'foo:create'
|
234
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
235
|
+
remote_run 'foo:empty'
|
236
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
237
|
+
end
|
238
|
+
|
239
|
+
end
|
240
|
+
|
241
|
+
describe 'with modified buildfile' do
|
242
|
+
|
243
|
+
before(:each) do
|
244
|
+
write_buildfile
|
245
|
+
app.options.rakelib = []
|
246
|
+
app.send :load_buildfile
|
247
|
+
drb.save_snapshot(app)
|
248
|
+
app.instance_eval { @last_loaded = Time.now - 10 }
|
249
|
+
write_buildfile %q{
|
250
|
+
rule '.rbc' => '.rb' do |t|
|
251
|
+
$stdout.puts "#{t.name} from #{t.source}"
|
252
|
+
end
|
253
|
+
define('foo') do
|
254
|
+
task('hello') do
|
255
|
+
$stdout.puts 'bye'
|
256
|
+
end
|
257
|
+
task('empty')
|
258
|
+
define('bar') do
|
259
|
+
|
260
|
+
end
|
261
|
+
end
|
262
|
+
}
|
263
|
+
end
|
264
|
+
|
265
|
+
it 'should reload the buildfile' do
|
266
|
+
app.should_receive(:reload_buildfile)
|
267
|
+
app.should_receive(:top_level)
|
268
|
+
remote_run
|
269
|
+
end
|
270
|
+
|
271
|
+
it 'should redefine projects' do
|
272
|
+
lambda { remote_run }.should run_tasks('foo', 'foo:bar')
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should remove tasks deleted from buildfile' do
|
276
|
+
app.lookup('foo:delete_me').should_not be_nil
|
277
|
+
remote_run
|
278
|
+
app.lookup('foo:delete_me').should be_nil
|
279
|
+
end
|
280
|
+
|
281
|
+
it 'should redefine tasks actions' do
|
282
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
283
|
+
actions.should be_empty # no action
|
284
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
285
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
286
|
+
actions.should_not be_empty
|
287
|
+
remote_run # cause to reload the buildfile
|
288
|
+
actions = app.lookup('foo:empty').instance_eval { @actions }
|
289
|
+
actions.should be_empty # as defined on the new buildfile
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'should redefine task prerequisites' do
|
293
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
294
|
+
pres.should be_empty # no action
|
295
|
+
app.lookup('foo:no').invoke # enhance the empty task
|
296
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
297
|
+
pres.should_not be_empty
|
298
|
+
remote_run # cause to reload the buildfile
|
299
|
+
pres = app.lookup('foo:empty').send(:prerequisites).map(&:to_s)
|
300
|
+
pres.should be_empty # as defined on the new buildfile
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'should drop runtime created tasks' do
|
304
|
+
app.lookup('foo:create').invoke
|
305
|
+
app.lookup('created').should_not be_nil
|
306
|
+
remote_run 'foo:empty'
|
307
|
+
app.lookup('created').should be_nil
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should restore options' do
|
311
|
+
app.options.bar = 'baz'
|
312
|
+
remote_run 'foo:empty'
|
313
|
+
app.options.bar.should be_nil
|
314
|
+
end
|
315
|
+
|
316
|
+
it 'should redefine rules' do
|
317
|
+
orig = app.instance_eval { @rules.size }
|
318
|
+
app.lookup('foo:create').invoke
|
319
|
+
app.instance_eval { @rules.size }.should eql(orig + 1)
|
320
|
+
remote_run 'foo:empty'
|
321
|
+
app.instance_eval { @rules.size }.should eql(orig)
|
322
|
+
end
|
323
|
+
|
324
|
+
end
|
325
|
+
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|