bundler 2.1.0.pre.2 → 2.1.0.pre.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bundler might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -1
- data/lib/bundler.rb +87 -24
- data/lib/bundler/build_metadata.rb +2 -2
- data/lib/bundler/cli.rb +55 -25
- data/lib/bundler/cli/add.rb +1 -0
- data/lib/bundler/cli/{package.rb → cache.rb} +2 -2
- data/lib/bundler/cli/exec.rb +0 -7
- data/lib/bundler/dsl.rb +1 -1
- data/lib/bundler/friendly_errors.rb +1 -1
- data/lib/bundler/gem_helper.rb +0 -2
- data/lib/bundler/gem_helpers.rb +1 -1
- data/lib/bundler/inline.rb +7 -3
- data/lib/bundler/lockfile_parser.rb +1 -0
- data/lib/bundler/rubygems_ext.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +0 -1
- data/lib/bundler/setup.rb +2 -9
- data/lib/bundler/shared_helpers.rb +12 -25
- data/lib/bundler/source/git.rb +1 -1
- data/lib/bundler/source/git/git_proxy.rb +1 -1
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +132 -109
- data/lib/bundler/vendor/fileutils/lib/fileutils/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +5 -2
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +6 -16
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +5 -5
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +18 -7
- data/lib/bundler/vendor/thor/lib/thor/base.rb +10 -8
- data/lib/bundler/vendor/thor/lib/thor/command.rb +21 -14
- data/lib/bundler/vendor/thor/lib/thor/error.rb +14 -18
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/line_editor/basic.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb +6 -6
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +8 -6
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +13 -3
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +1 -0
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +2 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +5 -1
- data/lib/bundler/version.rb +1 -1
- data/man/bundle-add.1 +1 -1
- data/man/bundle-add.1.txt +1 -1
- data/man/bundle-binstubs.1 +1 -1
- data/man/bundle-binstubs.1.txt +1 -1
- data/man/bundle-cache.1 +55 -0
- data/man/bundle-cache.1.txt +78 -0
- data/man/{bundle-package.ronn → bundle-cache.ronn} +15 -15
- data/man/bundle-check.1 +1 -1
- data/man/bundle-check.1.txt +1 -1
- data/man/bundle-clean.1 +1 -1
- data/man/bundle-clean.1.txt +1 -1
- data/man/bundle-config.1 +1 -1
- data/man/bundle-config.1.txt +1 -1
- data/man/bundle-doctor.1 +1 -1
- data/man/bundle-doctor.1.txt +1 -1
- data/man/bundle-exec.1 +1 -1
- data/man/bundle-exec.1.txt +1 -1
- data/man/bundle-gem.1 +1 -1
- data/man/bundle-gem.1.txt +1 -1
- data/man/bundle-info.1 +1 -1
- data/man/bundle-info.1.txt +1 -1
- data/man/bundle-init.1 +1 -1
- data/man/bundle-init.1.txt +1 -1
- data/man/bundle-inject.1 +1 -1
- data/man/bundle-inject.1.txt +1 -1
- data/man/bundle-install.1 +1 -1
- data/man/bundle-install.1.txt +1 -1
- data/man/bundle-list.1 +1 -1
- data/man/bundle-list.1.txt +1 -1
- data/man/bundle-lock.1 +1 -1
- data/man/bundle-lock.1.txt +1 -1
- data/man/bundle-open.1 +1 -1
- data/man/bundle-open.1.txt +1 -1
- data/man/bundle-outdated.1 +1 -1
- data/man/bundle-outdated.1.txt +1 -1
- data/man/bundle-platform.1 +1 -1
- data/man/bundle-platform.1.txt +1 -1
- data/man/bundle-pristine.1 +1 -1
- data/man/bundle-pristine.1.txt +1 -1
- data/man/bundle-remove.1 +1 -1
- data/man/bundle-remove.1.txt +1 -1
- data/man/bundle-show.1 +1 -1
- data/man/bundle-show.1.txt +1 -1
- data/man/bundle-update.1 +1 -1
- data/man/bundle-update.1.txt +1 -1
- data/man/bundle-viz.1 +1 -1
- data/man/bundle-viz.1.txt +1 -1
- data/man/bundle.1 +1 -1
- data/man/bundle.1.txt +1 -1
- data/man/gemfile.5 +1 -1
- data/man/gemfile.5.txt +1 -1
- data/man/index.txt +1 -1
- metadata +6 -7
- data/lib/bundler/vendor/thor/lib/thor/core_ext/ordered_hash.rb +0 -129
- data/man/bundle-package.1 +0 -55
- data/man/bundle-package.1.txt +0 -79
data/lib/bundler/cli/exec.rb
CHANGED
@@ -43,15 +43,11 @@ module Bundler
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def kernel_exec(*args)
|
46
|
-
ui = Bundler.ui
|
47
|
-
Bundler.ui = nil
|
48
46
|
Kernel.exec(*args)
|
49
47
|
rescue Errno::EACCES, Errno::ENOEXEC
|
50
|
-
Bundler.ui = ui
|
51
48
|
Bundler.ui.error "bundler: not executable: #{cmd}"
|
52
49
|
exit 126
|
53
50
|
rescue Errno::ENOENT
|
54
|
-
Bundler.ui = ui
|
55
51
|
Bundler.ui.error "bundler: command not found: #{cmd}"
|
56
52
|
Bundler.ui.warn "Install missing gem executables with `bundle install`"
|
57
53
|
exit 127
|
@@ -62,15 +58,12 @@ module Bundler
|
|
62
58
|
ARGV.replace(args)
|
63
59
|
$0 = file
|
64
60
|
Process.setproctitle(process_title(file, args)) if Process.respond_to?(:setproctitle)
|
65
|
-
ui = Bundler.ui
|
66
|
-
Bundler.ui = nil
|
67
61
|
require_relative "../setup"
|
68
62
|
TRAPPED_SIGNALS.each {|s| trap(s, "DEFAULT") }
|
69
63
|
Kernel.load(file)
|
70
64
|
rescue SystemExit, SignalException
|
71
65
|
raise
|
72
66
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
73
|
-
Bundler.ui = ui
|
74
67
|
Bundler.ui.error "bundler: failed to load command: #{cmd} (#{file})"
|
75
68
|
backtrace = e.backtrace ? e.backtrace.take_while {|bt| !bt.start_with?(__FILE__) } : []
|
76
69
|
abort "#{e.class}: #{e.message}\n #{backtrace.join("\n ")}"
|
data/lib/bundler/dsl.rb
CHANGED
@@ -44,7 +44,7 @@ module Bundler
|
|
44
44
|
@gemfile = expanded_gemfile_path
|
45
45
|
@gemfiles << expanded_gemfile_path
|
46
46
|
contents ||= Bundler.read_file(@gemfile.to_s)
|
47
|
-
instance_eval(contents.dup.untaint, gemfile.to_s, 1)
|
47
|
+
instance_eval(contents.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" }, gemfile.to_s, 1)
|
48
48
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
49
49
|
message = "There was an error " \
|
50
50
|
"#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \
|
@@ -16,7 +16,7 @@ module Bundler
|
|
16
16
|
Bundler.ui.error error.message
|
17
17
|
when GemRequireError
|
18
18
|
Bundler.ui.error error.message
|
19
|
-
Bundler.ui.trace error.orig_exception
|
19
|
+
Bundler.ui.trace error.orig_exception
|
20
20
|
when BundlerError
|
21
21
|
Bundler.ui.error error.message, :wrap => true
|
22
22
|
Bundler.ui.trace error
|
data/lib/bundler/gem_helper.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "vendored_thor" unless defined?(Thor)
|
4
3
|
require_relative "../bundler"
|
5
4
|
require "shellwords"
|
6
5
|
|
@@ -26,7 +25,6 @@ module Bundler
|
|
26
25
|
attr_reader :spec_path, :base, :gemspec
|
27
26
|
|
28
27
|
def initialize(base = nil, name = nil)
|
29
|
-
Bundler.ui = UI::Shell.new
|
30
28
|
@base = (base ||= SharedHelpers.pwd)
|
31
29
|
gemspecs = name ? [File.join(base, "#{name}.gemspec")] : Dir[File.join(base, "{,*}.gemspec")]
|
32
30
|
raise "Unable to determine name from existing gemspec. Use :name => 'gemname' in #install_tasks to manually set it." unless gemspecs.size == 1
|
data/lib/bundler/gem_helpers.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Bundler
|
4
4
|
module GemHelpers
|
5
|
-
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable MutableConstant
|
5
|
+
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
|
6
6
|
GENERICS = [
|
7
7
|
[Gem::Platform.new("java"), Gem::Platform.new("java")],
|
8
8
|
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
|
data/lib/bundler/inline.rb
CHANGED
@@ -38,6 +38,8 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
38
38
|
raise ArgumentError, "Unknown options: #{opts.keys.join(", ")}" unless opts.empty?
|
39
39
|
|
40
40
|
old_root = Bundler.method(:root)
|
41
|
+
bundler_module = class << Bundler; self; end
|
42
|
+
bundler_module.send(:remove_method, :root)
|
41
43
|
def Bundler.root
|
42
44
|
Bundler::SharedHelpers.pwd.expand_path
|
43
45
|
end
|
@@ -56,7 +58,7 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
56
58
|
definition.missing_specs?
|
57
59
|
end
|
58
60
|
|
59
|
-
Bundler.ui = ui
|
61
|
+
Bundler.ui = install ? ui : Bundler::UI::Silent.new
|
60
62
|
if install || missing_specs.call
|
61
63
|
Bundler.settings.temporary(:inline => true, :disable_platform_warnings => true) do
|
62
64
|
installer = Bundler::Installer.install(Bundler.root, definition, :system => true)
|
@@ -70,6 +72,8 @@ def gemfile(install = false, options = {}, &gemfile)
|
|
70
72
|
runtime.setup.require
|
71
73
|
end
|
72
74
|
ensure
|
73
|
-
bundler_module
|
74
|
-
|
75
|
+
if bundler_module
|
76
|
+
bundler_module.send(:remove_method, :root)
|
77
|
+
bundler_module.send(:define_method, :root, old_root)
|
78
|
+
end
|
75
79
|
end
|
data/lib/bundler/rubygems_ext.rb
CHANGED
@@ -29,7 +29,7 @@ module Gem
|
|
29
29
|
# gems at that time, this method could be called inside another require,
|
30
30
|
# thus raising with that constant being undefined. Better to check a method
|
31
31
|
if source.respond_to?(:path) || (source.respond_to?(:bundler_plugin_api_source?) && source.bundler_plugin_api_source?)
|
32
|
-
Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.untaint
|
32
|
+
Pathname.new(loaded_from).dirname.expand_path(source.root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
33
33
|
else
|
34
34
|
rg_full_gem_path
|
35
35
|
end
|
@@ -635,7 +635,6 @@ module Bundler
|
|
635
635
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path(gemfile)
|
636
636
|
require_relative "gemdeps"
|
637
637
|
runtime = Bundler.setup
|
638
|
-
Bundler.ui = nil
|
639
638
|
activated_spec_names = runtime.requested_specs.map(&:to_spec).sort_by(&:name)
|
640
639
|
[Gemdeps.new(runtime), activated_spec_names]
|
641
640
|
end
|
data/lib/bundler/setup.rb
CHANGED
@@ -6,9 +6,8 @@ if Bundler::SharedHelpers.in_bundle?
|
|
6
6
|
require_relative "../bundler"
|
7
7
|
|
8
8
|
if STDOUT.tty? || ENV["BUNDLER_FORCE_TTY"]
|
9
|
-
Bundler.ui = Bundler::UI::Shell.new
|
10
9
|
begin
|
11
|
-
Bundler.setup
|
10
|
+
Bundler.ui.silence { Bundler.setup }
|
12
11
|
rescue Bundler::BundlerError => e
|
13
12
|
Bundler.ui.warn "\e[31m#{e.message}\e[0m"
|
14
13
|
Bundler.ui.warn e.backtrace.join("\n") if ENV["DEBUG"]
|
@@ -18,12 +17,6 @@ if Bundler::SharedHelpers.in_bundle?
|
|
18
17
|
exit e.status_code
|
19
18
|
end
|
20
19
|
else
|
21
|
-
Bundler.setup
|
20
|
+
Bundler.ui.silence { Bundler.setup }
|
22
21
|
end
|
23
|
-
|
24
|
-
# Add bundler to the load path after disabling system gems
|
25
|
-
bundler_lib = File.expand_path("../..", __FILE__)
|
26
|
-
$LOAD_PATH.unshift(bundler_lib) unless $LOAD_PATH.include?(bundler_lib)
|
27
|
-
|
28
|
-
Bundler.ui = nil
|
29
22
|
end
|
@@ -13,13 +13,13 @@ module Bundler
|
|
13
13
|
def root
|
14
14
|
gemfile = find_gemfile
|
15
15
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
16
|
-
Pathname.new(gemfile).untaint.expand_path.parent
|
16
|
+
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path.parent
|
17
17
|
end
|
18
18
|
|
19
19
|
def default_gemfile
|
20
20
|
gemfile = find_gemfile
|
21
21
|
raise GemfileNotFound, "Could not locate Gemfile" unless gemfile
|
22
|
-
Pathname.new(gemfile).untaint.expand_path
|
22
|
+
Pathname.new(gemfile).tap{|x| x.untaint if RUBY_VERSION < "2.7" }.expand_path
|
23
23
|
end
|
24
24
|
|
25
25
|
def default_lockfile
|
@@ -28,7 +28,7 @@ module Bundler
|
|
28
28
|
case gemfile.basename.to_s
|
29
29
|
when "gems.rb" then Pathname.new(gemfile.sub(/.rb$/, ".locked"))
|
30
30
|
else Pathname.new("#{gemfile}.lock")
|
31
|
-
end.untaint
|
31
|
+
end.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
32
32
|
end
|
33
33
|
|
34
34
|
def default_bundle_dir
|
@@ -100,7 +100,7 @@ module Bundler
|
|
100
100
|
#
|
101
101
|
# @see {Bundler::PermissionError}
|
102
102
|
def filesystem_access(path, action = :write, &block)
|
103
|
-
yield(path.dup.untaint)
|
103
|
+
yield(path.dup.tap{|x| x.untaint if RUBY_VERSION < "2.7" })
|
104
104
|
rescue Errno::EACCES
|
105
105
|
raise PermissionError.new(path, action)
|
106
106
|
rescue Errno::EAGAIN
|
@@ -124,7 +124,12 @@ module Bundler
|
|
124
124
|
namespace.const_get(constant_name)
|
125
125
|
end
|
126
126
|
|
127
|
-
def major_deprecation(major_version, message)
|
127
|
+
def major_deprecation(major_version, message, print_caller_location: false)
|
128
|
+
if print_caller_location
|
129
|
+
caller_location = caller_locations(2, 2).first
|
130
|
+
message = "#{message} (called at #{caller_location.path}:#{caller_location.lineno})"
|
131
|
+
end
|
132
|
+
|
128
133
|
bundler_major_version = Bundler.bundler_major_version
|
129
134
|
if bundler_major_version > major_version
|
130
135
|
require_relative "errors"
|
@@ -132,10 +137,7 @@ module Bundler
|
|
132
137
|
end
|
133
138
|
|
134
139
|
return unless bundler_major_version >= major_version && prints_major_deprecations?
|
135
|
-
|
136
|
-
with_major_deprecation_ui do |ui|
|
137
|
-
ui.warn("[DEPRECATED] #{message}")
|
138
|
-
end
|
140
|
+
Bundler.ui.warn("[DEPRECATED] #{message}")
|
139
141
|
end
|
140
142
|
|
141
143
|
def print_major_deprecations!
|
@@ -212,21 +214,6 @@ module Bundler
|
|
212
214
|
|
213
215
|
private
|
214
216
|
|
215
|
-
def with_major_deprecation_ui(&block)
|
216
|
-
ui = Bundler.ui
|
217
|
-
|
218
|
-
if ui.is_a?(@major_deprecation_ui.class)
|
219
|
-
yield ui
|
220
|
-
else
|
221
|
-
begin
|
222
|
-
Bundler.ui = @major_deprecation_ui
|
223
|
-
yield Bundler.ui
|
224
|
-
ensure
|
225
|
-
Bundler.ui = ui
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
217
|
def validate_bundle_path
|
231
218
|
path_separator = Bundler.rubygems.path_separator
|
232
219
|
return unless Bundler.bundle_path.to_s.split(path_separator).size > 1
|
@@ -263,7 +250,7 @@ module Bundler
|
|
263
250
|
|
264
251
|
def search_up(*names)
|
265
252
|
previous = nil
|
266
|
-
current = File.expand_path(SharedHelpers.pwd).untaint
|
253
|
+
current = File.expand_path(SharedHelpers.pwd).tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
267
254
|
|
268
255
|
until !File.directory?(current) || current == previous
|
269
256
|
if ENV["BUNDLE_SPEC_RUN"]
|
data/lib/bundler/source/git.rb
CHANGED
@@ -316,7 +316,7 @@ module Bundler
|
|
316
316
|
|
317
317
|
def load_gemspec(file)
|
318
318
|
stub = Gem::StubSpecification.gemspec_stub(file, install_path.parent, install_path.parent)
|
319
|
-
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.untaint
|
319
|
+
stub.full_gem_path = Pathname.new(file).dirname.expand_path(root).to_s.tap{|x| x.untaint if RUBY_VERSION < "2.7" }
|
320
320
|
StubSpecification.from_stub(stub)
|
321
321
|
end
|
322
322
|
|
@@ -24,46 +24,56 @@ require_relative "fileutils/version"
|
|
24
24
|
#
|
25
25
|
# require 'bundler/vendor/fileutils/lib/fileutils'
|
26
26
|
#
|
27
|
-
# Bundler::FileUtils.cd(dir, options)
|
28
|
-
# Bundler::FileUtils.cd(dir, options) {|dir| block }
|
27
|
+
# Bundler::FileUtils.cd(dir, **options)
|
28
|
+
# Bundler::FileUtils.cd(dir, **options) {|dir| block }
|
29
29
|
# Bundler::FileUtils.pwd()
|
30
|
-
# Bundler::FileUtils.mkdir(dir, options)
|
31
|
-
# Bundler::FileUtils.mkdir(list, options)
|
32
|
-
# Bundler::FileUtils.mkdir_p(dir, options)
|
33
|
-
# Bundler::FileUtils.mkdir_p(list, options)
|
34
|
-
# Bundler::FileUtils.rmdir(dir, options)
|
35
|
-
# Bundler::FileUtils.rmdir(list, options)
|
36
|
-
# Bundler::FileUtils.ln(target, link, options)
|
37
|
-
# Bundler::FileUtils.ln(targets, dir, options)
|
38
|
-
# Bundler::FileUtils.ln_s(target, link, options)
|
39
|
-
# Bundler::FileUtils.ln_s(targets, dir, options)
|
40
|
-
# Bundler::FileUtils.ln_sf(target, link, options)
|
41
|
-
# Bundler::FileUtils.cp(src, dest, options)
|
42
|
-
# Bundler::FileUtils.cp(list, dir, options)
|
43
|
-
# Bundler::FileUtils.cp_r(src, dest, options)
|
44
|
-
# Bundler::FileUtils.cp_r(list, dir, options)
|
45
|
-
# Bundler::FileUtils.mv(src, dest, options)
|
46
|
-
# Bundler::FileUtils.mv(list, dir, options)
|
47
|
-
# Bundler::FileUtils.rm(list, options)
|
48
|
-
# Bundler::FileUtils.rm_r(list, options)
|
49
|
-
# Bundler::FileUtils.rm_rf(list, options)
|
50
|
-
# Bundler::FileUtils.install(src, dest, options)
|
51
|
-
# Bundler::FileUtils.chmod(mode, list, options)
|
52
|
-
# Bundler::FileUtils.chmod_R(mode, list, options)
|
53
|
-
# Bundler::FileUtils.chown(user, group, list, options)
|
54
|
-
# Bundler::FileUtils.chown_R(user, group, list, options)
|
55
|
-
# Bundler::FileUtils.touch(list, options)
|
30
|
+
# Bundler::FileUtils.mkdir(dir, **options)
|
31
|
+
# Bundler::FileUtils.mkdir(list, **options)
|
32
|
+
# Bundler::FileUtils.mkdir_p(dir, **options)
|
33
|
+
# Bundler::FileUtils.mkdir_p(list, **options)
|
34
|
+
# Bundler::FileUtils.rmdir(dir, **options)
|
35
|
+
# Bundler::FileUtils.rmdir(list, **options)
|
36
|
+
# Bundler::FileUtils.ln(target, link, **options)
|
37
|
+
# Bundler::FileUtils.ln(targets, dir, **options)
|
38
|
+
# Bundler::FileUtils.ln_s(target, link, **options)
|
39
|
+
# Bundler::FileUtils.ln_s(targets, dir, **options)
|
40
|
+
# Bundler::FileUtils.ln_sf(target, link, **options)
|
41
|
+
# Bundler::FileUtils.cp(src, dest, **options)
|
42
|
+
# Bundler::FileUtils.cp(list, dir, **options)
|
43
|
+
# Bundler::FileUtils.cp_r(src, dest, **options)
|
44
|
+
# Bundler::FileUtils.cp_r(list, dir, **options)
|
45
|
+
# Bundler::FileUtils.mv(src, dest, **options)
|
46
|
+
# Bundler::FileUtils.mv(list, dir, **options)
|
47
|
+
# Bundler::FileUtils.rm(list, **options)
|
48
|
+
# Bundler::FileUtils.rm_r(list, **options)
|
49
|
+
# Bundler::FileUtils.rm_rf(list, **options)
|
50
|
+
# Bundler::FileUtils.install(src, dest, **options)
|
51
|
+
# Bundler::FileUtils.chmod(mode, list, **options)
|
52
|
+
# Bundler::FileUtils.chmod_R(mode, list, **options)
|
53
|
+
# Bundler::FileUtils.chown(user, group, list, **options)
|
54
|
+
# Bundler::FileUtils.chown_R(user, group, list, **options)
|
55
|
+
# Bundler::FileUtils.touch(list, **options)
|
56
56
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# <tt>:
|
60
|
-
#
|
57
|
+
# Possible <tt>options</tt> are:
|
58
|
+
#
|
59
|
+
# <tt>:force</tt> :: forced operation (rewrite files if exist, remove
|
60
|
+
# directories if not empty, etc.);
|
61
|
+
# <tt>:verbose</tt> :: print command to be run, in bash syntax, before
|
62
|
+
# performing it;
|
63
|
+
# <tt>:preserve</tt> :: preserve object's group, user and modification
|
64
|
+
# time on copying;
|
65
|
+
# <tt>:noop</tt> :: no changes are made (usable in combination with
|
66
|
+
# <tt>:verbose</tt> which will print the command to run)
|
67
|
+
#
|
68
|
+
# Each method documents the options that it honours. See also ::commands,
|
69
|
+
# ::options and ::options_of methods to introspect which command have which
|
70
|
+
# options.
|
61
71
|
#
|
62
72
|
# All methods that have the concept of a "source" file or directory can take
|
63
73
|
# either one file or a list of files in that argument. See the method
|
64
74
|
# documentation for examples.
|
65
75
|
#
|
66
|
-
# There are some `low level' methods, which do not accept
|
76
|
+
# There are some `low level' methods, which do not accept keyword arguments:
|
67
77
|
#
|
68
78
|
# Bundler::FileUtils.copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
|
69
79
|
# Bundler::FileUtils.copy_file(src, dest, preserve = false, dereference = true)
|
@@ -119,7 +129,7 @@ module Bundler::FileUtils
|
|
119
129
|
#
|
120
130
|
# Bundler::FileUtils.cd('/') # change directory
|
121
131
|
#
|
122
|
-
# Bundler::FileUtils.cd('/', :
|
132
|
+
# Bundler::FileUtils.cd('/', verbose: true) # change directory and report it
|
123
133
|
#
|
124
134
|
# Bundler::FileUtils.cd('/') do # change directory
|
125
135
|
# # ... # do something
|
@@ -164,9 +174,9 @@ module Bundler::FileUtils
|
|
164
174
|
# Creates one or more directories.
|
165
175
|
#
|
166
176
|
# Bundler::FileUtils.mkdir 'test'
|
167
|
-
# Bundler::FileUtils.mkdir %w(
|
168
|
-
# Bundler::FileUtils.mkdir 'notexist', :
|
169
|
-
# Bundler::FileUtils.mkdir 'tmp', :
|
177
|
+
# Bundler::FileUtils.mkdir %w(tmp data)
|
178
|
+
# Bundler::FileUtils.mkdir 'notexist', noop: true # Does not really create.
|
179
|
+
# Bundler::FileUtils.mkdir 'tmp', mode: 0700
|
170
180
|
#
|
171
181
|
def mkdir(list, mode: nil, noop: nil, verbose: nil)
|
172
182
|
list = fu_list(list)
|
@@ -185,7 +195,7 @@ module Bundler::FileUtils
|
|
185
195
|
#
|
186
196
|
# Bundler::FileUtils.mkdir_p '/usr/local/lib/ruby'
|
187
197
|
#
|
188
|
-
# causes to make following directories, if
|
198
|
+
# causes to make following directories, if they do not exist.
|
189
199
|
#
|
190
200
|
# * /usr
|
191
201
|
# * /usr/local
|
@@ -249,7 +259,7 @@ module Bundler::FileUtils
|
|
249
259
|
# Bundler::FileUtils.rmdir 'somedir'
|
250
260
|
# Bundler::FileUtils.rmdir %w(somedir anydir otherdir)
|
251
261
|
# # Does not really remove directory; outputs message.
|
252
|
-
# Bundler::FileUtils.rmdir 'somedir', :
|
262
|
+
# Bundler::FileUtils.rmdir 'somedir', verbose: true, noop: true
|
253
263
|
#
|
254
264
|
def rmdir(list, parents: nil, noop: nil, verbose: nil)
|
255
265
|
list = fu_list(list)
|
@@ -278,7 +288,7 @@ module Bundler::FileUtils
|
|
278
288
|
#
|
279
289
|
# In the first form, creates a hard link +link+ which points to +target+.
|
280
290
|
# If +link+ already exists, raises Errno::EEXIST.
|
281
|
-
# But if the
|
291
|
+
# But if the +force+ option is set, overwrites +link+.
|
282
292
|
#
|
283
293
|
# Bundler::FileUtils.ln 'gcc', 'cc', verbose: true
|
284
294
|
# Bundler::FileUtils.ln '/usr/bin/emacs21', '/usr/bin/emacs'
|
@@ -304,9 +314,6 @@ module Bundler::FileUtils
|
|
304
314
|
alias link ln
|
305
315
|
module_function :link
|
306
316
|
|
307
|
-
#
|
308
|
-
# :call-seq:
|
309
|
-
# Bundler::FileUtils.cp_lr(src, dest, noop: nil, verbose: nil, dereference_root: true, remove_destination: false)
|
310
317
|
#
|
311
318
|
# Hard link +src+ to +dest+. If +src+ is a directory, this method links
|
312
319
|
# all its contents recursively. If +dest+ is a directory, links
|
@@ -314,13 +321,16 @@ module Bundler::FileUtils
|
|
314
321
|
#
|
315
322
|
# +src+ can be a list of files.
|
316
323
|
#
|
317
|
-
#
|
318
|
-
#
|
324
|
+
# If +dereference_root+ is true, this method dereference tree root.
|
325
|
+
#
|
326
|
+
# If +remove_destination+ is true, this method removes each destination file before copy.
|
327
|
+
#
|
328
|
+
# Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
|
319
329
|
# Bundler::FileUtils.cp_lr 'lib/', site_ruby + '/mylib'
|
320
330
|
#
|
321
331
|
# # Examples of linking several files to target directory.
|
322
332
|
# Bundler::FileUtils.cp_lr %w(mail.rb field.rb debug/), site_ruby + '/tmail'
|
323
|
-
# Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', :
|
333
|
+
# Bundler::FileUtils.cp_lr Dir.glob('*.rb'), '/home/aamine/lib/ruby', noop: true, verbose: true
|
324
334
|
#
|
325
335
|
# # If you want to link all contents of a directory instead of the
|
326
336
|
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
|
@@ -345,7 +355,7 @@ module Bundler::FileUtils
|
|
345
355
|
#
|
346
356
|
# In the first form, creates a symbolic link +link+ which points to +target+.
|
347
357
|
# If +link+ already exists, raises Errno::EEXIST.
|
348
|
-
# But if the
|
358
|
+
# But if the <tt>force</tt> option is set, overwrites +link+.
|
349
359
|
#
|
350
360
|
# Bundler::FileUtils.ln_s '/usr/bin/ruby', '/usr/local/bin/ruby'
|
351
361
|
# Bundler::FileUtils.ln_s 'verylongsourcefilename.c', 'c', force: true
|
@@ -411,7 +421,7 @@ module Bundler::FileUtils
|
|
411
421
|
#
|
412
422
|
# Bundler::FileUtils.cp 'eval.c', 'eval.c.org'
|
413
423
|
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6'
|
414
|
-
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', :
|
424
|
+
# Bundler::FileUtils.cp %w(cgi.rb complex.rb date.rb), '/usr/lib/ruby/1.6', verbose: true
|
415
425
|
# Bundler::FileUtils.cp 'symlink', 'dest' # copy content, "dest" is not a symlink
|
416
426
|
#
|
417
427
|
def cp(src, dest, preserve: nil, noop: nil, verbose: nil)
|
@@ -433,13 +443,17 @@ module Bundler::FileUtils
|
|
433
443
|
#
|
434
444
|
# +src+ can be a list of files.
|
435
445
|
#
|
446
|
+
# If +dereference_root+ is true, this method dereference tree root.
|
447
|
+
#
|
448
|
+
# If +remove_destination+ is true, this method removes each destination file before copy.
|
449
|
+
#
|
436
450
|
# # Installing Ruby library "mylib" under the site_ruby
|
437
|
-
# Bundler::FileUtils.rm_r site_ruby + '/mylib', :
|
451
|
+
# Bundler::FileUtils.rm_r site_ruby + '/mylib', force: true
|
438
452
|
# Bundler::FileUtils.cp_r 'lib/', site_ruby + '/mylib'
|
439
453
|
#
|
440
454
|
# # Examples of copying several files to target directory.
|
441
455
|
# Bundler::FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby + '/tmail'
|
442
|
-
# Bundler::FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', :
|
456
|
+
# Bundler::FileUtils.cp_r Dir.glob('*.rb'), '/home/foo/lib/ruby', noop: true, verbose: true
|
443
457
|
#
|
444
458
|
# # If you want to copy all contents of a directory instead of the
|
445
459
|
# # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
|
@@ -474,7 +488,11 @@ module Bundler::FileUtils
|
|
474
488
|
# If +remove_destination+ is true, this method removes each destination file before copy.
|
475
489
|
#
|
476
490
|
def copy_entry(src, dest, preserve = false, dereference_root = false, remove_destination = false)
|
477
|
-
|
491
|
+
if dereference_root
|
492
|
+
src = File.realpath(src)
|
493
|
+
end
|
494
|
+
|
495
|
+
Entry_.new(src, nil, false).wrap_traverse(proc do |ent|
|
478
496
|
destent = Entry_.new(dest, ent.rel, false)
|
479
497
|
File.unlink destent.path if remove_destination && (File.file?(destent.path) || File.symlink?(destent.path))
|
480
498
|
ent.copy destent.path
|
@@ -511,10 +529,10 @@ module Bundler::FileUtils
|
|
511
529
|
# disk partition, the file is copied then the original file is removed.
|
512
530
|
#
|
513
531
|
# Bundler::FileUtils.mv 'badname.rb', 'goodname.rb'
|
514
|
-
# Bundler::FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', :
|
532
|
+
# Bundler::FileUtils.mv 'stuff.rb', '/notexist/lib/ruby', force: true # no error
|
515
533
|
#
|
516
534
|
# Bundler::FileUtils.mv %w(junk.txt dust.txt), '/home/foo/.trash/'
|
517
|
-
# Bundler::FileUtils.mv Dir.glob('test*.rb'), 'test', :
|
535
|
+
# Bundler::FileUtils.mv Dir.glob('test*.rb'), 'test', noop: true, verbose: true
|
518
536
|
#
|
519
537
|
def mv(src, dest, force: nil, noop: nil, verbose: nil, secure: nil)
|
520
538
|
fu_output_message "mv#{force ? ' -f' : ''} #{[src,dest].flatten.join ' '}" if verbose
|
@@ -554,7 +572,7 @@ module Bundler::FileUtils
|
|
554
572
|
#
|
555
573
|
# Bundler::FileUtils.rm %w( junk.txt dust.txt )
|
556
574
|
# Bundler::FileUtils.rm Dir.glob('*.so')
|
557
|
-
# Bundler::FileUtils.rm 'NotExistFile', :
|
575
|
+
# Bundler::FileUtils.rm 'NotExistFile', force: true # never raises exception
|
558
576
|
#
|
559
577
|
def rm(list, force: nil, noop: nil, verbose: nil)
|
560
578
|
list = fu_list(list)
|
@@ -573,7 +591,7 @@ module Bundler::FileUtils
|
|
573
591
|
#
|
574
592
|
# Equivalent to
|
575
593
|
#
|
576
|
-
# Bundler::FileUtils.rm(list, :
|
594
|
+
# Bundler::FileUtils.rm(list, force: true)
|
577
595
|
#
|
578
596
|
def rm_f(list, noop: nil, verbose: nil)
|
579
597
|
rm list, force: true, noop: noop, verbose: verbose
|
@@ -589,18 +607,18 @@ module Bundler::FileUtils
|
|
589
607
|
# StandardError when :force option is set.
|
590
608
|
#
|
591
609
|
# Bundler::FileUtils.rm_r Dir.glob('/tmp/*')
|
592
|
-
# Bundler::FileUtils.rm_r 'some_dir', :
|
610
|
+
# Bundler::FileUtils.rm_r 'some_dir', force: true
|
593
611
|
#
|
594
612
|
# WARNING: This method causes local vulnerability
|
595
613
|
# if one of parent directories or removing directory tree are world
|
596
614
|
# writable (including /tmp, whose permission is 1777), and the current
|
597
615
|
# process has strong privilege such as Unix super user (root), and the
|
598
616
|
# system has symbolic link. For secure removing, read the documentation
|
599
|
-
# of
|
600
|
-
# Default is :
|
617
|
+
# of remove_entry_secure carefully, and set :secure option to true.
|
618
|
+
# Default is <tt>secure: false</tt>.
|
601
619
|
#
|
602
|
-
# NOTE: This method calls
|
603
|
-
# See also
|
620
|
+
# NOTE: This method calls remove_entry_secure if :secure option is set.
|
621
|
+
# See also remove_entry_secure.
|
604
622
|
#
|
605
623
|
def rm_r(list, force: nil, noop: nil, verbose: nil, secure: nil)
|
606
624
|
list = fu_list(list)
|
@@ -619,10 +637,10 @@ module Bundler::FileUtils
|
|
619
637
|
#
|
620
638
|
# Equivalent to
|
621
639
|
#
|
622
|
-
# Bundler::FileUtils.rm_r(list, :
|
640
|
+
# Bundler::FileUtils.rm_r(list, force: true)
|
623
641
|
#
|
624
642
|
# WARNING: This method causes local vulnerability.
|
625
|
-
# Read the documentation of
|
643
|
+
# Read the documentation of rm_r first.
|
626
644
|
#
|
627
645
|
def rm_rf(list, noop: nil, verbose: nil, secure: nil)
|
628
646
|
rm_r list, force: true, noop: noop, verbose: verbose, secure: secure
|
@@ -636,7 +654,7 @@ module Bundler::FileUtils
|
|
636
654
|
# This method removes a file system entry +path+. +path+ shall be a
|
637
655
|
# regular file, a directory, or something. If +path+ is a directory,
|
638
656
|
# remove it recursively. This method is required to avoid TOCTTOU
|
639
|
-
# (time-of-check-to-time-of-use) local security vulnerability of
|
657
|
+
# (time-of-check-to-time-of-use) local security vulnerability of rm_r.
|
640
658
|
# #rm_r causes security hole when:
|
641
659
|
#
|
642
660
|
# * Parent directory is world writable (including /tmp).
|
@@ -755,7 +773,7 @@ module Bundler::FileUtils
|
|
755
773
|
# +path+ might be a regular file, a directory, or something.
|
756
774
|
# If +path+ is a directory, remove it recursively.
|
757
775
|
#
|
758
|
-
# See also
|
776
|
+
# See also remove_entry_secure.
|
759
777
|
#
|
760
778
|
def remove_entry(path, force = false)
|
761
779
|
Entry_.new(path).postorder_traverse do |ent|
|
@@ -839,8 +857,8 @@ module Bundler::FileUtils
|
|
839
857
|
# mode to +mode+. If +dest+ is a directory, destination is +dest+/+src+.
|
840
858
|
# This method removes destination before copy.
|
841
859
|
#
|
842
|
-
# Bundler::FileUtils.install 'ruby', '/usr/local/bin/ruby', :
|
843
|
-
# Bundler::FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', :
|
860
|
+
# Bundler::FileUtils.install 'ruby', '/usr/local/bin/ruby', mode: 0755, verbose: true
|
861
|
+
# Bundler::FileUtils.install 'lib.rb', '/usr/local/lib/ruby/site_ruby', verbose: true
|
844
862
|
#
|
845
863
|
def install(src, dest, mode: nil, owner: nil, group: nil, preserve: nil,
|
846
864
|
noop: nil, verbose: nil)
|
@@ -970,12 +988,12 @@ module Bundler::FileUtils
|
|
970
988
|
# Absolute mode is
|
971
989
|
# Bundler::FileUtils.chmod 0755, 'somecommand'
|
972
990
|
# Bundler::FileUtils.chmod 0644, %w(my.rb your.rb his.rb her.rb)
|
973
|
-
# Bundler::FileUtils.chmod 0755, '/usr/bin/ruby', :
|
991
|
+
# Bundler::FileUtils.chmod 0755, '/usr/bin/ruby', verbose: true
|
974
992
|
#
|
975
993
|
# Symbolic mode is
|
976
994
|
# Bundler::FileUtils.chmod "u=wrx,go=rx", 'somecommand'
|
977
995
|
# Bundler::FileUtils.chmod "u=wr,go=rr", %w(my.rb your.rb his.rb her.rb)
|
978
|
-
# Bundler::FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', :
|
996
|
+
# Bundler::FileUtils.chmod "u=wrx,go=rx", '/usr/bin/ruby', verbose: true
|
979
997
|
#
|
980
998
|
# "a" :: is user, group, other mask.
|
981
999
|
# "u" :: is user's mask.
|
@@ -1035,7 +1053,7 @@ module Bundler::FileUtils
|
|
1035
1053
|
# the attribute.
|
1036
1054
|
#
|
1037
1055
|
# Bundler::FileUtils.chown 'root', 'staff', '/usr/local/bin/ruby'
|
1038
|
-
# Bundler::FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), :
|
1056
|
+
# Bundler::FileUtils.chown nil, 'bin', Dir.glob('/usr/bin/*'), verbose: true
|
1039
1057
|
#
|
1040
1058
|
def chown(user, group, list, noop: nil, verbose: nil)
|
1041
1059
|
list = fu_list(list)
|
@@ -1059,7 +1077,7 @@ module Bundler::FileUtils
|
|
1059
1077
|
# method does not change the attribute.
|
1060
1078
|
#
|
1061
1079
|
# Bundler::FileUtils.chown_R 'www', 'www', '/var/www/htdocs'
|
1062
|
-
# Bundler::FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', :
|
1080
|
+
# Bundler::FileUtils.chown_R 'cvs', 'cvs', '/var/cvs', verbose: true
|
1063
1081
|
#
|
1064
1082
|
def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)
|
1065
1083
|
list = fu_list(list)
|
@@ -1276,13 +1294,13 @@ module Bundler::FileUtils
|
|
1276
1294
|
opts[:encoding] = ::Encoding::UTF_8 if fu_windows?
|
1277
1295
|
|
1278
1296
|
files = if Dir.respond_to?(:children)
|
1279
|
-
Dir.children(path, opts)
|
1297
|
+
Dir.children(path, **opts)
|
1280
1298
|
else
|
1281
|
-
Dir.entries(path(), opts)
|
1299
|
+
Dir.entries(path(), **opts)
|
1282
1300
|
.reject {|n| n == '.' or n == '..' }
|
1283
1301
|
end
|
1284
1302
|
|
1285
|
-
files.map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
|
1303
|
+
files.map {|n| Entry_.new(prefix(), join(rel(), n.tap{|x| x.untaint if RUBY_VERSION < "2.7" })) }
|
1286
1304
|
end
|
1287
1305
|
|
1288
1306
|
def stat
|
@@ -1369,18 +1387,21 @@ module Bundler::FileUtils
|
|
1369
1387
|
end
|
1370
1388
|
when symlink?
|
1371
1389
|
File.symlink File.readlink(path()), dest
|
1372
|
-
when chardev?
|
1373
|
-
raise "cannot handle device file"
|
1374
|
-
mknod dest, ?c, 0666, lstat().rdev
|
1375
|
-
when blockdev?
|
1376
|
-
raise "cannot handle device file" unless File.respond_to?(:mknod)
|
1377
|
-
mknod dest, ?b, 0666, lstat().rdev
|
1390
|
+
when chardev?, blockdev?
|
1391
|
+
raise "cannot handle device file"
|
1378
1392
|
when socket?
|
1379
|
-
|
1380
|
-
|
1393
|
+
begin
|
1394
|
+
require 'socket'
|
1395
|
+
rescue LoadError
|
1396
|
+
raise "cannot handle socket"
|
1397
|
+
else
|
1398
|
+
raise "cannot handle socket" unless defined?(UNIXServer)
|
1399
|
+
end
|
1400
|
+
UNIXServer.new(dest).close
|
1401
|
+
File.chmod lstat().mode, dest
|
1381
1402
|
when pipe?
|
1382
1403
|
raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
|
1383
|
-
mkfifo dest,
|
1404
|
+
File.mkfifo dest, lstat().mode
|
1384
1405
|
when door?
|
1385
1406
|
raise "cannot handle door: #{path()}"
|
1386
1407
|
else
|
@@ -1499,14 +1520,14 @@ module Bundler::FileUtils
|
|
1499
1520
|
|
1500
1521
|
private
|
1501
1522
|
|
1502
|
-
|
1523
|
+
@@fileutils_rb_have_lchmod = nil
|
1503
1524
|
|
1504
1525
|
def have_lchmod?
|
1505
1526
|
# This is not MT-safe, but it does not matter.
|
1506
|
-
if
|
1507
|
-
|
1527
|
+
if @@fileutils_rb_have_lchmod == nil
|
1528
|
+
@@fileutils_rb_have_lchmod = check_have_lchmod?
|
1508
1529
|
end
|
1509
|
-
|
1530
|
+
@@fileutils_rb_have_lchmod
|
1510
1531
|
end
|
1511
1532
|
|
1512
1533
|
def check_have_lchmod?
|
@@ -1517,14 +1538,14 @@ module Bundler::FileUtils
|
|
1517
1538
|
return false
|
1518
1539
|
end
|
1519
1540
|
|
1520
|
-
|
1541
|
+
@@fileutils_rb_have_lchown = nil
|
1521
1542
|
|
1522
1543
|
def have_lchown?
|
1523
1544
|
# This is not MT-safe, but it does not matter.
|
1524
|
-
if
|
1525
|
-
|
1545
|
+
if @@fileutils_rb_have_lchown == nil
|
1546
|
+
@@fileutils_rb_have_lchown = check_have_lchown?
|
1526
1547
|
end
|
1527
|
-
|
1548
|
+
@@fileutils_rb_have_lchown
|
1528
1549
|
end
|
1529
1550
|
|
1530
1551
|
def check_have_lchown?
|
@@ -1546,10 +1567,13 @@ module Bundler::FileUtils
|
|
1546
1567
|
else
|
1547
1568
|
DIRECTORY_TERM = "(?=/|\\z)"
|
1548
1569
|
end
|
1549
|
-
SYSCASE = File::FNM_SYSCASE.nonzero? ? "-i" : ""
|
1550
1570
|
|
1551
1571
|
def descendant_directory?(descendant, ascendant)
|
1552
|
-
|
1572
|
+
if File::FNM_SYSCASE.nonzero?
|
1573
|
+
File.expand_path(File.dirname(descendant)).casecmp(File.expand_path(ascendant)) == 0
|
1574
|
+
else
|
1575
|
+
File.expand_path(File.dirname(descendant)) == File.expand_path(ascendant)
|
1576
|
+
end
|
1553
1577
|
end
|
1554
1578
|
end # class Entry_
|
1555
1579
|
|
@@ -1588,13 +1612,13 @@ module Bundler::FileUtils
|
|
1588
1612
|
end
|
1589
1613
|
private_module_function :fu_same?
|
1590
1614
|
|
1591
|
-
@fileutils_output = $stderr
|
1592
|
-
@fileutils_label = ''
|
1593
|
-
|
1594
1615
|
def fu_output_message(msg) #:nodoc:
|
1595
|
-
@fileutils_output
|
1596
|
-
|
1597
|
-
|
1616
|
+
output = @fileutils_output if defined?(@fileutils_output)
|
1617
|
+
output ||= $stderr
|
1618
|
+
if defined?(@fileutils_label)
|
1619
|
+
msg = @fileutils_label + msg
|
1620
|
+
end
|
1621
|
+
output.puts msg
|
1598
1622
|
end
|
1599
1623
|
private_module_function :fu_output_message
|
1600
1624
|
|
@@ -1605,8 +1629,11 @@ module Bundler::FileUtils
|
|
1605
1629
|
tbl
|
1606
1630
|
}
|
1607
1631
|
|
1632
|
+
public
|
1633
|
+
|
1608
1634
|
#
|
1609
|
-
# Returns an Array of
|
1635
|
+
# Returns an Array of names of high-level methods that accept any keyword
|
1636
|
+
# arguments.
|
1610
1637
|
#
|
1611
1638
|
# p Bundler::FileUtils.commands #=> ["chmod", "cp", "cp_r", "install", ...]
|
1612
1639
|
#
|
@@ -1645,7 +1672,7 @@ module Bundler::FileUtils
|
|
1645
1672
|
end
|
1646
1673
|
|
1647
1674
|
#
|
1648
|
-
# Returns an Array of
|
1675
|
+
# Returns an Array of methods names which have the option +opt+.
|
1649
1676
|
#
|
1650
1677
|
# p Bundler::FileUtils.collect_method(:preserve) #=> ["cp", "cp_r", "copy", "install"]
|
1651
1678
|
#
|
@@ -1653,14 +1680,16 @@ module Bundler::FileUtils
|
|
1653
1680
|
OPT_TABLE.keys.select {|m| OPT_TABLE[m].include?(opt) }
|
1654
1681
|
end
|
1655
1682
|
|
1656
|
-
|
1657
|
-
|
1683
|
+
private
|
1684
|
+
|
1685
|
+
LOW_METHODS = singleton_methods(false) - collect_method(:noop).map(&:intern) # :nodoc:
|
1686
|
+
module LowMethods # :nodoc: internal use only
|
1658
1687
|
private
|
1659
1688
|
def _do_nothing(*)end
|
1660
1689
|
::Bundler::FileUtils::LOW_METHODS.map {|name| alias_method name, :_do_nothing}
|
1661
1690
|
end
|
1662
1691
|
|
1663
|
-
METHODS = singleton_methods() - [:private_module_function,
|
1692
|
+
METHODS = singleton_methods() - [:private_module_function, # :nodoc:
|
1664
1693
|
:commands, :options, :have_option?, :options_of, :collect_method]
|
1665
1694
|
|
1666
1695
|
#
|
@@ -1670,8 +1699,6 @@ module Bundler::FileUtils
|
|
1670
1699
|
#
|
1671
1700
|
module Verbose
|
1672
1701
|
include Bundler::FileUtils
|
1673
|
-
@fileutils_output = $stderr
|
1674
|
-
@fileutils_label = ''
|
1675
1702
|
names = ::Bundler::FileUtils.collect_method(:verbose)
|
1676
1703
|
names.each do |name|
|
1677
1704
|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
@@ -1695,8 +1722,6 @@ module Bundler::FileUtils
|
|
1695
1722
|
module NoWrite
|
1696
1723
|
include Bundler::FileUtils
|
1697
1724
|
include LowMethods
|
1698
|
-
@fileutils_output = $stderr
|
1699
|
-
@fileutils_label = ''
|
1700
1725
|
names = ::Bundler::FileUtils.collect_method(:noop)
|
1701
1726
|
names.each do |name|
|
1702
1727
|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
@@ -1721,8 +1746,6 @@ module Bundler::FileUtils
|
|
1721
1746
|
module DryRun
|
1722
1747
|
include Bundler::FileUtils
|
1723
1748
|
include LowMethods
|
1724
|
-
@fileutils_output = $stderr
|
1725
|
-
@fileutils_label = ''
|
1726
1749
|
names = ::Bundler::FileUtils.collect_method(:noop)
|
1727
1750
|
names.each do |name|
|
1728
1751
|
module_eval(<<-EOS, __FILE__, __LINE__ + 1)
|