Class: Bonchi::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/bonchi/config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



7
8
9
10
11
12
13
# File 'lib/bonchi/config.rb', line 7

def initialize(path)
  data = YAML.load_file(path)
  @copy = Array(data["copy"])
  @ports = Array(data["ports"])
  @pre_setup = Array(data["pre_setup"])
  @setup = data["setup"] || "bin/setup"
end

Instance Attribute Details

#copyObject (readonly)

Returns the value of attribute copy.



5
6
7
# File 'lib/bonchi/config.rb', line 5

def copy
  @copy
end

#portsObject (readonly)

Returns the value of attribute ports.



5
6
7
# File 'lib/bonchi/config.rb', line 5

def ports
  @ports
end

#pre_setupObject (readonly)

Returns the value of attribute pre_setup.



5
6
7
# File 'lib/bonchi/config.rb', line 5

def pre_setup
  @pre_setup
end

#setupObject (readonly)

Returns the value of attribute setup.



5
6
7
# File 'lib/bonchi/config.rb', line 5

def setup
  @setup
end

Class Method Details

.from_main_worktreeObject



15
16
17
18
19
20
21
# File 'lib/bonchi/config.rb', line 15

def self.from_main_worktree
  main = Git.main_worktree
  path = File.join(main, ".worktree.yml")
  return nil unless File.exist?(path)

  new(path)
end