Module: FileUtils
- Defined in:
- lib/scm_workspace/core_ext/fileutils.rb
Defined Under Namespace
Classes: LoggerAdapter
Class Method Summary collapse
-
.cd(dir, options = {}, &block) ⇒ Object
Monkey patch original source code is here: github.com/ruby/ruby/blob/v2_0_0_247/lib/fileutils.rb#L122.
-
.chdir ⇒ Object
Monkey patch original source code is here: github.com/ruby/ruby/blob/v2_0_0_247/lib/fileutils.rb#L122.
- .with_logger(logger, level = :info) ⇒ Object
Class Method Details
.cd(dir, options = {}, &block) ⇒ Object
Monkey patch original source code is here:
https://github.com/ruby/ruby/blob/v2_0_0_247/lib/fileutils.rb#L122
9 10 11 12 13 14 15 |
# File 'lib/scm_workspace/core_ext/fileutils.rb', line 9 def cd(dir, = {}, &block) # :yield: dir , OPT_TABLE['cd'] "cd #{dir}" if [:verbose] r = Dir.chdir(dir, &block) 'cd -' if [:verbose] and block r end |
.chdir ⇒ Object
Monkey patch original source code is here:
https://github.com/ruby/ruby/blob/v2_0_0_247/lib/fileutils.rb#L122
18 19 20 21 22 23 24 |
# File 'lib/scm_workspace/core_ext/fileutils.rb', line 18 def cd(dir, = {}, &block) # :yield: dir , OPT_TABLE['cd'] "cd #{dir}" if [:verbose] r = Dir.chdir(dir, &block) 'cd -' if [:verbose] and block r end |
.with_logger(logger, level = :info) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/scm_workspace/core_ext/fileutils.rb', line 22 def with_logger(logger, level = :info) output = LoggerAdapter.new(logger, level) Module.new do include FileUtils @fileutils_output = output @fileutils_label = '' ::FileUtils.collect_method(:verbose).each do |name| module_eval(<<-EOS, __FILE__, __LINE__ + 1) def #{name}(*args) super(*fu_update_option(args, :verbose => true)) end private :#{name} EOS end extend self class << self ::FileUtils::METHODS.each do |m| public m end end end end |