Class: LocalInfo

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

Instance Method Summary collapse

Constructor Details

#initialize(dev = TerminalWriter.new) ⇒ LocalInfo

Returns a new instance of LocalInfo.



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

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

Instance Method Details

#default_create(testpath) ⇒ Object



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

def default_create(testpath)
  set_default_data(testpath)
  create(testpath)
end

#read(filepath) ⇒ Object



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

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_create(testpath) ⇒ Object



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

def user_create(testpath)
  ask_data(testpath)
  create(testpath)
end