predictability-engine 0.6.6 → 0.8.3
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 +4 -4
- data/lib/predictability_engine/cli.rb +1 -1
- data/lib/predictability_engine/config.rb +3 -2
- data/lib/predictability_engine/jira_workflow.rb +3 -1
- data/lib/predictability_engine/report.rb +1 -1
- data/lib/predictability_engine/setup_manager.rb +32 -8
- data/lib/predictability_engine/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6cadf818f2bc1f086f1b785030f8d7d0d4197e667389fda712056469af0371b
|
|
4
|
+
data.tar.gz: 3d5020ae42151184e37caec398a41129f840c4247d0d47c7ab4d556dd87897ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2eece20047eb44bea97b681dbcdf2479ea68bfea14fa8d767e8966d4ab2ffc771649d917144acf216e3c7bb12251f0706f5639a671edebe5de0798478994622
|
|
7
|
+
data.tar.gz: d44ec1ed5093076f3946cbee85dce66babc81f45fba329794830108ee5628d47327137520ac84960257fbe1b4cc48c6ed03350ba6e70b5d935088901d058e2fe
|
|
@@ -277,7 +277,7 @@ module PredictabilityEngine
|
|
|
277
277
|
PredictabilityEngine.logger.info { "Review #{path} and set role: arrival / departure / null per status." }
|
|
278
278
|
end
|
|
279
279
|
|
|
280
|
-
desc 'jira_workflow_merge OUTPUT
|
|
280
|
+
desc 'jira_workflow_merge OUTPUT SOURCES...',
|
|
281
281
|
'Merge multiple workflow configs into a shared config. Each SOURCE is ' \
|
|
282
282
|
'either a profile name (resolved to ~/.config/jira/<profile>.workflow.yml) ' \
|
|
283
283
|
'or an explicit path to a workflow YAML file.'
|
|
@@ -53,19 +53,20 @@ module PredictabilityEngine
|
|
|
53
53
|
# INFO or higher.
|
|
54
54
|
module JiraHttpLogger
|
|
55
55
|
def make_request(http_method, url, body = '', headers = {})
|
|
56
|
-
log = SemanticLogger['JIRA::HTTP']
|
|
56
|
+
log = ::SemanticLogger['JIRA::HTTP']
|
|
57
57
|
log.debug { "→ #{http_method.upcase} #{url}" }
|
|
58
58
|
result = super
|
|
59
59
|
log.debug { "← #{result.code} #{result.message}" }
|
|
60
60
|
result
|
|
61
61
|
rescue StandardError => e
|
|
62
|
-
SemanticLogger['JIRA::HTTP'].debug { "✗ #{http_method.upcase} #{url} (#{e.class}: #{e.message})" }
|
|
62
|
+
::SemanticLogger['JIRA::HTTP'].debug { "✗ #{http_method.upcase} #{url} (#{e.class}: #{e.message})" }
|
|
63
63
|
raise
|
|
64
64
|
end
|
|
65
65
|
end
|
|
66
66
|
private_constant :JiraHttpLogger
|
|
67
67
|
|
|
68
68
|
def self.instrument_jira_http!
|
|
69
|
+
require 'semantic_logger'
|
|
69
70
|
::JIRA::HttpClient.prepend(JiraHttpLogger)
|
|
70
71
|
end
|
|
71
72
|
private_class_method :instrument_jira_http!
|
|
@@ -278,7 +278,7 @@ module PredictabilityEngine
|
|
|
278
278
|
js_dir = File.join(Gem.loaded_specs['vega'].gem_dir, 'vendor', 'assets', 'javascripts')
|
|
279
279
|
{ '**/npm/vega@5**' => 'vega.js', '**/npm/vega-lite@5**' => 'vega-lite.js',
|
|
280
280
|
'**/npm/vega-embed@6**' => 'vega-embed.js' }.each do |pattern, filename|
|
|
281
|
-
content = File.
|
|
281
|
+
content = File.read(File.join(js_dir, filename), encoding: 'UTF-8')
|
|
282
282
|
page.route(pattern, ->(route, _req) { route.fulfill(body: content, contentType: 'application/javascript') })
|
|
283
283
|
end
|
|
284
284
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
+
require 'open3'
|
|
4
5
|
require 'bundler'
|
|
5
6
|
|
|
6
7
|
module PredictabilityEngine
|
|
@@ -22,6 +23,10 @@ module PredictabilityEngine
|
|
|
22
23
|
private
|
|
23
24
|
|
|
24
25
|
def install_ruby_dependencies
|
|
26
|
+
unless File.exist?(File.join(gem_root, 'Gemfile'))
|
|
27
|
+
PredictabilityEngine.logger.info { '==> Skipping bundle install (no Gemfile — gem install mode)' }
|
|
28
|
+
return
|
|
29
|
+
end
|
|
25
30
|
PredictabilityEngine.logger.info { '==> Installing Ruby dependencies' }
|
|
26
31
|
Bundler.with_unbundled_env do
|
|
27
32
|
system('bundle', 'install', '--jobs', '4', '--retry', '3') || raise(Error, 'bundle install failed')
|
|
@@ -42,11 +47,12 @@ module PredictabilityEngine
|
|
|
42
47
|
end
|
|
43
48
|
|
|
44
49
|
def node_major_version
|
|
45
|
-
|
|
50
|
+
out, = Open3.capture2('node', '--version')
|
|
51
|
+
raw = out.strip
|
|
46
52
|
return nil if raw.empty?
|
|
47
53
|
|
|
48
54
|
raw.delete_prefix('v').split('.').first.to_i
|
|
49
|
-
rescue Errno::ENOENT
|
|
55
|
+
rescue Errno::ENOENT, Errno::EACCES
|
|
50
56
|
nil
|
|
51
57
|
end
|
|
52
58
|
|
|
@@ -79,10 +85,10 @@ module PredictabilityEngine
|
|
|
79
85
|
def install_or_update_playwright
|
|
80
86
|
if !playwright_installed?
|
|
81
87
|
PredictabilityEngine.logger.info { '==> Installing Playwright (first run)' }
|
|
82
|
-
system(
|
|
88
|
+
system(npm_cmd, 'install', chdir: gem_root) || raise(Error, 'npm install failed')
|
|
83
89
|
elsif playwright_outdated?
|
|
84
90
|
PredictabilityEngine.logger.info { '==> Updating Playwright' }
|
|
85
|
-
system(
|
|
91
|
+
system(npm_cmd, 'update', 'playwright', chdir: gem_root) || raise(Error, 'npm update playwright failed')
|
|
86
92
|
else
|
|
87
93
|
PredictabilityEngine.logger.info { '==> Playwright — already up to date' }
|
|
88
94
|
end
|
|
@@ -90,11 +96,11 @@ module PredictabilityEngine
|
|
|
90
96
|
end
|
|
91
97
|
|
|
92
98
|
def playwright_installed?
|
|
93
|
-
File.exist?(File.join(gem_root, 'node_modules', '
|
|
99
|
+
File.exist?(File.join(gem_root, 'node_modules', 'playwright', 'package.json'))
|
|
94
100
|
end
|
|
95
101
|
|
|
96
102
|
def playwright_outdated?
|
|
97
|
-
raw = IO.popen(
|
|
103
|
+
raw = IO.popen([npm_cmd, 'outdated', '--json'], chdir: gem_root, err: File::NULL, &:read)
|
|
98
104
|
JSON.parse(raw).key?('playwright')
|
|
99
105
|
rescue JSON::ParserError
|
|
100
106
|
false
|
|
@@ -106,10 +112,28 @@ module PredictabilityEngine
|
|
|
106
112
|
return
|
|
107
113
|
end
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
args = [npx_cmd, 'playwright', 'install', 'chromium']
|
|
116
|
+
args << '--with-deps' if with_deps?
|
|
117
|
+
system(*args, chdir: gem_root) || raise(Error, 'playwright install chromium failed')
|
|
111
118
|
end
|
|
112
119
|
|
|
120
|
+
def windows?
|
|
121
|
+
!!(Gem::Platform.local.os =~ /mingw|mswin/)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# --with-deps installs OS-level libraries via apt-get/dnf and requires root.
|
|
125
|
+
# Only enable it when running as root (e.g. CI Docker containers).
|
|
126
|
+
def with_deps?
|
|
127
|
+
!windows? && root?
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def root?
|
|
131
|
+
Process.euid.zero?
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def npm_cmd = windows? ? 'npm.cmd' : 'npm'
|
|
135
|
+
def npx_cmd = windows? ? 'npx.cmd' : 'npx'
|
|
136
|
+
|
|
113
137
|
def gem_root
|
|
114
138
|
File.expand_path('../..', __dir__)
|
|
115
139
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: predictability-engine
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- cbp-org
|
|
@@ -560,7 +560,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
560
560
|
- !ruby/object:Gem::Version
|
|
561
561
|
version: '0'
|
|
562
562
|
requirements: []
|
|
563
|
-
rubygems_version: 4.0.
|
|
563
|
+
rubygems_version: 4.0.11
|
|
564
564
|
specification_version: 4
|
|
565
565
|
summary: Actionable Agile Metrics and Monte Carlo forecasting engine
|
|
566
566
|
test_files: []
|