Class: BooticCli::FileRunner

Inherits:
Object
  • Object
show all
Includes:
Connectivity
Defined in:
lib/bootic_cli/file_runner.rb

Constant Summary

Constants included from Connectivity

Connectivity::DEFAULT_ENV

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, file_name) ⇒ FileRunner

Returns a new instance of FileRunner.



9
10
11
12
# File 'lib/bootic_cli/file_runner.rb', line 9

def initialize(root, file_name)
  @root = root
  @file_name = file_name
end

Class Method Details

.run(root, file_name) ⇒ Object



5
6
7
# File 'lib/bootic_cli/file_runner.rb', line 5

def self.run(root, file_name)
  new(root, file_name).run
end

Instance Method Details

#rootObject

#root is already defined in Connectivity but we want to pass a pre-initialized root to avoid having to re-fetch root from API



21
22
23
# File 'lib/bootic_cli/file_runner.rb', line 21

def root
  @root
end

#runObject



14
15
16
# File 'lib/bootic_cli/file_runner.rb', line 14

def run
  self.instance_eval File.read(@file_name), @file_name
end