class Early::Travis
Public Class Methods
from_config(path)
click to toggle source
# File lib/early/travis.rb, line 6 def self.from_config(path) path = Pathname.new(path.to_s).expand_path config = YAML.load_file(path) envs = Array(config.dig('env', 'global')).map do |line| line.split('=', 2) end new(envs) end
new(envs)
click to toggle source
# File lib/early/travis.rb, line 17 def initialize(envs) @envs = envs end
Public Instance Methods
apply(except: nil)
click to toggle source
# File lib/early/travis.rb, line 21 def apply(except: nil) except = Array(except).map(&:to_s) @envs.each do |name, value| next if except.include?(name) ENV[name] ||= value end end