jungle_test 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/jungle_test.rb +54 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2b02c5193b57644e09d6651d2d31c9f3fb761a1
|
4
|
+
data.tar.gz: d567b1977855012b8e1947d2eaec6b38f3cd8ff3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ecec3341f815b4c224e5e2339fdead9c32775944e527e20fbd2f2d59d4a3cf6a2f01a0cbe2f4ee1f2ebc4bf7eee154b7cf34b2847338cc44ce90ee89f9d4875d
|
7
|
+
data.tar.gz: 8814506353033b0f110f022c726fe7fcd449e1dacbf82fd336a694bcb2e24e0ae14996edd3d6c5b37b2184364dd28726b366d1b53e34e5cd64154f6b6bbb5741
|
data/lib/jungle_test.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'jungle_test/version'
|
2
|
+
require 'jungle_test/datatable'
|
3
|
+
require 'jungle_test/professions'
|
4
|
+
require 'jungle_test/matrix_builder'
|
5
|
+
require 'jungle_test/draw_matrix'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'csv'
|
8
|
+
|
9
|
+
ROOT = File.dirname(__FILE__).freeze
|
10
|
+
CSV_PROF = File.join(ROOT, '../data/technical-test-professions.csv')
|
11
|
+
.freeze
|
12
|
+
CSV_CAT_JOBS = File.join(ROOT, '../data/technical-test-jobs.csv')
|
13
|
+
.freeze
|
14
|
+
|
15
|
+
module JungleTest
|
16
|
+
# Runner Class for the JungleTest gem
|
17
|
+
class Runner
|
18
|
+
class << self
|
19
|
+
def build_content_matrix
|
20
|
+
# Initialize datatable for two csv files
|
21
|
+
dt_p = JungleTest::DataTable.csv_to_datatable(CSV_PROF)
|
22
|
+
dt_j = JungleTest::DataTable.csv_to_datatable(CSV_CAT_JOBS)
|
23
|
+
|
24
|
+
# Create hash that contains profession category by id
|
25
|
+
cat = JungleTest::Professions.new(dt_p)
|
26
|
+
dt_merged = cat.merge_prof_contract(dt_j)
|
27
|
+
line_total = cat.total_by_contract_type(dt_merged)
|
28
|
+
mat = JungleTest::MatrixBuilder.new(dt_merged)
|
29
|
+
content = mat.content_line_matrix(line_total, dt_merged)
|
30
|
+
headers = mat.matrix_headers
|
31
|
+
{ headers: headers, content: content }
|
32
|
+
end
|
33
|
+
|
34
|
+
def draw_headers(columns)
|
35
|
+
JungleTest::DrawMatrix.puts_divider(columns)
|
36
|
+
JungleTest::DrawMatrix.puts_header(columns)
|
37
|
+
JungleTest::DrawMatrix.puts_divider(columns)
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute
|
41
|
+
headers = build_content_matrix[:headers]
|
42
|
+
content = build_content_matrix[:content]
|
43
|
+
columns = JungleTest::DrawMatrix.columns_spec(headers, content)
|
44
|
+
draw_headers(columns)
|
45
|
+
res = {}
|
46
|
+
content.each do |ct|
|
47
|
+
headers.each_key { |key| res[key] = ct[key].to_s.upcase }
|
48
|
+
JungleTest::DrawMatrix.puts_line(res, columns)
|
49
|
+
end
|
50
|
+
JungleTest::DrawMatrix.puts_divider(columns)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jungle_test
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- fabienp38
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: fileutils
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: csv
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Jungle Test generate a matrix from two csv files
|
42
|
+
email: fabienpipard@gmail.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/jungle_test.rb
|
48
|
+
homepage: https://rubygems.org/gems/example
|
49
|
+
licenses:
|
50
|
+
- MIT
|
51
|
+
metadata:
|
52
|
+
source_code_uri: https://github.com/fabienp38/jungle_test/tree/master/exercice1
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.6.14.4
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Jungle Test gem
|
73
|
+
test_files: []
|