Class: LocalInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/teuton-get/repo/local_info.rb

Overview

Create metadata for local user teuton test

Instance Method Summary collapse

Constructor Details

#initialize(dev = TerminalWriter.new) ⇒ LocalInfo

Returns a new instance of LocalInfo.



9
10
11
12
# File 'lib/teuton-get/repo/local_info.rb', line 9

def initialize(dev = TerminalWriter.new)
  @dev = dev
  @data = {}
end

Instance Method Details

#default_created(testpath) ⇒ Object



14
15
16
17
# File 'lib/teuton-get/repo/local_info.rb', line 14

def default_created(testpath)
  set_default_data(testpath)
  create(testpath)
end

#read(filepath) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/teuton-get/repo/local_info.rb', line 24

def read(filepath)
  dirpath = File.dirname(filepath)
  @dev.writeln "    Reading #{dirpath}"
  data = YamlReader.new(filepath).read

  filepaths = Dir.glob("#{dirpath}/**/*.*")
  files = filepaths.map { |i| i[dirpath.size + 1, i.size] }
  data["files"] = files
  data
end

#user_created(testpath) ⇒ Object



19
20
21
22
# File 'lib/teuton-get/repo/local_info.rb', line 19

def user_created(testpath)
  ask_data(testpath)
  create(testpath)
end