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
@@ -0,0 +1,512 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
# contributor license agreements. See the NOTICE file distributed with this
|
4
|
+
# work for additional information regarding copyright ownership. The ASF
|
5
|
+
# licenses this file to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
|
18
|
+
# This script helps buildr developers to obtain their own git clone from
|
19
|
+
# github, and also provides GitFlow commands to keep the git mirror in sync
|
20
|
+
# with Apache SVN.
|
21
|
+
#
|
22
|
+
# If you already have a buildr clone, just do the following:
|
23
|
+
#
|
24
|
+
# git config alias.apache '!'"ruby $PWD/doc/scripts/buildr-git.rb"
|
25
|
+
#
|
26
|
+
# After this, you have a 'git apache' command and you can try (be sure to read the help)
|
27
|
+
#
|
28
|
+
# git apache help
|
29
|
+
# git apache setup svn --help
|
30
|
+
# git apache sync --help
|
31
|
+
#
|
32
|
+
# To configure your local repo for svn synchronization,
|
33
|
+
#
|
34
|
+
# git apache update-authors
|
35
|
+
# git remote add upstream git@github.com:buildr/buildr.git
|
36
|
+
# git apache setup svn --username apacheLogin --apache-git upstream
|
37
|
+
# git apache sync
|
38
|
+
#
|
39
|
+
# This script can also be run without having a local buildr clone:
|
40
|
+
#
|
41
|
+
# ruby -ropen-uri -e 'eval(open("http://svn.apache.org/viewvc/buildr/trunk/doc/scripts/buildr-git.rb?view=co").read)' help
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
require 'yaml'
|
46
|
+
require 'open-uri'
|
47
|
+
|
48
|
+
if $0 == '-e' # invoked from open-uri
|
49
|
+
gitflow = "http://svn.apache.org/viewvc/buildr/trunk/doc/scripts/gitflow.rb?view=co"
|
50
|
+
eval(open(gitflow).read)
|
51
|
+
else
|
52
|
+
require File.expand_path('gitflow', File.dirname(__FILE__))
|
53
|
+
end
|
54
|
+
|
55
|
+
GitFlow.program = 'buildr-git'
|
56
|
+
|
57
|
+
module BuildrGit
|
58
|
+
|
59
|
+
class UpdateUsersCommand < GitFlow/'update-users'
|
60
|
+
|
61
|
+
@help = "Update list of Apache SVN committers from Jukka's list."
|
62
|
+
@@url = 'http://people.apache.org/~jukka/authors.txt'
|
63
|
+
|
64
|
+
def self.authors_file
|
65
|
+
File.expand_path('.git/authors.txt', Dir.pwd)
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.user_email(apache_login, authors_file = nil)
|
69
|
+
authors_file ||= self.authors_file
|
70
|
+
authors = YAML.load(File.read(authors_file).gsub!(/\s+=\s+/, ': '))
|
71
|
+
contact = authors[apache_login]
|
72
|
+
fail "You are not listed as apache commiter on #{authors_file}" unless contact
|
73
|
+
fail "Not a valid contact line: #{contact}" unless contact =~ /\s+<(.*)>/
|
74
|
+
[$`, $1]
|
75
|
+
end
|
76
|
+
|
77
|
+
def options(opts)
|
78
|
+
opts.url = @@url
|
79
|
+
opts.file = self.class.authors_file
|
80
|
+
[['-u', '--url URL',
|
81
|
+
"From URL. defaults to: #{opts.url}", lambda { |url|
|
82
|
+
opts.url = url
|
83
|
+
}],
|
84
|
+
['-f', '--file FILE',
|
85
|
+
"Write to FILE, defaults to #{opts.file}", lambda { |path|
|
86
|
+
opts.file = path
|
87
|
+
}]
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def execute(opts, argv)
|
92
|
+
FileUtils.mkdir_p(File.dirname(opts.file))
|
93
|
+
content = open(opts.url).read
|
94
|
+
File.open(opts.file, "w") { |f| f.print content }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
class CloneCommand < GitFlow/:clone
|
99
|
+
@help = "Create a clone from github.com/buildr repository."
|
100
|
+
|
101
|
+
def options(opts)
|
102
|
+
opts.origin = 'git://github.com/buildr/buildr.git'
|
103
|
+
opts.svn_prefix = 'apache'
|
104
|
+
opts.project = 'buildr'
|
105
|
+
opts.local = expand_path(opts.project)
|
106
|
+
[['--prefix SVN_PREFIX', opts.svn_prefix, lambda { |p|
|
107
|
+
opts.svn_prefix = p }],
|
108
|
+
['--origin GIT_ORIGIN', opts.origin, lambda { |o|
|
109
|
+
opts.origin = o }],
|
110
|
+
['-d', '--dir DIR', opts.local, lambda { |d| opts.local = d }]
|
111
|
+
]
|
112
|
+
end
|
113
|
+
|
114
|
+
def execute(opts, argv)
|
115
|
+
git 'clone', opts.origin, opts.local
|
116
|
+
Dir.chdir(opts.local) do
|
117
|
+
run 'update-users'
|
118
|
+
run 'setup'
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
class SetupCommand < GitFlow/:setup
|
124
|
+
@help = "Setup your buildr clone to be used with git mirror."
|
125
|
+
def options(opt)
|
126
|
+
[]
|
127
|
+
end
|
128
|
+
|
129
|
+
def execute(opt, argv)
|
130
|
+
run 'setup', 'alias'
|
131
|
+
run 'setup', 'svn'
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
class SetupAliasCommand < SetupCommand/:alias
|
136
|
+
def execute(opt, argv)
|
137
|
+
me = expand_path('doc/scripts/buildr-git.rb')
|
138
|
+
git 'config', 'alias.apache', "!ruby #{me}"
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
class SetupSvnCommand < SetupCommand/:svn
|
143
|
+
@help = "Setup for getting changes from Apache SVN."
|
144
|
+
|
145
|
+
def options(opt)
|
146
|
+
opt.svn_prefix = 'apache'
|
147
|
+
opt.svn_path = 'buildr'
|
148
|
+
opt.townhall = 'origin'
|
149
|
+
[['--username SVN_USER', 'Use Apache svn username for this svn remote',
|
150
|
+
lambda { |e| opt.apache_login = e }],
|
151
|
+
['--svn-prefix PREFIX', 'The name of svn remote to use for project.',
|
152
|
+
"Defaults to #{opt.svn_prefix}",
|
153
|
+
lambda{|p| opt.svn_prefix = p }],
|
154
|
+
['--svn-uri URI', lambda {|p| opt.svn_uri = p }],
|
155
|
+
['--svn-rev REVISION', lambda {|p| opt.svn_rev = p }],
|
156
|
+
['--svn-path PATH', 'The path to append to svn-uri.',
|
157
|
+
"Defaults to #{opt.svn_path}", lambda {|p| opt.svn_path = p }],
|
158
|
+
['--apache-git REMOTE', 'The name of remote you are using as town-hall git repo.',
|
159
|
+
"Defaults to #{opt.townhall}",
|
160
|
+
lambda {|p| opt.townhall = p }]
|
161
|
+
]
|
162
|
+
end
|
163
|
+
|
164
|
+
def execute(opt, argv)
|
165
|
+
authors_file = UpdateUsersCommand.authors_file
|
166
|
+
git 'config', 'svn.authorsfile', authors_file
|
167
|
+
git 'config', 'apache.svn', opt.svn_prefix
|
168
|
+
git 'config', 'apache.git', opt.townhall
|
169
|
+
|
170
|
+
if opt.apache_login
|
171
|
+
user, email = UpdateUsersCommand.user_email(opt.apache_login, authors_file)
|
172
|
+
puts "You claim to be #{user} <#{email}> with apache login: #{opt.apache_login}"
|
173
|
+
git('config', 'user.name', user)
|
174
|
+
git('config', 'user.email', email)
|
175
|
+
end
|
176
|
+
|
177
|
+
if opt.svn_rev
|
178
|
+
revision = opt.svn_rev
|
179
|
+
else
|
180
|
+
location, revision = svn_loc_rev
|
181
|
+
revision = opt.svn_rev || revision
|
182
|
+
end
|
183
|
+
|
184
|
+
if opt.svn_uri
|
185
|
+
repo = opt.svn_uri
|
186
|
+
else
|
187
|
+
fail "No #{opt.svn_path} directory on #{location}" unless
|
188
|
+
location =~ /\/#{opt.svn_path}/
|
189
|
+
repo = $`
|
190
|
+
end
|
191
|
+
|
192
|
+
# Tell git where the svn repository is
|
193
|
+
git('config', "svn-remote.#{opt.svn_prefix}.url", repo)
|
194
|
+
git('config', "svn-remote.#{opt.svn_prefix}.fetch",
|
195
|
+
"#{opt.svn_path}/trunk:refs/remotes/#{opt.svn_prefix}/trunk")
|
196
|
+
git('config', "svn-remote.#{opt.svn_prefix}.branches",
|
197
|
+
"#{opt.svn_path}/branches/*:refs/remotes/#{opt.svn_prefix}/*")
|
198
|
+
git('config', "svn-remote.#{opt.svn_prefix}.tags",
|
199
|
+
"#{opt.svn_path}/tags/*:refs/remotes/#{opt.svn_prefix}/tags/*")
|
200
|
+
|
201
|
+
# Store the user for svn dcommit
|
202
|
+
if opt.apache_login
|
203
|
+
git('config', "svn-remote.#{opt.svn_prefix}.username", opt.apache_login)
|
204
|
+
end
|
205
|
+
|
206
|
+
# Create the svn branch, do this instead of pulling the full svn history
|
207
|
+
git('update-ref', "refs/remotes/#{opt.svn_prefix}/trunk",
|
208
|
+
'refs/remotes/origin/master')
|
209
|
+
# create tags from git
|
210
|
+
git('tag').split.each do |tag|
|
211
|
+
git('update-ref', "refs/remotes/#{opt.svn_prefix}/tags/#{tag}",
|
212
|
+
"refs/tags/#{tag}")
|
213
|
+
end
|
214
|
+
# update svn metadata
|
215
|
+
mkdir_p(expand_path('.git/svn'))
|
216
|
+
svn_meta = expand_path('.git/svn/.metadata')
|
217
|
+
git('config', '--file', svn_meta,
|
218
|
+
"svn-remote.#{opt.svn_prefix}.branches-maxRev", revision)
|
219
|
+
git('config', '--file', svn_meta,
|
220
|
+
"svn-remote.#{opt.svn_prefix}.tags-maxRev", revision)
|
221
|
+
end
|
222
|
+
|
223
|
+
def svn_loc_rev
|
224
|
+
meta = sh('git log -n 10 | grep git-svn-id | head -n 1').chomp
|
225
|
+
fail "No svn metadata on last 10 commits" if meta.empty?
|
226
|
+
meta.split[1].split('@')
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
230
|
+
class FetchCommand < GitFlow/:fetch
|
231
|
+
@help = "Get changes from svn, creating tags, branches on townhall"
|
232
|
+
@documentation = <<-DOC
|
233
|
+
This command can be used to fetch changes from Apache\'s SVN repo.
|
234
|
+
|
235
|
+
GIT CONFIG VALUES:
|
236
|
+
|
237
|
+
apache.svn - The svn remote using to get changes from Apache SVN.
|
238
|
+
Set by setup-svn --svn-prefix.
|
239
|
+
DOC
|
240
|
+
|
241
|
+
def options(opt)
|
242
|
+
opt.apache_svn = git('config', '--get', 'apache.svn').chomp rescue nil
|
243
|
+
[['--apache-svn SVN_REMOTE', 'The SVN remote used to get changes from Apache',
|
244
|
+
"Current value: #{opt.apache_svn}",
|
245
|
+
lambda { |r| opt.apache_svn = r }]
|
246
|
+
]
|
247
|
+
end
|
248
|
+
|
249
|
+
def execute(opt, argv)
|
250
|
+
fail "Missing apache.svn config value" unless opt.apache_svn
|
251
|
+
git('svn', 'fetch', opt.apache_svn)
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
class SyncCommand < GitFlow/:sync
|
256
|
+
@help = "Synchronizes between Apache svn and git townhall."
|
257
|
+
@documentation = <<-DOC
|
258
|
+
This command will perform the following actions:
|
259
|
+
* fetch changes from apache svn.
|
260
|
+
* rebase them on the current branch or on the one specified with --onto
|
261
|
+
* dcommit (this will push your changes to Apache trunk)
|
262
|
+
|
263
|
+
GIT CONFIG VALUES:
|
264
|
+
|
265
|
+
apache.svn
|
266
|
+
The svn remote using to get changes from Apache SVN.
|
267
|
+
Set by setup-svn --svn-prefix.
|
268
|
+
|
269
|
+
apache.git
|
270
|
+
The git remote used as townhall repository.
|
271
|
+
Set by setup-svn --townhall.
|
272
|
+
|
273
|
+
svn-remote.APACHE_GIT.username
|
274
|
+
If configured, sync will use this svn username while dcommiting.
|
275
|
+
DOC
|
276
|
+
|
277
|
+
def options(opt)
|
278
|
+
git('branch').split.tap { |n| opt.current = n[n.index('*')+1] }
|
279
|
+
opt.branch = opt.current
|
280
|
+
opt.svn_branch = 'trunk'
|
281
|
+
opt.git_branch = 'master'
|
282
|
+
opt.apache_git = git('config', '--get', 'apache.git').chomp rescue nil
|
283
|
+
opt.apache_svn = git('config', '--get', 'apache.svn').chomp rescue nil
|
284
|
+
opt.svn_username = git('config', '--get',
|
285
|
+
"svn-remote.#{opt.apache_svn}.username").chomp rescue nil
|
286
|
+
[['--apache-svn SVN_REMOTE', 'The SVN remote used to get changes from Apache',
|
287
|
+
"Current value: #{opt.apache_svn}",
|
288
|
+
lambda { |r| opt.apache_svn = r }],
|
289
|
+
['--apache-git REMOTE', 'The git remote used as town-hall repository.',
|
290
|
+
"Current value: #{opt.apache_git}",
|
291
|
+
lambda { |r| opt.apache_git = r }],
|
292
|
+
['--username SVN_USER',
|
293
|
+
'Specify the SVN username for dcommit',
|
294
|
+
"Defaults to: #{opt.svn_username}",
|
295
|
+
lambda { |b| opt.svn_username = b }],
|
296
|
+
['--svn-branch SVN_BRANCH',
|
297
|
+
'Specify the SVN branch to rebase changes from, and where to dcommit',
|
298
|
+
"Defaults to: #{opt.svn_branch}",
|
299
|
+
lambda { |b| opt.svn_branch = b }],
|
300
|
+
['--git-branch REMOTE_BRANCH',
|
301
|
+
'Specify the remote town-hall branch (on apache.git) to update',
|
302
|
+
"Defaults to: #{opt.git_branch}",
|
303
|
+
lambda { |b| opt.git_branch = b }],
|
304
|
+
['--branch BRANCH', 'Specify the local branch to take changes from',
|
305
|
+
"Current branch: #{opt.branch}",
|
306
|
+
lambda { |b| opt.branch = b }]
|
307
|
+
]
|
308
|
+
end
|
309
|
+
|
310
|
+
def execute(opt, argv)
|
311
|
+
# obtain the svn url
|
312
|
+
url = git('config', '--get', "svn-remote.#{opt.apache_svn}.url").chomp
|
313
|
+
# obtain the path for project
|
314
|
+
path = git('config', '--get', "svn-remote.#{opt.apache_svn}.branches").
|
315
|
+
chomp.split('/branches').first
|
316
|
+
commit_url = "#{url}/#{path}/#{opt.svn_branch}"
|
317
|
+
|
318
|
+
# obtain latest changes from svn
|
319
|
+
git('svn', 'fetch', '--svn-remote', opt.apache_svn)
|
320
|
+
# obtain latest changes from git
|
321
|
+
git('fetch', opt.apache_git,
|
322
|
+
"#{opt.git_branch}:refs/remotes/#{opt.apache_git}/#{opt.git_branch}")
|
323
|
+
|
324
|
+
# rebase svn changes in the desired branch
|
325
|
+
git('rebase', "#{opt.apache_svn}/#{opt.svn_branch}", opt.branch)
|
326
|
+
git('rebase', "#{opt.apache_git}/#{opt.git_branch}", opt.branch)
|
327
|
+
|
328
|
+
# dcommit to the specific svn branch
|
329
|
+
['svn', 'dcommit',
|
330
|
+
'--svn-remote', opt.apache_svn, '--commit-url', commit_url].tap do |cmd|
|
331
|
+
if opt.svn_username
|
332
|
+
cmd << '--username' << opt.svn_username
|
333
|
+
end
|
334
|
+
git(*cmd)
|
335
|
+
end
|
336
|
+
|
337
|
+
# update townhall remote ref
|
338
|
+
git('update-ref',
|
339
|
+
"refs/remotes/#{opt.apache_git}/#{opt.git_branch}",
|
340
|
+
"refs/remotes/#{opt.apache_svn}/#{opt.svn_branch}")
|
341
|
+
|
342
|
+
# forward the remote townhall/master to apache/trunk
|
343
|
+
git('push', opt.apache_git,
|
344
|
+
"refs/remotes/#{opt.apache_git}/#{opt.git_branch}:#{opt.git_branch}")
|
345
|
+
|
346
|
+
# get back to the original branch
|
347
|
+
git('checkout', opt.current)
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
# This one is displayed when the user executes this script using
|
353
|
+
# open-uri -e
|
354
|
+
HEADER = <<HEADER
|
355
|
+
|
356
|
+
Buildr official commit channel is Apache's svn repository, however some
|
357
|
+
developers may prefer to use git while working on several features and
|
358
|
+
merging other's changes.
|
359
|
+
|
360
|
+
This script will configure a gitflow copy on so you can commit to svn.
|
361
|
+
|
362
|
+
Enter <-h> to see options, <-H> to see notes about configured aliases
|
363
|
+
and recommended workflow, or any other option.
|
364
|
+
|
365
|
+
Ctrl+D or an invalid option to abort
|
366
|
+
HEADER
|
367
|
+
|
368
|
+
# When fork is completed, we display the following notice on a
|
369
|
+
# pager, giving the user a brief overview of git aliases used
|
370
|
+
# to keep the mirror in sync.
|
371
|
+
NOTICE = <<NOTICE
|
372
|
+
ALIASES:
|
373
|
+
|
374
|
+
Some git aliases have been created for developer convenience:
|
375
|
+
|
376
|
+
git apache fetch # get changes from apache/trunk without merging them
|
377
|
+
# you can inspect what's happening on trunk without
|
378
|
+
# having to worry about merging conflicts.
|
379
|
+
# Inspect the remote branch with `git log apache/trunk`
|
380
|
+
# Or if you have a git-ui like `tig` you can use that.
|
381
|
+
|
382
|
+
git apache merge # Merge already fetched changes on the current branch
|
383
|
+
# Use this command to get up to date with trunk changes
|
384
|
+
# you can always cherry-pick from the apache/trunk
|
385
|
+
# branch.
|
386
|
+
|
387
|
+
git apache pull # get apache-fetch && git apache-merge
|
388
|
+
|
389
|
+
git apache push # Push to Apache's SVN. Only staged changes (those
|
390
|
+
# recorded using `git commit`) will be sent to SVN.
|
391
|
+
# You need not to be on the master branch.
|
392
|
+
# Actually you can work on a tiny-feature branch and
|
393
|
+
# commit directly from it.
|
394
|
+
#
|
395
|
+
# VERY IMPORTANT:
|
396
|
+
#
|
397
|
+
# Missing commits on Apache's SVN will be sent using
|
398
|
+
# your apache svn account. This means that you can
|
399
|
+
# make some commits on behalf of others (like patches
|
400
|
+
# comming from JIRA issues or casual contributors)
|
401
|
+
# Review the apache-push alias on .git/config if you
|
402
|
+
# want to change login-name used for commit to SVN.
|
403
|
+
#
|
404
|
+
# See the recommended workflow to avoid commiting
|
405
|
+
# other developers' changes and the following section.
|
406
|
+
|
407
|
+
THE GITHUB MIRROR:
|
408
|
+
|
409
|
+
Buildr has an unofficial git mirror on github, maintained by Apache committers:
|
410
|
+
|
411
|
+
http://github.com/buildr/buildr
|
412
|
+
|
413
|
+
This mirror DOES NOT replace Apache's SVN repository. We really care about
|
414
|
+
using Apache infrastructure and following Apache project guidelines for
|
415
|
+
contributions. This git mirror is provided only for developers convenience,
|
416
|
+
allowing them to easily create experimental branches or review code from
|
417
|
+
other committers.
|
418
|
+
|
419
|
+
All code that wants to make it to the official Apache Buildr repository needs
|
420
|
+
to be committed to the Apache SVN repository by using the command:
|
421
|
+
|
422
|
+
git synchronize
|
423
|
+
|
424
|
+
This command will synchronize both ways svn<->git to keep trunk upto date.
|
425
|
+
You need to be an Apache committer and have permissions on the SVN repo.
|
426
|
+
|
427
|
+
It's VERY IMPORTANT for Buildr committers to remember that contributions from
|
428
|
+
external entities wanting to be accepted will require them to sign the Apache ICLA.
|
429
|
+
We provide the git mirror to make it easier for people to experiment and
|
430
|
+
contribute back to Buildr, before merging their code in, please remember they
|
431
|
+
have to create create a JIRA issue granting ASF permission to include their code,
|
432
|
+
just like any other contribution following Apache's guidelines.
|
433
|
+
|
434
|
+
So, it's very important - if you care about meritocracy - to follow or at
|
435
|
+
least that you get an idea of the recommended workflow.
|
436
|
+
|
437
|
+
RECOMMENDED WORKFLOW:
|
438
|
+
|
439
|
+
So now that you have your local buildr copy you can create topic branches
|
440
|
+
to work on independent features, and still merge easily with head changes.
|
441
|
+
|
442
|
+
They may seem lots of things to consider, but it's all for Buildr's healt.
|
443
|
+
As all things git, you can always follow your own workflow and even create
|
444
|
+
aliases on you .git/config file to avoid typing much. So, here they are:
|
445
|
+
|
446
|
+
1) get your gitflow configured
|
447
|
+
(you have already do so, this was the most difficult part)
|
448
|
+
|
449
|
+
2) create a topic branch to work on, say.. you want to add cool-feature:
|
450
|
+
|
451
|
+
git checkout -b cool-feature master
|
452
|
+
# now on branch cool-feature
|
453
|
+
|
454
|
+
3) hack hack hack.. use the source luke.
|
455
|
+
every time you feel you have something important like added failing
|
456
|
+
spec, added part of feature, or resolved some conflict from merges,
|
457
|
+
you can commit your current progress. If you want to be selective, use:
|
458
|
+
|
459
|
+
git commit --interactive
|
460
|
+
|
461
|
+
3) review your changes, get ALL specs passing, repeat step 3 as needed
|
462
|
+
|
463
|
+
4) let's see what are they doing on trunk
|
464
|
+
|
465
|
+
git apache-fetch
|
466
|
+
# You can inspect the upstream changes without having to merge them
|
467
|
+
git log apache/trunk # what are they doing!!
|
468
|
+
|
469
|
+
5) integrate mainstream changes to your cool-feature branch, you can always
|
470
|
+
use `git cherry-pick` to select only some commits.
|
471
|
+
|
472
|
+
git merge apache/trunk cool-feature
|
473
|
+
|
474
|
+
6) Go to 3 unless ALL specs are passing.
|
475
|
+
|
476
|
+
7.a) (Skip to 7.b you have commit bit on Apache's SVN)
|
477
|
+
Create a patch using `git format-patch`
|
478
|
+
Promote your changes, create a JIRA issue and upload it granting Apache
|
479
|
+
license to include your code:
|
480
|
+
|
481
|
+
https://issues.apache.org/jira/browse/BUILDR
|
482
|
+
dev@buildr.apache.org
|
483
|
+
|
484
|
+
7.b) Now you have everyhing on staging area and merged important changes
|
485
|
+
from apache/trunk, it's time to commit them to Apache's SVN.
|
486
|
+
|
487
|
+
git apache-push
|
488
|
+
|
489
|
+
8) Optional. If you are a buildr committer you may want to synchronize
|
490
|
+
the github mirror for helping others to get changes without having to
|
491
|
+
wait on Victor's cronjob to run every hour (useful for urgent changes).
|
492
|
+
|
493
|
+
git synchronize
|
494
|
+
|
495
|
+
9) Pull changes from origin frequently.
|
496
|
+
|
497
|
+
git fetch origin
|
498
|
+
git rebase --onto origin/master master master
|
499
|
+
|
500
|
+
10) Unconditionally, Go to step 2 ;)
|
501
|
+
Share your gitflow workflow, git tips, etc.
|
502
|
+
|
503
|
+
RESOURCES:
|
504
|
+
|
505
|
+
http://github.com/buildr/buildr/tree/master
|
506
|
+
http://git.or.cz/gitwiki/GitCheatSheet
|
507
|
+
http://groups.google.com/group/git-users/web/git-references
|
508
|
+
|
509
|
+
NOTICE
|
510
|
+
#' for emacs
|
511
|
+
|
512
|
+
end
|