Module: Rexer::Definition::Lock

Defined in:
lib/rexer/definition/lock.rb

Defined Under Namespace

Classes: Dsl

Class Method Summary collapse

Class Method Details

.create_file(env) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/rexer/definition/lock.rb', line 17

def self.create_file(env)
  dsl = "    lock version: \"\#{Rexer::VERSION}\", env: :\#{env}\n\n    \#{Definition.file.read}\n  DSL\n  file.write(dsl)\nend\n"

.fileObject



4
5
6
# File 'lib/rexer/definition/lock.rb', line 4

def self.file
  @file ||= Definition.dir.join(Rexer.definition_lock_file)
end

.load_dataObject



8
9
10
11
12
13
14
15
# File 'lib/rexer/definition/lock.rb', line 8

def self.load_data
  return nil unless file.exist?

  dsl = Dsl.new.tap { _1.instance_eval(file.read) }
  dsl.to_data
rescue DefinitionFileNotFound
  nil
end