Class: LocalRepo
- Inherits:
-
Object
- Object
- LocalRepo
- Defined in:
- lib/teuton-get/repo/local_repo.rb
Overview
Create metadata for local user teuton repository
Class Method Summary collapse
Instance Method Summary collapse
- #create(dirpath) ⇒ Object
-
#initialize(args) ⇒ LocalRepo
constructor
A new instance of LocalRepo.
Constructor Details
#initialize(args) ⇒ LocalRepo
Returns a new instance of LocalRepo.
7 8 9 10 |
# File 'lib/teuton-get/repo/local_repo.rb', line 7 def initialize(args) @repoindex_writer = args[:repoindex_writer] @dev = args[:progress_writer] end |
Class Method Details
.default ⇒ Object
12 13 14 15 16 17 |
# File 'lib/teuton-get/repo/local_repo.rb', line 12 def self.default LocalRepo.new( repoindex_writer: FileWriter.new, progress_writer: TerminalWriter.new ) end |
Instance Method Details
#create(dirpath) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/teuton-get/repo/local_repo.rb', line 19 def create(dirpath) infofilename = Settings::INFOFILENAME infofiles = Dir.glob(File.join(dirpath, "**", infofilename)) return if infofiles.size.zero? @dev.writeln "\n==> Creating repository", color: :light_yellow data = read_files(infofiles) filepath = File.join(dirpath, Settings::INDEXFILENAME) @repoindex_writer.open(filepath) @repoindex_writer.write data.to_yaml @repoindex_writer.close @dev.writeln " Created #{filepath} (#{data.keys.size} tests)", color: :white true end |