From 0feb3174c8f835ecd2f79889d060ba088d9022aa Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Wed, 16 Sep 2020 14:04:49 -0600 Subject: [PATCH 1/2] -rename to AEPRulesEngine and add spm support for static & dynamic targets (#18) --- .gitignore | 2 +- .../contents.xcworkspacedata | 7 - .../xcschemes/RulesEngine-Package.xcscheme | 153 ------------------ .../xcschemes/RulesEngine.xcscheme | 77 --------- Package.swift | 32 +--- README.md | 4 +- .../ConditionEvaluator.swift | 0 .../Evaluable.swift | 0 .../Evaluating.swift | 0 .../Expression/ComparisonExpression.swift | 0 .../Expression/LogicalExpression.swift | 0 .../Expression/Operand.swift | 0 .../Expression/UnaryExpression.swift | 0 .../Operand+Literal.swift | 0 .../Result+RulesFailure.swift | 0 .../Rule.swift | 0 .../RulesEngine.swift | 0 .../RulesEngineLog.swift | 0 .../RulesEngineLogging.swift | 0 .../Template/MustacheToken.swift | 0 .../Template/Segment.swift | 0 .../Template/Template.swift | 0 .../Template/TemplateParser.swift | 0 .../Transforming.swift | 0 .../Traversable.swift | 0 SwiftRulesEngine.podspec | 6 +- .../UnitTests/ExpressionTests.swift | 2 +- .../UnitTests/ParserTests.swift | 2 +- .../UnitTests/RulesEngineDebugTests.swift | 2 +- .../UnitTests/RulesEngineTests.swift | 2 +- .../UnitTests/TraverseTests.swift | 2 +- 31 files changed, 17 insertions(+), 274 deletions(-) delete mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/RulesEngine-Package.xcscheme delete mode 100644 .swiftpm/xcode/xcshareddata/xcschemes/RulesEngine.xcscheme rename Sources/{SwiftRulesEngine => AEPRulesEngine}/ConditionEvaluator.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Evaluable.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Evaluating.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Expression/ComparisonExpression.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Expression/LogicalExpression.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Expression/Operand.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Expression/UnaryExpression.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Operand+Literal.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Result+RulesFailure.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Rule.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/RulesEngine.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/RulesEngineLog.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/RulesEngineLogging.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Template/MustacheToken.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Template/Segment.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Template/Template.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Template/TemplateParser.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Transforming.swift (100%) rename Sources/{SwiftRulesEngine => AEPRulesEngine}/Traversable.swift (100%) rename Tests/{SwiftRulesEngineTests => AEPRulesEngineTests}/UnitTests/ExpressionTests.swift (99%) rename Tests/{SwiftRulesEngineTests => AEPRulesEngineTests}/UnitTests/ParserTests.swift (98%) rename Tests/{SwiftRulesEngineTests => AEPRulesEngineTests}/UnitTests/RulesEngineDebugTests.swift (98%) rename Tests/{SwiftRulesEngineTests => AEPRulesEngineTests}/UnitTests/RulesEngineTests.swift (98%) rename Tests/{SwiftRulesEngineTests => AEPRulesEngineTests}/UnitTests/TraverseTests.swift (98%) diff --git a/.gitignore b/.gitignore index 1884ef2..ee56e1a 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,7 @@ playground.xcworkspace # # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata # hence it is not needed unless you have added a package configuration file to your project -# .swiftpm +.swiftpm .build/ diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine-Package.xcscheme deleted file mode 100644 index a588d19..0000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine-Package.xcscheme +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine.xcscheme deleted file mode 100644 index 22b5856..0000000 --- a/.swiftpm/xcode/xcshareddata/xcschemes/RulesEngine.xcscheme +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Package.swift b/Package.swift index f799f08..cdce476 100644 --- a/Package.swift +++ b/Package.swift @@ -4,17 +4,11 @@ import PackageDescription let package = Package( - name: "SwiftRulesEngine", + name: "AEPRulesEngine", products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. - .library( - name: "SwiftRulesEngine", - targets: ["SwiftRulesEngine"] - ) -// -// .library( -// name: "RulesDSL", -// targets: ["RulesDSL"]) + .library(name: "AEPRulesEngine", targets: ["AEPRulesEngine"]), + .library(name: "AEPRulesEngineDynamic", type: .dynamic, targets: ["AEPRulesEngine"]), + .library(name: "AEPRulesEngineStatic", type: .static, targets: ["AEPRulesEngine"]), ], dependencies: [ // Dependencies declare other packages that this package depends on. @@ -22,21 +16,7 @@ let package = Package( // .package(url: "https://github.com/Realm/SwiftLint", from: "0.28.1") ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. - .target( - name: "SwiftRulesEngine", - dependencies: [] - ), - .testTarget( - name: "SwiftRulesEngineTests", - dependencies: ["SwiftRulesEngine"] - ), -// .target( -// name: "RulesDSL", -// dependencies: []), -// .testTarget( -// name: "RulesDSLTests", -// dependencies: ["RulesEngine", "RulesDSL"]) + .target(name: "AEPRulesEngine", dependencies: []), + .testTarget(name: "AEPRulesEngineTests", dependencies: ["AEPRulesEngine"]), ] ) diff --git a/README.md b/README.md index 5e6ffc7..d3decc5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rules Engine +# AEPRulesEngine ## Overview @@ -37,7 +37,7 @@ let condition = ComparisonExpression(lhs: "abc", operationName: "equals", rhs: " let rule = ConsequenceRule(id: "sample-rule", condition: condition) rulesEngine.addRules(rules: [rule]) ``` -However, a rule like this doesn't make much sense, without the ability to dynamically fetch a value it will always be true or false. +However, a rule like this doesn't make much sense, without the ability to dynamically fetch a value it will always be true or false. ``` let mustache = Operand(mustache: "{{company}}") diff --git a/Sources/SwiftRulesEngine/ConditionEvaluator.swift b/Sources/AEPRulesEngine/ConditionEvaluator.swift similarity index 100% rename from Sources/SwiftRulesEngine/ConditionEvaluator.swift rename to Sources/AEPRulesEngine/ConditionEvaluator.swift diff --git a/Sources/SwiftRulesEngine/Evaluable.swift b/Sources/AEPRulesEngine/Evaluable.swift similarity index 100% rename from Sources/SwiftRulesEngine/Evaluable.swift rename to Sources/AEPRulesEngine/Evaluable.swift diff --git a/Sources/SwiftRulesEngine/Evaluating.swift b/Sources/AEPRulesEngine/Evaluating.swift similarity index 100% rename from Sources/SwiftRulesEngine/Evaluating.swift rename to Sources/AEPRulesEngine/Evaluating.swift diff --git a/Sources/SwiftRulesEngine/Expression/ComparisonExpression.swift b/Sources/AEPRulesEngine/Expression/ComparisonExpression.swift similarity index 100% rename from Sources/SwiftRulesEngine/Expression/ComparisonExpression.swift rename to Sources/AEPRulesEngine/Expression/ComparisonExpression.swift diff --git a/Sources/SwiftRulesEngine/Expression/LogicalExpression.swift b/Sources/AEPRulesEngine/Expression/LogicalExpression.swift similarity index 100% rename from Sources/SwiftRulesEngine/Expression/LogicalExpression.swift rename to Sources/AEPRulesEngine/Expression/LogicalExpression.swift diff --git a/Sources/SwiftRulesEngine/Expression/Operand.swift b/Sources/AEPRulesEngine/Expression/Operand.swift similarity index 100% rename from Sources/SwiftRulesEngine/Expression/Operand.swift rename to Sources/AEPRulesEngine/Expression/Operand.swift diff --git a/Sources/SwiftRulesEngine/Expression/UnaryExpression.swift b/Sources/AEPRulesEngine/Expression/UnaryExpression.swift similarity index 100% rename from Sources/SwiftRulesEngine/Expression/UnaryExpression.swift rename to Sources/AEPRulesEngine/Expression/UnaryExpression.swift diff --git a/Sources/SwiftRulesEngine/Operand+Literal.swift b/Sources/AEPRulesEngine/Operand+Literal.swift similarity index 100% rename from Sources/SwiftRulesEngine/Operand+Literal.swift rename to Sources/AEPRulesEngine/Operand+Literal.swift diff --git a/Sources/SwiftRulesEngine/Result+RulesFailure.swift b/Sources/AEPRulesEngine/Result+RulesFailure.swift similarity index 100% rename from Sources/SwiftRulesEngine/Result+RulesFailure.swift rename to Sources/AEPRulesEngine/Result+RulesFailure.swift diff --git a/Sources/SwiftRulesEngine/Rule.swift b/Sources/AEPRulesEngine/Rule.swift similarity index 100% rename from Sources/SwiftRulesEngine/Rule.swift rename to Sources/AEPRulesEngine/Rule.swift diff --git a/Sources/SwiftRulesEngine/RulesEngine.swift b/Sources/AEPRulesEngine/RulesEngine.swift similarity index 100% rename from Sources/SwiftRulesEngine/RulesEngine.swift rename to Sources/AEPRulesEngine/RulesEngine.swift diff --git a/Sources/SwiftRulesEngine/RulesEngineLog.swift b/Sources/AEPRulesEngine/RulesEngineLog.swift similarity index 100% rename from Sources/SwiftRulesEngine/RulesEngineLog.swift rename to Sources/AEPRulesEngine/RulesEngineLog.swift diff --git a/Sources/SwiftRulesEngine/RulesEngineLogging.swift b/Sources/AEPRulesEngine/RulesEngineLogging.swift similarity index 100% rename from Sources/SwiftRulesEngine/RulesEngineLogging.swift rename to Sources/AEPRulesEngine/RulesEngineLogging.swift diff --git a/Sources/SwiftRulesEngine/Template/MustacheToken.swift b/Sources/AEPRulesEngine/Template/MustacheToken.swift similarity index 100% rename from Sources/SwiftRulesEngine/Template/MustacheToken.swift rename to Sources/AEPRulesEngine/Template/MustacheToken.swift diff --git a/Sources/SwiftRulesEngine/Template/Segment.swift b/Sources/AEPRulesEngine/Template/Segment.swift similarity index 100% rename from Sources/SwiftRulesEngine/Template/Segment.swift rename to Sources/AEPRulesEngine/Template/Segment.swift diff --git a/Sources/SwiftRulesEngine/Template/Template.swift b/Sources/AEPRulesEngine/Template/Template.swift similarity index 100% rename from Sources/SwiftRulesEngine/Template/Template.swift rename to Sources/AEPRulesEngine/Template/Template.swift diff --git a/Sources/SwiftRulesEngine/Template/TemplateParser.swift b/Sources/AEPRulesEngine/Template/TemplateParser.swift similarity index 100% rename from Sources/SwiftRulesEngine/Template/TemplateParser.swift rename to Sources/AEPRulesEngine/Template/TemplateParser.swift diff --git a/Sources/SwiftRulesEngine/Transforming.swift b/Sources/AEPRulesEngine/Transforming.swift similarity index 100% rename from Sources/SwiftRulesEngine/Transforming.swift rename to Sources/AEPRulesEngine/Transforming.swift diff --git a/Sources/SwiftRulesEngine/Traversable.swift b/Sources/AEPRulesEngine/Traversable.swift similarity index 100% rename from Sources/SwiftRulesEngine/Traversable.swift rename to Sources/AEPRulesEngine/Traversable.swift diff --git a/SwiftRulesEngine.podspec b/SwiftRulesEngine.podspec index 1fb3c10..e7151f2 100644 --- a/SwiftRulesEngine.podspec +++ b/SwiftRulesEngine.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| - s.name = "SwiftRulesEngine" + s.name = "AEPRulesEngine" s.version = "0.0.1" - s.summary = "SwiftRulesEngine" + s.summary = "AEPRulesEngine" s.description = <<-DESC A simple, generic, extensible Rules Engine in Swift DESC @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.ios.deployment_target = '10.0' s.swift_version = '5.0' - s.source_files = 'Sources/SwiftRulesEngine/**/*.swift' + s.source_files = 'Sources/AEPRulesEngine/**/*.swift' end diff --git a/Tests/SwiftRulesEngineTests/UnitTests/ExpressionTests.swift b/Tests/AEPRulesEngineTests/UnitTests/ExpressionTests.swift similarity index 99% rename from Tests/SwiftRulesEngineTests/UnitTests/ExpressionTests.swift rename to Tests/AEPRulesEngineTests/UnitTests/ExpressionTests.swift index 8d496f4..03d9782 100644 --- a/Tests/SwiftRulesEngineTests/UnitTests/ExpressionTests.swift +++ b/Tests/AEPRulesEngineTests/UnitTests/ExpressionTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest -@testable import SwiftRulesEngine +@testable import AEPRulesEngine struct CustomOperand: Traversable { func get(key:String) -> Any? { return key diff --git a/Tests/SwiftRulesEngineTests/UnitTests/ParserTests.swift b/Tests/AEPRulesEngineTests/UnitTests/ParserTests.swift similarity index 98% rename from Tests/SwiftRulesEngineTests/UnitTests/ParserTests.swift rename to Tests/AEPRulesEngineTests/UnitTests/ParserTests.swift index 349c51e..b45b0f6 100644 --- a/Tests/SwiftRulesEngineTests/UnitTests/ParserTests.swift +++ b/Tests/AEPRulesEngineTests/UnitTests/ParserTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest -@testable import SwiftRulesEngine +@testable import AEPRulesEngine class ParserTests: XCTestCase { override func setUp() { diff --git a/Tests/SwiftRulesEngineTests/UnitTests/RulesEngineDebugTests.swift b/Tests/AEPRulesEngineTests/UnitTests/RulesEngineDebugTests.swift similarity index 98% rename from Tests/SwiftRulesEngineTests/UnitTests/RulesEngineDebugTests.swift rename to Tests/AEPRulesEngineTests/UnitTests/RulesEngineDebugTests.swift index c05b7c2..b176c27 100644 --- a/Tests/SwiftRulesEngineTests/UnitTests/RulesEngineDebugTests.swift +++ b/Tests/AEPRulesEngineTests/UnitTests/RulesEngineDebugTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest -@testable import SwiftRulesEngine +@testable import AEPRulesEngine class RulesEngineDebugTests: XCTestCase { override func setUp() { diff --git a/Tests/SwiftRulesEngineTests/UnitTests/RulesEngineTests.swift b/Tests/AEPRulesEngineTests/UnitTests/RulesEngineTests.swift similarity index 98% rename from Tests/SwiftRulesEngineTests/UnitTests/RulesEngineTests.swift rename to Tests/AEPRulesEngineTests/UnitTests/RulesEngineTests.swift index 83cfa5b..806a57f 100644 --- a/Tests/SwiftRulesEngineTests/UnitTests/RulesEngineTests.swift +++ b/Tests/AEPRulesEngineTests/UnitTests/RulesEngineTests.swift @@ -13,7 +13,7 @@ import Foundation import XCTest -@testable import SwiftRulesEngine +@testable import AEPRulesEngine class RulesEngineTests: XCTestCase { override func setUp() { diff --git a/Tests/SwiftRulesEngineTests/UnitTests/TraverseTests.swift b/Tests/AEPRulesEngineTests/UnitTests/TraverseTests.swift similarity index 98% rename from Tests/SwiftRulesEngineTests/UnitTests/TraverseTests.swift rename to Tests/AEPRulesEngineTests/UnitTests/TraverseTests.swift index 4948553..e68f070 100644 --- a/Tests/SwiftRulesEngineTests/UnitTests/TraverseTests.swift +++ b/Tests/AEPRulesEngineTests/UnitTests/TraverseTests.swift @@ -12,7 +12,7 @@ import Foundation -@testable import SwiftRulesEngine +@testable import AEPRulesEngine import XCTest extension Array: Traversable { From 23bb1679b1d7f02b5a09103578c4402afe8242c3 Mon Sep 17 00:00:00 2001 From: Steve Benedick Date: Wed, 16 Sep 2020 14:37:43 -0600 Subject: [PATCH 2/2] rename podspec (#19) * -rename to AEPRulesEngine and add spm support for static & dynamic targets * -fix podspec name --- SwiftRulesEngine.podspec => AEPRulesEngine.podspec | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename SwiftRulesEngine.podspec => AEPRulesEngine.podspec (100%) diff --git a/SwiftRulesEngine.podspec b/AEPRulesEngine.podspec similarity index 100% rename from SwiftRulesEngine.podspec rename to AEPRulesEngine.podspec