fbe 0.42.0 → 0.43.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e20ce6012a663c91fa76f4e332db9fcca0df0a00b5fae7ef53bb559653b8657d
4
- data.tar.gz: 76daff2e00b453611de5591b622b36e1ca16aaea86fd80966df27eec9738a187
3
+ metadata.gz: f86b0b823bccdb5e723fbdecd310066acc0cdb215773075a643f21f4cb96b539
4
+ data.tar.gz: a0941fa478e756ab1971bf483033d9cd77378ffff033ba53bebc810e7e7e91d9
5
5
  SHA512:
6
- metadata.gz: 535591e915b299f2ccd78d85e2a4f3876b539e9d6c39ac45e2da0e326cfc3309c13b84706567f94d2714b103da66abba634a90f155d42c8f68a4fe64b8417b3f
7
- data.tar.gz: a36a7ee9b7349deb85d05245cc2ade4366d429ea450e3180926a9d092e6a5087898038d4b37866c8d80c4ca1939186fac67b1f1fc26a996d18946f60eabdfe74
6
+ metadata.gz: e8ee05be4225d796f89567d8e8c15d956d6d1b2fcbb3cafbd1ff603d88a1b4be2bd5f4a1f397984a5202cacc8bfb336ebdac7eb51837fd507a5d6f87e70804e9
7
+ data.tar.gz: a5bc81d808a2475f74ac46801a5d472ca752716eabb210815b8aa767029bcb5d172b1c5ca8954c2aed036eb509659b0950368f1aa1ca8bba2191568cb5bb4f3f
@@ -20,4 +20,4 @@ jobs:
20
20
  runs-on: ubuntu-24.04
21
21
  steps:
22
22
  - uses: actions/checkout@v6
23
- - uses: DavidAnson/markdownlint-cli2-action@v20.0.0
23
+ - uses: DavidAnson/markdownlint-cli2-action@v21.0.0
@@ -16,6 +16,6 @@ jobs:
16
16
  runs-on: ubuntu-24.04
17
17
  steps:
18
18
  - uses: actions/checkout@v6
19
- - uses: crate-ci/typos@v1.39.0
19
+ - uses: crate-ci/typos@v1.40.0
20
20
  with:
21
21
  config: .github/.typos.toml
data/assets/pmp.xml ADDED
@@ -0,0 +1,89 @@
1
+ <?xml version='1.0'?>
2
+ <!--
3
+ SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
+ SPDX-License-Identifier: MIT
5
+ -->
6
+ <pmp>
7
+ <area name="hr">
8
+ <p>
9
+ <name>anger</name>
10
+ <default>2</default>
11
+ <type>int</type>
12
+ <memo>The level of anger</memo>
13
+ </p>
14
+ <p>
15
+ <name>days_to_reward</name>
16
+ <default>14</default>
17
+ <type>int</type>
18
+ <memo>How many days ago an event must happen so that we reward it?</memo>
19
+ </p>
20
+ <p>
21
+ <name>days_of_running_score</name>
22
+ <default>56</default>
23
+ <type>int</type>
24
+ <memo>How many days to include into the score of a person?</memo>
25
+ </p>
26
+ <p>
27
+ <name>master_punish_days</name>
28
+ <default>4</default>
29
+ <type>int</type>
30
+ <memo>Every X days to punish for direct push to master</memo>
31
+ </p>
32
+ </area>
33
+ <area name="integration">
34
+ <p>
35
+ <name>eva_interval</name>
36
+ <default>10</default>
37
+ <type>int</type>
38
+ <memo>Every X days to collect EVA statistics</memo>
39
+ </p>
40
+ <p>
41
+ <name>eva_learn_hours</name>
42
+ <default>8</default>
43
+ <type>int</type>
44
+ <memo>Every X hours to collect EVA numbers and learn the model using them</memo>
45
+ </p>
46
+ </area>
47
+ <area name="quality">
48
+ <p>
49
+ <name>paranoia</name>
50
+ <default>2</default>
51
+ <type>int</type>
52
+ <memo>The level of paranoia</memo>
53
+ </p>
54
+ <p>
55
+ <name>qos_days</name>
56
+ <default>32</default>
57
+ <type>int</type>
58
+ <memo>For how many days to collect QoS data</memo>
59
+ </p>
60
+ </area>
61
+ <area name="scope">
62
+ <p>
63
+ <name>qod_days</name>
64
+ <default>32</default>
65
+ <type>int</type>
66
+ <memo>For how many days to collect QoD data</memo>
67
+ </p>
68
+ </area>
69
+ <area name="cost">
70
+ <p>
71
+ <name>love</name>
72
+ <default>2</default>
73
+ <type>int</type>
74
+ <memo>The level of love</memo>
75
+ </p>
76
+ <p>
77
+ <name>award_price</name>
78
+ <default>0.0</default>
79
+ <type>float</type>
80
+ <memo>How many USD to pay for each award point</memo>
81
+ </p>
82
+ <p>
83
+ <name>slaves</name>
84
+ <default>torvalds</default>
85
+ <type>string</type>
86
+ <memo>List of people, who are not supposed to be paid real cash</memo>
87
+ </p>
88
+ </area>
89
+ </pmp>
data/lib/fbe/pmp.rb CHANGED
@@ -3,6 +3,8 @@
3
3
  # SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
