File: setenv.rb

package info (click to toggle)
ruby-grib 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 384 kB
  • ctags: 124
  • sloc: ruby: 708; ansic: 708; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 522 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
def_path = File.join(File.expand_path(File.dirname(__FILE__)),"definitions")
if File.exist?(def_path)
  env_name = 'GRIB_DEFINITION_PATH'
  if gdp = ENV[env_name]
    ENV[env_name] = "#{gdp}:#{def_path}"
  else
    begin
      path = `codes_info -d`.strip
    rescue
      $stderr.print <<-EOM
The 'grib_info' command cannot be found.
If you have the command, please set the PATH environment variable.
      EOM
      exit(-1)
    end
    if File.exist?(path)
      ENV[env_name] = "#{path}:#{def_path}"
    end
  end
end