rulezilla 0.4.5 → 0.4.7

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: a8ee7727cfe6615645b0684d845b89a12acb2f2c67791ce3a0804500ee5e2ab9
4
- data.tar.gz: d087ce428c000b31fb7c5a63fd0fbfa63de0784103cb08792724977d59a1855b
3
+ metadata.gz: 6941c7f485cc90010f97357c0662d7dd36c363be4067e02dd83d2e0aa034ab32
4
+ data.tar.gz: e87b673510615deeb29977215da82d056d17b33870d12982637b9af5f027374d
5
5
  SHA512:
6
- metadata.gz: be36cd5e03915645c49ac0ed3abcd893ae54c3a33cf650635bbe82457b45cd8499e1beb72816d2e1feedb1829177f9fc89dd5e7e9790c144a3e333255b4f90d3
7
- data.tar.gz: 16f3705107ff1e3d9ad3e0a45740b90ad60b4aad80d340a0bf97ab0ef2a38ee800deca1480f0ba6c71acceb1fd7fd9056703811c53fb18f538fc87edfa19ee02
6
+ metadata.gz: d0dd7029f354b0d45e13a300367cb56c34754e5df15985cef57c4e6c704805b3d1f3474f19c4d38ee83c0df33267cd7c0487e91aedeb711b2763e8c1f18df8a7
7
+ data.tar.gz: fab0af6a0152a830c58ef882c625e6e25861a3ffcd1a076d407a7592da96ad7abf3d22209cf9ed1575a85d5960fa462549a4cf6a6611cad373103907751540a3
@@ -18,7 +18,7 @@ jobs:
18
18
 
19
19
  strategy:
20
20
  matrix:
21
- ruby-version: [2.7, 3.0, 3.1]
21
+ ruby-version: [3.2, 3.3, 3.4]
22
22
 
23
23
  steps:
24
24
  - uses: actions/checkout@v3
@@ -0,0 +1,30 @@
1
+ name: Huxley TechDocs
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: master
7
+ paths:
8
+ - "docs/**"
9
+ - "mkdocs.yml"
10
+ - ".github/workflows/publish-docs.yaml"
11
+ pull_request:
12
+ branches: master
13
+ paths:
14
+ - "docs/**"
15
+ - "mkdocs.yaml"
16
+ - ".github/workflows/publish-docs.yaml"
17
+ schedule:
18
+ - cron: "15 3 1 * *"
19
+
20
+ concurrency: huxley-techdocs-${{ github.ref }}
21
+
22
+ jobs:
23
+ publish-techdocs:
24
+ uses: simplybusiness/github-action-reusable-workflows/.github/workflows/techdocs.yaml@v1
25
+ with:
26
+ repo: "github-action-reusable-workflows"
27
+ secrets:
28
+ region: ${{ secrets.AWS_LIVE_CICD_REGION }}
29
+ aws-access-key-id: ${{ secrets.AWS_LIVE_CICD_ACCESS_KEY_ID }}
30
+ aws-secret-access-key: ${{ secrets.AWS_LIVE_CICD_SECRET_ACCESS_KEY }}
@@ -13,7 +13,7 @@ jobs:
13
13
  runs-on: ubuntu-latest
14
14
 
15
15
  steps:
16
- - uses: simplybusiness/version-forget-me-not@v2.3.0
16
+ - uses: simplybusiness/version-forget-me-not@v2
17
17
  env:
18
18
  ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19
19
  VERSION_FILE_PATH: "lib/rulezilla/version.rb"
data/.gitignore CHANGED
@@ -1,5 +1,4 @@
1
1
  .bundle
2
2
  Gemfile.lock
3
- .ruby-version
4
3
  .ruby-gemset
5
4
  .idea/
data/.rubocop_todo.yml CHANGED
@@ -1,36 +1,36 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-07-06 10:13:12 UTC using RuboCop version 1.31.1.
3
+ # on 2025-02-28 15:35:40 UTC using RuboCop version 1.73.1.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Include.
10
+ # Configuration parameters: Severity, Include.
11
11
  # Include: **/*.gemspec
12
12
  Gemspec/RequiredRubyVersion:
13
13
  Exclude:
14
14
  - 'rulezilla.gemspec'
15
15
 
16
16
  # Offense count: 1
17
- # Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
17
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
18
18
  Metrics/AbcSize:
19
19
  Max: 20
20
20
 
21
21
  # Offense count: 2
22
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
23
- # IgnoredMethods: refine
22
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
23
+ # AllowedMethods: refine
24
24
  Metrics/BlockLength:
25
25
  Max: 32
