0
Config::CONFIG['host_os'] =~ /windows|cygwin|bccwin|cygwin|djgpp|mingw|mswin|wince/i
0
- # Finds and returns path to executable. Consults PATH environment variable.
0
- # Returns nil if executable not found.
0
- path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| path.gsub('\\', '/') }.map { |path| "#{path}/#{name}.{exe,bat,com}" }
0
- path = ENV['PATH'].split(File::PATH_SEPARATOR).map { |path| "#{path}/#{name}" }
0
- FileList[path].existing.first
0
# Runs Ruby with these command line arguments. The last argument may be a hash,
0
# supporting the following keys:
0
# :command -- Runs the specified script (e.g., :command=>'gem')
0
- # install_gems(*dependencies)
0
- def install_gems(*gems)
0
- installed = Gem::SourceIndex.from_installed_gems
0
- dependencies = gems.map do |gem|
0
- when Gem::Dependency then gem
0
- when Array then Gem::Dependency.new(*gem)
0
- when String then Gem::Dependency.new(gem, '> 0')
0
- else raise "Invalid gem dependency: #{gem.inspect}"
0
- dependencies.select { |dep| installed.search(dep.name, dep.version_requirements).empty? }.each do |dep|
0
- puts "Installing #{dep} ..."
0
- if win_os? # run the installer directly
0
- require 'rubygems/dependency_installer'
0
- Gem::DependencyInstaller.new(dep.name, dep.version_requirements).install
0
- require 'rubygems/remote_installer'
0
- Gem::RemoteInstaller.new.install(dep.name, dep.version_requirements)
0
- ruby 'install', dep.name, '-v', dep.version_requirements.to_s.inspect, :command=>'gem', :sudo=>true
0
# Just like File.expand_path, but for windows systems it
0
# capitalizes the drive name and ensures backslashes are used
0
def normalize_path(path, *dirs)
0
to, from = File.expand_path(to.to_s, "/"), File.expand_path(from.to_s, "/")
0
Pathname.new(to).relative_path_from(Pathname.new(from)).to_s
0
+ # Generally speaking, it's not a good idea to operate on dot files (files starting with dot).
0
+ # These are considered invisible files (.svn, .hg, .irbrc, etc). Dir.glob/FileList ignore them
0
+ # on purpose. There are few cases where we do have to work with them (filter, zip), a better
0
+ # solution is welcome, maybe being more explicit with include. For now, this will do.
0
+ def recursive_with_dot_files(*dirs)
0
+ FileList[dirs.map { |dir| File.join(dir, '/**/{*,.*}') }].reject { |file| File.basename(file) =~ /^[.]{1,2}$/ }
0
# Borrowed from Ruby 1.9.
0
+ task_args = TaskArguments.new(arg_names, args)
0
+ invoke_with_call_chain(task_args, Thread.current[:rake_chain] || InvocationChain::EMPTY)
0
+ def invoke_with_call_chain(task_args, invocation_chain)
0
+ new_chain = InvocationChain.append(self, invocation_chain)
0
+ if application.options.trace
0
+ puts "** Invoke #{name} #{format_trace_flags}"
0
+ return if @already_invoked
0
+ @already_invoked = true
0
+ invoke_prerequisites(task_args, new_chain)
0
+ old_chain, Thread.current[:rake_chain] = Thread.current[:rake_chain], new_chain
0
+ execute(task_args) if needed?
0
+ Thread.current[:rake_chain] = nil