buildr 1.3.0-java

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.
Files changed (138) hide show
  1. data/CHANGELOG +780 -0
  2. data/DISCLAIMER +7 -0
  3. data/KEYS +151 -0
  4. data/LICENSE +176 -0
  5. data/NOTICE +31 -0
  6. data/README +173 -0
  7. data/Rakefile +63 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +232 -0
  10. data/addon/buildr/hibernate.rb +142 -0
  11. data/addon/buildr/javacc.rb +85 -0
  12. data/addon/buildr/jdepend.rb +60 -0
  13. data/addon/buildr/jetty.rb +248 -0
  14. data/addon/buildr/nailgun.rb +892 -0
  15. data/addon/buildr/openjpa.rb +90 -0
  16. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  17. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  18. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  19. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  20. data/addon/buildr/xmlbeans.rb +93 -0
  21. data/bin/buildr +21 -0
  22. data/buildr.gemspec +50 -0
  23. data/doc/css/default.css +225 -0
  24. data/doc/css/print.css +95 -0
  25. data/doc/css/syntax.css +43 -0
  26. data/doc/images/apache-incubator-logo.png +0 -0
  27. data/doc/images/buildr-hires.png +0 -0
  28. data/doc/images/buildr.png +0 -0
  29. data/doc/images/note.png +0 -0
  30. data/doc/images/tip.png +0 -0
  31. data/doc/images/zbuildr.tif +0 -0
  32. data/doc/pages/artifacts.textile +317 -0
  33. data/doc/pages/building.textile +501 -0
  34. data/doc/pages/contributing.textile +178 -0
  35. data/doc/pages/download.textile +25 -0
  36. data/doc/pages/extending.textile +229 -0
  37. data/doc/pages/getting_started.textile +337 -0
  38. data/doc/pages/index.textile +63 -0
  39. data/doc/pages/mailing_lists.textile +17 -0
  40. data/doc/pages/more_stuff.textile +367 -0
  41. data/doc/pages/packaging.textile +592 -0
  42. data/doc/pages/projects.textile +449 -0
  43. data/doc/pages/recipes.textile +127 -0
  44. data/doc/pages/settings_profiles.textile +339 -0
  45. data/doc/pages/testing.textile +475 -0
  46. data/doc/pages/troubleshooting.textile +121 -0
  47. data/doc/pages/whats_new.textile +389 -0
  48. data/doc/print.haml +52 -0
  49. data/doc/print.toc.yaml +28 -0
  50. data/doc/scripts/buildr-git.rb +411 -0
  51. data/doc/scripts/install-jruby.sh +44 -0
  52. data/doc/scripts/install-linux.sh +64 -0
  53. data/doc/scripts/install-osx.sh +52 -0
  54. data/doc/site.haml +55 -0
  55. data/doc/site.toc.yaml +44 -0
  56. data/lib/buildr.rb +47 -0
  57. data/lib/buildr/core.rb +27 -0
  58. data/lib/buildr/core/application.rb +373 -0
  59. data/lib/buildr/core/application_cli.rb +134 -0
  60. data/lib/buildr/core/build.rb +262 -0
  61. data/lib/buildr/core/checks.rb +382 -0
  62. data/lib/buildr/core/common.rb +155 -0
  63. data/lib/buildr/core/compile.rb +594 -0
  64. data/lib/buildr/core/environment.rb +120 -0
  65. data/lib/buildr/core/filter.rb +258 -0
  66. data/lib/buildr/core/generate.rb +195 -0
  67. data/lib/buildr/core/help.rb +118 -0
  68. data/lib/buildr/core/progressbar.rb +156 -0
  69. data/lib/buildr/core/project.rb +890 -0
  70. data/lib/buildr/core/test.rb +690 -0
  71. data/lib/buildr/core/transports.rb +486 -0
  72. data/lib/buildr/core/util.rb +235 -0
  73. data/lib/buildr/ide.rb +19 -0
  74. data/lib/buildr/ide/eclipse.rb +181 -0
  75. data/lib/buildr/ide/idea.ipr.template +300 -0
  76. data/lib/buildr/ide/idea.rb +194 -0
  77. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  78. data/lib/buildr/ide/idea7x.rb +210 -0
  79. data/lib/buildr/java.rb +26 -0
  80. data/lib/buildr/java/ant.rb +71 -0
  81. data/lib/buildr/java/bdd_frameworks.rb +267 -0
  82. data/lib/buildr/java/commands.rb +210 -0
  83. data/lib/buildr/java/compilers.rb +432 -0
  84. data/lib/buildr/java/deprecated.rb +141 -0
  85. data/lib/buildr/java/groovyc.rb +137 -0
  86. data/lib/buildr/java/jruby.rb +99 -0
  87. data/lib/buildr/java/org/apache/buildr/BuildrNail$Main.class +0 -0
  88. data/lib/buildr/java/org/apache/buildr/BuildrNail.class +0 -0
  89. data/lib/buildr/java/org/apache/buildr/BuildrNail.java +41 -0
  90. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  91. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +116 -0
  92. data/lib/buildr/java/packaging.rb +706 -0
  93. data/lib/buildr/java/pom.rb +178 -0
  94. data/lib/buildr/java/rjb.rb +142 -0
  95. data/lib/buildr/java/test_frameworks.rb +290 -0
  96. data/lib/buildr/java/version_requirement.rb +172 -0
  97. data/lib/buildr/packaging.rb +21 -0
  98. data/lib/buildr/packaging/artifact.rb +729 -0
  99. data/lib/buildr/packaging/artifact_namespace.rb +957 -0
  100. data/lib/buildr/packaging/artifact_search.rb +140 -0
  101. data/lib/buildr/packaging/gems.rb +102 -0
  102. data/lib/buildr/packaging/package.rb +233 -0
  103. data/lib/buildr/packaging/tar.rb +104 -0
  104. data/lib/buildr/packaging/zip.rb +719 -0
  105. data/rakelib/apache.rake +126 -0
  106. data/rakelib/changelog.rake +56 -0
  107. data/rakelib/doc.rake +103 -0
  108. data/rakelib/package.rake +44 -0
  109. data/rakelib/release.rake +53 -0
  110. data/rakelib/rspec.rake +81 -0
  111. data/rakelib/rubyforge.rake +45 -0
  112. data/rakelib/scm.rake +49 -0
  113. data/rakelib/setup.rake +59 -0
  114. data/rakelib/stage.rake +45 -0
  115. data/spec/application_spec.rb +316 -0
  116. data/spec/archive_spec.rb +494 -0
  117. data/spec/artifact_namespace_spec.rb +635 -0
  118. data/spec/artifact_spec.rb +738 -0
  119. data/spec/build_spec.rb +193 -0
  120. data/spec/checks_spec.rb +537 -0
  121. data/spec/common_spec.rb +579 -0
  122. data/spec/compile_spec.rb +561 -0
  123. data/spec/groovy_compilers_spec.rb +239 -0
  124. data/spec/java_bdd_frameworks_spec.rb +238 -0
  125. data/spec/java_compilers_spec.rb +446 -0
  126. data/spec/java_packaging_spec.rb +1042 -0
  127. data/spec/java_test_frameworks_spec.rb +414 -0
  128. data/spec/packaging_helper.rb +63 -0
  129. data/spec/packaging_spec.rb +589 -0
  130. data/spec/project_spec.rb +739 -0
  131. data/spec/sandbox.rb +116 -0
  132. data/spec/scala_compilers_spec.rb +239 -0
  133. data/spec/spec.opts +6 -0
  134. data/spec/spec_helpers.rb +283 -0
  135. data/spec/test_spec.rb +871 -0
  136. data/spec/transport_spec.rb +300 -0
  137. data/spec/version_requirement_spec.rb +115 -0
  138. metadata +324 -0
