fitting 2.13.1 → 2.14.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 +5 -5
- data/.rubocop.yml +1 -1
- data/.ruby-version +1 -1
- data/.tool-versions +1 -1
- data/.travis.yml +1 -1
- data/CHANGELOG.md +23 -0
- data/README.md +127 -84
- data/lib/fitting/records/spherical/requests.rb +3 -1
- data/lib/fitting/report/action.rb +53 -0
- data/lib/fitting/report/actions.rb +55 -0
- data/lib/fitting/report/combination.rb +37 -0
- data/lib/fitting/report/combinations.rb +47 -0
- data/lib/fitting/report/console.rb +41 -0
- data/lib/fitting/report/prefix.rb +53 -0
- data/lib/fitting/report/prefixes.rb +44 -0
- data/lib/fitting/report/response.rb +71 -0
- data/lib/fitting/report/responses.rb +48 -0
- data/lib/fitting/report/test.rb +61 -0
- data/lib/fitting/report/tests.rb +62 -0
- data/lib/fitting/tests.rb +0 -1
- data/lib/fitting/version.rb +1 -1
- data/lib/tasks/fitting.rake +65 -31
- data/lib/templates/bomboniere/.gitignore +21 -0
- data/lib/templates/bomboniere/.tool-versions +1 -0
- data/lib/templates/bomboniere/README.md +19 -0
- data/lib/templates/bomboniere/dist/css/app.62e086ac.css +1 -0
- data/lib/templates/bomboniere/dist/css/chunk-vendors.ec5f6c3f.css +1 -0
- data/lib/templates/bomboniere/dist/favicon.ico +0 -0
- data/lib/templates/bomboniere/dist/index.html +1 -0
- data/lib/templates/bomboniere/dist/js/app.4356d509.js +2 -0
- data/lib/templates/bomboniere/dist/js/app.4356d509.js.map +1 -0
- data/lib/templates/bomboniere/dist/js/chunk-vendors.90aeb613.js +13 -0
- data/lib/templates/bomboniere/dist/js/chunk-vendors.90aeb613.js.map +1 -0
- data/lib/templates/bomboniere/package-lock.json +9263 -0
- data/lib/templates/bomboniere/package.json +25 -0
- data/lib/templates/bomboniere/public/favicon.ico +0 -0
- data/lib/templates/bomboniere/public/index.html +17 -0
- data/lib/templates/bomboniere/src/App.vue +102 -0
- data/lib/templates/bomboniere/src/assets/logo.png +0 -0
- data/lib/templates/bomboniere/src/components/HelloWorld.vue +188 -0
- data/lib/templates/bomboniere/src/main.js +10 -0
- data/lib/templates/bomboniere/src/router/index.js +31 -0
- data/lib/templates/bomboniere/src/views/About.vue +5 -0
- data/lib/templates/bomboniere/src/views/Action.vue +154 -0
- data/lib/templates/bomboniere/src/views/Home.vue +17 -0
- data/lib/templates/bomboniere/vue.config.js +3 -0
- metadata +38 -4
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'fitting/report/action'
|
2
|
+
|
3
|
+
module Fitting
|
4
|
+
module Report
|
5
|
+
class Actions
|
6
|
+
def initialize(prefix, tomogram_json_path)
|
7
|
+
actions = Tomograph::Tomogram.new(
|
8
|
+
prefix: prefix,
|
9
|
+
tomogram_json_path: tomogram_json_path
|
10
|
+
)
|
11
|
+
@actions = []
|
12
|
+
actions.to_a.map do |action|
|
13
|
+
@actions.push(Fitting::Report::Action.new(action))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_a
|
18
|
+
@actions
|
19
|
+
end
|
20
|
+
|
21
|
+
def join(tests)
|
22
|
+
tests.to_a.map do |test|
|
23
|
+
if is_there_a_suitable_action?(test)
|
24
|
+
cram_into_the_appropriate_action(test)
|
25
|
+
test.mark_action
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def is_there_a_suitable_action?(test)
|
31
|
+
@actions.map do |action|
|
32
|
+
return true if test.method == action.method && action.path_match(test.path)
|
33
|
+
end
|
34
|
+
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def cram_into_the_appropriate_action(test)
|
39
|
+
@actions.map do |action|
|
40
|
+
if test.method == action.method && action.path_match(test.path)
|
41
|
+
action.add_test(test)
|
42
|
+
return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def details(prefix)
|
48
|
+
{
|
49
|
+
tests_without_actions: prefix.tests.without_actions,
|
50
|
+
actions_details: @actions.map { |a| {method: a.method, path: a.path, tests_size: a.tests.size, responses: a.details} }
|
51
|
+
}
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Fitting
|
2
|
+
module Report
|
3
|
+
class Combination
|
4
|
+
def initialize(json_schema:, type:, combination:)
|
5
|
+
@json_schema = json_schema
|
6
|
+
@type = type
|
7
|
+
@combination = combination
|
8
|
+
@tests = Fitting::Report::Tests.new([])
|
9
|
+
@id = SecureRandom.hex
|
10
|
+
end
|
11
|
+
|
12
|
+
def json_schema
|
13
|
+
@json_schema
|
14
|
+
end
|
15
|
+
|
16
|
+
def id
|
17
|
+
@id
|
18
|
+
end
|
19
|
+
|
20
|
+
def type
|
21
|
+
@type
|
22
|
+
end
|
23
|
+
|
24
|
+
def name
|
25
|
+
@combination
|
26
|
+
end
|
27
|
+
|
28
|
+
def tests
|
29
|
+
@tests
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_test(test)
|
33
|
+
@tests.push(test)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Fitting
|
2
|
+
module Report
|
3
|
+
class Combinations
|
4
|
+
def initialize(combinations)
|
5
|
+
@combinations = combinations
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_a
|
9
|
+
@combinations
|
10
|
+
end
|
11
|
+
|
12
|
+
def size
|
13
|
+
@combinations.size
|
14
|
+
end
|
15
|
+
|
16
|
+
def size_with_tests
|
17
|
+
@combinations.count { |c| c.tests.size != 0 }
|
18
|
+
end
|
19
|
+
|
20
|
+
def join(tests)
|
21
|
+
tests.to_a.map do |test|
|
22
|
+
if is_there_a_suitable_combination?(test)
|
23
|
+
cram_into_the_appropriate_combinations(test)
|
24
|
+
test.mark_combination
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def is_there_a_suitable_combination?(test)
|
30
|
+
return false if @combinations.nil?
|
31
|
+
@combinations.map do |combination|
|
32
|
+
return true if JSON::Validator.fully_validate(combination.json_schema, test.body) == []
|
33
|
+
end
|
34
|
+
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def cram_into_the_appropriate_combinations(test)
|
39
|
+
@combinations.map do |combination|
|
40
|
+
if JSON::Validator.fully_validate(combination.json_schema, test.body) == []
|
41
|
+
combination.add_test(test)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Fitting
|
2
|
+
module Report
|
3
|
+
class Console
|
4
|
+
def initialize(tests_without_prefixes, prefixes_details)
|
5
|
+
@tests_without_prefixes = tests_without_prefixes
|
6
|
+
@prefixes_details = prefixes_details
|
7
|
+
@good = true
|
8
|
+
@tests_without_actions = []
|
9
|
+
@tests_without_responses = []
|
10
|
+
end
|
11
|
+
|
12
|
+
def output
|
13
|
+
doc_res = @prefixes_details.inject('') do |res, prefix_details|
|
14
|
+
res += "#{prefix_details[:name]}\n"
|
15
|
+
@tests_without_actions += prefix_details[:actions][:tests_without_actions]
|
16
|
+
res += prefix_details[:actions][:actions_details].inject('') do |res_actions, action|
|
17
|
+
res_actions += "#{action[:method]}\t#{action[:path]}"
|
18
|
+
tab = "\t" * ((3 - action[:path].size / 8) + 3)
|
19
|
+
@tests_without_responses += action[:responses][:tests_without_responses]
|
20
|
+
res_actions += tab + action[:responses][:responses_details].inject('') do |res_responses, response|
|
21
|
+
@good = false if response[:combinations][:cover_percent] != '100%'
|
22
|
+
res_responses += " #{response[:combinations][:cover_percent]} #{response[:method]}"
|
23
|
+
end
|
24
|
+
res_actions += "\n"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
doc_res += "\n"
|
28
|
+
doc_res += "tests_without_prefixes: #{@tests_without_prefixes.size}\n"
|
29
|
+
doc_res += "tests_without_actions: #{@tests_without_actions.size}\n"
|
30
|
+
doc_res += "tests_without_responses: #{@tests_without_responses.size}\n"
|
31
|
+
end
|
32
|
+
|
33
|
+
def good?
|
34
|
+
return false if @tests_without_prefixes.size != 0
|
35
|
+
return false if @tests_without_actions.size != 0
|
36
|
+
return false if @tests_without_responses.size != 0
|
37
|
+
@good
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'fitting/report/actions'
|
2
|
+
|
3
|
+
module Fitting
|
4
|
+
module Report
|
5
|
+
class Prefix
|
6
|
+
def initialize(name, tomogram_json_path, skip = false)
|
7
|
+
@name = name
|
8
|
+
@tomogram_json_path = tomogram_json_path
|
9
|
+
@tests = Fitting::Report::Tests.new([])
|
10
|
+
@skip = skip
|
11
|
+
unless skip
|
12
|
+
@actions = Fitting::Report::Actions.new(name, tomogram_json_path)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def name
|
17
|
+
@name
|
18
|
+
end
|
19
|
+
|
20
|
+
def tests
|
21
|
+
@tests
|
22
|
+
end
|
23
|
+
|
24
|
+
def skip?
|
25
|
+
@skip
|
26
|
+
end
|
27
|
+
|
28
|
+
def actions
|
29
|
+
@actions
|
30
|
+
end
|
31
|
+
|
32
|
+
def details
|
33
|
+
if @skip
|
34
|
+
{
|
35
|
+
name: @name,
|
36
|
+
tests_size: @tests.size,
|
37
|
+
actions: {tests_without_actions: [], actions_details: []}
|
38
|
+
}
|
39
|
+
else
|
40
|
+
{
|
41
|
+
name: @name,
|
42
|
+
tests_size: @tests.size,
|
43
|
+
actions: @actions.details(self)
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def add_test(test)
|
49
|
+
@tests.push(test)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'fitting/report/prefix'
|
2
|
+
|
3
|
+
module Fitting
|
4
|
+
module Report
|
5
|
+
class Prefixes
|
6
|
+
def initialize(config_path)
|
7
|
+
@prefixes = []
|
8
|
+
YAML.safe_load(File.read(config_path))['prefixes'].map do |prefix|
|
9
|
+
@prefixes.push(Fitting::Report::Prefix.new(prefix['name'], prefix['tomogram_json_path'], prefix['skip']))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def is_there_a_suitable_prefix?(test_path)
|
14
|
+
@prefixes.map do |prefix|
|
15
|
+
return true if test_path[0..prefix.name.size - 1] == prefix.name
|
16
|
+
end
|
17
|
+
|
18
|
+
false
|
19
|
+
end
|
20
|
+
|
21
|
+
def cram_into_the_appropriate_prefix(test)
|
22
|
+
@prefixes.map do |prefix|
|
23
|
+
if test.path[0..prefix.name.size - 1] == prefix.name
|
24
|
+
prefix.add_test(test)
|
25
|
+
return
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def join(tests)
|
31
|
+
tests.to_a.map do |test|
|
32
|
+
if is_there_a_suitable_prefix?(test.path)
|
33
|
+
cram_into_the_appropriate_prefix(test)
|
34
|
+
test.mark_prefix
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_a
|
40
|
+
@prefixes
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'fitting/statistics/template_cover_error'
|
2
|
+
require 'fitting/statistics/template_cover_error_enum'
|
3
|
+
require 'fitting/statistics/template_cover_error_one_of'
|
4
|
+
require 'fitting/report/combinations'
|
5
|
+
require 'fitting/report/combination'
|
6
|
+
|
7
|
+
module Fitting
|
8
|
+
module Report
|
9
|
+
class Response
|
10
|
+
def initialize(response)
|
11
|
+
@response = response
|
12
|
+
@tests = Fitting::Report::Tests.new([])
|
13
|
+
@id = SecureRandom.hex
|
14
|
+
end
|
15
|
+
|
16
|
+
def status
|
17
|
+
@response['status']
|
18
|
+
end
|
19
|
+
|
20
|
+
def body
|
21
|
+
@response['body']
|
22
|
+
end
|
23
|
+
|
24
|
+
def id
|
25
|
+
@id
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_test(test)
|
29
|
+
@tests.push(test)
|
30
|
+
end
|
31
|
+
|
32
|
+
def tests
|
33
|
+
@tests
|
34
|
+
end
|
35
|
+
|
36
|
+
def combinations
|
37
|
+
return @combinations if @combinations
|
38
|
+
|
39
|
+
cmbntns = []
|
40
|
+
combinations = Fitting::Cover::JSONSchema.new(body).combi + Fitting::Cover::JSONSchemaEnum.new(body).combi + Fitting::Cover::JSONSchemaOneOf.new(body).combi
|
41
|
+
if combinations != []
|
42
|
+
combinations.map do |combination|
|
43
|
+
cmbntns.push(
|
44
|
+
Fitting::Report::Combination.new(
|
45
|
+
json_schema: combination[0],
|
46
|
+
type: combination[1][0],
|
47
|
+
combination: combination[1][1]
|
48
|
+
)
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
@combinations = Fitting::Report::Combinations.new(cmbntns)
|
54
|
+
end
|
55
|
+
|
56
|
+
def cover_percent
|
57
|
+
return '0%' if @tests.size == 0
|
58
|
+
return '100%' if @combinations.size == 0
|
59
|
+
"#{(@combinations.size_with_tests + 1) * 100 / (@combinations.size + 1)}%"
|
60
|
+
end
|
61
|
+
|
62
|
+
def details
|
63
|
+
{
|
64
|
+
cover_percent: cover_percent,
|
65
|
+
tests_without_combinations: @tests.without_combinations,
|
66
|
+
combinations_details: @combinations.to_a.map { |c| {json_schema: c.id, tests_size: c.tests.size, type: c.type, name: c.name} }
|
67
|
+
}
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'fitting/report/response'
|
2
|
+
|
3
|
+
module Fitting
|
4
|
+
module Report
|
5
|
+
class Responses
|
6
|
+
def initialize(responses)
|
7
|
+
@responses = responses
|
8
|
+
@responses = []
|
9
|
+
responses.to_a.map do |response|
|
10
|
+
@responses.push(Fitting::Report::Response.new(response))
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_a
|
15
|
+
@responses
|
16
|
+
end
|
17
|
+
|
18
|
+
def join(tests)
|
19
|
+
tests.to_a.map do |test|
|
20
|
+
if is_there_a_suitable_response?(test)
|
21
|
+
cram_into_the_appropriate_response(test)
|
22
|
+
test.mark_response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def is_there_a_suitable_response?(test)
|
28
|
+
return false if @responses.nil?
|
29
|
+
@responses.map do |response|
|
30
|
+
return true if response.status.to_s == test.status &&
|
31
|
+
JSON::Validator.fully_validate(response.body, test.body) == []
|
32
|
+
end
|
33
|
+
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
37
|
+
def cram_into_the_appropriate_response(test)
|
38
|
+
@responses.map do |response|
|
39
|
+
if response.status.to_s == test.status &&
|
40
|
+
JSON::Validator.fully_validate(response.body, test.body) == []
|
41
|
+
response.add_test(test)
|
42
|
+
return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module Fitting
|
2
|
+
module Report
|
3
|
+
class Test
|
4
|
+
def initialize(test)
|
5
|
+
@test = test
|
6
|
+
@prefix = false
|
7
|
+
@action = false
|
8
|
+
@response = false
|
9
|
+
@combination = false
|
10
|
+
end
|
11
|
+
|
12
|
+
def path
|
13
|
+
@test['path']
|
14
|
+
end
|
15
|
+
|
16
|
+
def method
|
17
|
+
@test['method']
|
18
|
+
end
|
19
|
+
|
20
|
+
def status
|
21
|
+
@test['response']['status'].to_s
|
22
|
+
end
|
23
|
+
|
24
|
+
def body
|
25
|
+
@test['response']['body']
|
26
|
+
end
|
27
|
+
|
28
|
+
def mark_prefix
|
29
|
+
@prefix = true
|
30
|
+
end
|
31
|
+
|
32
|
+
def mark_action
|
33
|
+
@action = true
|
34
|
+
end
|
35
|
+
|
36
|
+
def mark_response
|
37
|
+
@response = true
|
38
|
+
end
|
39
|
+
|
40
|
+
def mark_combination
|
41
|
+
@combination = true
|
42
|
+
end
|
43
|
+
|
44
|
+
def is_there_a_prefix?
|
45
|
+
@prefix
|
46
|
+
end
|
47
|
+
|
48
|
+
def is_there_an_actions?
|
49
|
+
@action
|
50
|
+
end
|
51
|
+
|
52
|
+
def is_there_an_responses?
|
53
|
+
@response
|
54
|
+
end
|
55
|
+
|
56
|
+
def is_there_an_combinations?
|
57
|
+
@combination
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|