teuton-get 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -22
- data/bin/teuton-get +3 -0
- data/docs/get.md +38 -10
- data/docs/repo.md +28 -5
- data/lib/teuton-get/downloader.rb +1 -1
- data/lib/teuton-get/files/repos.ini +2 -0
- data/lib/teuton-get/repo/local_info.rb +6 -1
- data/lib/teuton-get/repo/local_repo.rb +1 -0
- data/lib/teuton-get/repo/repo_config.rb +9 -8
- data/lib/teuton-get/repo/repo_data.rb +9 -3
- data/lib/teuton-get/searcher.rb +1 -1
- data/lib/teuton-get/{format.rb → utils/format.rb} +0 -0
- 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 +1 -1
- data/lib/teuton-get.rb +9 -4
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbdff5b1a781df1aeb1ddb23fc43b504787f0a43a255d44e72fcea0789e92f99
|
4
|
+
data.tar.gz: f557290df95c13818dcfce2d79756cead6c757ed320261a046a7cff0c5a8b955
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3745b13fb5ae095f5c1b87c39ac9471795ee39dff9f844a96012ce4ac613971237f122504828f6cfd21189394545acd22fa452187b28daf72f2a70abc116cd16
|
7
|
+
data.tar.gz: 17448758d158b88b1370b45dffe0bc7310c2e5c3efd8ecff7a90b35b4358a729c1857e289dca68758be2d47c6a27e4fa6f948dc99e7597005dd06aca763682f7
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/teuton-get.svg)](https://badge.fury.io/rb/teuton-get)
|
1
2
|
|
2
3
|
# Teuton-Get
|
3
4
|
|
@@ -13,32 +14,20 @@
|
|
13
14
|
|
14
15
|
# Use
|
15
16
|
|
16
|
-
|
17
|
-
|
17
|
+
1. `teutonget init`, at first, create config file.
|
18
|
+
1. `teutonget search FILTER`. then, search tests. Example: `teutonget search linux`, will show a list with "linux" related tests.
|
19
|
+
1. `teutonget download REPONAME:TESTPATH`, download test files.
|
18
20
|
|
21
|
+
## Example
|
19
22
|
|
20
|
-
*
|
23
|
+
* Search test and show details:
|
21
24
|
|
22
|
-
|
25
|
+
![](docs/images/teutonget-info.png)
|
26
|
+
|
27
|
+
* Download test:
|
28
|
+
|
29
|
+
![](docs/images/teutonget-download.png)
|
23
30
|
|
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
31
|
|
43
32
|
# Contact
|
44
33
|
|
data/bin/teuton-get
ADDED
data/docs/get.md
CHANGED
@@ -2,23 +2,51 @@
|
|
2
2
|
|
3
3
|
# Get
|
4
4
|
|
5
|
-
Find and download local or remote files.
|
5
|
+
Find and download local or remote test files.
|
6
6
|
|
7
|
-
|
7
|
+
1. [Search](#1-search)
|
8
|
+
2. [Info](#2-info)
|
9
|
+
3. [Download](#3-download)
|
8
10
|
|
9
|
-
|
11
|
+
## 1. Search
|
10
12
|
|
11
|
-
|
13
|
+
At first we need to locate the test according to some criterios.
|
14
|
+
|
15
|
+
```
|
16
|
+
teutonget search FILTER
|
17
|
+
```
|
18
|
+
|
19
|
+
| Command | Description |
|
20
|
+
| --------------------- | ----------- |
|
21
|
+
| teutonget search TEXT | Find test that contains TEXT |
|
22
|
+
| teutonget search :TEXT | |
|
23
|
+
| teutonget search ALL:TEXT | |
|
24
|
+
| teutonget search TEXT1,TEXT2 | Find test that contains TEXT1 or TEXT2 |
|
25
|
+
| teutonget search REPONAME:TEXT | Find test from REPONAME, that contains TEXT f|
|
26
|
+
| teutonget search REPONAME:ALL | Find all test from REPONAME |
|
12
27
|
|
13
28
|
Example:
|
14
29
|
|
15
30
|
```
|
16
|
-
❯ teutonget
|
17
|
-
(
|
18
|
-
(
|
31
|
+
❯ teutonget se window
|
32
|
+
(x3) teuton.en:systems.1/01-windows-conf
|
33
|
+
(x1) teuton.en:systems.1/04-winserver-conf
|
34
|
+
(x1) teuton.en:systems.2/01-install-w10-vbox
|
35
|
+
|
36
|
+
```
|
37
|
+
|
38
|
+
As a result we have a list of tests ordered from highest to lowest value according to the search requirement. In this example, the test with value x3 has greater weight than x1 and therefore appears recommended in the first position.
|
39
|
+
|
40
|
+
Ejample:
|
19
41
|
```
|
42
|
+
❯ teutonget se script,fvarrui
|
43
|
+
(x6) teuton.es:sistemas.3/scripting/usermin
|
44
|
+
(x1) teuton.en:systems.2/01-install-w10-vbox
|
45
|
+
```
|
46
|
+
|
47
|
+
In this example, the filter is form by multiple words separated by commas. As result, will be shown tests that contain word 1 or word 2, or both. And appear in order from highest to lowest according to the number of times these words appear in the test metadata.
|
20
48
|
|
21
|
-
## Info
|
49
|
+
## 2. Info
|
22
50
|
|
23
51
|
Show info about test. Example:
|
24
52
|
```
|
@@ -32,9 +60,9 @@ tags : Debian, configuration
|
|
32
60
|
files : README.md, config.yaml, debian.rb, network.rb, start.rb
|
33
61
|
```
|
34
62
|
|
35
|
-
## Download
|
63
|
+
## 3. Download
|
36
64
|
|
37
|
-
Download test by TESTID. Example:
|
65
|
+
Download teuton test files identified by TESTID. Example:
|
38
66
|
|
39
67
|
```
|
40
68
|
❯ teutonget download teuton.en:systems.1/03-debian-conf
|
data/docs/repo.md
CHANGED
@@ -4,7 +4,12 @@
|
|
4
4
|
|
5
5
|
Manage repositories: configure and creation.
|
6
6
|
|
7
|
-
|
7
|
+
1. Create info
|
8
|
+
2. Create repository
|
9
|
+
3. Configure remote repository
|
10
|
+
4. Configure local repository
|
11
|
+
|
12
|
+
## 1. Create info
|
8
13
|
|
9
14
|
Teuton test files are located into remote machines. Every Teuton test requires
|
10
15
|
a special info file that acts as manifest or test metadata.
|
@@ -23,11 +28,11 @@ desc? Practice basic commands into Debian host.
|
|
23
28
|
tags? practice,basic,command,debian,host
|
24
29
|
```
|
25
30
|
|
26
|
-
Every Teuton test
|
31
|
+
Every downdable Teuton test requires metadata file. Test info file called `tt-info.yaml`.
|
27
32
|
|
28
|
-
## Create repository
|
33
|
+
## 2. Create repository
|
29
34
|
|
30
|
-
|
35
|
+
All tests metadata is summarized into repo metadata. Repo info file called `tt-repo-yaml`.
|
31
36
|
|
32
37
|
* Go to your remote repository server host.
|
33
38
|
* Move to your repository root directory.
|
@@ -48,7 +53,7 @@ Example:
|
|
48
53
|
Created file ./tt-repo.yaml with 7 tests.
|
49
54
|
```
|
50
55
|
|
51
|
-
## Configure remote repository
|
56
|
+
## 3. Configure remote repository
|
52
57
|
|
53
58
|
Finaly we have to configure the new remote repo.
|
54
59
|
|
@@ -66,3 +71,21 @@ enable = true
|
|
66
71
|
```
|
67
72
|
|
68
73
|
* Run `teutonget repos` to check configuration.
|
74
|
+
|
75
|
+
## 4. Configure local repository
|
76
|
+
|
77
|
+
The usual thing will be to have remote repositories from where to download the tests. This process requires a network connection between our local machine and the remote repository.
|
78
|
+
|
79
|
+
But it is possible to have a repository on our local machine and not use the network for test downloads.
|
80
|
+
|
81
|
+
To do this we will create the repository on our local machine as indicated above, but instead of using https:// the URL will use a path to a local directory.
|
82
|
+
|
83
|
+
|
84
|
+
Example:
|
85
|
+
|
86
|
+
```
|
87
|
+
[LOCALREPONAME]
|
88
|
+
description = WRITE LOCAL REPO DESCRIPTION
|
89
|
+
URL = /path/to/your/local/repo/folder
|
90
|
+
enable=true
|
91
|
+
```
|
@@ -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|
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# version 1
|
2
2
|
|
3
3
|
[teuton.en]
|
4
|
+
type = teutontest
|
4
5
|
description = Main Teuton repo
|
5
6
|
URL = https://raw.githubusercontent.com/teuton-software/teuton-tests/master/en
|
6
7
|
enable = true
|
7
8
|
|
8
9
|
[teuton.es]
|
10
|
+
type = teutontest
|
9
11
|
description = Repositorio principal de Teuton Test
|
10
12
|
URL = https://raw.githubusercontent.com/teuton-software/teuton-tests/master/es
|
11
13
|
enable = true
|
@@ -4,6 +4,7 @@ require_relative "../reader/yaml_reader"
|
|
4
4
|
require "erb"
|
5
5
|
require "tty-prompt"
|
6
6
|
|
7
|
+
# Create metadata for local user teuton test
|
7
8
|
class LocalInfo
|
8
9
|
def initialize(dev = TerminalWriter.new)
|
9
10
|
@dev = dev
|
@@ -47,7 +48,7 @@ class LocalInfo
|
|
47
48
|
@data[:name] = prompt.ask("name?", default: @data[:name])
|
48
49
|
@data[:author] = prompt.ask("author?", default: @data[:author])
|
49
50
|
@data[:date] = prompt.ask("date?", default: @data[:date])
|
50
|
-
@data[:desc] = prompt.ask("desc?", default: @data[:desc])
|
51
|
+
@data[:desc] = sanityze(prompt.ask("desc?", default: @data[:desc]))
|
51
52
|
input = prompt.ask("tags?", default: @data[:tags].join(","))
|
52
53
|
@data[:tags] = input.split(",")
|
53
54
|
end
|
@@ -68,4 +69,8 @@ class LocalInfo
|
|
68
69
|
|
69
70
|
true
|
70
71
|
end
|
72
|
+
|
73
|
+
def sanityze(text)
|
74
|
+
text.tr(":", " ")
|
75
|
+
end
|
71
76
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require_relative "../application"
|
3
|
-
require_relative "../format"
|
4
3
|
require_relative "../reader/inifile_reader"
|
4
|
+
require_relative "../utils/format"
|
5
5
|
require_relative "../writer/terminal_writer"
|
6
6
|
|
7
|
+
# Create Teuton Repo config file
|
7
8
|
class RepoConfig
|
8
9
|
attr_reader :data
|
9
10
|
|
@@ -27,7 +28,7 @@ class RepoConfig
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def create
|
30
|
-
@dev.writeln "\n==> Creating configuration files"
|
31
|
+
@dev.writeln "\n==> Creating configuration files"
|
31
32
|
create_dir
|
32
33
|
create_ini_file
|
33
34
|
end
|
@@ -56,12 +57,12 @@ class RepoConfig
|
|
56
57
|
def create_dir
|
57
58
|
dirpath = @config_dirpath
|
58
59
|
if Dir.exist? dirpath
|
59
|
-
@dev.write " \u{2716} Exists dir! : "
|
60
|
-
@dev.writeln dirpath, color: :
|
60
|
+
@dev.write " \u{2716} Exists dir! : ", color: :white
|
61
|
+
@dev.writeln dirpath, color: :white
|
61
62
|
else
|
62
63
|
begin
|
63
64
|
FileUtils.mkdir_p(dirpath)
|
64
|
-
@dev.write " \u{2714} Create dir : "
|
65
|
+
@dev.write " \u{2714} Create dir : ", color: :white
|
65
66
|
@dev.writeln dirpath, color: :green
|
66
67
|
rescue => e
|
67
68
|
@dev.write " \u{2716} Create dir ERROR: "
|
@@ -78,13 +79,13 @@ class RepoConfig
|
|
78
79
|
|
79
80
|
def copyfile(target, dest)
|
80
81
|
if File.exist? dest
|
81
|
-
@dev.write " \u{2716} Exists file! : "
|
82
|
-
@dev.writeln dest, color: :
|
82
|
+
@dev.write " \u{2716} Exists file! : ", color: :white
|
83
|
+
@dev.writeln dest, color: :white
|
83
84
|
return true
|
84
85
|
end
|
85
86
|
begin
|
86
87
|
FileUtils.cp(target, dest)
|
87
|
-
@dev.write " \u{2714} Create file : "
|
88
|
+
@dev.write " \u{2714} Create file : ", color: :white
|
88
89
|
@dev.writeln dest, color: :green
|
89
90
|
rescue => e
|
90
91
|
@dev.write " \u{2716} Create file ERROR: "
|
@@ -28,7 +28,7 @@ class RepoData
|
|
28
28
|
dirpath = @cache_dirpath
|
29
29
|
FileUtils.rm_r(dirpath) if Dir.exist? dirpath
|
30
30
|
|
31
|
-
@dev.writeln "\n==> Refreshing active repos"
|
31
|
+
@dev.writeln "\n==> Refreshing active repos"
|
32
32
|
@data.keys.sort.each do |key|
|
33
33
|
refresh_repo key
|
34
34
|
end
|
@@ -44,7 +44,7 @@ class RepoData
|
|
44
44
|
|
45
45
|
def show_testinfo(item)
|
46
46
|
return unless item
|
47
|
-
|
47
|
+
|
48
48
|
["name", "author", "date", "desc"].each do |key|
|
49
49
|
@dev.write "#{key.ljust(7)} : ", color: :white
|
50
50
|
@dev.writeln item[key].to_s
|
@@ -58,6 +58,12 @@ class RepoData
|
|
58
58
|
|
59
59
|
def database_filename
|
60
60
|
# REVISE: Used by teutonget search... replace by #get()
|
61
|
+
unless Dir.exist? @cache_dirpath
|
62
|
+
puts " [WARN] Create Teuton config files!"
|
63
|
+
puts " Usage: teutonget init"
|
64
|
+
exit 1
|
65
|
+
end
|
66
|
+
|
61
67
|
File.join(@cache_dirpath, "database.yaml")
|
62
68
|
end
|
63
69
|
|
@@ -65,7 +71,7 @@ class RepoData
|
|
65
71
|
|
66
72
|
def refresh_repo(reponame)
|
67
73
|
unless enabled? reponame
|
68
|
-
@dev.writeln " \u{2716} Skiping repo #{reponame}"
|
74
|
+
@dev.writeln " \u{2716} Skiping repo #{reponame}", color: :yellow
|
69
75
|
return false
|
70
76
|
end
|
71
77
|
dirpath = File.join(@cache_dirpath)
|
data/lib/teuton-get/searcher.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require_relative "application"
|
2
|
-
require_relative "format"
|
3
2
|
require_relative "reader/yaml_reader"
|
4
3
|
require_relative "repo/repo_data"
|
5
4
|
require_relative "searcher/result"
|
5
|
+
require_relative "utils/format"
|
6
6
|
require_relative "writer/terminal_writer"
|
7
7
|
|
8
8
|
class Searcher
|
File without changes
|
data/lib/teuton-get/version.rb
CHANGED
data/lib/teuton-get.rb
CHANGED
@@ -6,19 +6,28 @@ require_relative "teuton-get/searcher"
|
|
6
6
|
require_relative "teuton-get/downloader"
|
7
7
|
|
8
8
|
module TeutonGet
|
9
|
+
# Create metadata for local user teuton test
|
9
10
|
def self.create_info(testpath)
|
10
11
|
LocalInfo.new.user_create(testpath)
|
11
12
|
end
|
12
13
|
|
14
|
+
# Create metadata for local user teuton repository
|
13
15
|
def self.create_repo(dirpath)
|
14
16
|
LocalRepo.new_by_default.create(dirpath)
|
15
17
|
end
|
16
18
|
|
19
|
+
# Download remote teuton test
|
20
|
+
def self.download(test_id)
|
21
|
+
Downloader.new.run(test_id)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Create Teuton Repo config file
|
17
25
|
def self.init
|
18
26
|
RepoConfig.new_by_default.create
|
19
27
|
refresh # Auto repo refresh
|
20
28
|
end
|
21
29
|
|
30
|
+
# Refresh Teuton Repo Data
|
22
31
|
def self.refresh
|
23
32
|
RepoData.new_by_default.refresh
|
24
33
|
end
|
@@ -38,8 +47,4 @@ module TeutonGet
|
|
38
47
|
searcher.get(filter)
|
39
48
|
searcher.show_result
|
40
49
|
end
|
41
|
-
|
42
|
-
def self.download(test_id)
|
43
|
-
Downloader.new.run(test_id)
|
44
|
-
end
|
45
50
|
end
|
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.2.
|
4
|
+
version: 0.2.2
|
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-15 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,7 +109,6 @@ 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
|
110
|
-
- lib/teuton-get/format.rb
|
111
112
|
- lib/teuton-get/reader/inifile_reader.rb
|
112
113
|
- lib/teuton-get/reader/linux_environment_reader.rb
|
113
114
|
- lib/teuton-get/reader/reader.rb
|
@@ -119,6 +120,7 @@ files:
|
|
119
120
|
- lib/teuton-get/repo/repo_data.rb
|
120
121
|
- lib/teuton-get/searcher.rb
|
121
122
|
- lib/teuton-get/searcher/result.rb
|
123
|
+
- lib/teuton-get/utils/format.rb
|
122
124
|
- lib/teuton-get/version.rb
|
123
125
|
- lib/teuton-get/writer/file_writer.rb
|
124
126
|
- lib/teuton-get/writer/null_writer.rb
|
@@ -143,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
145
|
- !ruby/object:Gem::Version
|
144
146
|
version: '0'
|
145
147
|
requirements: []
|
146
|
-
rubygems_version: 3.
|
148
|
+
rubygems_version: 3.3.3
|
147
149
|
signing_key:
|
148
150
|
specification_version: 4
|
149
151
|
summary: TeutonGet (Teuton Software)
|