buildr 1.3.5-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGELOG +998 -0
  2. data/LICENSE +176 -0
  3. data/NOTICE +26 -0
  4. data/README.rdoc +134 -0
  5. data/Rakefile +45 -0
  6. data/_buildr +29 -0
  7. data/_jbuildr +29 -0
  8. data/addon/buildr/antlr.rb +65 -0
  9. data/addon/buildr/cobertura.rb +22 -0
  10. data/addon/buildr/drb.rb +281 -0
  11. data/addon/buildr/emma.rb +22 -0
  12. data/addon/buildr/hibernate.rb +142 -0
  13. data/addon/buildr/javacc.rb +85 -0
  14. data/addon/buildr/jdepend.rb +60 -0
  15. data/addon/buildr/jetty.rb +248 -0
  16. data/addon/buildr/jibx.rb +86 -0
  17. data/addon/buildr/nailgun.rb +221 -0
  18. data/addon/buildr/openjpa.rb +90 -0
  19. data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
  20. data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
  21. data/addon/buildr/org/apache/buildr/BuildrNail.java +41 -0
  22. data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
  23. data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
  24. data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
  25. data/addon/buildr/org/apache/buildr/JettyWrapper.java +144 -0
  26. data/addon/buildr/xmlbeans.rb +93 -0
  27. data/bin/buildr +19 -0
  28. data/buildr.buildfile +58 -0
  29. data/buildr.gemspec +65 -0
  30. data/doc/_config.yml +1 -0
  31. data/doc/_layouts/default.html +88 -0
  32. data/doc/_layouts/preface.html +22 -0
  33. data/doc/artifacts.textile +211 -0
  34. data/doc/building.textile +244 -0
  35. data/doc/contributing.textile +252 -0
  36. data/doc/css/default.css +236 -0
  37. data/doc/css/print.css +101 -0
  38. data/doc/css/syntax.css +23 -0
  39. data/doc/download.textile +79 -0
  40. data/doc/extending.textile +186 -0
  41. data/doc/images/1442160941-frontcover.jpg +0 -0
  42. data/doc/images/asf-logo.gif +0 -0
  43. data/doc/images/asf-logo.png +0 -0
  44. data/doc/images/buildr-hires.png +0 -0
  45. data/doc/images/buildr.png +0 -0
  46. data/doc/images/favicon.png +0 -0
  47. data/doc/images/growl-icon.tiff +0 -0
  48. data/doc/images/note.png +0 -0
  49. data/doc/images/project-structure.png +0 -0
  50. data/doc/images/tip.png +0 -0
  51. data/doc/images/zbuildr.png +0 -0
  52. data/doc/images/zbuildr.tif +0 -0
  53. data/doc/index.textile +69 -0
  54. data/doc/installing.textile +266 -0
  55. data/doc/languages.textile +459 -0
  56. data/doc/mailing_lists.textile +25 -0
  57. data/doc/more_stuff.textile +457 -0
  58. data/doc/packaging.textile +430 -0
  59. data/doc/preface.textile +54 -0
  60. data/doc/projects.textile +271 -0
  61. data/doc/quick_start.textile +210 -0
  62. data/doc/scripts/buildr-git.rb +512 -0
  63. data/doc/scripts/gitflow.rb +296 -0
  64. data/doc/scripts/install-jruby.sh +44 -0
  65. data/doc/scripts/install-linux.sh +72 -0
  66. data/doc/scripts/install-osx.sh +52 -0
  67. data/doc/settings_profiles.textile +280 -0
  68. data/doc/testing.textile +222 -0
  69. data/etc/KEYS +151 -0
  70. data/lib/buildr.rb +36 -0
  71. data/lib/buildr/core.rb +35 -0
  72. data/lib/buildr/core/application.rb +656 -0
  73. data/lib/buildr/core/build.rb +452 -0
  74. data/lib/buildr/core/checks.rb +254 -0
  75. data/lib/buildr/core/common.rb +150 -0
  76. data/lib/buildr/core/compile.rb +608 -0
  77. data/lib/buildr/core/environment.rb +129 -0
  78. data/lib/buildr/core/filter.rb +362 -0
  79. data/lib/buildr/core/generate.rb +195 -0
  80. data/lib/buildr/core/help.rb +119 -0
  81. data/lib/buildr/core/osx.rb +46 -0
  82. data/lib/buildr/core/progressbar.rb +156 -0
  83. data/lib/buildr/core/project.rb +866 -0
  84. data/lib/buildr/core/shell.rb +198 -0
  85. data/lib/buildr/core/test.rb +723 -0
  86. data/lib/buildr/core/transports.rb +559 -0
  87. data/lib/buildr/core/util.rb +449 -0
  88. data/lib/buildr/groovy.rb +19 -0
  89. data/lib/buildr/groovy/bdd.rb +106 -0
  90. data/lib/buildr/groovy/compiler.rb +138 -0
  91. data/lib/buildr/groovy/shell.rb +48 -0
  92. data/lib/buildr/ide.rb +19 -0
  93. data/lib/buildr/ide/eclipse.rb +334 -0
  94. data/lib/buildr/ide/eclipse/java.rb +53 -0
  95. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  96. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  97. data/lib/buildr/ide/idea.ipr.template +300 -0
  98. data/lib/buildr/ide/idea.rb +190 -0
  99. data/lib/buildr/ide/idea7x.ipr.template +290 -0
  100. data/lib/buildr/ide/idea7x.rb +212 -0
  101. data/lib/buildr/java.rb +23 -0
  102. data/lib/buildr/java/ant.rb +94 -0
  103. data/lib/buildr/java/bdd.rb +459 -0
  104. data/lib/buildr/java/cobertura.rb +274 -0
  105. data/lib/buildr/java/commands.rb +213 -0
  106. data/lib/buildr/java/compiler.rb +349 -0
  107. data/lib/buildr/java/deprecated.rb +141 -0
  108. data/lib/buildr/java/emma.rb +244 -0
  109. data/lib/buildr/java/jruby.rb +117 -0
  110. data/lib/buildr/java/jtestr_runner.rb.erb +116 -0
  111. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  112. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +137 -0
  113. data/lib/buildr/java/packaging.rb +716 -0
  114. data/lib/buildr/java/pom.rb +174 -0
  115. data/lib/buildr/java/rjb.rb +155 -0
  116. data/lib/buildr/java/test_result.rb +353 -0
  117. data/lib/buildr/java/tests.rb +333 -0
  118. data/lib/buildr/java/version_requirement.rb +172 -0
  119. data/lib/buildr/packaging.rb +24 -0
  120. data/lib/buildr/packaging/archive.rb +488 -0
  121. data/lib/buildr/packaging/artifact.rb +749 -0
  122. data/lib/buildr/packaging/artifact_namespace.rb +972 -0
  123. data/lib/buildr/packaging/artifact_search.rb +140 -0
  124. data/lib/buildr/packaging/gems.rb +102 -0
  125. data/lib/buildr/packaging/package.rb +238 -0
  126. data/lib/buildr/packaging/tar.rb +186 -0
  127. data/lib/buildr/packaging/version_requirement.rb +172 -0
  128. data/lib/buildr/packaging/zip.rb +73 -0
  129. data/lib/buildr/packaging/ziptask.rb +316 -0
  130. data/lib/buildr/resources/buildr.icns +0 -0
  131. data/lib/buildr/scala.rb +25 -0
  132. data/lib/buildr/scala/bdd.rb +109 -0
  133. data/lib/buildr/scala/compiler.rb +195 -0
  134. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  135. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  136. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  137. data/lib/buildr/scala/shell.rb +55 -0
  138. data/lib/buildr/scala/tests.rb +157 -0
  139. data/lib/buildr/shell.rb +180 -0
  140. data/rakelib/checks.rake +57 -0
  141. data/rakelib/doc.rake +92 -0
  142. data/rakelib/jekylltask.rb +120 -0
  143. data/rakelib/package.rake +73 -0
  144. data/rakelib/release.rake +149 -0
  145. data/rakelib/rspec.rake +73 -0
  146. data/rakelib/setup.rake +54 -0
  147. data/rakelib/stage.rake +213 -0
  148. data/rakelib/stage.rake~ +213 -0
  149. data/spec/addon/drb_spec.rb +328 -0
  150. data/spec/core/application_spec.rb +502 -0
  151. data/spec/core/build_spec.rb +677 -0
  152. data/spec/core/checks_spec.rb +519 -0
  153. data/spec/core/common_spec.rb +670 -0
  154. data/spec/core/compile_spec.rb +583 -0
  155. data/spec/core/extension_spec.rb +93 -0
  156. data/spec/core/generate_spec.rb +33 -0
  157. data/spec/core/project_spec.rb +762 -0
  158. data/spec/core/test_spec.rb +1098 -0
  159. data/spec/core/transport_spec.rb +537 -0
  160. data/spec/core/util_spec.rb +67 -0
  161. data/spec/groovy/bdd_spec.rb +80 -0
  162. data/spec/groovy/compiler_spec.rb +240 -0
  163. data/spec/ide/eclipse_spec.rb +501 -0
  164. data/spec/ide/idea7x_spec.rb +84 -0
  165. data/spec/java/ant_spec.rb +33 -0
  166. data/spec/java/bdd_spec.rb +382 -0
  167. data/spec/java/cobertura_spec.rb +85 -0
  168. data/spec/java/compiler_spec.rb +446 -0
  169. data/spec/java/emma_spec.rb +119 -0
  170. data/spec/java/java_spec.rb +124 -0
  171. data/spec/java/packaging_spec.rb +1134 -0
  172. data/spec/java/test_coverage_helper.rb +257 -0
  173. data/spec/java/tests_spec.rb +493 -0
  174. data/spec/packaging/archive_spec.rb +527 -0
  175. data/spec/packaging/artifact_namespace_spec.rb +654 -0
  176. data/spec/packaging/artifact_spec.rb +795 -0
  177. data/spec/packaging/packaging_helper.rb +63 -0
  178. data/spec/packaging/packaging_spec.rb +684 -0
  179. data/spec/sandbox.rb +142 -0
  180. data/spec/scala/bdd_spec.rb +119 -0
  181. data/spec/scala/compiler_spec.rb +284 -0
  182. data/spec/scala/scala.rb +38 -0
  183. data/spec/scala/tests_spec.rb +261 -0
  184. data/spec/spec_helpers.rb +340 -0
  185. data/spec/version_requirement_spec.rb +129 -0
  186. metadata +383 -0
