workarea-upgrade 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +327 -0
- data/CHANGELOG.md +285 -0
- data/Gemfile +17 -0
- data/README.md +210 -0
- data/Rakefile +30 -0
- data/bin/rails +18 -0
- data/exe/workarea_upgrade +7 -0
- data/lib/workarea/upgrade.rb +26 -0
- data/lib/workarea/upgrade/cli.rb +289 -0
- data/lib/workarea/upgrade/diff.rb +87 -0
- data/lib/workarea/upgrade/diff/current_app.rb +15 -0
- data/lib/workarea/upgrade/diff/gem_diff.rb +99 -0
- data/lib/workarea/upgrade/diff/workarea_file.rb +43 -0
- data/lib/workarea/upgrade/engine.rb +12 -0
- data/lib/workarea/upgrade/gemfile.rb +102 -0
- data/lib/workarea/upgrade/report.rb +176 -0
- data/lib/workarea/upgrade/report_card.rb +94 -0
- data/lib/workarea/upgrade/version.rb +5 -0
- data/workarea-upgrade.gemspec +25 -0
- metadata +112 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
module Workarea
|
2
|
+
module Upgrade
|
3
|
+
class ReportCard
|
4
|
+
CATEGORIES = %w(
|
5
|
+
assets
|
6
|
+
controllers
|
7
|
+
helpers
|
8
|
+
listeners
|
9
|
+
mailers
|
10
|
+
models
|
11
|
+
services
|
12
|
+
view_models
|
13
|
+
views
|
14
|
+
workers
|
15
|
+
)
|
16
|
+
|
17
|
+
def initialize(diff)
|
18
|
+
@diff = diff
|
19
|
+
end
|
20
|
+
|
21
|
+
def results
|
22
|
+
CATEGORIES.inject({}) do |memo, category|
|
23
|
+
memo[category] = calculate_grade(category)
|
24
|
+
memo
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def customized_percents
|
29
|
+
@customized_percents ||= CATEGORIES.inject({}) do |memo, category|
|
30
|
+
percent_customized = customized_totals[category] / changed_totals[category].to_f
|
31
|
+
percent_customized *= 100
|
32
|
+
|
33
|
+
memo[category] = percent_customized.nan? ? 0 : percent_customized.round
|
34
|
+
memo
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# If a file was decorated or overridden and removed, this is the
|
39
|
+
# biggest pain point.
|
40
|
+
def worst_files
|
41
|
+
@worst_files ||= CATEGORIES.inject({}) do |memo, category|
|
42
|
+
memo[category] = customized_files_now_missing
|
43
|
+
.select { |f| f.include?(category) }
|
44
|
+
.count
|
45
|
+
|
46
|
+
memo
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def changed_totals
|
51
|
+
@changed_totals ||= CATEGORIES.inject({}) do |memo, category|
|
52
|
+
memo[category] = @diff.all.select { |f| f.include?(category) }.count
|
53
|
+
memo
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def customized_totals
|
58
|
+
@customized_totals ||= CATEGORIES.inject({}) do |memo, category|
|
59
|
+
memo[category] = @diff.for_current_app.select { |f| f.include?(category) }.count
|
60
|
+
memo
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def calculate_grade(category)
|
65
|
+
customized_total = customized_totals[category]
|
66
|
+
return 'A' if customized_total <= 3
|
67
|
+
|
68
|
+
percent_customized = customized_percents[category]
|
69
|
+
return 'A' if percent_customized < 5
|
70
|
+
|
71
|
+
score = worst_files[category]
|
72
|
+
score += percent_customized
|
73
|
+
|
74
|
+
if score.between?(0, 9)
|
75
|
+
'A'
|
76
|
+
elsif score.between?(10, 24)
|
77
|
+
'B'
|
78
|
+
elsif score.between?(25, 34)
|
79
|
+
'C'
|
80
|
+
elsif score.between?(35, 44)
|
81
|
+
'D'
|
82
|
+
else
|
83
|
+
'F'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def customized_files_now_missing
|
90
|
+
@diff.customized_files & @diff.removed
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require 'workarea/upgrade/version'
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'workarea-upgrade'
|
9
|
+
s.version = Workarea::Upgrade::VERSION
|
10
|
+
s.authors = ['Ben Crouse', 'Curt Howard']
|
11
|
+
s.email = ['bcrouse@workarea.com', 'choward@workarea.com']
|
12
|
+
s.homepage = 'https://github.com/workarea-commerce/workarea-upgrade'
|
13
|
+
s.summary = 'Workarea upgrade tools'
|
14
|
+
s.description = 'Upgrade tools for the Workarea commerce system'
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.bindir = 'exe'
|
17
|
+
s.executable = 'workarea_upgrade'
|
18
|
+
|
19
|
+
s.required_ruby_version = '>= 2.0.0'
|
20
|
+
|
21
|
+
s.add_dependency 'bundler', '~> 2.0.0'
|
22
|
+
s.add_dependency 'diffy', '~> 3.1.0'
|
23
|
+
|
24
|
+
s.add_development_dependency 'workarea', '~> 3.x'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: workarea-upgrade
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Crouse
|
8
|
+
- Curt Howard
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 2.0.0
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 2.0.0
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: diffy
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 3.1.0
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 3.1.0
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: workarea
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 3.x
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 3.x
|
56
|
+
description: Upgrade tools for the Workarea commerce system
|
57
|
+
email:
|
58
|
+
- bcrouse@workarea.com
|
59
|
+
- choward@workarea.com
|
60
|
+
executables:
|
61
|
+
- workarea_upgrade
|
62
|
+
extensions: []
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- ".editorconfig"
|
66
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
67
|
+
- ".github/ISSUE_TEMPLATE/documentation-request.md"
|
68
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
69
|
+
- ".gitignore"
|
70
|
+
- ".rspec"
|
71
|
+
- ".rubocop.yml"
|
72
|
+
- CHANGELOG.md
|
73
|
+
- Gemfile
|
74
|
+
- README.md
|
75
|
+
- Rakefile
|
76
|
+
- bin/rails
|
77
|
+
- exe/workarea_upgrade
|
78
|
+
- lib/workarea/upgrade.rb
|
79
|
+
- lib/workarea/upgrade/cli.rb
|
80
|
+
- lib/workarea/upgrade/diff.rb
|
81
|
+
- lib/workarea/upgrade/diff/current_app.rb
|
82
|
+
- lib/workarea/upgrade/diff/gem_diff.rb
|
83
|
+
- lib/workarea/upgrade/diff/workarea_file.rb
|
84
|
+
- lib/workarea/upgrade/engine.rb
|
85
|
+
- lib/workarea/upgrade/gemfile.rb
|
86
|
+
- lib/workarea/upgrade/report.rb
|
87
|
+
- lib/workarea/upgrade/report_card.rb
|
88
|
+
- lib/workarea/upgrade/version.rb
|
89
|
+
- workarea-upgrade.gemspec
|
90
|
+
homepage: https://github.com/workarea-commerce/workarea-upgrade
|
91
|
+
licenses: []
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.0.0
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubygems_version: 3.1.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Workarea upgrade tools
|
112
|
+
test_files: []
|