mguymon-buildr 1.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1291 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.rdoc +134 -0
- data/Rakefile +44 -0
- data/_buildr +35 -0
- data/_jbuildr +35 -0
- data/addon/buildr/antlr.rb +65 -0
- data/addon/buildr/bnd.rb +147 -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 +149 -0
- data/addon/buildr/javacc.rb +85 -0
- data/addon/buildr/jaxb_xjc.rb +72 -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 +88 -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/protobuf.rb +88 -0
- data/addon/buildr/xmlbeans.rb +93 -0
- data/bin/buildr +19 -0
- data/buildr.buildfile +58 -0
- data/buildr.gemspec +78 -0
- data/doc/_config.yml +1 -0
- data/doc/_layouts/default.html +90 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/artifacts.textile +217 -0
- data/doc/building.textile +276 -0
- data/doc/contributing.textile +268 -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 +151 -0
- data/doc/extending.textile +212 -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 +109 -0
- data/doc/installing.textile +284 -0
- data/doc/languages.textile +599 -0
- data/doc/mailing_lists.textile +29 -0
- data/doc/more_stuff.textile +845 -0
- data/doc/packaging.textile +618 -0
- data/doc/preface.textile +54 -0
- data/doc/projects.textile +276 -0
- data/doc/quick_start.textile +210 -0
- data/doc/releasing.textile +117 -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 +73 -0
- data/doc/scripts/install-osx.sh +52 -0
- data/doc/settings_profiles.textile +287 -0
- data/doc/testing.textile +247 -0
- data/etc/KEYS +189 -0
- data/lib/buildr.rb +44 -0
- data/lib/buildr/clojure.rb +34 -0
- data/lib/buildr/clojure/shell.rb +52 -0
- data/lib/buildr/core.rb +34 -0
- data/lib/buildr/core/application.rb +700 -0
- data/lib/buildr/core/build.rb +516 -0
- data/lib/buildr/core/cc.rb +166 -0
- data/lib/buildr/core/checks.rb +253 -0
- data/lib/buildr/core/common.rb +151 -0
- data/lib/buildr/core/compile.rb +622 -0
- data/lib/buildr/core/doc.rb +276 -0
- data/lib/buildr/core/environment.rb +129 -0
- data/lib/buildr/core/filter.rb +404 -0
- data/lib/buildr/core/generate.rb +197 -0
- data/lib/buildr/core/help.rb +119 -0
- data/lib/buildr/core/jrebel.rb +42 -0
- data/lib/buildr/core/linux.rb +30 -0
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +975 -0
- data/lib/buildr/core/run.rb +43 -0
- data/lib/buildr/core/shell.rb +137 -0
- data/lib/buildr/core/test.rb +843 -0
- data/lib/buildr/core/transports.rb +575 -0
- data/lib/buildr/core/util.rb +537 -0
- data/lib/buildr/groovy.rb +20 -0
- data/lib/buildr/groovy/bdd.rb +106 -0
- data/lib/buildr/groovy/compiler.rb +153 -0
- data/lib/buildr/groovy/doc.rb +76 -0
- data/lib/buildr/groovy/shell.rb +57 -0
- data/lib/buildr/ide.rb +19 -0
- data/lib/buildr/ide/eclipse.rb +427 -0
- data/lib/buildr/ide/eclipse/java.rb +53 -0
- data/lib/buildr/ide/eclipse/plugin.rb +71 -0
- data/lib/buildr/ide/eclipse/scala.rb +68 -0
- data/lib/buildr/ide/idea.rb +576 -0
- data/lib/buildr/java.rb +25 -0
- data/lib/buildr/java/ant.rb +94 -0
- data/lib/buildr/java/bdd.rb +460 -0
- data/lib/buildr/java/cobertura.rb +297 -0
- data/lib/buildr/java/commands.rb +223 -0
- data/lib/buildr/java/compiler.rb +135 -0
- data/lib/buildr/java/deprecated.rb +141 -0
- data/lib/buildr/java/doc.rb +86 -0
- data/lib/buildr/java/ecj.rb +69 -0
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/external.rb +73 -0
- data/lib/buildr/java/jruby.rb +122 -0
- data/lib/buildr/java/jtestr_result.rb +295 -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 +142 -0
- data/lib/buildr/java/packaging.rb +734 -0
- data/lib/buildr/java/pom.rb +178 -0
- data/lib/buildr/java/rjb.rb +154 -0
- data/lib/buildr/java/test_result.rb +101 -0
- data/lib/buildr/java/tests.rb +362 -0
- data/lib/buildr/java/version_requirement.rb +172 -0
- data/lib/buildr/packaging.rb +25 -0
- data/lib/buildr/packaging/archive.rb +535 -0
- data/lib/buildr/packaging/artifact.rb +904 -0
- data/lib/buildr/packaging/artifact_namespace.rb +984 -0
- data/lib/buildr/packaging/artifact_search.rb +140 -0
- data/lib/buildr/packaging/gems.rb +105 -0
- data/lib/buildr/packaging/package.rb +249 -0
- data/lib/buildr/packaging/repository_array.rb +108 -0
- data/lib/buildr/packaging/tar.rb +189 -0
- data/lib/buildr/packaging/version_requirement.rb +192 -0
- data/lib/buildr/packaging/zip.rb +178 -0
- data/lib/buildr/packaging/ziptask.rb +356 -0
- data/lib/buildr/resources/buildr.icns +0 -0
- data/lib/buildr/resources/completed.png +0 -0
- data/lib/buildr/resources/failed.png +0 -0
- data/lib/buildr/resources/icons-license.txt +17 -0
- data/lib/buildr/run.rb +195 -0
- data/lib/buildr/scala.rb +26 -0
- data/lib/buildr/scala/bdd.rb +118 -0
- data/lib/buildr/scala/compiler.rb +242 -0
- data/lib/buildr/scala/doc.rb +142 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +52 -0
- data/lib/buildr/scala/tests.rb +171 -0
- data/lib/buildr/shell.rb +185 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +137 -0
- data/rakelib/metrics.rake +39 -0
- data/rakelib/package.rake +73 -0
- data/rakelib/release.rake +160 -0
- data/rakelib/rspec.rake +91 -0
- data/rakelib/setup.rake +66 -0
- data/rakelib/stage.rake +220 -0
- data/spec/addon/bnd_spec.rb +330 -0
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/addon/jaxb_xjc_spec.rb +125 -0
- data/spec/core/application_spec.rb +631 -0
- data/spec/core/build_spec.rb +837 -0
- data/spec/core/cc_spec.rb +224 -0
- data/spec/core/checks_spec.rb +519 -0
- data/spec/core/common_spec.rb +725 -0
- data/spec/core/compile_spec.rb +658 -0
- data/spec/core/doc_spec.rb +195 -0
- data/spec/core/extension_spec.rb +201 -0
- data/spec/core/generate_spec.rb +33 -0
- data/spec/core/project_spec.rb +772 -0
- data/spec/core/run_spec.rb +93 -0
- data/spec/core/shell_spec.rb +146 -0
- data/spec/core/test_spec.rb +1320 -0
- data/spec/core/transport_spec.rb +544 -0
- data/spec/core/util_spec.rb +141 -0
- data/spec/groovy/bdd_spec.rb +80 -0
- data/spec/groovy/compiler_spec.rb +251 -0
- data/spec/groovy/doc_spec.rb +65 -0
- data/spec/ide/eclipse_spec.rb +739 -0
- data/spec/ide/idea_spec.rb +1145 -0
- data/spec/java/ant_spec.rb +37 -0
- data/spec/java/bdd_spec.rb +374 -0
- data/spec/java/cobertura_spec.rb +112 -0
- data/spec/java/commands_spec.rb +93 -0
- data/spec/java/compiler_spec.rb +252 -0
- data/spec/java/doc_spec.rb +56 -0
- data/spec/java/ecj_spec.rb +115 -0
- data/spec/java/emma_spec.rb +121 -0
- data/spec/java/external_spec.rb +56 -0
- data/spec/java/java_spec.rb +132 -0
- data/spec/java/packaging_spec.rb +1266 -0
- data/spec/java/run_spec.rb +78 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +497 -0
- data/spec/packaging/archive_spec.rb +775 -0
- data/spec/packaging/artifact_namespace_spec.rb +743 -0
- data/spec/packaging/artifact_spec.rb +1074 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +719 -0
- data/spec/packaging/repository_array_spec.rb +109 -0
- data/spec/sandbox.rb +165 -0
- data/spec/scala/bdd_spec.rb +124 -0
- data/spec/scala/compiler_spec.rb +289 -0
- data/spec/scala/doc_spec.rb +88 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +283 -0
- data/spec/spec_helpers.rb +369 -0
- data/spec/version_requirement_spec.rb +143 -0
- data/spec/xpath_matchers.rb +121 -0
- metadata +649 -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,73 @@
|
|
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://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz
|
31
|
+
tar xzf rubygems-1.3.7.tgz
|
32
|
+
cd rubygems-1.3.7
|
33
|
+
sudo ruby setup.rb
|
34
|
+
cd ..
|
35
|
+
rm -rf rubygems-1.3.7
|
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.7' ] ; then
|
58
|
+
echo "Upgrading to latest version of RubyGems"
|
59
|
+
sudo gem update --system
|
60
|
+
sudo update_rubygems
|
61
|
+
echo
|
62
|
+
fi
|
63
|
+
|
64
|
+
if [ `which buildr` ] ; then
|
65
|
+
echo "Updating to the latest version of Buildr"
|
66
|
+
sudo env JAVA_HOME=$JAVA_HOME gem update buildr
|
67
|
+
else
|
68
|
+
echo "Installing the latest version of Buildr"
|
69
|
+
sudo env JAVA_HOME=$JAVA_HOME gem install buildr
|
70
|
+
fi
|
71
|
+
echo
|
72
|
+
|
73
|
+
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
|