module Rake
extend Rake
task with a ‘set_non_standard_vars` method
extend Rake
task with a logger
Public Class Methods
cygwin?()
click to toggle source
# File lib/rake/helpers/rake.rb, line 52 def self.cygwin? RUBY_PLATFORM.downcase.include?('cygwin') end
quotepath(switch, path)
click to toggle source
# File lib/rake/helpers/rake.rb, line 40 def self.quotepath(switch, path) return ! path.to_s.empty? ? "#{switch}\"#{path.to_s}\"" : '' end
ruby18?()
click to toggle source
# File lib/rake/helpers/rake.rb, line 48 def self.ruby18? /^1\.8/.match(RUBY_VERSION) end
set_env_to_vars(vars_list, vars, envVarsEncoding, localEncoding)
click to toggle source
# File lib/rake/helpers/rake.rb, line 19 def self.set_env_to_vars(vars_list, vars, envVarsEncoding, localEncoding) vars_list.flatten.each do |v| value = ENV[v] if value value = value.dup # Env vars are in system encoding # On Windows/Cygwin only if value.respond_to?(:force_encoding) if Rake.application.windows? || Rake.cygwin? value.force_encoding(envVarsEncoding) value.encode!(localEncoding, envVarsEncoding) end elsif Rake.application.windows? require 'iconv' value = Iconv.iconv(localEncoding, envVarsEncoding, value)[0] end end vars[v.to_sym] = value end end
set_non_standard_vars()
click to toggle source
# File lib/rake/helpers/rake.rb, line 6 def self.set_non_standard_vars # convert tasks to vars # and remove them from the list of tasks Rake.application.top_level_tasks.delete_if do |task| # if task name is like <var.with.dot>=<value> if /^[^.=][^=]+=.*/.match(task) name, value = task.split('=', 2) ENV[name] = value true end end end
unquotepath(path)
click to toggle source
# File lib/rake/helpers/rake.rb, line 44 def self.unquotepath(path) return path.to_s.gsub(/^"|"$/, '') end