Sha256: 460d798e17f1af1dcc8159938d2e6fa9c6964436fd11a00cf074852919f383ed

Contents?: true

Size: 467 Bytes

Versions: 6

Compression:

Stored size: 467 Bytes

Contents

module Chester
  module Helpers
    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
  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

6 entries across 6 versions & 1 rubygems

Version Path
chester-0.4.0 lib/chester/helpers.rb
chester-0.3.1 lib/chester/helpers.rb
chester-0.2.0 lib/chester/helpers.rb
chester-0.1.2 lib/chester/helpers.rb
chester-0.1.1 lib/chester/helpers.rb
chester-0.1.0 lib/chester/helpers.rb