Class: Early::Travis
- Inherits:
-
Object
- Object
- Early::Travis
- Defined in:
- lib/early/travis.rb
Class Method Summary collapse
Instance Method Summary collapse
- #apply(except: nil) ⇒ Object
-
#initialize(envs) ⇒ Travis
constructor
A new instance of Travis.
Constructor Details
#initialize(envs) ⇒ Travis
Returns a new instance of Travis.
17 18 19 |
# File 'lib/early/travis.rb', line 17 def initialize(envs) @envs = envs end |
Class Method Details
.from_config(path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/early/travis.rb', line 6 def self.from_config(path) path = Pathname.new(path.to_s). config = YAML.load_file(path) envs = Array(config.dig('env', 'global')).map do |line| line.split('=', 2) end new(envs) end |
Instance Method Details
#apply(except: nil) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# 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 |