4
4
  # SPDX-License-Identifier: MIT
5
5
 
6
+ require 'delegate'
7
+ require 'nokogiri'
6
8
  require 'others'
7
9
  require_relative '../fbe'
8
10
  require_relative 'fb'
@@ -41,18 +43,49 @@ require_relative 'fb'
41
43
  # # Get deadline from time area
42
44
  # deadline = Fbe.pmp.time.deadline
43
45
  def Fbe.pmp(fb: Fbe.fb, global: $global, options: $options, loog: $loog)
44
- others do |*args1|
45
- area = args1.first
46
- unless %w[cost scope hr time procurement risk integration quality communication].include?(area.to_s)
47
- raise "Invalid area #{area.inspect} (not part of PMBOK)"
46
+ xml = Nokogiri::XML(File.read(File.join(__dir__, '../../assets/pmp.xml')))
47
+ pmpv =
48
+ Class.new(SimpleDelegator) do
49
+ def initialize(value, dv)
50
+ super(value)
51
+ @dv = dv
52
+ end
53
+
54
+ def default
55
+ @dv
56
+ end
57
+ end
58
+ Class.new do
59
+ define_method(:areas) do
60
+ xml.xpath('/pmp/area/@name').map(&:value)
48
61
  end
49
- others do |*args2|
50
- param = args2.first
51
- f = Fbe.fb(global:, fb:, options:, loog:).query("(and (eq what 'pmp') (eq area '#{area}'))").each.first
52
- raise "Unknown area #{area.inspect}" if f.nil?
53
- r = f[param]
54
- raise "Unknown property #{param.inspect} in the #{area.inspect} area" if r.nil?
55
- r.first
62
+ others do |*args1|
63
+ area = args1.first.to_s
64
+ node = xml.at_xpath("/pmp/area[@name='#{area}']")
65
+ raise "Unknown area #{area.inspect}" if node.nil?
66
+ Class.new do
67
+ define_method(:properties) do
68
+ node.xpath('p/name').map(&:text)
69
+ end
70
+ others do |*args2|
71
+ param = args2.first.to_s
72
+ f = Fbe.fb(global:, fb:, options:, loog:).query("(and (eq what 'pmp') (eq area '#{area}'))").each.first
73
+ r = f&.[](param)&.first
74
+ prop = node.at_xpath("p[name='#{param}']")
75
+ dv = nil
76
+ if prop
77
+ d = prop.at_xpath('default').text
78
+ t = prop.at_xpath('type').text
79
+ dv =
80
+ case t
81
+ when 'int' then d.to_i
82
+ when 'float' then d.to_f
83
+ else d
84
+ end
85
+ end
86
+ pmpv.new(r || dv, dv)
87
+ end
88
+ end.new
56
89
  end
57
- end
90
+ end.new
58
91
  end
data/lib/fbe.rb CHANGED
@@ -10,5 +10,5 @@
10
10
  # License:: MIT
11
11
  module Fbe
12
12
  # Current version of the gem (changed by +.rultor.yml+ on every release)
13
- VERSION = '0.42.0' unless const_defined?(:VERSION)
13
+ VERSION = '0.43.1' unless const_defined?(:VERSION)
14
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fbe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.42.0
4
+ version: 0.43.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
@@ -375,6 +375,7 @@ files:
375
375
  - assets/bylaws/published-release-was-rewarded.fe.liquid
376
376
  - assets/bylaws/push-to-master-was-punished.fe.liquid
377
377
  - assets/bylaws/resolved-bug-was-rewarded.fe.liquid
378
+ - assets/pmp.xml
378
379
  - fbe.gemspec
379
380
  - lib/fbe.rb
380
381
  - lib/fbe/award.rb