block_repeater 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1e8e6a3d4e23e4a4ae9393ad3d88af3d17cc8740ba233553017721b96fdebf86
4
+ data.tar.gz: 34ae892f2748bef12418fd48fc2543615d15625a1268f9d25251259f06101125
5
+ SHA512:
6
+ metadata.gz: 7b5c660ec13efdd6d00f3ab892128b769b0ca8e037483c3519c9441b1952cc5b6806b00cad69619a8867fb2e5c14b50bb2364313339fceb85e5a7d70f9308658
7
+ data.tar.gz: 47ad3e0e3dd09ded940f95367737670e8a00ffde0b08d13d0a8549ae726020e79a9b0c336b2164c30f153f2cad180d69c8c73a0eb8ec7766ccd9fa485de6f76a
data/.drone.yml ADDED
@@ -0,0 +1,32 @@
1
+ ---
2
+ kind: pipeline
3
+ name: default
4
+
5
+ platform:
6
+ os: linux
7
+ arch: amd64
8
+
9
+ steps:
10
+ - name: unit tests
11
+ pull: if-not-exists
12
+ image: ecr.tooling.dvla.gov.uk/base-images/qe-ruby:2.7.0-1
13
+ commands:
14
+ - bundle --jobs 5 --quiet
15
+ - bundle exec rspec
16
+ when:
17
+ event:
18
+ - push
19
+
20
+ - name: build and deploy
21
+ pull: if-not-exists
22
+ image: ecr.tooling.dvla.gov.uk/base-images/qe-ruby:2.7.0-1
23
+ commands:
24
+ - apk add --update git unzip alpine-sdk jq --no-cache
25
+ - gem install bundler
26
+ - gem install nexus
27
+ - bundle --jobs 5 --quiet
28
+ - gem build block_repeater.gemspec
29
+ - gem nexus --url https://nexus.tooling.dvla.gov.uk/repository/gem-private/ block_repeater*gem
30
+ when:
31
+ branch:
32
+ - master
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.idea/.rakeTasks ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Settings><!--This file was automatically generated by Ruby plugin.
3
+ You are allowed to:
4
+ 1. Remove rake task
5
+ 2. Add existing rake tasks
6
+ To add existing rake tasks automatically delete this file and reload the project.
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build block_repeater-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install block_repeater-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install block_repeater-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push block_repeater-0.1.0.gem to https://nexus-internal.iep.dvla.gov.uk/nexus/content/groups/gems" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Rubocop" enabled="false" level="WARNING" enabled_by_default="false" />
5
+ </profile>
6
+ </component>
data/.idea/misc.xml ADDED
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptSettings">
4
+ <option name="languageLevel" value="ES6" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="ruby-2.3.7-p456" project-jdk-type="RUBY_SDK" />
7
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/repeater.iml" filepath="$PROJECT_DIR$/.idea/repeater.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,23 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$" />
8
+ <orderEntry type="jdk" jdkName="RVM: ruby-2.7.2" jdkType="RUBY_SDK" />
9
+ <orderEntry type="sourceFolder" forTests="false" />
10
+ <orderEntry type="library" scope="PROVIDED" name="bump (v0.10.0, RVM: ruby-2.7.2) [gem]" level="application" />
11
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, RVM: ruby-2.7.2) [gem]" level="application" />
12
+ <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.3, RVM: ruby-2.7.2) [gem]" level="application" />
13
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, RVM: ruby-2.7.2) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v1.0.0, RVM: ruby-2.7.2) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="pry (v0.14.1, RVM: ruby-2.7.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, RVM: ruby-2.7.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.10.0, RVM: ruby-2.7.2) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.10.1, RVM: ruby-2.7.2) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.10.2, RVM: ruby-2.7.2) [gem]" level="application" />
22
+ </component>
23
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,368 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="b98fee1d-e3fb-4a5d-b159-c1c7714c792f" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/.idea/.rakeTasks" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.rakeTasks" afterDir="false" />
6
+ <change beforePath="$PROJECT_DIR$/.idea/repeater.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/repeater.iml" afterDir="false" />
7
+ <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/lib/block_repeater/repeatable.rb" beforeDir="false" afterPath="$PROJECT_DIR$/lib/block_repeater/repeatable.rb" afterDir="false" />
9
+ </list>
10
+ <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
11
+ <option name="SHOW_DIALOG" value="false" />
12
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
13
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
14
+ <option name="LAST_RESOLUTION" value="IGNORE" />
15
+ </component>
16
+ <component name="FileEditorManager">
17
+ <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
18
+ <file pinned="false" current-in-tab="true">
19
+ <entry file="file://$PROJECT_DIR$/block_repeater.gemspec">
20
+ <provider selected="true" editor-type-id="text-editor">
21
+ <state relative-caret-position="555">
22
+ <caret line="37" column="51" selection-start-line="37" selection-start-column="51" selection-end-line="37" selection-end-column="51" />
23
+ </state>
24
+ </provider>
25
+ </entry>
26
+ </file>
27
+ <file pinned="false" current-in-tab="false">
28
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater.rb">
29
+ <provider selected="true" editor-type-id="text-editor">
30
+ <state>
31
+ <caret column="29" selection-start-column="29" selection-end-column="29" />
32
+ </state>
33
+ </provider>
34
+ </entry>
35
+ </file>
36
+ <file pinned="false" current-in-tab="false">
37
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeater.rb">
38
+ <provider selected="true" editor-type-id="text-editor">
39
+ <state relative-caret-position="668">
40
+ <caret line="49" selection-start-line="49" selection-end-line="49" />
41
+ </state>
42
+ </provider>
43
+ </entry>
44
+ </file>
45
+ <file pinned="false" current-in-tab="false">
46
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeatable.rb">
47
+ <provider selected="true" editor-type-id="text-editor">
48
+ <state relative-caret-position="405">
49
+ <caret line="27" selection-start-line="27" selection-end-line="27" />
50
+ </state>
51
+ </provider>
52
+ </entry>
53
+ </file>
54
+ <file pinned="false" current-in-tab="false">
55
+ <entry file="file://$PROJECT_DIR$/.drone.yml">
56
+ <provider selected="true" editor-type-id="text-editor">
57
+ <state relative-caret-position="345">
58
+ <caret line="23" column="59" selection-start-line="23" selection-start-column="59" selection-end-line="23" selection-end-column="59" />
59
+ </state>
60
+ </provider>
61
+ </entry>
62
+ </file>
63
+ <file pinned="false" current-in-tab="false">
64
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeater_methods.rb">
65
+ <provider selected="true" editor-type-id="text-editor">
66
+ <state relative-caret-position="-5">
67
+ <caret line="8" column="4" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="4" />
68
+ </state>
69
+ </provider>
70
+ </entry>
71
+ </file>
72
+ <file pinned="false" current-in-tab="false">
73
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
74
+ <provider selected="true" editor-type-id="text-editor" />
75
+ </entry>
76
+ </file>
77
+ <file pinned="false" current-in-tab="false">
78
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater/repeatable_spec.rb">
79
+ <provider selected="true" editor-type-id="text-editor">
80
+ <state relative-caret-position="615">
81
+ <caret line="41" column="7" selection-start-line="41" selection-start-column="7" selection-end-line="41" selection-end-column="7" />
82
+ </state>
83
+ </provider>
84
+ </entry>
85
+ </file>
86
+ <file pinned="false" current-in-tab="false">
87
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater/repeater_spec.rb">
88
+ <provider selected="true" editor-type-id="text-editor">
89
+ <state>
90
+ <caret column="41" selection-start-column="41" selection-end-column="41" />
91
+ </state>
92
+ </provider>
93
+ </entry>
94
+ </file>
95
+ <file pinned="false" current-in-tab="false">
96
+ <entry file="file://$PROJECT_DIR$/README.md">
97
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
98
+ <state split_layout="SPLIT">
99
+ <first_editor relative-caret-position="863">
100
+ <caret line="79" selection-start-line="79" selection-end-line="79" />
101
+ </first_editor>
102
+ <second_editor />
103
+ </state>
104
+ </provider>
105
+ </entry>
106
+ </file>
107
+ </leaf>
108
+ </component>
109
+ <component name="Git.Settings">
110
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
111
+ </component>
112
+ <component name="IdeDocumentHistory">
113
+ <option name="CHANGED_PATHS">
114
+ <list>
115
+ <option value="$APPLICATION_CONFIG_DIR$/scratches/scratch_1.rb" />
116
+ <option value="$PROJECT_DIR$/lib/repeater/repeater_methods.rb" />
117
+ <option value="$PROJECT_DIR$/lib/repeater.rb" />
118
+ <option value="$PROJECT_DIR$/lib/repeater/repeater.rb" />
119
+ <option value="$PROJECT_DIR$/lib/repeater/repeatable.rb" />
120
+ <option value="$PROJECT_DIR$/lib/block_repeater/repeater.rb" />
121
+ <option value="$PROJECT_DIR$/spec/block_repeater_spec.rb" />
122
+ <option value="$PROJECT_DIR$/repeater.gemspec" />
123
+ <option value="$PROJECT_DIR$/lib/block_repeater/version.rb" />
124
+ <option value="$PROJECT_DIR$/Gemfile.lock" />
125
+ <option value="$PROJECT_DIR$/Gemfile" />
126
+ <option value="$PROJECT_DIR$/README.md" />
127
+ <option value="$PROJECT_DIR$/lib/block_repeater/repeater.rb" />
128
+ <option value="$PROJECT_DIR$/spec/block_repeater/repeater_methods_spec.rb" />
129
+ <option value="$PROJECT_DIR$/lib/block_repeater.rb" />
130
+ <option value="$PROJECT_DIR$/lib/block_repeater.rb" />
131
+ <option value="$PROJECT_DIR$/lib/block_repeater/repeater_methods.rb" />
132
+ <option value="$PROJECT_DIR$/spec/block_repeater/repeatable_spec.rb" />
133
+ <option value="$PROJECT_DIR$/lib/block_repeater/repeatable.rb" />
134
+ <option value="$PROJECT_DIR$/.drone.yml" />
135
+ <option value="$PROJECT_DIR$/block_repeater.gemspec" />
136
+ </list>
137
+ </option>
138
+ </component>
139
+ <component name="ProjectFrameBounds" fullScreen="true">
140
+ <option name="x" value="-1920" />
141
+ <option name="width" value="1920" />
142
+ <option name="height" value="1080" />
143
+ </component>
144
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
145
+ <component name="ProjectView">
146
+ <navigator proportions="" version="1">
147
+ <foldersAlwaysOnTop value="true" />
148
+ </navigator>
149
+ <panes>
150
+ <pane id="ProjectPane">
151
+ <subPane>
152
+ <expand>
153
+ <path>
154
+ <item name="block_repeater" type="b2602c69:ProjectViewProjectNode" />
155
+ <item name="block_repeater" type="462c0819:PsiDirectoryNode" />
156
+ </path>
157
+ <path>
158
+ <item name="block_repeater" type="b2602c69:ProjectViewProjectNode" />
159
+ <item name="block_repeater" type="462c0819:PsiDirectoryNode" />
160
+ <item name="spec" type="462c0819:PsiDirectoryNode" />
161
+ </path>
162
+ <path>
163
+ <item name="block_repeater" type="b2602c69:ProjectViewProjectNode" />
164
+ <item name="block_repeater" type="462c0819:PsiDirectoryNode" />
165
+ <item name="spec" type="462c0819:PsiDirectoryNode" />
166
+ <item name="block_repeater" type="462c0819:PsiDirectoryNode" />
167
+ </path>
168
+ </expand>
169
+ <select />
170
+ </subPane>
171
+ </pane>
172
+ <pane id="Scope" />
173
+ </panes>
174
+ </component>
175
+ <component name="PropertiesComponent">
176
+ <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
177
+ <property name="WebServerToolWindowFactoryState" value="false" />
178
+ <property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="ruby" />
179
+ <property name="last_opened_file_path" value="$PROJECT_DIR$" />
180
+ <property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
181
+ <property name="nodejs_npm_path_reset_for_default_project" value="true" />
182
+ </component>
183
+ <component name="RunDashboard">
184
+ <option name="ruleStates">
185
+ <list>
186
+ <RuleState>
187
+ <option name="name" value="ConfigurationTypeDashboardGroupingRule" />
188
+ </RuleState>
189
+ <RuleState>
190
+ <option name="name" value="StatusDashboardGroupingRule" />
191
+ </RuleState>
192
+ </list>
193
+ </option>
194
+ </component>
195
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
196
+ <component name="TaskManager">
197
+ <task active="true" id="Default" summary="Default task">
198
+ <changelist id="b98fee1d-e3fb-4a5d-b159-c1c7714c792f" name="Default Changelist" comment="" />
199
+ <created>1626098360263</created>
200
+ <option name="number" value="Default" />
201
+ <option name="presentableId" value="Default" />
202
+ <updated>1626098360263</updated>
203
+ <workItem from="1626098361348" duration="13047000" />
204
+ <workItem from="1626264453454" duration="3322000" />
205
+ <workItem from="1626418917271" duration="950000" />
206
+ <workItem from="1626764476711" duration="18455000" />
207
+ <workItem from="1628769996055" duration="4210000" />
208
+ <workItem from="1629964050435" duration="1745000" />
209
+ <workItem from="1630485234370" duration="10691000" />
210
+ </task>
211
+ <servers />
212
+ </component>
213
+ <component name="TimeTrackingManager">
214
+ <option name="totallyTimeSpent" value="52420000" />
215
+ </component>
216
+ <component name="ToolWindowManager">
217
+ <frame x="-1920" y="0" width="1920" height="1080" extended-state="0" />
218
+ <editor active="true" />
219
+ <layout>
220
+ <window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.14057508" />
221
+ <window_info id="Structure" order="1" side_tool="true" weight="0.25" />
222
+ <window_info id="Favorites" order="2" side_tool="true" />
223
+ <window_info anchor="bottom" id="Message" order="0" />
224
+ <window_info anchor="bottom" id="Find" order="1" />
225
+ <window_info anchor="bottom" id="Run" order="2" />
226
+ <window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
227
+ <window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
228
+ <window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
229
+ <window_info anchor="bottom" id="TODO" order="6" />
230
+ <window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
231
+ <window_info anchor="bottom" id="Database Changes" order="8" />
232
+ <window_info anchor="bottom" id="Version Control" order="9" />
233
+ <window_info anchor="bottom" id="Terminal" order="10" />
234
+ <window_info anchor="bottom" id="Event Log" order="11" side_tool="true" />
235
+ <window_info active="true" anchor="bottom" id="Messages" order="12" visible="true" weight="0.3291536" />
236
+ <window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
237
+ <window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
238
+ <window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
239
+ <window_info anchor="right" id="Database" order="3" />
240
+ </layout>
241
+ </component>
242
+ <component name="TypeScriptGeneratedFilesManager">
243
+ <option name="version" value="1" />
244
+ </component>
245
+ <component name="editorHistoryManager">
246
+ <entry file="file://$PROJECT_DIR$/bin/console">
247
+ <provider selected="true" editor-type-id="text-editor">
248
+ <state relative-caret-position="180">
249
+ <caret line="12" column="13" lean-forward="true" selection-start-line="12" selection-start-column="13" selection-end-line="12" selection-end-column="13" />
250
+ </state>
251
+ </provider>
252
+ </entry>
253
+ <entry file="file://$PROJECT_DIR$/Rakefile">
254
+ <provider selected="true" editor-type-id="text-editor" />
255
+ </entry>
256
+ <entry file="file://$PROJECT_DIR$/Gemfile">
257
+ <provider selected="true" editor-type-id="text-editor">
258
+ <state relative-caret-position="105">
259
+ <caret line="7" selection-start-line="7" selection-end-line="7" />
260
+ </state>
261
+ </provider>
262
+ </entry>
263
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/version.rb">
264
+ <provider selected="true" editor-type-id="text-editor">
265
+ <state relative-caret-position="45">
266
+ <caret line="3" lean-forward="true" selection-start-line="3" selection-end-line="3" />
267
+ </state>
268
+ </provider>
269
+ </entry>
270
+ <entry file="file://$PROJECT_DIR$/Gemfile.lock">
271
+ <provider selected="true" editor-type-id="text-editor">
272
+ <state relative-caret-position="585">
273
+ <caret line="39" column="8" selection-start-line="39" selection-start-column="8" selection-end-line="39" selection-end-column="8" />
274
+ </state>
275
+ </provider>
276
+ </entry>
277
+ <entry file="file://$APPLICATION_CONFIG_DIR$/scratches/scratch_1.rb">
278
+ <provider selected="true" editor-type-id="text-editor">
279
+ <state relative-caret-position="375">
280
+ <caret line="25" column="36" selection-start-line="25" selection-start-column="36" selection-end-line="25" selection-end-column="36" />
281
+ </state>
282
+ </provider>
283
+ </entry>
284
+ <entry file="file://$PROJECT_DIR$/README.md">
285
+ <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
286
+ <state split_layout="SPLIT">
287
+ <first_editor relative-caret-position="863">
288
+ <caret line="79" selection-start-line="79" selection-end-line="79" />
289
+ </first_editor>
290
+ <second_editor />
291
+ </state>
292
+ </provider>
293
+ </entry>
294
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater/repeater_spec.rb">
295
+ <provider selected="true" editor-type-id="text-editor">
296
+ <state>
297
+ <caret column="41" selection-start-column="41" selection-end-column="41" />
298
+ </state>
299
+ </provider>
300
+ </entry>
301
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater/repeater_methods_spec.rb">
302
+ <provider selected="true" editor-type-id="text-editor">
303
+ <state>
304
+ <caret column="33" lean-forward="true" selection-start-column="33" selection-end-column="33" />
305
+ </state>
306
+ </provider>
307
+ </entry>
308
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater/repeatable_spec.rb">
309
+ <provider selected="true" editor-type-id="text-editor">
310
+ <state relative-caret-position="615">
311
+ <caret line="41" column="7" selection-start-line="41" selection-start-column="7" selection-end-line="41" selection-end-column="7" />
312
+ </state>
313
+ </provider>
314
+ </entry>
315
+ <entry file="file://$PROJECT_DIR$/spec/block_repeater_spec.rb">
316
+ <provider selected="true" editor-type-id="text-editor">
317
+ <state relative-caret-position="105">
318
+ <caret line="7" lean-forward="true" selection-start-line="7" selection-end-line="7" />
319
+ </state>
320
+ </provider>
321
+ </entry>
322
+ <entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
323
+ <provider selected="true" editor-type-id="text-editor" />
324
+ </entry>
325
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeater_methods.rb">
326
+ <provider selected="true" editor-type-id="text-editor">
327
+ <state relative-caret-position="-5">
328
+ <caret line="8" column="4" selection-start-line="8" selection-start-column="4" selection-end-line="8" selection-end-column="4" />
329
+ </state>
330
+ </provider>
331
+ </entry>
332
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeater.rb">
333
+ <provider selected="true" editor-type-id="text-editor">
334
+ <state relative-caret-position="668">
335
+ <caret line="49" selection-start-line="49" selection-end-line="49" />
336
+ </state>
337
+ </provider>
338
+ </entry>
339
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater.rb">
340
+ <provider selected="true" editor-type-id="text-editor">
341
+ <state>
342
+ <caret column="29" selection-start-column="29" selection-end-column="29" />
343
+ </state>
344
+ </provider>
345
+ </entry>
346
+ <entry file="file://$PROJECT_DIR$/lib/block_repeater/repeatable.rb">
347
+ <provider selected="true" editor-type-id="text-editor">
348
+ <state relative-caret-position="405">
349
+ <caret line="27" selection-start-line="27" selection-end-line="27" />
350
+ </state>
351
+ </provider>
352
+ </entry>
353
+ <entry file="file://$PROJECT_DIR$/.drone.yml">
354
+ <provider selected="true" editor-type-id="text-editor">
355
+ <state relative-caret-position="345">
356
+ <caret line="23" column="59" selection-start-line="23" selection-start-column="59" selection-end-line="23" selection-end-column="59" />
357
+ </state>
358
+ </provider>
359
+ </entry>
360
+ <entry file="file://$PROJECT_DIR$/block_repeater.gemspec">
361
+ <provider selected="true" editor-type-id="text-editor">
362
+ <state relative-caret-position="555">
363
+ <caret line="37" column="51" selection-start-line="37" selection-start-column="51" selection-end-line="37" selection-end-column="51" />
364
+ </state>
365
+ </provider>
366
+ </entry>
367
+ </component>
368
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.7.2
6
+ before_install: gem install bundler -v 2.1.4
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in block_repeater.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 12.0'
9
+ gem 'rspec', '~> 3.0'
data/Gemfile.lock ADDED
@@ -0,0 +1,43 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ block_repeater (0.2.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ bump (0.10.0)
10
+ coderay (1.1.3)
11
+ diff-lcs (1.4.4)
12
+ method_source (1.0.0)
13
+ pry (0.14.1)
14
+ coderay (~> 1.1)
15
+ method_source (~> 1.0)
16
+ rake (12.3.3)
17
+ rspec (3.10.0)
18
+ rspec-core (~> 3.10.0)
19
+ rspec-expectations (~> 3.10.0)
20
+ rspec-mocks (~> 3.10.0)
21
+ rspec-core (3.10.1)
22
+ rspec-support (~> 3.10.0)
23
+ rspec-expectations (3.10.1)
24
+ diff-lcs (>= 1.2.0, < 2.0)
25
+ rspec-support (~> 3.10.0)
26
+ rspec-mocks (3.10.2)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.10.0)
29
+ rspec-support (3.10.2)
30
+
31
+ PLATFORMS
32
+ ruby
33
+
34
+ DEPENDENCIES
35
+ block_repeater!
36
+ bump (~> 0.6)
37
+ bundler (~> 2.1.4)
38
+ pry
39
+ rake (~> 12.0)
40
+ rspec (~> 3.0)
41
+
42
+ BUNDLED WITH
43
+ 2.1.4
data/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # Block Repeater
2
+
3
+ A way to repeat a block of code until either a given condition is met or a timeout has been reached
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'block_repeater'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install block_repeater
20
+
21
+ ## Usage
22
+ Add the repeater and it's methods into a project
23
+ ```ruby
24
+ include BlockRepeater
25
+ ```
26
+
27
+ In order to maintain parity with existing Repeater implementations you may also need to expose the repeater class itself
28
+ ```ruby
29
+ Repeater = BlockRepeater::Repeater
30
+ ```
31
+
32
+ ### Repeat method
33
+ This is the preferred way to use the repeater. It requires two blocks, the one to be executed and the one which sets the exit condition. As these are ordinary ruby blocks they can be defined using either `{ }` or `do end` syntax.
34
+
35
+ ```ruby
36
+ repeater{ call_database_method }.until{ |result| result.count.positive? }
37
+ ```
38
+ ```ruby
39
+ repeater do
40
+ call_database_method
41
+ end.until do |result|
42
+ result.count.positive?
43
+ end
44
+ ```
45
+
46
+ The repeater also takes two parameters:
47
+ - `delay:` is how long in seconds the repeater will wait between attempts (defaults to 0.2 seconds)
48
+ - `times:` is how many attempts the repeater will make before giving up (defaults to 25)
49
+ ```ruby
50
+ repeater(delay: 0.5, times: 10){ call_database_method }.until{ |result| result.count.positive? }
51
+ ```
52
+
53
+ ### RSpec functionality
54
+ An RSpec expectation can be used in the block for the `until` method. The expectation will be attempted each try, but the exception will only be raised if it has still failed once the number or attempts has been reached.
55
+ ```ruby
56
+ repeater do
57
+ call_database_method
58
+ end.until do |result|
59
+ expect(result.count).to be_positive, raise 'No result returned from databased'
60
+ end
61
+ ```
62
+ ### Non predefined condition methods
63
+ Very simple conditions can be utilised without using a block. This expects either one or two method names which will be called against the result of repeating the main block.
64
+ The required format is `until_<method name>` or `until_<method name>_becomes_<method name>`.
65
+
66
+ ```ruby
67
+ repeat{ a_method_which_returns_a_number }.until_positive?
68
+ #Attempts to call the :positive? method on the result of the method call
69
+
70
+ repeat{ a_method_which_returns_an_array }.until_count_becomes_positive?
71
+ #Attempts to call :count on the result of the method call, then :positive? on that result
72
+ ````
73
+ This supports two consecutive method calls, anything more complex should be written out in full in the standard manner.
74
+
75
+ ### Direct class usage
76
+ It's also possible to directly access the Repeater class which has been left available as to not break existing functionality. It's not recommended to combine this with the non predefined condition method pattern described above.
77
+ ```ruby
78
+ Repeater = BlockRepeater::Repeater
79
+
80
+ Repeater.new do
81
+ call_database_method
82
+ end.until do |result|
83
+ expect(result.count).to be_positive, raise 'No result returned from databased'
84
+ end.repeat(delay: 1, times: 5)
85
+ ```
86
+ In this case any optional arguments (`times` or `delay`) must be sent to the method called `repeat`, which is called after the second block. The repeat method is mandatory to run the repeater when using it in this manner.
87
+
88
+ ## Development
89
+
90
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
91
+
92
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'repeater'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/block_repeater/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'block_repeater'
7
+ spec.version = BlockRepeater::VERSION
8
+ spec.authors = ['William Bray']
9
+ spec.email = ['william.bray@dvla.gov.uk']
10
+
11
+ spec.summary = 'Conditionally repeat a block of code'
12
+ spec.description = 'Attempt a piece of code a set number of times or until a condition is met'
13
+ spec.homepage = 'https://github.com/dvla/block-repeater'
14
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
15
+ spec.license = 'MIT'
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/dvla/block-repeater"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_development_dependency 'bump', '~> 0.6'
30
+ spec.add_development_dependency 'bundler', '~> 2.1.4'
31
+ spec.add_development_dependency 'pry'
32
+ spec.add_development_dependency 'rake', '~> 10.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.8'
34
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlockRepeater
4
+ ##
5
+ # A nicer way to access the Repeater without setting up the class manually
6
+ #
7
+ module Repeatable
8
+
9
+ ##
10
+ # Create an instance of the Repeater class
11
+ #
12
+ # @param **kwargs - Capture all the keyword arguments, pass them into the Repeater
13
+ # Specifically pass through times: and delay: as others will be ignored
14
+ # @param &block - The block of code to be repeated
15
+ #
16
+ def repeat(**kwargs, &block)
17
+ Repeater.new(manual_repeat: false, **kwargs, &block)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'block_repeater/repeater_methods'
4
+
5
+ ##
6
+ # A class which repeatedly executes a block of code until a given condition is met or a timeout is reached
7
+ #
8
+ module BlockRepeater
9
+ class Repeater
10
+ include RepeaterMethods
11
+
12
+
13
+ ##
14
+ # Prepare the Repeater to take the initial block to be repeated
15
+ #
16
+ # @param manual_repeat - Determines whether the repeat method needs to called manually, used by the Repeatable module
17
+ # @param **kwargs - Capture other arguments in the situation where repeat isn't being called manually
18
+ # @param &block - The block of code to be repeated
19
+ def initialize(manual_repeat: true, **kwargs, &block)
20
+ @manual_repeat = manual_repeat
21
+ @repeater_arguments = kwargs
22
+ @repeat_block = block
23
+ end
24
+
25
+ ##
26
+ # Repeat a block until either the defined timeout is met or the condition block returns true
27
+ #
28
+ # @param times - How many times to attempt to execute the main block
29
+ # @param delay - The amount of time to wait between each attempt
30
+ # @param **_ - Capture any extra keyword arguments and discard them
31
+ # @return The result of calling the main block the final time
32
+ def repeat(times: 25, delay: 0.2, **_)
33
+ result, @condition_met, exception = nil
34
+ times.times do
35
+ result = @repeat_block.call
36
+ begin
37
+ @condition_met = @condition_block.call(result) if @condition_block
38
+ exception = nil
39
+ rescue RSpec::Expectations::ExpectationNotMetError => e
40
+ exception = e
41
+ end
42
+ break if @condition_met
43
+
44
+ sleep delay
45
+ end
46
+
47
+ raise exception if exception
48
+
49
+ result
50
+ end
51
+
52
+ ##
53
+ # Set the block which determines if the main block should stop being executed
54
+ #
55
+ # @param &block - The block of code which determines the target condition of the main block
56
+ # @return Either return the repeater object if the repeat method is being called manually
57
+ # or return the result of calling the repeat method
58
+ def until(&block)
59
+ @condition_block = block
60
+ if @manual_repeat
61
+ self
62
+ else
63
+ repeat @repeater_arguments
64
+ end
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ ##
4
+ # Additional methods for the Repeater class
5
+ #
6
+ module RepeaterMethods
7
+ UNTIL_METHOD_REGEX = /until_((.*)_becomes_(.*)|(.*))/.freeze
8
+
9
+ ##
10
+ # If a method in the correct format is provided it will be converted into the conditional block for the Repeater class
11
+ # This expects either one or two method names which will be called against the result of repeating the main block.
12
+ # The correct format is 'until_<method name>' or 'until_<method name>_becomes_<method name>'.
13
+ #
14
+ # examples:
15
+ #
16
+ # until_positive?
17
+ # Attempts to call the :positive? method on the result of the block repeat
18
+ #
19
+ # until_count_becomes_positive?
20
+ # Attempts to call :count on the result of the block repeat, then :positive? on that result
21
+ #
22
+ def method_missing(method_name, *args, &block)
23
+ if method_name.match UNTIL_METHOD_REGEX
24
+ @manual_repeat = false
25
+ @unresponsive_errors = []
26
+ first_match = Regexp.last_match(1)
27
+ second_match = Regexp.last_match(2)
28
+ third_match = Regexp.last_match(3)
29
+
30
+ if second_match && third_match
31
+ final_result = self.until do |result|
32
+ call_output = call_if_method_responsive(result, second_match)
33
+ call_if_method_responsive(call_output, third_match) if @unresponsive_errors.empty?
34
+ end
35
+ else
36
+ final_result = self.until do |result|
37
+ call_if_method_responsive(result, first_match)
38
+ end
39
+ end
40
+ raise MethodUnresponsiveError, "Methods were not compatible: #{@unresponsive_errors.uniq.join(', ')}" unless @unresponsive_errors.empty?
41
+ final_result
42
+ else
43
+ super
44
+ end
45
+ end
46
+
47
+ def respond_to_missing?(method_name, *)
48
+ method_name.match UNTIL_METHOD_REGEX || super
49
+ end
50
+
51
+ def call_if_method_responsive(value, method)
52
+ method = method.to_sym
53
+ if value.respond_to?(method)
54
+ value.send(method)
55
+ else
56
+ @unresponsive_errors << "#{value.class.name} does not respond to method #{method}"
57
+ end
58
+ end
59
+
60
+ class MethodUnresponsiveError < StandardError
61
+ def initialize(msg = 'Value in repeater did not respond to given method')
62
+ super
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module BlockRepeater
4
+ VERSION = '0.2.0'
5
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'block_repeater/version'
4
+ require 'block_repeater/repeatable'
5
+ require 'block_repeater/repeater'
6
+
7
+ ##
8
+ # A class for repeating a block of code until a condition or timeout is met
9
+ # Can be accessed directly through the Repeater class or through the method
10
+ # exposed in the Repeatable module
11
+ #
12
+ module BlockRepeater
13
+ include Repeatable
14
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: block_repeater
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - William Bray
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-10-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bump
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.1.4
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.8'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.8'
83
+ description: Attempt a piece of code a set number of times or until a condition is
84
+ met
85
+ email:
86
+ - william.bray@dvla.gov.uk
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - ".drone.yml"
92
+ - ".gitignore"
93
+ - ".idea/.rakeTasks"
94
+ - ".idea/inspectionProfiles/Project_Default.xml"
95
+ - ".idea/misc.xml"
96
+ - ".idea/modules.xml"
97
+ - ".idea/repeater.iml"
98
+ - ".idea/vcs.xml"
99
+ - ".idea/workspace.xml"
100
+ - ".rspec"
101
+ - ".travis.yml"
102
+ - Gemfile
103
+ - Gemfile.lock
104
+ - README.md
105
+ - Rakefile
106
+ - bin/console
107
+ - bin/setup
108
+ - block_repeater.gemspec
109
+ - lib/block_repeater.rb
110
+ - lib/block_repeater/repeatable.rb
111
+ - lib/block_repeater/repeater.rb
112
+ - lib/block_repeater/repeater_methods.rb
113
+ - lib/block_repeater/version.rb
114
+ homepage: https://github.com/dvla/block-repeater
115
+ licenses:
116
+ - MIT
117
+ metadata:
118
+ homepage_uri: https://github.com/dvla/block-repeater
119
+ source_code_uri: https://github.com/dvla/block-repeater
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: 2.3.0
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubygems_version: 3.1.4
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Conditionally repeat a block of code
139
+ test_files: []