teuton-get 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9a7d30a57e1d17315bdc1a70eca4bb76e397c901c46cb5a5709fd72802945ea
4
- data.tar.gz: 12d9f68bfbd6a1f4c3107acb4059527b829def841e2049753f4ed77e3c70c362
3
+ metadata.gz: fbdff5b1a781df1aeb1ddb23fc43b504787f0a43a255d44e72fcea0789e92f99
4
+ data.tar.gz: f557290df95c13818dcfce2d79756cead6c757ed320261a046a7cff0c5a8b955
5
5
  SHA512:
6
- metadata.gz: 6b5a55be18579de050724e9cc48dfdd1aebd0e87108b3810d2a785034b94de87c392fdff0f85ba87858227bda8f604e77173193bd65b5efe9867aecf02e31011
7
- data.tar.gz: 23a880ed0a732db0891947a828a12188a034cc4b6f9611b30748916751e7104f530eb77b61b95a492bc2db574a46b5a59e97ca7dcbf48354573e8adb25592909
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,21 +14,20 @@
13
14
 
14
15
  # Use
15
16
 
16
- * At first, create config file with `teutonget init`.
17
- * Then, search tests with `teutonget search FILTER`. Example: `teutonget search linux`, will show a list with "linux" related tests.
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
- * `teutonget download REPONAME:TESTPATH`
23
+ * Search test and show details:
21
24
 
22
- ## Example
25
+ ![](docs/images/teutonget-info.png)
23
26
 
24
- * Search and download test:
27
+ * Download test:
25
28
 
26
29
  ![](docs/images/teutonget-download.png)
27
30
 
28
- * Refresh repos and show test details:
29
-
30
- ![](docs/images/teutonget-info.png)
31
31
 
32
32
  # Contact
33
33
 
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
- ## Search
7
+ 1. [Search](#1-search)
8
+ 2. [Info](#2-info)
9
+ 3. [Download](#3-download)
8
10
 
9
- At first we need to locate the files according to some criterios.
11
+ ## 1. Search
10
12
 
11
- * `teutonget search FILTER` is used to find files with FILTER criterio.
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 search debian
17
- (3) teuton.en:en/systems.1/03-debian-conf
18
- (2) teuton.en:en/systems.2/02-debian-basic-configuration
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
- ## Create info
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 that you want to be downdable, requires test info file (tt-info.yaml).
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
- We need to summarize all our test information into repo info file (tt-repo-yaml).
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
+ ```
@@ -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
@@ -2,6 +2,7 @@ require_relative "../application"
2
2
  require_relative "../writer/file_writer"
3
3
  require_relative "../writer/terminal_writer"
4
4
 
5
+ # Create metadata for local user teuton repository
5
6
  class LocalRepo
6
7
  def initialize(args)
7
8
  @repoindex_writer = args[:repoindex_writer]
@@ -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", color: :light_yellow
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: :yellow
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: :yellow
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", color: :light_yellow
31
+ @dev.writeln "\n==> Refreshing active repos"
32
32
  @data.keys.sort.each do |key|
33
33
  refresh_repo key
34
34
  end
@@ -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)
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Version
2
2
  NAME = "teuton-get"
3
3
  EXECUTABLE = "teutonget"
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  HOMEPAGE = "https://github.com/teuton-software/#{NAME}"
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "tty-table"
2
2
  require_relative "writer"
3
- require_relative "../format"
3
+ require_relative "../utils/format"
4
4
 
5
5
  class TerminalWriter < Writer
6
6
  def write(text = "", args = {})
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.1
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-05 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inifile
@@ -109,7 +109,6 @@ files:
109
109
  - lib/teuton-get/downloader.rb
110
110
  - lib/teuton-get/files/repos.ini
111
111
  - lib/teuton-get/files/tt-info.yaml
112
- - lib/teuton-get/format.rb
113
112
  - lib/teuton-get/reader/inifile_reader.rb
114
113
  - lib/teuton-get/reader/linux_environment_reader.rb
115
114
  - lib/teuton-get/reader/reader.rb
@@ -121,6 +120,7 @@ files:
121
120
  - lib/teuton-get/repo/repo_data.rb
122
121
  - lib/teuton-get/searcher.rb
123
122
  - lib/teuton-get/searcher/result.rb
123
+ - lib/teuton-get/utils/format.rb
124
124
  - lib/teuton-get/version.rb
125
125
  - lib/teuton-get/writer/file_writer.rb
126
126
  - lib/teuton-get/writer/null_writer.rb