26
26
 
27
27
  # Offense count: 2
28
- # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
28
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
29
29
  Metrics/MethodLength:
30
30
  Max: 19
31
31
 
32
32
  # Offense count: 3
33
- # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
33
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
34
34
  # NamePrefix: is_, has_, have_
35
35
  # ForbiddenPrefixes: is_, has_, have_
36
36
  # AllowedMethods: is_a?
@@ -41,7 +41,7 @@ Naming/PredicateName:
41
41
  - 'lib/rulezilla/node.rb'
42
42
  - 'lib/rulezilla/tree.rb'
43
43
 
44
- # Offense count: 6
44
+ # Offense count: 5
45
45
  # Configuration parameters: AllowedConstants.
46
46
  Style/Documentation:
47
47
  Exclude:
@@ -51,11 +51,10 @@ Style/Documentation:
51
51
  - 'lib/rulezilla/dsl.rb'
52
52
  - 'lib/rulezilla/node.rb'
53
53
  - 'lib/rulezilla/tree.rb'
54
- - 'lib/rulezilla/version.rb'
55
54
 
56
- # Offense count: 3
55
+ # Offense count: 2
56
+ # This cop supports safe autocorrection (--autocorrect).
57
57
  # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
58
58
  Style/GuardClause:
59
59
  Exclude:
60
60
  - 'lib/rulezilla/dsl.rb'
