Sha256: 2b2b4f47f91038bd568bf7a6e145100d638182a2f64b310ead6cadf8ac3ab5bc

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

# -*- encoding: utf-8 -*-

require 'rake'

module Albacore
  # module methods for handling paths
  module Paths
    class << self
      def separator
        ::Rake::Win32.windows? ? '\\' : '/'
      end

      # normalize the slashes of the path to what the operating system prefers
      def normalise_slashes path
        raise ArgumentError, "path is nil" if path.nil?
        ::Rake::Win32.windows? ? path.gsub('/', '\\') : path.gsub('\\', '/')
      end

      def make_command executable, parameters
        raise ArgumentError, "executable is nil" if executable.nil?
        params = parameters.collect{|p| '"' + p + '"'}.join ' '
        exe = normalise_slashes executable
        %Q{"#{exe}" #{params}}
      end

      def normalise executable, parameters
        raise ArgumentError, "executable is nil" if executable.nil?
        parameters = parameters.collect{ |p| (p === String) ? p : p.to_s }
        exe = normalise_slashes executable
        ["#{exe}", parameters]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
albacore-2.0.0.rc.6 lib/albacore/paths.rb
albacore-2.0.0.rc.5 lib/albacore/paths.rb
albacore-2.0.0.rc.4 lib/albacore/paths.rb
albacore-2.0.0.rc.3 lib/albacore/paths.rb
albacore-2.0.0.rc.2 lib/albacore/paths.rb
albacore-2.0.0.rc.1 lib/albacore/paths.rb