teuton-get 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dec6728e4afe5e3d3273d1391d5c968d3f3ad37f1c742c973e42ed990116518c
4
- data.tar.gz: 9a188d0781561d45e7e1aa6c9d722cfada8175e77d0fe4f374e897daecdd0f90
3
+ metadata.gz: 514a1e09803689eda7e6475c56b91ee42cef303221138beb6170fb0529dc359b
4
+ data.tar.gz: 0071f6c6009a2910afcb419d0a3b8d10234b0aa66c45368f7a524756880e9093
5
5
  SHA512:
6
- metadata.gz: 462dbca5915bbb736940152eb7d36f00892889d9a69401b3cd9152b082f8211a055ad5c665e466ce1fde703b5cf1bcaf379d8d58229692c246697b31a26b6fb5
7
- data.tar.gz: 3e9ffcd01859e9102aaf385a0eab14540cbc8f406a3f722a56b09de0fd9975544e4fef89d0786a44860f30ca7a3be2c373d59ad3f01f5e66187e79f8fb9763ee
6
+ metadata.gz: 1cb61d8605da22e792bd4bf6a153c0c5f39b567727cc4c892dcba311e5d2a50449d75ab7a246886e8f7027adcaa957ed04b62a11437c28867033be6ec2f22147
7
+ data.tar.gz: a8586c74954443d00ce1def318568f46c79c5fe44ce3d69b0eb36d310cafbe092625da6666bc169f758309107997dcdcd4ebcf9cd7188ff25c3fcb7d7c3fe16f
data/README.md CHANGED
@@ -15,8 +15,31 @@
15
15
 
16
16
  * At first, create config file with `teutonget init`.
17
17
  * Then, search tests with `teutonget search FILTER`. Example: `teutonget search linux`, will show a list with "linux" related tests.
18
+
19
+
18
20
  * `teutonget download REPONAME:TESTPATH`
19
21
 
22
+ ## Example
23
+
24
+ ```bash
25
+ ❯ teutonget search conf
26
+ (x3) teuton.en:systems.1/01-windows-conf
27
+ (x3) teuton.en:systems.1/02-opensuse-conf
28
+ (x3) teuton.en:systems.1/03-debian-conf
29
+ (x3) teuton.en:systems.1/04-winserver-conf
30
+ (x2) teuton.en:systems.2/01-install-w10-vbox
31
+ (x2) teuton.en:systems.2/02-debian-basic-configuration
32
+
33
+ ❯ teutonget download teuton.en:systems.1/02-opensuse-conf
34
+ ==> Downloading systems.1/02-opensuse-conf from teuton.en...
35
+ ==> File: README.md
36
+ ==> File: config.yaml
37
+ ==> File: network.rb
38
+ ==> File: opensuse.rb
39
+ ==> File: start.rb
40
+ ==> File: tt-info.yaml
41
+ ```
42
+
20
43
  # Contact
21
44
 
22
45
  * **Email**: `teuton.software@protonmail.com`
@@ -0,0 +1,23 @@
1
+ require "colorize"
2
+
3
+ module TeutonGet
4
+ module Format
5
+ COLORS = [:light_blue, :light_magenta, :light_cyan, :red, :green, :yellow]
6
+
7
+ def self.colorize(text = "", option = nil)
8
+ return text if option.nil?
9
+ color = if option.instance_of? Integer
10
+ if option < COLORS.size
11
+ COLORS[option]
12
+ else
13
+ COLORS[option - COLOR.size]
14
+ end
15
+ elsif option.instance_of? Symbol
16
+ option
17
+ else
18
+ :silver
19
+ end
20
+ text.colorize(color)
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,6 @@
1
1
  require "fileutils"
2
2
  require_relative "../application"
3
+ require_relative "../format"
3
4
  require_relative "../reader/inifile_reader"
4
5
  require_relative "../writer/terminal_writer"
5
6
 
@@ -36,11 +37,13 @@ class RepoConfig
36
37
  rows << ["E", "NAME", "DESCRIPTION"]
37
38
  rows << :separator
38
39
 
