Module: Drakkon::PlatformCompat

Included in:
Build, Run
Defined in:
lib/drakkon/lib/platform_compat.rb

Overview

Helper to provide platform compatibility

Instance Method Summary collapse

Instance Method Details

#build_envObject



10
11
12
# File 'lib/drakkon/lib/platform_compat.rb', line 10

def build_env
  run_env # not sure if these will ever be different
end

#path_dividerObject



18
19
20
21
22
23
24
25
# File 'lib/drakkon/lib/platform_compat.rb', line 18

def path_divider
  if windows?
    ';'
  # Linux uses ':' (same with mac/unix?)
  else
    ':'
  end
end

#run_envObject



4
5
6
7
8
# File 'lib/drakkon/lib/platform_compat.rb', line 4

def run_env
  {
    'PATH' => "#{version_dir}#{path_divider}#{ENV.fetch('PATH', nil)}"
  }
end

#windows?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/drakkon/lib/platform_compat.rb', line 14

def windows?
  (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end