Class: RepoConfig

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

Overview

Create Teuton Repo config file

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ RepoConfig

Returns a new instance of RepoConfig.



12
13
14
15
16
17
18
19
# File 'lib/teuton-get/repo/repo_config.rb', line 12

def initialize(args)
  @reader = args[:config_reader]
  @data = @reader.read
  @dev = args[:progress_writer]

  @config_dirpath = args[:config_dirpath] || ""
  @config_filepath = File.join(@config_dirpath, Settings::CONFIGFILE)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



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

def data
  @data
end

Class Method Details

.defaultObject



21
22
23
24
25
26
27
28
29
# File 'lib/teuton-get/repo/repo_config.rb', line 21

def self.default
  config_filepath = Settings.get(:config_filepath)

  RepoConfig.new(
    config_reader: IniFileReader.new(config_filepath),
    progress_writer: TerminalWriter.new,
    config_dirpath: Settings.get(:config_dirpath)
  )
end

Instance Method Details

#createObject



31
32
33
34
35
# File 'lib/teuton-get/repo/repo_config.rb', line 31

def create
  @dev.writeln "\n==> Creating configuration files"
  create_dir
  create_ini_file
end

#show_list(options) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/teuton-get/repo/repo_config.rb', line 37

def show_list(options)
  if options["format"] == "json"
    show_json_list
  else
    show_default_list
  end
end