@@ -0,0 +1,296 @@
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
+ require 'optparse'
18
+ require 'ostruct'
19
+ require 'fileutils'
20
+
21
+ module GitFlow
22
+ extend self
23
+
24
+ attr_accessor :should_run, :trace, :program
25
+
26
+ self.program = 'gitflow'
27
+ self.should_run = true # should we run at exit?
28
+
29
+ HELP = <<-HELP
30
+
31
+ GitFlow is a tool to create custom git commands implemented in ruby.
32
+ It is generic enougth to be used on any git based project besides Apache Buildr.
33
+
34
+ OVERVIEW:
35
+
36
+ gitflow is intended to help developers with their daily git workflow,
37
+ performing repetitive git commands for them. It is implemented in
38
+ ruby so you can do anything, from invoking rake tasks to telling
39
+ people on twitter you are having trouble with their code :P.
40
+
41
+ To get help for a specific command use:
42
+ gitflow.rb help command
43
+ gitflow.rb command --help
44
+
45
+ For convenience you can create an alias to be execute using git.
46
+ The following example registers buildr-git.rb, which provides apache
47
+ svn and git synchronization commands:
48
+
49
+ git config alias.apache '!'"ruby $PWD/doc/scripts/buildr-git.rb"
50
+
51
+ After that you can use
52
+ git apache command --help
53
+
54
+ EXTENDING YOUR WORKFLOW:
55
+
56
+ You can create your own gitflow commands, to adapt your development
57
+ workflow.
58
+
59
+ Simply create a ruby script somewhere say ~/.buildr/gitflow.rb
60
+ And alias it in your local repo:
61
+
62
+ git config alias.flow '!'"ruby ~/.buildr/gitflow.rb"
63
+ git config alias.work '!'"ruby ~/.buildr/gitflow.rb my-flow sub-work"
64
+
65
+ A sample command would look like this.. (you may want to look at buildr-git.rb)
66
+
67
+ #!/usr/bin/env ruby
68
+ require /path/to/gitflow.rb
69
+
70
+ class MyCommand < GitFlow/'my-flow'
71
+
72
+ @help = "Summary to be displayed when listing commands"
73
+ @documentation = "Very long help that will be paged if necessary. (for --help)"
74
+
75
+ # takes an openstruct to place default values and option values.
76
+ # returns an array of arguments given to optparse.on
77
+ def options(opts)
78
+ opts.something = 'default'
79
+ [
80
+ ['--name NAME', lambda { |n| opts.name = n }],
81
+ ['--yes', lambda { |n| opts.yes = true }]
82
+ ]
83
+ end
84
+
85
+ # takes the opts openstruct after options have been parsed and
86
+ # an argv array with non-option arguments.
87
+ def execute(opts, argv)
88
+ # you can run another command using
89
+ run('other-command', '--using-this', 'arg')
90
+ some = git('config', '--get', 'some.property').chomp rescue nil
91
+ page { puts "This will be paged on terminal if needed" }
92
+ end
93
+
94
+ class SubCommand < MyCommand/'sub-work'
95
+ ... # implement a subcommand
96
+ end
97
+
98
+ end
99
+
100
+ You would then get help for your command with
101
+
102
+ git flow my-flow --help
103
+ git work --help
104
+
105
+ Using gitflow you can customize per-project git interface.
106
+
107
+ HELP
108
+
109
+ # Pager from http://nex-3.com/posts/73-git-style-automatic-paging-in-ruby
110
+ def pager
111
+ return if RUBY_PLATFORM =~ /win32/
112
+ return unless STDOUT.tty?
113
+
114
+ read, write = IO.pipe
115
+
116
+ unless Kernel.fork # Child process
117
+ STDOUT.reopen(write)
118
+ STDERR.reopen(write) if STDERR.tty?
119
+ read.close
120
+ write.close
121
+ return
122
+ end
123
+
124
+ # Parent process, become pager
125
+ STDIN.reopen(read)
126
+ read.close
127
+ write.close
128
+
129
+ ENV['LESS'] = 'FSRX' # Don't page if the input is short enough
130
+
131
+ Kernel.select [STDIN] # Wait until we have input before we start the pager
132
+ pager = ENV['PAGER'] || 'less'
133
+ exec pager rescue exec '/bin/sh', '-c', pager
134
+ end
135
+
136
+ # Return a class to be extended in order to register a GitFlow command
137
+ # if command name is nil, it will be registered as the top level command.
138
+ # Classes implementing commands also provide this method, allowing for
139
+ # sub-command creation.
140
+ def /(command_name)
141
+ command_name = command_name.to_s unless command_name.nil?
142
+ cls = Class.new { include GitFlow::Mixin }
143
+ (class << cls; self; end).module_eval do
144
+ attr_accessor :help, :documentation, :command
145
+ define_method(:/) do |subcommand|
146
+ raise "Subcommand cannot be nil" unless subcommand
147
+ GitFlow/([command_name, subcommand].compact.join(' '))
148
+ end
149
+ define_method(:inherited) do |subclass|
150
+ subclass.command = command_name
151
+ GitFlow.commands[command_name] = subclass
152
+ end
153
+ end
154
+ cls
155
+ end
156
+
157
+ def commands
158
+ @commands ||= Hash.new
159
+ end
160
+
161
+ def optparse
162
+ optparse = opt = OptionParser.new
163
+ opt.separator ' '
164
+ opt.separator 'OPTIONS'
165
+ opt.separator ' '
166
+ opt.on('-h', '--help', 'Display this help') do
167
+ GitFlow.pager; puts opt; throw :exit
168
+ end
169
+ opt.on('--trace', 'Display traces') { GitFlow.trace = true }
170
+ optparse
171
+ end
172
+
173
+ def command(argv)
174
+ cmds = []
175
+ argv.each_with_index do |arg, i|
176
+ arg = argv[0..i].join(' ')
177
+ cmds << commands[arg] if commands.key?(arg)
178
+ end
179
+ cmds.last || commands[nil]
180
+ end
181
+
182
+ def run(*argv)
183
+ catch :exit do
184
+ command = self.command(argv).new
185
+ argv = argv[command.class.command.split.length..-1] if command.class.command
186
+ parser = optparse
187
+ parser.banner = "Usage: #{GitFlow.program} #{command.class.command} [options]"
188
+ options = OpenStruct.new
189
+ if command.respond_to?(:options)
190
+ command.options(options).each { |args| parser.on(*args) }
191
+ end
192
+ if command.class.documentation && command.class.documentation != ''
193
+ parser.separator ' '
194
+ parser.separator command.class.documentation.split(/\n/)
195
+ end
196
+ parser.parse!(argv)
197
+ command.execute(options, argv)
198
+ end
199
+ end
200
+
201
+ module Mixin
202
+ include FileUtils
203
+
204
+ # Override this method in your command class if it
205
+ # needs to parse command line options.
206
+ #
207
+ # This method takes an openstruct object as argument
208
+ # allowing you to store default values on it, and
209
+ # set option values.
210
+ #
211
+ # The return value must be an array of arguments
212
+ # given to optparse.on
213
+ def options(opt)
214
+ []
215
+ end
216
+
217
+ # Override this method in your command class to implement
218
+ # the command.
219
+ # First argument is the openstruct object after
220
+ # it has been populated by the option parser.
221
+ # Second argument is the array of non-option arguments.
222
+ def execute(opt, argv)
223
+ fail "#{self.class.command} not implemented"
224
+ end
225
+
226
+ # Run the command line given on argv
227
+ def run(*argv, &block)
228
+ GitFlow.run(*argv, &block)
229
+ end
230
+
231
+ # Yield paging the blocks output if necessary.
232
+ def page
233
+ GitFlow.pager
234
+ yield
235
+ end
236
+
237
+ def trace(*str)
238
+ STDERR.puts(*str) if GitFlow.trace
239
+ end
240
+
241
+ def git(*args)
242
+ cmd = 'git ' + args.map { |arg| arg[' '] ? %Q{"#{arg}"} : arg }.join(' ')
243
+ trace cmd
244
+ `#{cmd}`.tap {
245
+ fail "GIT command `#{cmd}` failed with status #{$?.exitstatus}" unless $?.exitstatus == 0
246
+ }
247
+ end
248
+
249
+ def sh(*args)
250
+ `#{args.join(' ')}`.tap {
251
+ fail "Shell command `#{args.join(' ')}` failed with status #{$?.exitstatus}" unless $?.exitstatus == 0
252
+ }
253
+ end
254
+
255
+ def expand_path(path, dir=Dir.pwd)
256
+ File.expand_path(path, dir)
257
+ end
258
+ end
259
+
260
+ class NoSuchCommand < GitFlow/nil
261
+ @documentation = HELP
262
+
263
+ def execute(opts, argv)
264
+ page do
265
+ puts "Command not found: #{argv.join(' ').inspect}"
266
+ puts "Try `#{GitFlow.program} help` to obtain a list of commands."
267
+ end
268
+ end
269
+ end
270
+
271
+ class HelpCommand < GitFlow/:help
272
+ @help = "Display help for a command or show command list"
273
+ @documentation = "Displays help for the command given as argument"
274
+
275
+ def execute(opts, argv)
276
+ if argv.empty?
277
+ opt = GitFlow.optparse
278
+ opt.banner = "Usage: #{GitFlow.program} command [options]"
279
+ opt.separator ' '
280
+ opt.separator 'COMMANDS'
281
+ opt.separator ' '
282
+ commands = GitFlow.commands.map { |name, cls| [nil, name, cls.help] }.
283
+ sort_by { |a| a[1] || '' }
284
+ commands.each { |a| opt.separator("%-2s%-25s%s" % a) if a[1] }
285
+ opt.separator ' '
286
+ opt.separator 'You can also obtain help for any command giving it --help.'
287
+ page { puts opt }
288
+ else
289
+ run(*(argv + ['--help']))
290
+ end
291
+ end
292
+ end
293
+
294
+ end
295
+
296
+ at_exit { GitFlow.run(*ARGV) if GitFlow.should_run }
@@ -0,0 +1,44 @@
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
+ if [ -z `which jruby` ] ; then
17
+ version=1.1.6
18
+ target=/opt/jruby
19
+ echo "Installing JRuby ${version} in ${target}"
20
+ sudo mkdir -p $(dirname ${target})
21
+ wget http://dist.codehaus.org/jruby/${version}/jruby-bin-${version}.tar.gz
22
+ tar -xz < jruby-bin-${version}.tar.gz
23
+ sudo mv jruby-${version} ${target}
24
+ rm jruby-bin-${version}.tar.gz
25
+ export PATH=$PATH:${target}
26
+ if [ -e ~/.bash_profile ] ; then
27
+ echo "export PATH=${target}/bin:\$PATH" >> ~/.bash_profile
28
+ elif [ -e ~/.profile ] ; then
29
+ echo "export PATH=${target}/bin:\$PATH" >> ~/.profile
30
+ else
31
+ echo "You need to add ${target}/bin to the PATH"
32
+ fi
33
+ fi
34
+
35
+ if [ `which buildr` ] ; then
36
+ echo "Updating to the latest version of Buildr"
37
+ sudo jruby -S gem update buildr
38
+ else
39
+ echo "Installing the latest version of Buildr"
40
+ sudo jruby -S gem install buildr
41
+ fi
42
+ echo
43
+
44
+ jruby -S buildr --version
@@ -0,0 +1,72 @@
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
+ if [ -z `which ruby` ] ; then
17
+ echo "You do not have Ruby 1.8.6 ..."
18
+ # yum comes first since some people have apt-get installed in addition to yum.
19
+ # urpmi is added in case of mandriva : apt-get or yum are working for mandriva too
20
+ if [ `which yum` ] ; then
21
+ echo "Installing Ruby using yum"
22
+ sudo yum install ruby rubygems ruby-devel gcc
23
+ elif [ `which apt-get` ] ; then
24
+ echo "Installing Ruby using apt-get"
25
+ # ruby package does not contain RDoc, IRB, etc; ruby-full is a meta-package.
26
+ # build-essentials not installed by default in Ubuntu, required for C extensions.
27
+ sudo apt-get install ruby-full ruby1.8-dev libopenssl-ruby build-essential
28
+ # RubyGems broken on Ubuntu, installing directly from source.
29
+ echo "Installing RubyGems from RubyForge"
30
+ wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
31
+ tar xzf rubygems-1.3.1.tgz
32
+ cd rubygems-1.3.1
33
+ sudo ruby setup.rb
34
+ cd ..
35
+ rm -rf rubygems-1.3.1
36
+ # ruby is same as ruby1.8, we need gem that is same as gem1.8
37
+ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
38
+ elif [ `which urpmi` ] ; then
39
+ echo "Installing Ruby using urpmi"
40
+ sudo urpmi ruby rubygems ruby-devel gcc
41
+ if [ $? -ne 0 ] ; then
42
+ echo "URPMI install error"
43
+ exit 1
44
+ fi
45
+ else
46
+ echo "Can only install Ruby 1.8.6 using apt-get, yum or urpmi, and can't find any of them"
47
+ exit 1
48
+ fi
49
+ echo
50
+ fi
51
+
52
+ if [ -z $JAVA_HOME ] ; then
53
+ echo "Please set JAVA_HOME before proceeding"
54
+ exit 1
55
+ fi
56
+
57
+ if [ $(gem --version) \< '1.3.1' ] ; then
58
+ echo "Upgrading to latest version of RubyGems"
59
+ sudo gem update --system
60
+ echo
61
+ fi
62
+
63
+ if [ `which buildr` ] ; then
64
+ echo "Updating to the latest version of Buildr"
65
+ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
66
+ else
67
+ echo "Installing the latest version of Buildr"
68
+ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
69
+ fi
70
+ echo
71
+
72
+ buildr --version
@@ -0,0 +1,52 @@
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
+ version=$(ruby --version)
17
+ if [ ${version:5:5} \< '1.8.6' ] ; then
18
+ echo "You do not have Ruby 1.8.6 or later, attempting to install a newer version."
19
+ if [ `which port` ] ; then
20
+ echo "Installing Ruby using MacPorts"
21
+ sudo port install ruby rb-rubygems
22
+ elif [ `which fink` ] ; then
23
+ echo "Installing Ruby using Fink"
24
+ sudo fink install ruby ruby18-dev rubygems-rb18
25
+ else
26
+ echo "Can only upgrade to Ruby 1.8.6 using either MacPorts or Fink, and can't find either one"
27
+ exit 1
28
+ fi
29
+ echo
30
+ fi
31
+
32
+ if [ -z $JAVA_HOME ] ; then
33
+ echo "Setting JAVA_HOME"
34
+ export JAVA_HOME=/Library/Java/Home
35
+ fi
36
+
37
+ if [ $(gem --version) \< '1.3.1' ] ; then
38
+ echo "Upgrading to latest version of RubyGems"
39
+ sudo gem update --system
40
+ echo
41
+ fi
42
+
43
+ if [ `which buildr` ] ; then
44
+ echo "Updating to the latest version of Buildr"
45
+ sudo env JAVA_HOME=$JAVA_HOME gem update buildr
46
+ else
47
+ echo "Installing the latest version of Buildr"
48
+ sudo env JAVA_HOME=$JAVA_HOME gem install buildr
49
+ fi
50
+ echo
51
+
52
+ buildr --version