Sha256: 4fad9b8cbb54c564cc5592581cfc04d9d0d56c0c646649457a9ff86ac03d21e1

Contents?: true

Size: 653 Bytes

Versions: 5

Compression:

Stored size: 653 Bytes

Contents

# borrowed from heroku

module Proviso
  module Helpers
    PROVISO_PATH = '.proviso'
    CONFIG_FILE = 'proviso.yml'
    
    def home_directory
      running_on_windows? ? ENV['USERPROFILE'] : ENV['HOME']
    end

    def running_on_windows?
      RUBY_PLATFORM =~ /mswin32|mingw32/
    end

    def running_on_a_mac?
      RUBY_PLATFORM =~ /-darwin\d/
    end
    
    def yaml_file
      File.join(home_directory, PROVISO_PATH, CONFIG_FILE)
    end
    
  end
end

unless String.method_defined?(:shellescape)
  class String
    def shellescape
      empty? ? "''" : gsub(/([^A-Za-z0-9_\-.,:\/@\n])/n, '\\\\\\1').gsub(/\n/, "'\n'")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
proviso-0.2.0 lib/proviso/helpers.rb
proviso-0.2.0.beta4 lib/proviso/helpers.rb
proviso-0.2.0.beta3 lib/proviso/helpers.rb
proviso-0.2.0.beta2 lib/proviso/helpers.rb
proviso-0.2.0.beta1 lib/proviso/helpers.rb