@@ -0,0 +1,52 @@
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/apache-incubator-logo.png', :alt=>'Apache Incubator', :style=>'float:right;width:10em' }
31
+ %img{ :src=>'images/buildr-hires.png', :alt=>collection.title, :style=>'width:20em' }
32
+ .tagline= ''
33
+ #content
34
+ = collection.toc.to_html(:nested, :class=>'toc')
35
+ #license
36
+ %p Copyright 2007-2008 Apache Buildr
37
+ %p
38
+ Licensed under the Apache License, Version 2.0 (the "License"); you
39
+ may not use this file except in compliance with the License. You
40
+ may obtain a copy of the License at
41
+ %p{ :style=>'margin-left: 2em' }
42
+ %a{ :href=>'http://www.apache.org/licenses/LICENSE-2.0' } http://www.apache.org/licenses/LICENSE-2.0
43
+ %p
44
+ Unless required by applicable law or agreed to in writing, software
45
+ distributed under the License is distributed on an "AS IS" BASIS,
46
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
47
+ implied. See the License for the specific language governing
48
+ permissions and limitations under the License.
49
+ - pages.each do |page|
50
+ %h1{ :id=>page.id }= page.title
51
+ = page.toc.to_html(:nested, :class=>'toc')
52
+ ~ collect_links(renumber_footnotes(page.content))
@@ -0,0 +1,28 @@
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
+ - More Stuff: more_stuff.html
25
+ - Extending: extending.html
26
+ - Recipes: recipes.html
27
+ - Troubleshooting: troubleshooting.html
28
+ - Contributing: contributing.html
@@ -0,0 +1,411 @@
1
+ #!/bin/sh
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 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.put "!git apache-push && git push origin"`
397
+
398
+ # This is Victor's cronjob
399
+ `git config alias.synchronize "!git get && git mrg && git put"`
400
+
401
+ # Final notices.
402
+ puts <<-NOTICE + notice
403
+
404
+ Your git repo #{local} has been configured, please review the
405
+ #{File.join(local, '.git/config')} file.
406
+
407
+ NOTICE
408
+ end
409
+ end # perform method
410
+
411
+ main