Module: EmberCli::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/ember_cli/helpers.rb

Instance Method Summary collapse

Instance Method Details

#current_environmentObject



18
19
20
# File 'lib/ember_cli/helpers.rb', line 18

def current_environment
  ENV.fetch("EMBER_ENV") { default_environment }
end

#which(cmd) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ember_cli/helpers.rb', line 5

def which(cmd)
  exts = ENV.fetch("PATHEXT", ";").split(";", -1).uniq

  ENV.fetch("PATH").split(File::PATH_SEPARATOR).each do |path|
    exts.each do |ext|
      exe = File.join(path, "#{cmd}#{ext}")
      return exe if File.executable?(exe) && !File.directory?(exe)
    end
  end

  nil
end