40
+ index = 0
39
41
  @data.each_pair do |key, value|
40
42
  enable = "\u{2714}"
41
43
  enable = " " unless value["enable"]
42
44
  description = value["description"] || "?"
43
- rows << [enable, key, description]
45
+ rows << [enable, TeutonGet::Format.colorize(key, index), description]
46
+ index += 1
44
47
  end
45
48
  @dev.writeln "Repository list"
46
49
  @dev.write_table(rows)
@@ -1,6 +1,8 @@
1
1
  require_relative "../application"
2
2
 
3
3
  class Result
4
+ @@repoindex = Set.new
5
+
4
6
  attr_accessor :score
5
7
  attr_reader :reponame
6
8
  attr_reader :testname
@@ -9,6 +11,7 @@ class Result
9
11
  @score = args[:score] || 0
10
12
  @reponame = args[:reponame] || "???"
11
13
  @testname = args[:testname] || "???"
14
+ @@repoindex << @reponame
12
15
  end
13
16
 
14
17
  def id
@@ -16,6 +19,15 @@ class Result
16
19
  end
17
20
 
18
21
  def to_h
19
- {score: @score, id: id, reponame: @reponame, testname: @testname}
22
+ {
23
+ score: @score,
24
+ id: id, reponame: @reponame,
25
+ testname: @testname,
26
+ repoindex: repoindex
27
+ }
28
+ end
29
+
30
+ def repoindex
31
+ @@repoindex.to_a.index(@reponame)
20
32
  end
21
33
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "application"
2
+ require_relative "format"
2
3
  require_relative "reader/yaml_reader"
3
4
  require_relative "repo/repo_data"
4
5
  require_relative "searcher/result"
@@ -30,10 +31,11 @@ class Searcher
30
31
  search_inside(reponame_filter, filters)
31
32
  end
32
33
 
33
- def show(result)
34
+ def show_result
34
35
  @results.each do |i|
35
36
  @dev.write "(x#{i[:score]}) ", color: :white
36
- @dev.writeln "#{i[:reponame]}#{Application::SEPARATOR}#{i[:testname]}"
37
+ reponame = TeutonGet::Format.colorize(i[:reponame], i[:repoindex])
38
+ @dev.writeln "#{reponame}#{Application::SEPARATOR}#{i[:testname]}"
37
39
  end
38
40
  end
39
41
 
@@ -1,6 +1,6 @@
1
1
  module Version
2
2
  NAME = "teuton-get"
3
3
  EXECUTABLE = "teutonget"
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  HOMEPAGE = "https://github.com/teuton-software/#{NAME}"
6
6
  end
@@ -1,11 +1,10 @@
1
- require "colorize"
2
1
  require "tty-table"
3
2
  require_relative "writer"
3
+ require_relative "../format"
4
4
 
5
5
  class TerminalWriter < Writer
6
6
  def write(text = "", args = {})
7
- color = args[:color] || :silver
8
- print text.colorize(color)
7
+ print TeutonGet::Format.colorize(text, args[:color])
9
8
  end
10
9
 
11
10
  def writeln(text = "", args = {})
data/lib/teuton-get.rb CHANGED
@@ -35,8 +35,8 @@ module TeutonGet
35
35
 
36
36
  def self.search(filter)
37
37
  searcher = Searcher.new_by_default
38
- result = searcher.get(filter)
39
- searcher.show(result)
38
+ searcher.get(filter)
39
+ searcher.show_result
40
40
  end
41
41
 
42
42
  def self.download(test_id)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teuton-get
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-29 00:00:00.000000000 Z
11
+ date: 2022-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
@@ -107,6 +107,7 @@ files:
107
107
  - lib/teuton-get/downloader.rb
108
108
  - lib/teuton-get/files/repos.ini
109
109
  - lib/teuton-get/files/tt-info.yaml
110
+ - lib/teuton-get/format.rb
110
111
  - lib/teuton-get/reader/inifile_reader.rb
111
112
  - lib/teuton-get/reader/linux_environment_reader.rb
112
113
  - lib/teuton-get/reader/reader.rb