cuprum 1.0.0.rc.0 → 1.0.0.rc.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/DEVELOPMENT.md +0 -19
- data/lib/cuprum/steps.rb +9 -66
- data/lib/cuprum/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: 1acf1f03e1b78fd7c90cb8b3eb96bd2ba8771b29dd92c743a7580c22700919df
|
4
|
+
data.tar.gz: 07eae29a24b5819cf80c646c016fb7e0508ffe93f5820795a74d1c2dfdbd6bf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cec2ebc229e0507dde9ca02aedf2bd93f55161151eef230f43408d4e39d7ab8b8711c655c72d4b193733f9a2b235e95cb390c57cccebb61f6e129915b261588c
|
7
|
+
data.tar.gz: d10c6180899006af62022ac1f9543897d258f8407a3dfca56d270f0eba356a7aabd418234330901dd3b8e3c55de27f07e9ae4c2c37398056800331bd8b6ae8f1
|
data/CHANGELOG.md
CHANGED
data/DEVELOPMENT.md
CHANGED
@@ -1,24 +1,5 @@
|
|
1
1
|
# Development
|
2
2
|
|
3
|
-
## Version 1.0.0
|
4
|
-
|
5
|
-
The "Look On My Works, Ye Mighty, and Despair" Update
|
6
|
-
|
7
|
-
- Documentation pass.
|
8
|
-
|
9
|
-
Steps Case Study: |
|
10
|
-
|
11
|
-
CMS application - creating a new post.
|
12
|
-
Directory has many Posts
|
13
|
-
Post has a Content
|
14
|
-
Post has many Tags
|
15
|
-
|
16
|
-
Find Directory
|
17
|
-
Create Post
|
18
|
-
Create Content
|
19
|
-
Tags.each { FindOrCreate Tag }
|
20
|
-
Publish Post # Requires that post have content
|
21
|
-
|
22
3
|
## Future Versions
|
23
4
|
|
24
5
|
Add `.rbs` files
|
data/lib/cuprum/steps.rb
CHANGED
@@ -63,56 +63,6 @@ module Cuprum
|
|
63
63
|
module Steps
|
64
64
|
include Cuprum::ResultHelpers
|
65
65
|
|
66
|
-
UNDEFINED = Object.new.freeze
|
67
|
-
private_constant :UNDEFINED
|
68
|
-
|
69
|
-
class << self
|
70
|
-
# @!visibility private
|
71
|
-
def execute_method(receiver, method_name, *args, **kwargs, &block)
|
72
|
-
if block_given? && kwargs.empty?
|
73
|
-
receiver.send(method_name, *args, &block)
|
74
|
-
elsif block_given?
|
75
|
-
receiver.send(method_name, *args, **kwargs, &block)
|
76
|
-
elsif kwargs.empty?
|
77
|
-
receiver.send(method_name, *args)
|
78
|
-
else
|
79
|
-
receiver.send(method_name, *args, **kwargs)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# @!visibility private
|
84
|
-
def extract_result_value(result)
|
85
|
-
return result unless result.respond_to?(:to_cuprum_result)
|
86
|
-
|
87
|
-
result = result.to_cuprum_result
|
88
|
-
|
89
|
-
return result.value if result.success?
|
90
|
-
|
91
|
-
throw :cuprum_failed_step, result
|
92
|
-
end
|
93
|
-
|
94
|
-
# rubocop:disable Metrics/MethodLength
|
95
|
-
# @!visibility private
|
96
|
-
def validate_method_name(method_name)
|
97
|
-
if method_name.nil?
|
98
|
-
raise ArgumentError,
|
99
|
-
'expected a block or a method name',
|
100
|
-
caller(1..-1)
|
101
|
-
end
|
102
|
-
|
103
|
-
unless method_name.is_a?(String) || method_name.is_a?(Symbol)
|
104
|
-
raise ArgumentError,
|
105
|
-
'expected method name to be a String or Symbol',
|
106
|
-
caller(1..-1)
|
107
|
-
end
|
108
|
-
|
109
|
-
return unless method_name.empty?
|
110
|
-
|
111
|
-
raise ArgumentError, "method name can't be blank", caller(1..-1)
|
112
|
-
end
|
113
|
-
# rubocop:enable Metrics/MethodLength
|
114
|
-
end
|
115
|
-
|
116
66
|
# Executes the block and returns the value, or halts on a failure.
|
117
67
|
#
|
118
68
|
# @yield Called with no parameters.
|
@@ -155,25 +105,18 @@ module Cuprum
|
|
155
105
|
# @example Calling a Step with a Failing Result
|
156
106
|
# # The #do_something_wrong method returns a failing Cuprum result.
|
157
107
|
# step { do_something_wrong() } # Throws the :cuprum_failed_step symbol.
|
158
|
-
def step
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
)
|
108
|
+
def step
|
109
|
+
raise ArgumentError, 'expected a block' unless block_given?
|
110
|
+
|
111
|
+
result = yield
|
112
|
+
|
113
|
+
return result unless result.respond_to?(:to_cuprum_result)
|
165
114
|
|
166
|
-
|
115
|
+
result = result.to_cuprum_result
|
167
116
|
|
168
|
-
|
169
|
-
.execute_method(self, method_name, *args, **kwargs, &block)
|
170
|
-
elsif !block_given?
|
171
|
-
raise ArgumentError, 'expected a block'
|
172
|
-
else
|
173
|
-
block.call
|
174
|
-
end
|
117
|
+
return result.value if result.success?
|
175
118
|
|
176
|
-
|
119
|
+
throw :cuprum_failed_step, result
|
177
120
|
end
|
178
121
|
|
179
122
|
# Returns the first failing #step result, or the final result if none fail.
|
data/lib/cuprum/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuprum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.rc.
|
4
|
+
version: 1.0.0.rc.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob "Merlin" Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sleeping_king_studios-tools
|