realityforge-buildr 1.5.9
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +176 -0
- data/NOTICE +26 -0
- data/README.md +3 -0
- data/Rakefile +50 -0
- data/addon/buildr/checkstyle-report.xsl +104 -0
- data/addon/buildr/checkstyle.rb +254 -0
- data/addon/buildr/git_auto_version.rb +36 -0
- data/addon/buildr/gpg.rb +90 -0
- data/addon/buildr/gwt.rb +413 -0
- data/addon/buildr/jacoco.rb +161 -0
- data/addon/buildr/pmd.rb +185 -0
- data/addon/buildr/single_intermediate_layout.rb +71 -0
- data/addon/buildr/spotbugs.rb +265 -0
- data/addon/buildr/top_level_generate_dir.rb +37 -0
- data/addon/buildr/wsgen.rb +192 -0
- data/bin/buildr +20 -0
- data/buildr.gemspec +61 -0
- data/lib/buildr.rb +86 -0
- data/lib/buildr/core/application.rb +705 -0
- data/lib/buildr/core/assets.rb +96 -0
- data/lib/buildr/core/build.rb +587 -0
- data/lib/buildr/core/common.rb +167 -0
- data/lib/buildr/core/compile.rb +599 -0
- data/lib/buildr/core/console.rb +124 -0
- data/lib/buildr/core/doc.rb +275 -0
- data/lib/buildr/core/environment.rb +128 -0
- data/lib/buildr/core/filter.rb +405 -0
- data/lib/buildr/core/help.rb +114 -0
- data/lib/buildr/core/progressbar.rb +161 -0
- data/lib/buildr/core/project.rb +994 -0
- data/lib/buildr/core/test.rb +776 -0
- data/lib/buildr/core/transports.rb +456 -0
- data/lib/buildr/core/util.rb +77 -0
- data/lib/buildr/ide/idea.rb +1664 -0
- data/lib/buildr/java/commands.rb +230 -0
- data/lib/buildr/java/compiler.rb +85 -0
- data/lib/buildr/java/custom_pom.rb +300 -0
- data/lib/buildr/java/doc.rb +62 -0
- data/lib/buildr/java/packaging.rb +393 -0
- data/lib/buildr/java/pom.rb +191 -0
- data/lib/buildr/java/test_result.rb +54 -0
- data/lib/buildr/java/tests.rb +111 -0
- data/lib/buildr/packaging/archive.rb +586 -0
- data/lib/buildr/packaging/artifact.rb +1113 -0
- data/lib/buildr/packaging/artifact_namespace.rb +1010 -0
- data/lib/buildr/packaging/artifact_search.rb +138 -0
- data/lib/buildr/packaging/package.rb +237 -0
- data/lib/buildr/packaging/version_requirement.rb +189 -0
- data/lib/buildr/packaging/zip.rb +189 -0
- data/lib/buildr/packaging/ziptask.rb +387 -0
- data/lib/buildr/version.rb +18 -0
- data/rakelib/release.rake +99 -0
- data/spec/addon/checkstyle_spec.rb +58 -0
- data/spec/core/application_spec.rb +576 -0
- data/spec/core/build_spec.rb +922 -0
- data/spec/core/common_spec.rb +670 -0
- data/spec/core/compile_spec.rb +656 -0
- data/spec/core/console_spec.rb +65 -0
- data/spec/core/doc_spec.rb +194 -0
- data/spec/core/extension_spec.rb +200 -0
- data/spec/core/project_spec.rb +736 -0
- data/spec/core/test_spec.rb +1131 -0
- data/spec/core/transport_spec.rb +452 -0
- data/spec/core/util_spec.rb +154 -0
- data/spec/ide/idea_spec.rb +1952 -0
- data/spec/java/commands_spec.rb +79 -0
- data/spec/java/compiler_spec.rb +274 -0
- data/spec/java/custom_pom_spec.rb +165 -0
- data/spec/java/doc_spec.rb +55 -0
- data/spec/java/packaging_spec.rb +786 -0
- data/spec/java/pom_spec.rb +162 -0
- data/spec/java/test_coverage_helper.rb +257 -0
- data/spec/java/tests_spec.rb +224 -0
- data/spec/packaging/archive_spec.rb +686 -0
- data/spec/packaging/artifact_namespace_spec.rb +757 -0
- data/spec/packaging/artifact_spec.rb +1351 -0
- data/spec/packaging/packaging_helper.rb +63 -0
- data/spec/packaging/packaging_spec.rb +690 -0
- data/spec/sandbox.rb +166 -0
- data/spec/spec_helpers.rb +420 -0
- data/spec/version_requirement_spec.rb +145 -0
- data/spec/xpath_matchers.rb +123 -0
- metadata +295 -0
@@ -0,0 +1,124 @@
|
|
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
|
+
module Buildr #nodoc
|
17
|
+
|
18
|
+
# A utility class that helps with colorizing output for interactive shells where appropriate
|
19
|
+
class Console
|
20
|
+
class << self
|
21
|
+
def use_color
|
22
|
+
@use_color.nil? ? false : @use_color
|
23
|
+
end
|
24
|
+
|
25
|
+
def use_color=(use_color)
|
26
|
+
@use_color = use_color
|
27
|
+
end
|
28
|
+
|
29
|
+
# Emit message with color at the start of the message and the clear color command at the end of the sequence.
|
30
|
+
def color(message, color)
|
31
|
+
raise "Unknown color #{color.inspect}" unless [:green, :red, :blue].include?(color)
|
32
|
+
return message unless use_color
|
33
|
+
constants = {:green => "\e[32m", :red => "\e[31m", :blue => "\e[34m"}
|
34
|
+
@java_console.putString("#{constants[color]}#{message}\e[0m") if @java_console
|
35
|
+
"#{constants[color]}#{message}\e[0m"
|
36
|
+
end
|
37
|
+
|
38
|
+
# Return the [rows, columns] of a console or nil if unknown
|
39
|
+
def console_dimensions
|
40
|
+
begin
|
41
|
+
if $stdout.isatty
|
42
|
+
if /solaris/ =~ RUBY_PLATFORM and
|
43
|
+
`stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/
|
44
|
+
[$2, $1].map { |c| x.to_i }
|
45
|
+
else
|
46
|
+
`stty size 2> /dev/null`.split.map { |x| x.to_i }.reverse
|
47
|
+
end
|
48
|
+
else
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
rescue => e
|
52
|
+
nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Return the number of columns in console or nil if unknown
|
57
|
+
def output_cols
|
58
|
+
d = console_dimensions
|
59
|
+
d ? d[0] : nil
|
60
|
+
end
|
61
|
+
|
62
|
+
def agree?(message)
|
63
|
+
puts "#{message} (Y or N)"
|
64
|
+
:agree == ask('Y' => :agree, 'N' => :disagree)
|
65
|
+
end
|
66
|
+
|
67
|
+
def ask_password(prompt)
|
68
|
+
puts prompt
|
69
|
+
begin
|
70
|
+
set_no_echo_mode
|
71
|
+
password = $stdin.readline
|
72
|
+
return password.chomp
|
73
|
+
ensure
|
74
|
+
reset_mode
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def present_menu(header, options)
|
79
|
+
puts header
|
80
|
+
question_options = {}
|
81
|
+
count = 1
|
82
|
+
options.each_pair do |message, result|
|
83
|
+
puts "#{count}. #{message}"
|
84
|
+
question_options[count.to_s] = result
|
85
|
+
count += 1
|
86
|
+
end
|
87
|
+
ask(question_options)
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def set_no_echo_mode
|
93
|
+
@state = `stty -g 2>/dev/null`
|
94
|
+
`stty -echo -icanon 2>/dev/null`
|
95
|
+
end
|
96
|
+
|
97
|
+
def reset_mode
|
98
|
+
`stty #{@state} 2>/dev/null`
|
99
|
+
@state = nil
|
100
|
+
end
|
101
|
+
|
102
|
+
def ask(options)
|
103
|
+
keys = options.keys
|
104
|
+
keys_downcased = keys.collect { |k| k.downcase }
|
105
|
+
result = nil
|
106
|
+
show_prompt = false
|
107
|
+
until keys_downcased.include?(result)
|
108
|
+
puts "Invalid response. Valid responses include: #{keys.join(', ')}\n" if show_prompt
|
109
|
+
show_prompt = true
|
110
|
+
result = $stdin.readline
|
111
|
+
result = result.strip.downcase if result
|
112
|
+
end
|
113
|
+
options.each_pair do |key, value|
|
114
|
+
if key.downcase == result
|
115
|
+
return value.is_a?(Proc) ? value.call : value
|
116
|
+
end
|
117
|
+
end
|
118
|
+
return nil
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
Buildr::Console.use_color = $stdout.isatty
|
@@ -0,0 +1,275 @@
|
|
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
|
+
module Buildr #:nodoc:
|
17
|
+
module Doc
|
18
|
+
include Extension
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def select_by_lang(lang)
|
22
|
+
fail 'Unable to define doc task for nil language' if lang.nil?
|
23
|
+
engines.detect { |e| e.language.to_sym == lang.to_sym }
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method :select, :select_by_lang
|
27
|
+
|
28
|
+
def select_by_name(name)
|
29
|
+
fail 'Unable to define doc task for nil' if name.nil?
|
30
|
+
engines.detect { |e| e.to_sym == name.to_sym }
|
31
|
+
end
|
32
|
+
|
33
|
+
def engines
|
34
|
+
@engines ||= []
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# Base class for any documentation provider. Defines most
|
40
|
+
# common functionality (things like @into@, @from@ and friends).
|
41
|
+
class Base
|
42
|
+
class << self
|
43
|
+
attr_accessor :language, :source_ext
|
44
|
+
|
45
|
+
def specify(options)
|
46
|
+
@language = options[:language]
|
47
|
+
@source_ext = options[:source_ext]
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_sym
|
51
|
+
@symbol ||= name.split('::').last.downcase.to_sym
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
attr_reader :project
|
56
|
+
|
57
|
+
def initialize(project)
|
58
|
+
@project = project
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
class DocTask < Rake::Task
|
64
|
+
|
65
|
+
# The target directory for the generated documentation files.
|
66
|
+
attr_reader :target
|
67
|
+
|
68
|
+
# Classpath dependencies.
|
69
|
+
attr_accessor :classpath
|
70
|
+
|
71
|
+
# Additional sourcepaths that are not part of the documented files.
|
72
|
+
attr_accessor :sourcepath
|
73
|
+
|
74
|
+
# Returns the documentation tool options.
|
75
|
+
attr_reader :options
|
76
|
+
|
77
|
+
attr_reader :project # :nodoc:
|
78
|
+
|
79
|
+
def initialize(*args) #:nodoc:
|
80
|
+
super
|
81
|
+
@options = {}
|
82
|
+
@classpath = []
|
83
|
+
@sourcepath = []
|
84
|
+
@files = FileList[]
|
85
|
+
enhance do |task|
|
86
|
+
rm_rf target.to_s
|
87
|
+
mkdir_p target.to_s
|
88
|
+
|
89
|
+
engine.generate(source_files, File.expand_path(target.to_s),
|
90
|
+
options.merge(:classpath => classpath, :sourcepath => sourcepath))
|
91
|
+
|
92
|
+
touch target.to_s
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# :call-seq:
|
97
|
+
# into(path) => self
|
98
|
+
#
|
99
|
+
# Sets the target directory and returns self. This will also set the Javadoc task
|
100
|
+
# as a prerequisite to a file task on the target directory.
|
101
|
+
#
|
102
|
+
# For example:
|
103
|
+
# package :zip, :classifier=>'docs', :include=>doc.target
|
104
|
+
def into(path)
|
105
|
+
@target = file(path.to_s).enhance([self]) unless @target && @target.to_s == path.to_s
|
106
|
+
self
|
107
|
+
end
|
108
|
+
|
109
|
+
# :call-seq:
|
110
|
+
# include(*files) => self
|
111
|
+
#
|
112
|
+
# Includes additional source files and directories when generating the documentation
|
113
|
+
# and returns self. When specifying a directory, includes all source files in that directory.
|
114
|
+
def include(*files)
|
115
|
+
files.each do |file|
|
116
|
+
if file.respond_to? :to_ary
|
117
|
+
include(*file.to_ary)
|
118
|
+
else
|
119
|
+
@files.include *files.flatten.compact.collect { |f| File.expand_path(f.to_s) }
|
120
|
+
end
|
121
|
+
end
|
122
|
+
self
|
123
|
+
end
|
124
|
+
|
125
|
+
# :call-seq:
|
126
|
+
# exclude(*files) => self
|
127
|
+
#
|
128
|
+
# Excludes source files and directories from generating the documentation.
|
129
|
+
def exclude(*files)
|
130
|
+
@files.exclude *files.collect{|f|File.expand_path(f)}
|
131
|
+
self
|
132
|
+
end
|
133
|
+
|
134
|
+
# :call-seq:
|
135
|
+
# with(*artifacts) => self
|
136
|
+
#
|
137
|
+
# Adds files and artifacts as classpath dependencies, and returns self.
|
138
|
+
def with(*specs)
|
139
|
+
@classpath |= Buildr.artifacts(specs.flatten).uniq
|
140
|
+
self
|
141
|
+
end
|
142
|
+
|
143
|
+
# :call-seq:
|
144
|
+
# using(options) => self
|
145
|
+
#
|
146
|
+
# Sets the documentation tool options from a hash and returns self.
|
147
|
+
#
|
148
|
+
# For example:
|
149
|
+
# doc.using :windowtitle=>'My application'
|
150
|
+
def using(*args)
|
151
|
+
args.pop.each { |key, value| @options[key.to_sym] = value } if Hash === args.last
|
152
|
+
|
153
|
+
until args.empty?
|
154
|
+
new_engine = Doc.select_by_name(args.pop)
|
155
|
+
@engine = new_engine.new(project) unless new_engine.nil?
|
156
|
+
end
|
157
|
+
|
158
|
+
self
|
159
|
+
end
|
160
|
+
|
161
|
+
def engine
|
162
|
+
@engine ||= guess_engine
|
163
|
+
end
|
164
|
+
|
165
|
+
# :call-seq:
|
166
|
+
# engine?(clazz) => boolean
|
167
|
+
#
|
168
|
+
# Check if the underlying engine is an instance of the given class
|
169
|
+
def engine?(clazz)
|
170
|
+
begin
|
171
|
+
@engine ||= guess_engine if project.compile.language
|
172
|
+
rescue
|
173
|
+
return false
|
174
|
+
end
|
175
|
+
@engine.is_a?(clazz) if @engine
|
176
|
+
end
|
177
|
+
|
178
|
+
# :call-seq:
|
179
|
+
# from(*sources) => self
|
180
|
+
#
|
181
|
+
# Includes files, directories and projects in the documentation and returns self.
|
182
|
+
#
|
183
|
+
# You can call this method with source files and directories containing source files
|
184
|
+
# to include these files in the documentation, similar to #include. You can also call
|
185
|
+
# this method with projects. When called with a project, it includes all the source files compiled
|
186
|
+
# by that project and classpath dependencies used when compiling.
|
187
|
+
#
|
188
|
+
# For example:
|
189
|
+
# doc.from projects('myapp:foo', 'myapp:bar')
|
190
|
+
def from(*sources)
|
191
|
+
sources.flatten.each do |source|
|
192
|
+
case source
|
193
|
+
when Project
|
194
|
+
self.enhance source.prerequisites
|
195
|
+
self.include source.compile.sources
|
196
|
+
self.with source.compile.dependencies
|
197
|
+
when Rake::Task, String
|
198
|
+
self.include source
|
199
|
+
else
|
200
|
+
fail "Don't know how to generate documentation from #{source || 'nil'}"
|
201
|
+
end
|
202
|
+
end
|
203
|
+
self
|
204
|
+
end
|
205
|
+
|
206
|
+
def prerequisites #:nodoc:
|
207
|
+
super + @files + classpath + sourcepath
|
208
|
+
end
|
209
|
+
|
210
|
+
def source_files #:nodoc:
|
211
|
+
@source_files ||= @files.map(&:to_s).map do |file|
|
212
|
+
Array(engine.class.source_ext).map do |ext|
|
213
|
+
File.directory?(file) ? FileList[File.join(file, "**/*.#{ext}")] : File.expand_path(file)
|
214
|
+
end
|
215
|
+
end.flatten.reject { |file| @files.exclude?(file) }
|
216
|
+
end
|
217
|
+
|
218
|
+
def needed? #:nodoc:
|
219
|
+
return false if source_files.empty?
|
220
|
+
return true unless File.exist?(target.to_s)
|
221
|
+
source_files.map { |src| File.stat(src.to_s).mtime }.max > File.stat(target.to_s).mtime
|
222
|
+
end
|
223
|
+
|
224
|
+
private
|
225
|
+
|
226
|
+
def guess_engine
|
227
|
+
doc_engine = Doc.select project.compile.language
|
228
|
+
fail 'Unable to guess documentation provider for project.' unless doc_engine
|
229
|
+
doc_engine.new project
|
230
|
+
end
|
231
|
+
|
232
|
+
def associate_with(project)
|
233
|
+
@project ||= project
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
|
238
|
+
first_time do
|
239
|
+
desc 'Create the documentation for this project'
|
240
|
+
Project.local_task :doc
|
241
|
+
end
|
242
|
+
|
243
|
+
before_define(:doc) do |project|
|
244
|
+
DocTask.define_task('doc').tap do |doc|
|
245
|
+
doc.send(:associate_with, project)
|
246
|
+
doc.into project.path_to(:target, :doc)
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
after_define(:doc) do |project|
|
251
|
+
project.doc.from project
|
252
|
+
end
|
253
|
+
|
254
|
+
# :call-seq:
|
255
|
+
# doc(*sources) => JavadocTask
|
256
|
+
#
|
257
|
+
# This method returns the project's documentation task. It also accepts a list of source files,
|
258
|
+
# directories and projects to include when generating the docs.
|
259
|
+
#
|
260
|
+
# By default the doc task uses all the source directories from compile.sources and generates
|
261
|
+
# documentation in the target/doc directory. This method accepts sources and adds them by calling
|
262
|
+
# Buildr::Doc::Base#from.
|
263
|
+
#
|
264
|
+
# For example, if you want to generate documentation for a given project that includes all source files
|
265
|
+
# in two of its sub-projects:
|
266
|
+
# doc projects('myapp:foo', 'myapp:bar').using(:windowtitle=>'Docs for foo and bar')
|
267
|
+
def doc(*sources, &block)
|
268
|
+
task('doc').from(*sources).enhance &block
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
class Project #:nodoc:
|
273
|
+
include Doc
|
274
|
+
end
|
275
|
+
end
|
@@ -0,0 +1,128 @@
|
|
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
|
+
module Buildr #:nodoc:
|
17
|
+
|
18
|
+
# Collection of options for controlling Buildr.
|
19
|
+
class Options
|
20
|
+
|
21
|
+
# We use this to present environment variable as arrays.
|
22
|
+
class EnvArray < Array #:nodoc:
|
23
|
+
|
24
|
+
def initialize(name)
|
25
|
+
@name = name.upcase
|
26
|
+
replace((ENV[@name] || ENV[@name.downcase] || '').split(/\s*,\s*/).reject(&:empty?))
|
27
|
+
end
|
28
|
+
|
29
|
+
(Array.instance_methods - Object.instance_methods - Enumerable.instance_methods - ['each']).sort.each do |method|
|
30
|
+
class_eval %{def #{method}(*args, &block) ; result = super ; write_envarray ; result ; end}
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def write_envarray
|
36
|
+
ENV[@name.downcase] = nil
|
37
|
+
ENV[@name] = map(&:to_s).join(',')
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
# Wraps around the proxy environment variables:
|
44
|
+
# * :http -- HTTP_PROXY
|
45
|
+
# * :https -- HTTPS_PROXY
|
46
|
+
# * :exclude -- NO_PROXY
|
47
|
+
class Proxies
|
48
|
+
|
49
|
+
# Returns the HTTP_PROXY URL.
|
50
|
+
def http
|
51
|
+
ENV['HTTP_PROXY'] || ENV['http_proxy']
|
52
|
+
end
|
53
|
+
|
54
|
+
# Sets the HTTP_PROXY URL.
|
55
|
+
def http=(url)
|
56
|
+
ENV['http_proxy'] = nil
|
57
|
+
ENV['HTTP_PROXY'] = url
|
58
|
+
end
|
59
|
+
|
60
|
+
# Returns the HTTPS_PROXY URL.
|
61
|
+
def https
|
62
|
+
ENV['HTTPS_PROXY'] || ENV['https_proxy']
|
63
|
+
end
|
64
|
+
|
65
|
+
# Sets the HTTPS_PROXY URL.
|
66
|
+
def https=(url)
|
67
|
+
ENV['https_proxy'] = nil
|
68
|
+
ENV['HTTPS_PROXY'] = url
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns list of hosts to exclude from proxying (NO_PROXY).
|
72
|
+
def exclude
|
73
|
+
@exclude ||= EnvArray.new('NO_PROXY')
|
74
|
+
end
|
75
|
+
|
76
|
+
# Sets list of hosts to exclude from proxy (NO_PROXY). Accepts host name, array of names,
|
77
|
+
# or nil to clear the list.
|
78
|
+
def exclude=(url)
|
79
|
+
exclude.clear
|
80
|
+
exclude.concat [url].flatten if url
|
81
|
+
exclude
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
# :call-seq:
|
87
|
+
# proxy => options
|
88
|
+
#
|
89
|
+
# Returns the proxy options. Currently supported options are:
|
90
|
+
# * :http -- HTTP proxy for use when downloading.
|
91
|
+
# * :exclude -- Do not use proxy for these hosts/domains.
|
92
|
+
#
|
93
|
+
# For example:
|
94
|
+
# options.proxy.http = 'http://proxy.acme.com:8080'
|
95
|
+
# You can also set it using the environment variable HTTP_PROXY.
|
96
|
+
#
|
97
|
+
# You can exclude individual hosts from being proxied, or entire domains, for example:
|
98
|
+
# options.proxy.exclude = 'optimus'
|
99
|
+
# options.proxy.exclude = ['optimus', 'prime']
|
100
|
+
# options.proxy.exclude << '*.internal'
|
101
|
+
def proxy
|
102
|
+
@proxy ||= Proxies.new
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
class << self
|
109
|
+
|
110
|
+
# :call-seq:
|
111
|
+
# options => Options
|
112
|
+
#
|
113
|
+
# Returns the Buildr options. See Options.
|
114
|
+
def options
|
115
|
+
@options ||= Options.new
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
# :call-seq:
|
121
|
+
# options => Options
|
122
|
+
#
|
123
|
+
# Returns the Buildr options. See Options.
|
124
|
+
def options
|
125
|
+
Buildr.options
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|