teuton-get 0.1.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/bin/teuton-get +3 -0
- data/lib/teuton-get/downloader.rb +1 -1
- data/lib/teuton-get/format.rb +23 -0
- data/lib/teuton-get/repo/local_info.rb +5 -1
- data/lib/teuton-get/repo/repo_config.rb +4 -1
- data/lib/teuton-get/repo/repo_data.rb +1 -1
- data/lib/teuton-get/searcher/result.rb +13 -1
- data/lib/teuton-get/searcher.rb +4 -2
- data/lib/teuton-get/version.rb +1 -1
- data/lib/teuton-get/writer/file_writer.rb +3 -0
- data/lib/teuton-get/writer/terminal_writer.rb +2 -3
- data/lib/teuton-get.rb +2 -2
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9a7d30a57e1d17315bdc1a70eca4bb76e397c901c46cb5a5709fd72802945ea
|
4
|
+
data.tar.gz: 12d9f68bfbd6a1f4c3107acb4059527b829def841e2049753f4ed77e3c70c362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b5a55be18579de050724e9cc48dfdd1aebd0e87108b3810d2a785034b94de87c392fdff0f85ba87858227bda8f604e77173193bd65b5efe9867aecf02e31011
|
7
|
+
data.tar.gz: 23a880ed0a732db0891947a828a12188a034cc4b6f9611b30748916751e7104f530eb77b61b95a492bc2db574a46b5a59e97ca7dcbf48354573e8adb25592909
|
data/README.md
CHANGED
@@ -15,8 +15,20 @@
|
|
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
|
+
* Search and download test:
|
25
|
+
|
26
|
+
![](docs/images/teutonget-download.png)
|
27
|
+
|
28
|
+
* Refresh repos and show test details:
|
29
|
+
|
30
|
+
![](docs/images/teutonget-info.png)
|
31
|
+
|
20
32
|
# Contact
|
21
33
|
|
22
34
|
* **Email**: `teuton.software@protonmail.com`
|
data/bin/teuton-get
ADDED
@@ -56,7 +56,7 @@ class Downloader
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def download(reponame, url, path, files)
|
59
|
-
@dev.writeln "==> Downloading #{path} from #{reponame}...", color: :light_yellow
|
59
|
+
@dev.writeln "==> Downloading '#{path}' from repo '#{reponame}'...", color: :light_yellow
|
60
60
|
localpath = path.tr("/", "_")
|
61
61
|
FileUtils.mkdir(localpath) unless File.exist? localpath
|
62
62
|
files.each do |filename|
|
@@ -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
|
@@ -47,7 +47,7 @@ class LocalInfo
|
|
47
47
|
@data[:name] = prompt.ask("name?", default: @data[:name])
|
48
48
|
@data[:author] = prompt.ask("author?", default: @data[:author])
|
49
49
|
@data[:date] = prompt.ask("date?", default: @data[:date])
|
50
|
-
@data[:desc] = prompt.ask("desc?", default: @data[:desc])
|
50
|
+
@data[:desc] = sanityze(prompt.ask("desc?", default: @data[:desc]))
|
51
51
|
input = prompt.ask("tags?", default: @data[:tags].join(","))
|
52
52
|
@data[:tags] = input.split(",")
|
53
53
|
end
|
@@ -68,4 +68,8 @@ class LocalInfo
|
|
68
68
|
|
69
69
|
true
|
70
70
|
end
|
71
|
+
|
72
|
+
def sanityze(text)
|
73
|
+
text.tr(":", " ")
|
74
|
+
end
|
71
75
|
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
|
-
{
|
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
|
data/lib/teuton-get/searcher.rb
CHANGED
@@ -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
|
34
|
+
def show_result
|
34
35
|
@results.each do |i|
|
35
36
|
@dev.write "(x#{i[:score]}) ", color: :white
|
36
|
-
|
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
|
|
data/lib/teuton-get/version.rb
CHANGED
@@ -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
|
-
|
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
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
|
4
|
+
version: 0.2.1
|
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-
|
11
|
+
date: 2022-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|
@@ -84,17 +84,19 @@ description: " Find and download Teuton Test.\n"
|
|
84
84
|
email: teuton.software@protonmail.com
|
85
85
|
executables:
|
86
86
|
- teutonget
|
87
|
+
- teuton-get
|
87
88
|
extensions: []
|
88
89
|
extra_rdoc_files:
|
89
90
|
- README.md
|
90
91
|
- LICENSE
|
91
92
|
- docs/commands.md
|
92
93
|
- docs/get.md
|
93
|
-
- docs/settings.md
|
94
94
|
- docs/repo.md
|
95
|
+
- docs/settings.md
|
95
96
|
files:
|
96
97
|
- LICENSE
|
97
98
|
- README.md
|
99
|
+
- bin/teuton-get
|
98
100
|
- bin/teutonget
|
99
101
|
- docs/commands.md
|
100
102
|
- docs/get.md
|
@@ -107,6 +109,7 @@ files:
|
|
107
109
|
- lib/teuton-get/downloader.rb
|
108
110
|
- lib/teuton-get/files/repos.ini
|
109
111
|
- lib/teuton-get/files/tt-info.yaml
|
112
|
+
- lib/teuton-get/format.rb
|
110
113
|
- lib/teuton-get/reader/inifile_reader.rb
|
111
114
|
- lib/teuton-get/reader/linux_environment_reader.rb
|
112
115
|
- lib/teuton-get/reader/reader.rb
|
@@ -142,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
145
|
- !ruby/object:Gem::Version
|
143
146
|
version: '0'
|
144
147
|
requirements: []
|
145
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.3.3
|
146
149
|
signing_key:
|
147
150
|
specification_version: 4
|
148
151
|
summary: TeutonGet (Teuton Software)
|