61
- - 'rulezilla.gemspec'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.4.1
data/README.md CHANGED
@@ -1,115 +1 @@
1
- [![Build Status](https://semaphoreci.com/api/v1/projects/e488365d-9c57-4431-916a-72aea091d1b5/229083/shields_badge.svg)](https://semaphoreci.com/simplybusiness/rulezilla)
2
- [![Code Climate](https://codeclimate.com/repos/53ecc0416956800c1d01f6bf/badges/76b47eaeffc33e312508/gpa.svg)](https://codeclimate.com/repos/53ecc0416956800c1d01f6bf/feed)
3
- [![Gem Version](https://badge.fury.io/rb/rulezilla.svg)](http://badge.fury.io/rb/rulezilla)
4
-
5
- rulezilla
6
- =========
7
-
8
- This provides a DSL to implement rules for various tasks. In the current version we are still relying on user to have a certain level of Ruby knowledge
9
- in order to be able to use this DSL. The ultimate goal is for people without prior Ruby knowledge to be able to change and even write the Rule.
10
-
11
-
12
- # Installation
13
-
14
- ## Using `Gemfile`
15
-
16
- Add the following line to your `Gemfile`:
17
-
18
- gem 'rulezilla'
19
-
20
- Then run:
21
-
22
- bundle install
23
-
24
- ## Without `Gemfile`
25
-
26
- On your command line run the following:
27
-
28
- gem install 'rulezilla'
29
-
30
- ## Usage
31
-
32
- ### Rules
33
-
34
- Rules are defined in Ruby. Rules are classes that include the `Rulezilla::DSL`.
35
-
36
- #### Ruby
37
-
38
- You can use plain Ruby to define the rule classes. But you will need to include the `Rulezilla::DSL` module. That will give you access to the DSL used to define rules.
39
-
40
- Here is an example:
41
-
42
- class RoboticsRule
43
- include Rulezilla::DSL
44
-
45
- group :may_not_injure_human do
46
- condition { not_injure_human? }
47
-
48
- group :obey_human do
49
- condition { do_as_human_told? }
50
-
51
- define :protect_its_own_existence do
52
- condition { protect_itself? }
53
- result(true)
54
- end
55
- end
56
- end
57
-
58
- default(false)
59
-
60
- end
61
-
62
- Please refer to the [feature](spec/features/rulezilla_dsl_framework.feature) for further details of the DSL.
63
-
64
- ### Support Module
65
-
66
- The support module will be automatically included if its name is `"#{rule_class_name}Support"`
67
-
68
- e.g. if the rule class name is `RoboticsRule`, then the support would be `RoboticsRuleSupport`
69
-
70
- module RoboticsRuleSupport
71
- def protect_itself?
72
- in_danger? && not_letting_itself_be_detroyed?
73
- end
74
- end
75
-
76
- ### How to execute the rule
77
-
78
- If the entity is:
79
-
80
- entity = {
81
- not_injure_human?: true,
82
- do_as_human_told?: true,
83
- in_danger?: true,
84
- not_letting_itself_be_detroyed?: true
85
- }
86
-
87
- #### To get the first matching result output
88
-
89
- RoboticsRule.apply(entity) #=> true
90
-
91
- #### To get all matching result outputs
92
-
93
- RoboticsRule.all(entity) #=> [true, false]
94
-
95
- Note that `false` is the result outcome coming out from `default(false)` on top level, which is also called `root node`. The `root` node does not have any condition and hence
96
- it is considered to be matching. This means, by consequence, that its result (`default(false)`) is included in the list of matching result outputs which `#all(entity)` above
97
- returns.
98
-
99
- #### To get the trace of all nodes
100
-
101
- RoboticsRule.trace(entity)
102
- #=> all the nodes instance: [root, may_not_injure_human, obey_human, protect_its_own_existence] in sequence order.
103
-
104
- #### To get all results from the Rule
105
-
106
- RoboticsRule.results #=> [true, false]
107
-
108
-
109
- ### Syntax
110
-
111
- Please refer to the features for DSL syntax:
112
-
113
- [DSL Feature](spec/features/rulezilla_dsl_framework.feature),
114
-
115
- [Default Support Methods Feature](spec/features/default_support_methods.feature)
1
+ All documentation is now in the `docs/` subdirectory, or can be viewed in rendered form on Backstage. Start with the [index](docs/index.md)
@@ -0,0 +1,9 @@
1
+ version: 0.2
2
+
3
+ phases:
4
+ install:
5
+ commands:
6
+ - docker_setup
7
+ build:
8
+ commands:
9
+ - run_huxley publish_backstage_docs
data/catalog-info.yaml CHANGED
@@ -2,7 +2,9 @@ apiVersion: backstage.io/v1alpha1
2
2
  kind: Component
3
3
  metadata:
4
4
  name: rulezilla
5
- description: Rule DSL
5
+ description: Rule DSL
6
+ annotations:
7
+ backstage.io/techdocs-ref: dir:.
6
8
  spec:
7
9
  type: library
8
10
  lifecycle: production
data/docs/index.md ADDED
@@ -0,0 +1,115 @@
1
+ [![Build Status](https://semaphoreci.com/api/v1/projects/e488365d-9c57-4431-916a-72aea091d1b5/229083/shields_badge.svg)](https://semaphoreci.com/simplybusiness/rulezilla)
2
+ [![Code Climate](https://codeclimate.com/repos/53ecc0416956800c1d01f6bf/badges/76b47eaeffc33e312508/gpa.svg)](https://codeclimate.com/repos/53ecc0416956800c1d01f6bf/feed)
3
+ [![Gem Version](https://badge.fury.io/rb/rulezilla.svg)](http://badge.fury.io/rb/rulezilla)
4
+
5
+ rulezilla
6
+ =========
7
+
8
+ This provides a DSL to implement rules for various tasks. In the current version we are still relying on user to have a certain level of Ruby knowledge
9
+ in order to be able to use this DSL. The ultimate goal is for people without prior Ruby knowledge to be able to change and even write the Rule.
10
+
11
+
12
+ # Installation
13
+
14
+ ## Using `Gemfile`
15
+
16
+ Add the following line to your `Gemfile`:
17
+
18
+ gem 'rulezilla'
19
+
20
+ Then run:
21
+
22
+ bundle install
23
+
24
+ ## Without `Gemfile`
25
+
26
+ On your command line run the following:
27
+
28
+ gem install 'rulezilla'
29
+
30
+ ## Usage
31
+
32
+ ### Rules
33
+
34
+ Rules are defined in Ruby. Rules are classes that include the `Rulezilla::DSL`.
35
+
36
+ #### Ruby
37
+
38
+ You can use plain Ruby to define the rule classes. But you will need to include the `Rulezilla::DSL` module. That will give you access to the DSL used to define rules.
39
+
40
+ Here is an example:
41
+
42
+ class RoboticsRule
43
+ include Rulezilla::DSL
44
+
45
+ group :may_not_injure_human do
46
+ condition { not_injure_human? }
47
+
48
+ group :obey_human do
49
+ condition { do_as_human_told? }
50
+
51
+ define :protect_its_own_existence do
52
+ condition { protect_itself? }
53
+ result(true)
54
+ end
55
+ end
56
+ end
57
+
58
+ default(false)
59
+
60
+ end
61
+
62
+ Please refer to the [feature](spec/features/rulezilla_dsl_framework.feature) for further details of the DSL.
63
+
64
+ ### Support Module
65
+
66
+ The support module will be automatically included if its name is `"#{rule_class_name}Support"`
67
+
68
+ e.g. if the rule class name is `RoboticsRule`, then the support would be `RoboticsRuleSupport`
69
+
70
+ module RoboticsRuleSupport
71
+ def protect_itself?
72
+ in_danger? && not_letting_itself_be_detroyed?
73
+ end
74
+ end
75
+
76
+ ### How to execute the rule
77
+
78
+ If the entity is:
79
+
80
+ entity = {
81
+ not_injure_human?: true,
82
+ do_as_human_told?: true,
83
+ in_danger?: true,
84
+ not_letting_itself_be_detroyed?: true
85
+ }
86
+
87
+ #### To get the first matching result output
88
+
89
+ RoboticsRule.apply(entity) #=> true
90
+
91
+ #### To get all matching result outputs
92
+
93
+ RoboticsRule.all(entity) #=> [true, false]
94
+
95
+ Note that `false` is the result outcome coming out from `default(false)` on top level, which is also called `root node`. The `root` node does not have any condition and hence
96
+ it is considered to be matching. This means, by consequence, that its result (`default(false)`) is included in the list of matching result outputs which `#all(entity)` above
97
+ returns.
98
+
99
+ #### To get the trace of all nodes
100
+
101
+ RoboticsRule.trace(entity)
102
+ #=> all the nodes instance: [root, may_not_injure_human, obey_human, protect_its_own_existence] in sequence order.
103
+
104
+ #### To get all results from the Rule
105
+
106
+ RoboticsRule.results #=> [true, false]
107
+
108
+
109
+ ### Syntax
110
+
111
+ Please refer to the features for DSL syntax:
112
+
113
+ [DSL Feature](spec/features/rulezilla_dsl_framework.feature),
114
+
115
+ [Default Support Methods Feature](spec/features/default_support_methods.feature)
data/lib/rulezilla/dsl.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'ostruct'
4
+
3
5
  module Rulezilla
4
6
  module DSL
5
7
  def self.included(base)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rulezilla
4
- VERSION = '0.4.5'
4
+ VERSION = '0.4.7'
5
5
  end
data/mkdocs.yaml ADDED
@@ -0,0 +1,8 @@
1
+ site_name: Rulezilla Docs
2
+ repo_url: https://github.com/simplybusiness/rulezilla
3
+ edit_uri: blob/master/docs/
4
+ docs_dir: "docs"
5
+ nav:
6
+ - Home: index.md
7
+ plugins:
8
+ - techdocs-core
data/rulezilla.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
17
17
  gem.version = Rulezilla::VERSION
18
18
  gem.license = 'MIT'
19
19
 
20
+ gem.add_runtime_dependency('ostruct')
20
21
  gem.add_runtime_dependency('rspec')
21
22
  gem.add_development_dependency('pry')
22
23
  gem.add_development_dependency('pry-doc')
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rulezilla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simply Business
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
10
+ date: 2025-02-28 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ostruct
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: rspec
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +104,7 @@ files:
91
104
  - ".github/workflows/codeql-analysis.yaml"
92
105
  - ".github/workflows/dobby-actions.yml"
93
106
  - ".github/workflows/gem-publish.yaml"
107
+ - ".github/workflows/publish-docs.yaml"
94
108
  - ".github/workflows/version-forget-me-not.yaml"
95
109
  - ".gitignore"
96
110
  - ".rspec"
@@ -101,13 +115,16 @@ files:
101
115
  - Gemfile
102
116
  - LICENSE.txt
103
117
  - README.md
118
+ - _pipeline/stage_publishdocs.yml
104
119
  - catalog-info.yaml
120
+ - docs/index.md
105
121
  - lib/rulezilla.rb
106
122
  - lib/rulezilla/basic_support.rb
107
123
  - lib/rulezilla/dsl.rb
108
124
  - lib/rulezilla/node.rb
109
125
  - lib/rulezilla/tree.rb
110
126
  - lib/rulezilla/version.rb
127
+ - mkdocs.yaml
111
128
  - rulezilla.gemspec
112
129
  - spec/features/default_support_methods.feature
113
130
  - spec/features/rulezilla_dsl_framework.feature
@@ -117,7 +134,6 @@ homepage: https://github.com/simplybusiness/rulezilla
117
134
  licenses:
118
135
  - MIT
119
136
  metadata: {}
120
- post_install_message:
121
137
  rdoc_options: []
122
138
  require_paths:
123
139
  - lib
@@ -132,8 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
148
  - !ruby/object:Gem::Version
133
149
  version: '0'
134
150
  requirements: []
135
- rubygems_version: 3.3.7
136
- signing_key:
151
+ rubygems_version: 3.6.2
137
152
  specification_version: 4
138
153
  summary: Rules DSL
139
154
  test_files: []