ittayd-buildr 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +62 -9
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +20 -39
- data/_buildr +1 -0
- data/{spec/java/ant.rb → _jbuildr} +11 -15
- metadata +30 -210
- data/DISCLAIMER +0 -7
- data/addon/buildr/antlr.rb +0 -65
- data/addon/buildr/cobertura.rb +0 -22
- data/addon/buildr/drb.rb +0 -281
- data/addon/buildr/emma.rb +0 -22
- data/addon/buildr/hibernate.rb +0 -142
- data/addon/buildr/javacc.rb +0 -85
- data/addon/buildr/jdepend.rb +0 -60
- data/addon/buildr/jetty.rb +0 -248
- data/addon/buildr/jibx.rb +0 -86
- data/addon/buildr/nailgun.rb +0 -221
- data/addon/buildr/openjpa.rb +0 -90
- 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 +0 -41
- 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 +0 -144
- data/addon/buildr/path.rb +0 -136
- data/addon/buildr/xmlbeans.rb +0 -93
- data/buildr.buildfile +0 -53
- data/buildr.gemspec +0 -58
- data/doc/css/default.css +0 -228
- data/doc/css/print.css +0 -100
- data/doc/css/syntax.css +0 -52
- data/doc/images/apache-incubator-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.tif +0 -0
- data/doc/pages/artifacts.textile +0 -207
- data/doc/pages/building.textile +0 -240
- data/doc/pages/contributing.textile +0 -208
- data/doc/pages/download.textile +0 -62
- data/doc/pages/extending.textile +0 -175
- data/doc/pages/getting_started.textile +0 -273
- data/doc/pages/index.textile +0 -42
- data/doc/pages/languages.textile +0 -407
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/more_stuff.textile +0 -314
- data/doc/pages/packaging.textile +0 -427
- data/doc/pages/projects.textile +0 -274
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/settings_profiles.textile +0 -274
- data/doc/pages/testing.textile +0 -212
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/print.toc.yaml +0 -29
- data/doc/scripts/buildr-git.rb +0 -412
- data/doc/scripts/install-jruby.sh +0 -44
- data/doc/scripts/install-linux.sh +0 -64
- data/doc/scripts/install-osx.sh +0 -52
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/KEYS +0 -151
- data/etc/git-svn-authors +0 -16
- data/lib/buildr.rb +0 -33
- data/lib/buildr/core.rb +0 -29
- data/lib/buildr/core/application.rb +0 -665
- data/lib/buildr/core/build.rb +0 -311
- data/lib/buildr/core/checks.rb +0 -254
- data/lib/buildr/core/common.rb +0 -150
- data/lib/buildr/core/compile.rb +0 -590
- data/lib/buildr/core/environment.rb +0 -117
- data/lib/buildr/core/filter.rb +0 -366
- data/lib/buildr/core/generate.rb +0 -195
- data/lib/buildr/core/help.rb +0 -119
- data/lib/buildr/core/osx.rb +0 -49
- data/lib/buildr/core/progressbar.rb +0 -156
- data/lib/buildr/core/project.rb +0 -923
- data/lib/buildr/core/test.rb +0 -715
- data/lib/buildr/core/transports.rb +0 -560
- data/lib/buildr/core/util.rb +0 -294
- data/lib/buildr/groovy.rb +0 -18
- data/lib/buildr/groovy/bdd.rb +0 -106
- data/lib/buildr/groovy/compiler.rb +0 -138
- data/lib/buildr/ide.rb +0 -19
- data/lib/buildr/ide/eclipse.rb +0 -222
- data/lib/buildr/ide/idea.ipr.template +0 -300
- data/lib/buildr/ide/idea.rb +0 -190
- data/lib/buildr/ide/idea7x.ipr.template +0 -290
- data/lib/buildr/ide/idea7x.rb +0 -212
- data/lib/buildr/java.rb +0 -23
- data/lib/buildr/java/ant.rb +0 -92
- data/lib/buildr/java/bdd.rb +0 -451
- data/lib/buildr/java/cobertura.rb +0 -236
- data/lib/buildr/java/commands.rb +0 -211
- data/lib/buildr/java/compiler.rb +0 -348
- data/lib/buildr/java/deprecated.rb +0 -141
- data/lib/buildr/java/emma.rb +0 -238
- data/lib/buildr/java/jruby.rb +0 -117
- data/lib/buildr/java/jtestr_runner.rb.erb +0 -116
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +0 -119
- data/lib/buildr/java/packaging.rb +0 -717
- data/lib/buildr/java/pom.rb +0 -174
- data/lib/buildr/java/rjb.rb +0 -155
- data/lib/buildr/java/test_result.rb +0 -307
- data/lib/buildr/java/tests.rb +0 -329
- data/lib/buildr/java/version_requirement.rb +0 -172
- data/lib/buildr/packaging.rb +0 -24
- data/lib/buildr/packaging/archive.rb +0 -488
- data/lib/buildr/packaging/artifact.rb +0 -759
- data/lib/buildr/packaging/artifact_namespace.rb +0 -972
- data/lib/buildr/packaging/artifact_search.rb +0 -140
- data/lib/buildr/packaging/gems.rb +0 -102
- data/lib/buildr/packaging/package.rb +0 -233
- data/lib/buildr/packaging/tar.rb +0 -186
- data/lib/buildr/packaging/version_requirement.rb +0 -172
- data/lib/buildr/packaging/zip.rb +0 -64
- data/lib/buildr/packaging/ziptask.rb +0 -313
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/scala.rb +0 -19
- data/lib/buildr/scala/compiler.rb +0 -109
- data/lib/buildr/scala/tests.rb +0 -203
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/doc.rake +0 -103
- data/rakelib/package.rake +0 -76
- data/rakelib/release.rake +0 -65
- data/rakelib/rspec.rake +0 -83
- data/rakelib/rubyforge.rake +0 -56
- data/rakelib/scm.rake +0 -49
- data/rakelib/setup.rake +0 -81
- data/rakelib/stage.rake +0 -48
- data/spec/addon/drb_spec.rb +0 -328
- data/spec/core/application_spec.rb +0 -419
- data/spec/core/build_spec.rb +0 -423
- data/spec/core/checks_spec.rb +0 -519
- data/spec/core/common_spec.rb +0 -670
- data/spec/core/compile_spec.rb +0 -582
- data/spec/core/generate_spec.rb +0 -33
- data/spec/core/project_spec.rb +0 -776
- data/spec/core/test_spec.rb +0 -1098
- data/spec/core/transport_spec.rb +0 -500
- data/spec/groovy/bdd_spec.rb +0 -80
- data/spec/groovy/compiler_spec.rb +0 -239
- data/spec/ide/eclipse_spec.rb +0 -311
- data/spec/java/bdd_spec.rb +0 -358
- data/spec/java/cobertura_spec.rb +0 -77
- data/spec/java/compiler_spec.rb +0 -446
- data/spec/java/emma_spec.rb +0 -120
- data/spec/java/java_spec.rb +0 -96
- data/spec/java/packaging_spec.rb +0 -1120
- data/spec/java/test_coverage_spec.rb +0 -255
- data/spec/java/tests_spec.rb +0 -471
- data/spec/packaging/archive_spec.rb +0 -503
- data/spec/packaging/artifact_namespace_spec.rb +0 -646
- data/spec/packaging/artifact_spec.rb +0 -795
- data/spec/packaging/packaging_helper.rb +0 -63
- data/spec/packaging/packaging_spec.rb +0 -589
- data/spec/sandbox.rb +0 -139
- data/spec/scala/compiler_spec.rb +0 -228
- data/spec/scala/tests_spec.rb +0 -215
- data/spec/spec_helpers.rb +0 -327
- data/spec/version_requirement_spec.rb +0 -123
data/doc/print.haml
DELETED
@@ -1,51 +0,0 @@
|
|
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
|
-
!!! 1.1
|
17
|
-
%html
|
18
|
-
%head
|
19
|
-
%meta{ 'http-equiv'=>'Content-Type', :content=>'text/html;charset=UTF-8' }/
|
20
|
-
%title= collection.title
|
21
|
-
%style{ :type=>'text/css' }
|
22
|
-
@import 'css/default.css';
|
23
|
-
@import 'css/syntax.css';
|
24
|
-
@import 'css/print.css' print;
|
25
|
-
%meta{ :name=>'subject', :content=>'Official Buildr documentation from the people in the know' }
|
26
|
-
%meta{ :name=>'author', :content=>'http://incubator.apache.org/buildr' }
|
27
|
-
%body
|
28
|
-
#wrap
|
29
|
-
#header
|
30
|
-
%img{ :src=>'images/buildr-hires.png', :alt=>collection.title, :style=>'width:20em' }
|
31
|
-
.tagline= ''
|
32
|
-
#content
|
33
|
-
= collection.toc.to_html(:nested, :class=>'toc')
|
34
|
-
#license
|
35
|
-
%p Copyright 2007-2008 Apache Buildr
|
36
|
-
%p
|
37
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you
|
38
|
-
may not use this file except in compliance with the License. You
|
39
|
-
may obtain a copy of the License at
|
40
|
-
%p{ :style=>'margin-left: 2em' }
|
41
|
-
%a{ :href=>'http://www.apache.org/licenses/LICENSE-2.0' } http://www.apache.org/licenses/LICENSE-2.0
|
42
|
-
%p
|
43
|
-
Unless required by applicable law or agreed to in writing, software
|
44
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
45
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
46
|
-
implied. See the License for the specific language governing
|
47
|
-
permissions and limitations under the License.
|
48
|
-
- pages.each do |page|
|
49
|
-
%h1{ :id=>page.id }= page.title
|
50
|
-
= page.toc.to_html(:nested, :class=>'toc')
|
51
|
-
~ collect_links(renumber_footnotes(page.content))
|
data/doc/print.toc.yaml
DELETED
@@ -1,29 +0,0 @@
|
|
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
|
-
- Welcome: index.html
|
17
|
-
- Getting Started: getting_started.html
|
18
|
-
- Projects: projects.html
|
19
|
-
- Building: building.html
|
20
|
-
- Artifacts: artifacts.html
|
21
|
-
- Packaging: packaging.html
|
22
|
-
- Testing: testing.html
|
23
|
-
- Settings/Profiles: settings_profiles.html
|
24
|
-
- Languages: languages.html
|
25
|
-
- More Stuff: more_stuff.html
|
26
|
-
- Extending: extending.html
|
27
|
-
- Recipes: recipes.html
|
28
|
-
- Troubleshooting: troubleshooting.html
|
29
|
-
- Contributing: contributing.html
|
data/doc/scripts/buildr-git.rb
DELETED
@@ -1,412 +0,0 @@
|
|
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, having a set of pre-defined aliases to work with Apache's SVN.
|
20
|
-
#
|
21
|
-
# You dont need to have a buildr copy to use it, just execute the buildr-git balloon:
|
22
|
-
#
|
23
|
-
# ruby -ropen-uri -e 'eval(open("http://balloon.hobix.com/buildr-git").read)'
|
24
|
-
|
25
|
-
require 'yaml'
|
26
|
-
require 'optparse'
|
27
|
-
require 'ostruct'
|
28
|
-
|
29
|
-
# Pager from http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
|
30
|
-
def run_pager
|
31
|
-
return if RUBY_PLATFORM =~ /win32/
|
32
|
-
return unless STDOUT.tty?
|
33
|
-
|
34
|
-
read, write = IO.pipe
|
35
|
-
|
36
|
-
unless Kernel.fork # Child process
|
37
|
-
STDOUT.reopen(write)
|
38
|
-
STDERR.reopen(write) if STDERR.tty?
|
39
|
-
read.close
|
40
|
-
write.close
|
41
|
-
return
|
42
|
-
end
|
43
|
-
|
44
|
-
# Parent process, become pager
|
45
|
-
STDIN.reopen(read)
|
46
|
-
read.close
|
47
|
-
write.close
|
48
|
-
|
49
|
-
ENV['LESS'] = 'FSRX' # Don't page if the input is short enough
|
50
|
-
|
51
|
-
Kernel.select [STDIN] # Wait until we have input before we start the pager
|
52
|
-
pager = ENV['PAGER'] || 'less'
|
53
|
-
exec pager rescue exec "/bin/sh", "-c", pager
|
54
|
-
end
|
55
|
-
|
56
|
-
def header
|
57
|
-
<<HEADER
|
58
|
-
|
59
|
-
Buildr official commit channel is Apache's svn repository, however some
|
60
|
-
developers may prefer to use git while working on several features and
|
61
|
-
merging other's changes.
|
62
|
-
|
63
|
-
This script will configure a buildr-git copy on so you can commit to svn.
|
64
|
-
|
65
|
-
Enter <-h> to see options, <-H> to see notes about configured aliases
|
66
|
-
and recommended workflow, or any other option.
|
67
|
-
|
68
|
-
Ctrl+D or an invalid option to abort
|
69
|
-
HEADER
|
70
|
-
end
|
71
|
-
|
72
|
-
def notice
|
73
|
-
<<NOTICE
|
74
|
-
ALIASES:
|
75
|
-
|
76
|
-
Some git aliases have been created for developer convenience:
|
77
|
-
|
78
|
-
git apache-fetch # get changes from apache/trunk without merging them
|
79
|
-
# you can inspect what's happening on trunk without
|
80
|
-
# having to worry about merging conflicts.
|
81
|
-
# Inspect the remote branch with `git log apache/trunk`
|
82
|
-
# Or if you have a git-ui like `tig` you can use that.
|
83
|
-
|
84
|
-
git apache-merge # Merge already fetched changes on the current branch
|
85
|
-
# Use this command to get up to date with trunk changes
|
86
|
-
# you can always cherry-pick from the apache/trunk
|
87
|
-
# branch.
|
88
|
-
|
89
|
-
git apache-pull # get apache-fetch && git apache-merge
|
90
|
-
|
91
|
-
git apache-push # Push to Apache's SVN. Only staged changes (those
|
92
|
-
# recorded using `git commit`) will be sent to SVN.
|
93
|
-
# You need not to be on the master branch.
|
94
|
-
# Actually you can work on a tiny-feature branch and
|
95
|
-
# commit directly from it.
|
96
|
-
#
|
97
|
-
# VERY IMPORTANT:
|
98
|
-
#
|
99
|
-
# Missing commits on Apache's SVN will be sent using
|
100
|
-
# your apache svn account. This means that you can
|
101
|
-
# make some commits on behalf of others (like patches
|
102
|
-
# comming from JIRA issues or casual contributors)
|
103
|
-
# Review the apache-push alias on .git/config if you
|
104
|
-
# want to change login-name used for commit to SVN.
|
105
|
-
#
|
106
|
-
# See the recommended workflow to avoid commiting
|
107
|
-
# other developers' changes and the following section.
|
108
|
-
|
109
|
-
THE GITHUB MIRROR:
|
110
|
-
|
111
|
-
Buildr has an unofficial git mirror on github, maintained by Victor:
|
112
|
-
|
113
|
-
http://github.com/vic/buildr
|
114
|
-
|
115
|
-
Actually it's not Victor who manually updates it, he has a cron-job on his
|
116
|
-
server, that only runs
|
117
|
-
|
118
|
-
git synchronize
|
119
|
-
|
120
|
-
A command you also have configured on your .git/config file.
|
121
|
-
|
122
|
-
However there are some limitations due to the fact that git-svn cannot
|
123
|
-
commit as multiple authors (unless all of them provided their passwords
|
124
|
-
to Victor, yet he doesn't want to take over the world.)
|
125
|
-
This means that if a commit is pushed to vic/buildr/master and has not
|
126
|
-
already been pushed by YOU to Apache's SVN by using `git apache-push`
|
127
|
-
your change will be commited to apache/trunk having Victor as the author
|
128
|
-
(that's how he gains meritocratic points at Apache :P).
|
129
|
-
|
130
|
-
So, it's very important - if you care about meritocracy - to follow or at
|
131
|
-
least that you get an idea of the recommended workflow.
|
132
|
-
|
133
|
-
RECOMMENDED WORKFLOW:
|
134
|
-
|
135
|
-
So now that you have your local buildr copy you can create topic branches
|
136
|
-
to work on independent features, and still merge easily with head changes.
|
137
|
-
|
138
|
-
They may seem lots of things to consider, but it's all for Buildr's healt.
|
139
|
-
As all things git, you can always follow your own workflow and even create
|
140
|
-
aliases on you .git/config file to avoid typing much. So, here they are:
|
141
|
-
|
142
|
-
1) get your buildr-git configured
|
143
|
-
(you have already do so, this was the most difficult part)
|
144
|
-
|
145
|
-
2) create a topic branch to work on, say.. you want to add cool-feature:
|
146
|
-
|
147
|
-
git checkout -b cool-feature master
|
148
|
-
# now on branch cool-feature
|
149
|
-
|
150
|
-
3) hack hack hack.. use the source luke.
|
151
|
-
every time you feel you have something important like added failing
|
152
|
-
spec, added part of feature, or resolved some conflict from merges,
|
153
|
-
you can commit your current progress. If you want to be selective, use:
|
154
|
-
|
155
|
-
git commit --interactive
|
156
|
-
|
157
|
-
3) review your changes, get ALL specs passing, repeat step 3 as needed
|
158
|
-
|
159
|
-
4) let's see what are they doing on trunk
|
160
|
-
|
161
|
-
git apache-fetch
|
162
|
-
# You can inspect the upstream changes without having to merge them
|
163
|
-
git log apache/trunk # what are they doing!!
|
164
|
-
|
165
|
-
5) integrate mainstream changes to your cool-feature branch, you can always
|
166
|
-
use `git cherry-pick` to select only some commits.
|
167
|
-
|
168
|
-
git merge apache/trunk cool-feature
|
169
|
-
|
170
|
-
6) Go to 3 unless ALL specs are passing.
|
171
|
-
|
172
|
-
7.a) (Skip to 7.b you have commit bit on Apache's SVN)
|
173
|
-
Create a patch using `git format-patch`
|
174
|
-
Promote your changes, create a JIRA issue and upload it granting Apache
|
175
|
-
license to include your code:
|
176
|
-
|
177
|
-
https://issues.apache.org/jira/browse/BUILDR
|
178
|
-
buildr-dev@incubator.apache.org
|
179
|
-
|
180
|
-
7.b) Now you have everyhing on staging area and merged important changes
|
181
|
-
from apache/trunk, it's time to commit them to Apache's SVN.
|
182
|
-
|
183
|
-
git apache-push
|
184
|
-
|
185
|
-
8) Optional. If you can push to vic/buildr/master mirror, you can just
|
186
|
-
synchronize the mirror helping others to get changes without having to
|
187
|
-
wait on Victor's cronjob to run every hour (useful for urgent changes).
|
188
|
-
|
189
|
-
git synchronize
|
190
|
-
|
191
|
-
9) Pull changes from origin frequently.
|
192
|
-
|
193
|
-
git fetch origin
|
194
|
-
git rebase --onto origin/master master master
|
195
|
-
|
196
|
-
10) Unconditionally, Go to step 2 ;)
|
197
|
-
Share your buildr-git workflow, git tips, etc.
|
198
|
-
|
199
|
-
RESOURCES:
|
200
|
-
|
201
|
-
http://github.com/vic/buildr/tree/master
|
202
|
-
http://git.or.cz/gitwiki/GitCheatSheet
|
203
|
-
http://groups.google.com/group/git-users/web/git-references
|
204
|
-
|
205
|
-
NOTICE
|
206
|
-
end # notice method
|
207
|
-
|
208
|
-
def optparse(options = OpenStruct.new, argv = ARGV)
|
209
|
-
opt = OptionParser.new do |opt|
|
210
|
-
|
211
|
-
if `git status 2>/dev/null`.chomp.empty?
|
212
|
-
options.local = File.expand_path('buildr', Dir.pwd)
|
213
|
-
else
|
214
|
-
puts "Current directory is a git repo: #{Dir.pwd}"
|
215
|
-
options.local = Dir.pwd
|
216
|
-
end
|
217
|
-
|
218
|
-
options.svn_branch = "apache/trunk"
|
219
|
-
options.origin = "git://github.com/vic/buildr.git"
|
220
|
-
options.member = false
|
221
|
-
|
222
|
-
opt.banner = "Usage: buildr-git.rb [options]"
|
223
|
-
opt.separator ""
|
224
|
-
opt.separator "OPTIONS:"
|
225
|
-
|
226
|
-
opt.on('-a', "--anon", "Use git://github.com/vic/buildr.git as origin") do
|
227
|
-
options.origin = "git://github.com/vic/buildr.git"
|
228
|
-
end
|
229
|
-
opt.on('-A', "--auth", "Use git@github.com:vic/buildr.git as origin") do
|
230
|
-
options.origin = "git@github.com:vic/buildr.git"
|
231
|
-
end
|
232
|
-
opt.on("-o", "--origin GIT_URL", "Clone from GIT_URL origin") do |value|
|
233
|
-
options.origin = value
|
234
|
-
end
|
235
|
-
opt.on('-l', "--local DIRECTORY", "Create local git clone on DIRECTORY") do |value|
|
236
|
-
options.local = value
|
237
|
-
end
|
238
|
-
opt.on('-b', "--branch GIT_SVN_BRANCH",
|
239
|
-
"Set the name for svn branch instead of apache/trunk") do |value|
|
240
|
-
options.svn_branch = value
|
241
|
-
end
|
242
|
-
opt.on('-e', "--email EMAIL",
|
243
|
-
"Configure git to use EMAIL for commits") do |value|
|
244
|
-
options.email = value
|
245
|
-
end
|
246
|
-
opt.on('-n', "--name USER_NAME",
|
247
|
-
"Configure your USER_NAME for git commits") do |value|
|
248
|
-
options.user_name = value
|
249
|
-
end
|
250
|
-
opt.on('-h', "--help", "Show buildr-git help") do
|
251
|
-
puts opt
|
252
|
-
throw :exit
|
253
|
-
end
|
254
|
-
opt.on('-H', "--notice", "Show notice about aliases and git workflow") do
|
255
|
-
run_pager
|
256
|
-
puts notice
|
257
|
-
throw :exit
|
258
|
-
end
|
259
|
-
end
|
260
|
-
opt.parse!(argv)
|
261
|
-
options
|
262
|
-
end # optparse method
|
263
|
-
|
264
|
-
|
265
|
-
def main
|
266
|
-
catch :exit do
|
267
|
-
options = optparse
|
268
|
-
puts header
|
269
|
-
puts
|
270
|
-
print '> '
|
271
|
-
if input = gets
|
272
|
-
options = optparse(options, input.split)
|
273
|
-
end
|
274
|
-
if input.nil? || (input != "\n" && input.empty?)
|
275
|
-
puts "Aborting."
|
276
|
-
return
|
277
|
-
end
|
278
|
-
perform(options)
|
279
|
-
end
|
280
|
-
end
|
281
|
-
|
282
|
-
def perform(options)
|
283
|
-
origin = options.origin
|
284
|
-
member = origin =~ /@/
|
285
|
-
local = options.local
|
286
|
-
svn_branch = options.svn_branch
|
287
|
-
user_email = options.email
|
288
|
-
user_name = options.user_name
|
289
|
-
|
290
|
-
`git clone #{origin} #{local} 1>&2` unless File.directory?(File.join('.git', origin))
|
291
|
-
|
292
|
-
puts
|
293
|
-
puts "Entering #{local} directory"
|
294
|
-
puts
|
295
|
-
Dir.chdir(local) do
|
296
|
-
|
297
|
-
# Load the list of git-svn committers
|
298
|
-
svn_authors_file = File.expand_path('etc/git-svn-authors', Dir.pwd)
|
299
|
-
svn_authors = File.read(svn_authors_file)
|
300
|
-
svn_authors.gsub!(/\s+=\s+/, ': ')
|
301
|
-
svn_authors = YAML.load(svn_authors)
|
302
|
-
|
303
|
-
# set the git-svn-authors file
|
304
|
-
`git config svn.authorsfile "#{svn_authors_file}"`
|
305
|
-
|
306
|
-
# Check that git is configured for the developer
|
307
|
-
user_email ||= `git config --get user.email`.chomp
|
308
|
-
if user_email.empty?
|
309
|
-
if member
|
310
|
-
puts "Enter your email as listed on #{svn_authors_file}"
|
311
|
-
print "> "
|
312
|
-
user_email = gets.chomp
|
313
|
-
else
|
314
|
-
puts "Provide an email address for git usage:"
|
315
|
-
user_email = gets.chomp
|
316
|
-
end
|
317
|
-
end
|
318
|
-
|
319
|
-
# Check user is listed
|
320
|
-
unless user_email.empty?
|
321
|
-
svn_user, git_contact = *svn_authors.find { |entry| /#{user_email}/ === entry.join(' ') }
|
322
|
-
end
|
323
|
-
|
324
|
-
if member
|
325
|
-
if git_contact.nil? # if using the authenticated git, he must be listed
|
326
|
-
puts <<-NOTICE
|
327
|
-
You need to be a buildr commmitter listed on #{svn_authors_file}.
|
328
|
-
Perhaps you need to add yourself to it, commit it using SVN, and
|
329
|
-
and run this script again.
|
330
|
-
Also checks your git global values for user.email and user.name
|
331
|
-
NOTICE
|
332
|
-
return
|
333
|
-
elsif /\s*(.*?)\s+\<(.+)\>\s*/ === git_contact
|
334
|
-
user_name, user_email = $1, $2
|
335
|
-
else
|
336
|
-
puts "Invalid contact string for #{svn_user}: #{git_contact.inspect}"
|
337
|
-
return
|
338
|
-
end
|
339
|
-
elsif user_email =~ /^\s*$/
|
340
|
-
puts "User email shall not include spaces: #{user_email.inspect}"
|
341
|
-
return
|
342
|
-
end
|
343
|
-
|
344
|
-
user_name ||= `git config --get user.name`.chomp
|
345
|
-
if git_contact.nil? && user_name.empty?
|
346
|
-
puts "Provide a developer name for git usage:"
|
347
|
-
user_name = gets.chomp
|
348
|
-
end
|
349
|
-
|
350
|
-
# Start the pager
|
351
|
-
run_pager
|
352
|
-
puts
|
353
|
-
|
354
|
-
|
355
|
-
old_origin = `git config --get remote.origin.url`.chomp
|
356
|
-
if member && old_origin !~ /@/
|
357
|
-
puts "Switching to authenticated origin #{origin}", ""
|
358
|
-
`git config remote.origin.url "#{origin}"`
|
359
|
-
elsif !member && old_origin =~ /@/
|
360
|
-
puts "Switching to anonymous origin #{origin}", ""
|
361
|
-
`git config remote.origin.url "#{origin}"`
|
362
|
-
end
|
363
|
-
|
364
|
-
# Configure user name and email for git sake (and github's gravatar)
|
365
|
-
puts "You claim to be #{user_name.inspect} <#{user_email}> "
|
366
|
-
puts "with apache-svn user: #{svn_user}" if svn_user
|
367
|
-
puts
|
368
|
-
`git config user.name "#{user_name}"`
|
369
|
-
`git config user.email "#{user_email}"`
|
370
|
-
|
371
|
-
# Ok, now obtain the last svn commit from history
|
372
|
-
last_svn_log = `git log -n 10 | grep git-svn-id | head -n 1`
|
373
|
-
fail "No svn metadata on last 10 commits" unless last_svn_log =~ /git-svn-id/
|
374
|
-
svn_repo, svn_prev = last_svn_log.split[1].split("@")
|
375
|
-
|
376
|
-
# Tell git where the svn repository is.
|
377
|
-
`git config svn-remote.#{svn_branch}.url #{svn_repo}`
|
378
|
-
`git config svn-remote.#{svn_branch}.fetch :refs/remotes/#{svn_branch}`
|
379
|
-
|
380
|
-
# Create the svn branch, do this instead of pulling the full svn history
|
381
|
-
`git push --force . refs/remotes/origin/master:refs/remotes/#{svn_branch}`
|
382
|
-
|
383
|
-
# Create apache aliases for developers git-workflow.
|
384
|
-
`git config alias.apache-fetch "!git-svn fetch #{svn_branch}"`
|
385
|
-
`git config alias.apache-merge "!git merge #{svn_branch}"`
|
386
|
-
`git config alias.apache-pull "!git apache-fetch && git apache-merge"`
|
387
|
-
if svn_user
|
388
|
-
`git config alias.apache-push "!git-svn dcommit --username #{svn_user}"`
|
389
|
-
else
|
390
|
-
`git config alias.apache-push "!git-svn dcommit"`
|
391
|
-
end
|
392
|
-
|
393
|
-
# Create github origin aliases
|
394
|
-
`git config alias.get "!git apache-fetch && git fetch origin"`
|
395
|
-
`git config alias.mrg "!git apache-merge && git merge origin"`
|
396
|
-
`git config alias.rbs "!git rebase --onto #{svn_branch} origin/master master"`
|
397
|
-
`git config alias.put "!git apache-push && git push origin"`
|
398
|
-
|
399
|
-
# This is Victor's cronjob
|
400
|
-
`git config alias.synchronize "!git get && git rbs && git put"`
|
401
|
-
|
402
|
-
# Final notices.
|
403
|
-
puts <<-NOTICE + notice
|
404
|
-
|
405
|
-
Your git repo #{local} has been configured, please review the
|
406
|
-
#{File.join(local, '.git/config')} file.
|
407
|
-
|
408
|
-
NOTICE
|
409
|
-
end
|
410
|
-
end # perform method
|
411
|
-
|
412
|
-
main
|