slippy_method_hooks 0.1.0
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 +7 -0
- data/.gitignore +13 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/inspectionProfiles/Project_Default.xml +6 -0
- data/.idea/misc.xml +10 -0
- data/.idea/modules.xml +8 -0
- data/.idea/slippy_method_hooks.iml +22 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +428 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +163 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/slippy_method_hooks +3 -0
- data/lib/slippy_method_hooks.rb +3 -0
- data/lib/slippy_method_hooks/errors.rb +5 -0
- data/lib/slippy_method_hooks/hooks.rb +79 -0
- data/lib/slippy_method_hooks/version.rb +3 -0
- data/slippy_method_hooks.gemspec +40 -0
- metadata +126 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 39993b337e7088bb73775484a5ec0d8969ae730ee3f1201a60e4ee7f0def6578
|
|
4
|
+
data.tar.gz: 278d09f19c6bcb21f992a603d1a8d212e511546c6da24394eb4fe2d86aea3096
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 96d4d5eb6b8bb5198cca0a6945510b0de3733743671724bd94a0081b8404935e27c8e46c99283586718cf6d608ea753d5476687964739181d9cef5ac13145f78
|
|
7
|
+
data.tar.gz: d7236b370c93dc267df1bad0a1354be2ab22c8991458650abfaef934105ec8700b725c64f3378b5036c2068a70fc7fc10c35882e61a2f7c7454fcf892580ace2
|
data/.gitignore
ADDED
data/.idea/encodings.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="RubyBlockToMethodReference" enabled="false" level="WARNING" enabled_by_default="false" />
|
|
5
|
+
</profile>
|
|
6
|
+
</component>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
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="NodePackageJsonFileManager">
|
|
7
|
+
<packageJsonPaths />
|
|
8
|
+
</component>
|
|
9
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.4.0" project-jdk-type="RUBY_SDK" />
|
|
10
|
+
</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/slippy_method_hooks.iml" filepath="$PROJECT_DIR$/.idea/slippy_method_hooks.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,22 @@
|
|
|
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.6.0" jdkType="RUBY_SDK" />
|
|
9
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
10
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.0.1, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
11
|
+
<orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.2, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
12
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
13
|
+
<orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="pry (v0.12.2, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v10.5.0, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, RVM: ruby-2.6.0) [gem]" level="application" />
|
|
21
|
+
</component>
|
|
22
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="73f66db3-41ba-4cf9-986c-73cfe2cfd1ed" name="Default Changelist" comment="">
|
|
5
|
+
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
|
6
|
+
</list>
|
|
7
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
|
8
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
9
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
10
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
11
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="CoverageDataManager">
|
|
14
|
+
<SUITE FILE_PATH="coverage/slippy_method_hooks@SlippyMethodHooks_hooks__timeout_throws___SlippyMethodHooks__TimeoutError__error_when_method_runs_too_long__slippy_method_hooks.rcov" NAME="SlippyMethodHooks hooks #timeout throws #{SlippyMethodHooks::TimeoutError} error when method runs too long: slippy_method_hooks Coverage Results" MODIFIED="1552074272707" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="rcov" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" MODULE_NAME="slippy_method_hooks" />
|
|
15
|
+
</component>
|
|
16
|
+
<component name="FileEditorManager">
|
|
17
|
+
<leaf>
|
|
18
|
+
<file pinned="false" current-in-tab="false">
|
|
19
|
+
<entry file="file://$PROJECT_DIR$/spec/slippy_method_hooks_spec.rb">
|
|
20
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
21
|
+
<state relative-caret-position="5104">
|
|
22
|
+
<caret line="244" column="4" selection-start-line="244" selection-start-column="4" selection-end-line="244" selection-end-column="4" />
|
|
23
|
+
<folding>
|
|
24
|
+
<element signature="e#4480#4790#0" />
|
|
25
|
+
</folding>
|
|
26
|
+
</state>
|
|
27
|
+
</provider>
|
|
28
|
+
</entry>
|
|
29
|
+
</file>
|
|
30
|
+
<file pinned="false" current-in-tab="false">
|
|
31
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks/hooks.rb">
|
|
32
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
33
|
+
<state relative-caret-position="660">
|
|
34
|
+
<caret line="30" column="16" lean-forward="true" selection-start-line="30" selection-start-column="16" selection-end-line="30" selection-end-column="16" />
|
|
35
|
+
</state>
|
|
36
|
+
</provider>
|
|
37
|
+
</entry>
|
|
38
|
+
</file>
|
|
39
|
+
<file pinned="false" current-in-tab="true">
|
|
40
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
41
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
42
|
+
<state split_layout="FIRST">
|
|
43
|
+
<first_editor relative-caret-position="968">
|
|
44
|
+
<caret line="44" column="27" lean-forward="true" selection-start-line="44" selection-start-column="27" selection-end-line="44" selection-end-column="27" />
|
|
45
|
+
</first_editor>
|
|
46
|
+
<second_editor />
|
|
47
|
+
</state>
|
|
48
|
+
</provider>
|
|
49
|
+
</entry>
|
|
50
|
+
</file>
|
|
51
|
+
<file pinned="false" current-in-tab="false">
|
|
52
|
+
<entry file="file://$PROJECT_DIR$/.rspec">
|
|
53
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
54
|
+
</entry>
|
|
55
|
+
</file>
|
|
56
|
+
<file pinned="false" current-in-tab="false">
|
|
57
|
+
<entry file="file://$PROJECT_DIR$/.rspec_status">
|
|
58
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
59
|
+
</entry>
|
|
60
|
+
</file>
|
|
61
|
+
<file pinned="false" current-in-tab="false">
|
|
62
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
|
63
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
64
|
+
</entry>
|
|
65
|
+
</file>
|
|
66
|
+
<file pinned="false" current-in-tab="false">
|
|
67
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
68
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
69
|
+
<state>
|
|
70
|
+
<caret column="17" selection-start-column="17" selection-end-column="17" />
|
|
71
|
+
</state>
|
|
72
|
+
</provider>
|
|
73
|
+
</entry>
|
|
74
|
+
</file>
|
|
75
|
+
<file pinned="false" current-in-tab="false">
|
|
76
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
|
77
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
78
|
+
<state relative-caret-position="264">
|
|
79
|
+
<caret line="12" column="12" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
|
|
80
|
+
</state>
|
|
81
|
+
</provider>
|
|
82
|
+
</entry>
|
|
83
|
+
</file>
|
|
84
|
+
<file pinned="false" current-in-tab="false">
|
|
85
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks.rb">
|
|
86
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
87
|
+
<state relative-caret-position="44">
|
|
88
|
+
<caret line="2" column="31" lean-forward="true" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
|
|
89
|
+
</state>
|
|
90
|
+
</provider>
|
|
91
|
+
</entry>
|
|
92
|
+
</file>
|
|
93
|
+
<file pinned="false" current-in-tab="false">
|
|
94
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks/errors.rb">
|
|
95
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
96
|
+
<state relative-caret-position="88">
|
|
97
|
+
<caret line="4" column="3" lean-forward="true" selection-start-line="4" selection-start-column="3" selection-end-line="4" selection-end-column="3" />
|
|
98
|
+
</state>
|
|
99
|
+
</provider>
|
|
100
|
+
</entry>
|
|
101
|
+
</file>
|
|
102
|
+
</leaf>
|
|
103
|
+
</component>
|
|
104
|
+
<component name="FindInProjectRecents">
|
|
105
|
+
<findStrings>
|
|
106
|
+
<find>binding.pry</find>
|
|
107
|
+
</findStrings>
|
|
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="$PROJECT_DIR$/lib/slippy_method_hooks/version.rb" />
|
|
116
|
+
<option value="$PROJECT_DIR$/Rakefile" />
|
|
117
|
+
<option value="$PROJECT_DIR$/Gemfile.lock" />
|
|
118
|
+
<option value="$PROJECT_DIR$/spec/spec_helper.rb" />
|
|
119
|
+
<option value="$PROJECT_DIR$/slippy_method_hooks.gemspec" />
|
|
120
|
+
<option value="$PROJECT_DIR$/spec/test_helpers.rb" />
|
|
121
|
+
<option value="$PROJECT_DIR$/lib/slippy_method_hooks.rb" />
|
|
122
|
+
<option value="$PROJECT_DIR$/lib/slippy_method_hooks/errors.rb" />
|
|
123
|
+
<option value="$PROJECT_DIR$/lib/slippy_method_hooks/hooks.rb" />
|
|
124
|
+
<option value="$PROJECT_DIR$/spec/slippy_method_hooks_spec.rb" />
|
|
125
|
+
<option value="$PROJECT_DIR$/.gitignore" />
|
|
126
|
+
<option value="$PROJECT_DIR$/README.md" />
|
|
127
|
+
</list>
|
|
128
|
+
</option>
|
|
129
|
+
</component>
|
|
130
|
+
<component name="ProjectFrameBounds">
|
|
131
|
+
<option name="y" value="23" />
|
|
132
|
+
<option name="width" value="1440" />
|
|
133
|
+
<option name="height" value="877" />
|
|
134
|
+
</component>
|
|
135
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
|
136
|
+
<component name="ProjectView">
|
|
137
|
+
<navigator proportions="" version="1">
|
|
138
|
+
<foldersAlwaysOnTop value="true" />
|
|
139
|
+
</navigator>
|
|
140
|
+
<panes>
|
|
141
|
+
<pane id="Scope" />
|
|
142
|
+
<pane id="ProjectPane">
|
|
143
|
+
<subPane>
|
|
144
|
+
<expand>
|
|
145
|
+
<path>
|
|
146
|
+
<item name="slippy_method_hooks" type="b2602c69:ProjectViewProjectNode" />
|
|
147
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
148
|
+
</path>
|
|
149
|
+
<path>
|
|
150
|
+
<item name="slippy_method_hooks" type="b2602c69:ProjectViewProjectNode" />
|
|
151
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
152
|
+
<item name="bin" type="462c0819:PsiDirectoryNode" />
|
|
153
|
+
</path>
|
|
154
|
+
<path>
|
|
155
|
+
<item name="slippy_method_hooks" type="b2602c69:ProjectViewProjectNode" />
|
|
156
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
157
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
158
|
+
</path>
|
|
159
|
+
<path>
|
|
160
|
+
<item name="slippy_method_hooks" type="b2602c69:ProjectViewProjectNode" />
|
|
161
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
162
|
+
<item name="lib" type="462c0819:PsiDirectoryNode" />
|
|
163
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
164
|
+
</path>
|
|
165
|
+
<path>
|
|
166
|
+
<item name="slippy_method_hooks" type="b2602c69:ProjectViewProjectNode" />
|
|
167
|
+
<item name="slippy_method_hooks" type="462c0819:PsiDirectoryNode" />
|
|
168
|
+
<item name="spec" type="462c0819:PsiDirectoryNode" />
|
|
169
|
+
</path>
|
|
170
|
+
</expand>
|
|
171
|
+
<select />
|
|
172
|
+
</subPane>
|
|
173
|
+
</pane>
|
|
174
|
+
</panes>
|
|
175
|
+
</component>
|
|
176
|
+
<component name="PropertiesComponent">
|
|
177
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
|
178
|
+
<property name="nodejs_interpreter_path.stuck_in_default_project" value="undefined stuck path" />
|
|
179
|
+
<property name="nodejs_npm_path_reset_for_default_project" value="true" />
|
|
180
|
+
<property name="nodejs_package_manager_path" value="npm" />
|
|
181
|
+
<property name="settings.editor.selected.configurable" value="org.jetbrains.plugins.ruby.settings.RubyActiveModuleSdkConfigurable" />
|
|
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="RunManager">
|
|
196
|
+
<configuration name="SlippyMethodHooks hooks #timeout throws #{SlippyMethodHooks::TimeoutError} error when method runs too long: slippy_method_hooks" type="RSpecRunConfigurationType" factoryName="RSpec" temporary="true">
|
|
197
|
+
<module name="slippy_method_hooks" />
|
|
198
|
+
<predefined_log_file enabled="true" id="RUBY_RSPEC" />
|
|
199
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
|
|
200
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
|
|
201
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
|
202
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
|
203
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
|
204
|
+
<envs>
|
|
205
|
+
<env name="JRUBY_OPTS" value="-X+O" />
|
|
206
|
+
</envs>
|
|
207
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="true" />
|
|
208
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
|
209
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov">
|
|
210
|
+
<COVERAGE_PATTERN ENABLED="true">
|
|
211
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
|
212
|
+
</COVERAGE_PATTERN>
|
|
213
|
+
</EXTENSION>
|
|
214
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
|
215
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="$MODULE_DIR$/spec/slippy_method_hooks_spec.rb" />
|
|
216
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
|
217
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="'**/*_spec.rb'" />
|
|
218
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="SlippyMethodHooks hooks #timeout throws #{SlippyMethodHooks::TimeoutError} error when method runs too long" />
|
|
219
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
|
220
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
|
221
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
|
222
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
|
223
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
|
224
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
|
225
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
|
226
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
|
227
|
+
<method v="2" />
|
|
228
|
+
</configuration>
|
|
229
|
+
<recent_temporary>
|
|
230
|
+
<list>
|
|
231
|
+
<item itemvalue="RSpec.SlippyMethodHooks hooks #timeout throws #{SlippyMethodHooks::TimeoutError} error when method runs too long: slippy_method_hooks" />
|
|
232
|
+
</list>
|
|
233
|
+
</recent_temporary>
|
|
234
|
+
</component>
|
|
235
|
+
<component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" />
|
|
236
|
+
<component name="SvnConfiguration">
|
|
237
|
+
<configuration />
|
|
238
|
+
</component>
|
|
239
|
+
<component name="TaskManager">
|
|
240
|
+
<task active="true" id="Default" summary="Default task">
|
|
241
|
+
<changelist id="73f66db3-41ba-4cf9-986c-73cfe2cfd1ed" name="Default Changelist" comment="" />
|
|
242
|
+
<created>1552071643572</created>
|
|
243
|
+
<option name="number" value="Default" />
|
|
244
|
+
<option name="presentableId" value="Default" />
|
|
245
|
+
<updated>1552071643572</updated>
|
|
246
|
+
<workItem from="1552071645019" duration="25085000" />
|
|
247
|
+
</task>
|
|
248
|
+
<servers />
|
|
249
|
+
</component>
|
|
250
|
+
<component name="TestHistory">
|
|
251
|
+
<history-entry file="SlippyMethodHooks_hooks_#timeout_throws_#{SlippyMethodHooks__TimeoutError}_error_when_method_runs_too_long__slippy_method_hooks - 2019.03.08 at 11h 44m 33s.xml">
|
|
252
|
+
<configuration name="SlippyMethodHooks hooks #timeout throws #{SlippyMethodHooks::TimeoutError} error when method runs too long: slippy_method_hooks" configurationId="RSpecRunConfigurationType" />
|
|
253
|
+
</history-entry>
|
|
254
|
+
</component>
|
|
255
|
+
<component name="TimeTrackingManager">
|
|
256
|
+
<option name="totallyTimeSpent" value="25085000" />
|
|
257
|
+
</component>
|
|
258
|
+
<component name="ToolWindowManager">
|
|
259
|
+
<frame x="0" y="23" width="1440" height="877" extended-state="0" />
|
|
260
|
+
<editor active="true" />
|
|
261
|
+
<layout>
|
|
262
|
+
<window_info id="Favorites" side_tool="true" />
|
|
263
|
+
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.24964234" />
|
|
264
|
+
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
|
265
|
+
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
|
266
|
+
<window_info anchor="bottom" id="Database Changes" />
|
|
267
|
+
<window_info anchor="bottom" id="Version Control" />
|
|
268
|
+
<window_info anchor="bottom" id="Terminal" />
|
|
269
|
+
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
|
270
|
+
<window_info anchor="bottom" id="Message" order="0" />
|
|
271
|
+
<window_info anchor="bottom" id="Find" order="1" />
|
|
272
|
+
<window_info anchor="bottom" id="Run" order="2" weight="0.3296433" />
|
|
273
|
+
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
|
274
|
+
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
|
275
|
+
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
|
276
|
+
<window_info anchor="bottom" id="TODO" order="6" />
|
|
277
|
+
<window_info anchor="right" id="Database" />
|
|
278
|
+
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
|
279
|
+
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
|
280
|
+
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
|
281
|
+
</layout>
|
|
282
|
+
</component>
|
|
283
|
+
<component name="TypeScriptGeneratedFilesManager">
|
|
284
|
+
<option name="version" value="1" />
|
|
285
|
+
</component>
|
|
286
|
+
<component name="editorHistoryManager">
|
|
287
|
+
<entry file="file://$PROJECT_DIR$/LICENSE.txt">
|
|
288
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
289
|
+
</entry>
|
|
290
|
+
<entry file="file://$PROJECT_DIR$/Rakefile">
|
|
291
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
292
|
+
<state relative-caret-position="22">
|
|
293
|
+
<caret line="1" column="12" selection-start-line="1" selection-start-column="12" selection-end-line="1" selection-end-column="12" />
|
|
294
|
+
</state>
|
|
295
|
+
</provider>
|
|
296
|
+
</entry>
|
|
297
|
+
<entry file="file://$PROJECT_DIR$/Gemfile.lock">
|
|
298
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
299
|
+
</entry>
|
|
300
|
+
<entry file="file://$PROJECT_DIR$/spec/spec_helper.rb">
|
|
301
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
302
|
+
<state relative-caret-position="22">
|
|
303
|
+
<caret line="1" column="12" selection-start-line="1" selection-start-column="12" selection-end-line="1" selection-end-column="12" />
|
|
304
|
+
</state>
|
|
305
|
+
</provider>
|
|
306
|
+
</entry>
|
|
307
|
+
<entry file="file://$PROJECT_DIR$/slippy_method_hooks.gemspec">
|
|
308
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
309
|
+
<state relative-caret-position="554">
|
|
310
|
+
<caret line="36" column="2" selection-start-line="36" selection-start-column="2" selection-end-line="36" selection-end-column="2" />
|
|
311
|
+
</state>
|
|
312
|
+
</provider>
|
|
313
|
+
</entry>
|
|
314
|
+
<entry file="file://$PROJECT_DIR$/spec/test_helpers.rb">
|
|
315
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
316
|
+
<state relative-caret-position="22">
|
|
317
|
+
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
|
318
|
+
</state>
|
|
319
|
+
</provider>
|
|
320
|
+
</entry>
|
|
321
|
+
<entry file="file://$USER_HOME$/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb">
|
|
322
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
323
|
+
<state relative-caret-position="378">
|
|
324
|
+
<caret line="119" column="4" selection-start-line="119" selection-start-column="4" selection-end-line="119" selection-end-column="4" />
|
|
325
|
+
</state>
|
|
326
|
+
</provider>
|
|
327
|
+
</entry>
|
|
328
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs26/kernel.rb">
|
|
329
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
330
|
+
<state relative-caret-position="370">
|
|
331
|
+
<caret line="4363" column="8" selection-start-line="4363" selection-start-column="8" selection-end-line="4363" selection-end-column="8" />
|
|
332
|
+
</state>
|
|
333
|
+
</provider>
|
|
334
|
+
</entry>
|
|
335
|
+
<entry file="file://$APPLICATION_HOME_DIR$/rubystubs26/basic_object.rb">
|
|
336
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
337
|
+
<state relative-caret-position="329">
|
|
338
|
+
<caret line="201" column="8" selection-start-line="201" selection-start-column="8" selection-end-line="201" selection-end-column="8" />
|
|
339
|
+
</state>
|
|
340
|
+
</provider>
|
|
341
|
+
</entry>
|
|
342
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.6.0/gems/rspec-core-3.8.0/lib/rspec/core/example.rb">
|
|
343
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
344
|
+
<state relative-caret-position="286">
|
|
345
|
+
<caret line="13" column="31" lean-forward="true" selection-start-line="13" selection-start-column="31" selection-end-line="13" selection-end-column="31" />
|
|
346
|
+
</state>
|
|
347
|
+
</provider>
|
|
348
|
+
</entry>
|
|
349
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks/version.rb">
|
|
350
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
351
|
+
<state>
|
|
352
|
+
<caret column="7" selection-start-column="7" selection-end-column="7" />
|
|
353
|
+
</state>
|
|
354
|
+
</provider>
|
|
355
|
+
</entry>
|
|
356
|
+
<entry file="file://$USER_HOME$/.rvm/gems/ruby-2.6.0/gems/rspec-expectations-3.8.2/lib/rspec/expectations/syntax.rb">
|
|
357
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
358
|
+
<state relative-caret-position="258">
|
|
359
|
+
<caret line="67" column="10" selection-start-line="67" selection-start-column="10" selection-end-line="67" selection-end-column="10" />
|
|
360
|
+
</state>
|
|
361
|
+
</provider>
|
|
362
|
+
</entry>
|
|
363
|
+
<entry file="file://$PROJECT_DIR$/.rspec">
|
|
364
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
365
|
+
</entry>
|
|
366
|
+
<entry file="file://$PROJECT_DIR$/.rspec_status">
|
|
367
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
368
|
+
</entry>
|
|
369
|
+
<entry file="file://$PROJECT_DIR$/.travis.yml">
|
|
370
|
+
<provider selected="true" editor-type-id="text-editor" />
|
|
371
|
+
</entry>
|
|
372
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
|
373
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
374
|
+
<state>
|
|
375
|
+
<caret column="17" selection-start-column="17" selection-end-column="17" />
|
|
376
|
+
</state>
|
|
377
|
+
</provider>
|
|
378
|
+
</entry>
|
|
379
|
+
<entry file="file://$PROJECT_DIR$/.gitignore">
|
|
380
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
381
|
+
<state relative-caret-position="264">
|
|
382
|
+
<caret line="12" column="12" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
|
|
383
|
+
</state>
|
|
384
|
+
</provider>
|
|
385
|
+
</entry>
|
|
386
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks/errors.rb">
|
|
387
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
388
|
+
<state relative-caret-position="88">
|
|
389
|
+
<caret line="4" column="3" lean-forward="true" selection-start-line="4" selection-start-column="3" selection-end-line="4" selection-end-column="3" />
|
|
390
|
+
</state>
|
|
391
|
+
</provider>
|
|
392
|
+
</entry>
|
|
393
|
+
<entry file="file://$PROJECT_DIR$/spec/slippy_method_hooks_spec.rb">
|
|
394
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
395
|
+
<state relative-caret-position="5104">
|
|
396
|
+
<caret line="244" column="4" selection-start-line="244" selection-start-column="4" selection-end-line="244" selection-end-column="4" />
|
|
397
|
+
<folding>
|
|
398
|
+
<element signature="e#4480#4790#0" />
|
|
399
|
+
</folding>
|
|
400
|
+
</state>
|
|
401
|
+
</provider>
|
|
402
|
+
</entry>
|
|
403
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks.rb">
|
|
404
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
405
|
+
<state relative-caret-position="44">
|
|
406
|
+
<caret line="2" column="31" lean-forward="true" selection-start-line="2" selection-start-column="31" selection-end-line="2" selection-end-column="31" />
|
|
407
|
+
</state>
|
|
408
|
+
</provider>
|
|
409
|
+
</entry>
|
|
410
|
+
<entry file="file://$PROJECT_DIR$/lib/slippy_method_hooks/hooks.rb">
|
|
411
|
+
<provider selected="true" editor-type-id="text-editor">
|
|
412
|
+
<state relative-caret-position="660">
|
|
413
|
+
<caret line="30" column="16" lean-forward="true" selection-start-line="30" selection-start-column="16" selection-end-line="30" selection-end-column="16" />
|
|
414
|
+
</state>
|
|
415
|
+
</provider>
|
|
416
|
+
</entry>
|
|
417
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
|
418
|
+
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
|
419
|
+
<state split_layout="FIRST">
|
|
420
|
+
<first_editor relative-caret-position="968">
|
|
421
|
+
<caret line="44" column="27" lean-forward="true" selection-start-line="44" selection-start-column="27" selection-end-line="44" selection-end-column="27" />
|
|
422
|
+
</first_editor>
|
|
423
|
+
<second_editor />
|
|
424
|
+
</state>
|
|
425
|
+
</provider>
|
|
426
|
+
</entry>
|
|
427
|
+
</component>
|
|
428
|
+
</project>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 guckin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# SlippyMethodHooks
|
|
2
|
+
|
|
3
|
+
Available Hooks
|
|
4
|
+
|
|
5
|
+
`.before` - before a method execute callback
|
|
6
|
+
|
|
7
|
+
`.after` - after a method execute callback
|
|
8
|
+
|
|
9
|
+
`.rescue_on_fail` - if failure then rescue then call callback
|
|
10
|
+
|
|
11
|
+
`.time_box_method` - time box and call callback
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
Add this line to your application's Gemfile:
|
|
16
|
+
|
|
17
|
+
```ruby
|
|
18
|
+
gem 'slippy_method_hooks'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
And then execute:
|
|
22
|
+
|
|
23
|
+
$ bundle
|
|
24
|
+
|
|
25
|
+
Or install it yourself as:
|
|
26
|
+
|
|
27
|
+
$ gem install slippy_method_hooks
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
### `.before`
|
|
32
|
+
The before hook will be called before the method call
|
|
33
|
+
```ruby
|
|
34
|
+
class MyClass
|
|
35
|
+
include SlippyMethodHooks
|
|
36
|
+
|
|
37
|
+
def a(args)
|
|
38
|
+
puts "#a called with args #{args}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def b(args)
|
|
42
|
+
puts "#b called with args #{args.join(', ')}"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
before(:a, :b) do |name, args|
|
|
46
|
+
puts name # this is the name of the method
|
|
47
|
+
puts args # yields the args
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
my_class = MyClass.new
|
|
51
|
+
my_class.b('arg 1', 'arg 2')
|
|
52
|
+
# b
|
|
53
|
+
# ['arg 1', 'arg 2']
|
|
54
|
+
# b called with args arg 1, arg 2
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### `.after`
|
|
59
|
+
|
|
60
|
+
```ruby
|
|
61
|
+
TODO
|
|
62
|
+
class MyClass
|
|
63
|
+
include SlippyMethodHooks
|
|
64
|
+
def a(args)
|
|
65
|
+
args
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def b(args)
|
|
69
|
+
args
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
before(:a, :b) do |name, args|
|
|
73
|
+
puts name # this is the name of the method
|
|
74
|
+
puts args # yields the args
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
my_class = MyClass.new
|
|
78
|
+
my_class.b('arg 1', 'arg 2')
|
|
79
|
+
# b
|
|
80
|
+
# ['arg 1', 'arg 2']
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `.rescue_on_fail`
|
|
84
|
+
|
|
85
|
+
```ruby
|
|
86
|
+
TODO
|
|
87
|
+
class MyClass
|
|
88
|
+
include SlippyMethodHooks
|
|
89
|
+
def a(args)
|
|
90
|
+
args
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def b(args)
|
|
94
|
+
args
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
before(:a, :b) do |name, args|
|
|
98
|
+
puts name # this is the name of the method
|
|
99
|
+
puts args # yields the args
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
my_class = MyClass.new
|
|
103
|
+
my_class.b('arg 1', 'arg 2')
|
|
104
|
+
# b
|
|
105
|
+
# ['arg 1', 'arg 2']
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### `.time_box_method`
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
TODO
|
|
112
|
+
class MyClass
|
|
113
|
+
include SlippyMethodHooks
|
|
114
|
+
def a(args)
|
|
115
|
+
args
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def b(args)
|
|
119
|
+
args
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
before(:a, :b) do |name, args|
|
|
123
|
+
puts name # this is the name of the method
|
|
124
|
+
puts args # yields the args
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
my_class = MyClass.new
|
|
128
|
+
my_class.b('arg 1', 'arg 2')
|
|
129
|
+
# b
|
|
130
|
+
# ['arg 1', 'arg 2']
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Development
|
|
134
|
+
|
|
135
|
+
After checking out the repo, run `bin/setup`
|
|
136
|
+
to install dependencies. Then, run `rake spec`
|
|
137
|
+
to run the tests. You can also run `bin/console`
|
|
138
|
+
for an interactive prompt that will allow you to
|
|
139
|
+
experiment.
|
|
140
|
+
|
|
141
|
+
TODOS:
|
|
142
|
+
* documentation
|
|
143
|
+
* refactoring on hooks
|
|
144
|
+
* refactoring tests
|
|
145
|
+
* set up travis for deployment
|
|
146
|
+
|
|
147
|
+
To install this gem onto your local machine, run
|
|
148
|
+
`bundle exec rake install`. To release a new version,
|
|
149
|
+
update the version number in `version.rb`, and then
|
|
150
|
+
run `bundle exec rake release`, which will create a
|
|
151
|
+
git tag for the version, push git commits and tags,
|
|
152
|
+
and push the `.gem` file to
|
|
153
|
+
[rubygems.org](https://rubygems.org).
|
|
154
|
+
|
|
155
|
+
## Contributing
|
|
156
|
+
|
|
157
|
+
Bug reports and pull requests are welcome
|
|
158
|
+
on GitHub at https://github.com/guckin/slippy_method_hooks.
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
The gem is available as open source under the
|
|
163
|
+
terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "slippy_method_hooks"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
require 'slippy_method_hooks/errors'
|
|
2
|
+
require 'timeout'
|
|
3
|
+
module SlippyMethodHooks
|
|
4
|
+
def self.included(mod)
|
|
5
|
+
mod.extend(ClassMethods)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def self.extend(mod)
|
|
9
|
+
mod.extend(ClassMethods)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
module ClassMethods
|
|
13
|
+
def time_box_method(time, *names, &blk)
|
|
14
|
+
names.each do |name|
|
|
15
|
+
meth = instance_method(name)
|
|
16
|
+
define_method(name) do |*args, &block|
|
|
17
|
+
begin
|
|
18
|
+
Timeout.timeout(time) do
|
|
19
|
+
meth.bind(self).call(*args, &block)
|
|
20
|
+
end
|
|
21
|
+
rescue Timeout::Error
|
|
22
|
+
error_args = [TimeoutError, 'execution expired', caller]
|
|
23
|
+
raise(*error_args) unless block_given?
|
|
24
|
+
|
|
25
|
+
instance_exec(*error_args, &blk)
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def rescue_on_fail(*names, &blk)
|
|
32
|
+
unless blk
|
|
33
|
+
raise NoBlockGiven,
|
|
34
|
+
'.rescue_on_fail must be called with a block',
|
|
35
|
+
caller
|
|
36
|
+
end
|
|
37
|
+
names.each do |name|
|
|
38
|
+
meth = instance_method(name)
|
|
39
|
+
define_method(name) do |*args, &block|
|
|
40
|
+
begin
|
|
41
|
+
meth.bind(self).call(*args, &block)
|
|
42
|
+
rescue StandardError => e
|
|
43
|
+
instance_exec(e, &blk)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def before(*names, &blk)
|
|
50
|
+
unless blk
|
|
51
|
+
raise NoBlockGiven,
|
|
52
|
+
'.rescue_on_fail must be called with a block',
|
|
53
|
+
caller
|
|
54
|
+
end
|
|
55
|
+
names.each do |name|
|
|
56
|
+
meth = instance_method(name)
|
|
57
|
+
define_method name do |*args, &block|
|
|
58
|
+
instance_exec(name, *args, block, &blk)
|
|
59
|
+
meth.bind(self).call(*args, &block)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def after(*names, &blk)
|
|
65
|
+
unless blk
|
|
66
|
+
raise NoBlockGiven,
|
|
67
|
+
'.rescue_on_fail must be called with a block',
|
|
68
|
+
caller
|
|
69
|
+
end
|
|
70
|
+
names.each do |name|
|
|
71
|
+
meth = instance_method(name)
|
|
72
|
+
define_method name do |*args, &block|
|
|
73
|
+
result = meth.bind(self).call(*args, &block)
|
|
74
|
+
instance_exec(result, &blk)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
|
+
require 'slippy_method_hooks/version'
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = 'slippy_method_hooks'
|
|
7
|
+
spec.version = SlippyMethodHooks::VERSION
|
|
8
|
+
spec.authors = ['guckin']
|
|
9
|
+
spec.email = ['donald.stephen.mcguckin@gmail.com']
|
|
10
|
+
|
|
11
|
+
spec.summary = 'Method Hooks for ruby'
|
|
12
|
+
spec.homepage = 'https://github.com/guckin/slippy_method_hooks'
|
|
13
|
+
spec.license = 'MIT'
|
|
14
|
+
|
|
15
|
+
if spec.respond_to?(:metadata)
|
|
16
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
|
17
|
+
|
|
18
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
19
|
+
spec.metadata['source_code_uri'] = 'https://github.com/guckin/slippy_method_hooks'
|
|
20
|
+
else
|
|
21
|
+
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
|
22
|
+
'public gem pushes.'
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Specify which files should be added to the gem when it is released.
|
|
26
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
27
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
28
|
+
`git ls-files -z`
|
|
29
|
+
.split("\x0")
|
|
30
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
31
|
+
end
|
|
32
|
+
spec.bindir = 'exe'
|
|
33
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
34
|
+
spec.require_paths = ['lib']
|
|
35
|
+
|
|
36
|
+
spec.add_development_dependency 'bundler'
|
|
37
|
+
spec.add_development_dependency 'pry'
|
|
38
|
+
spec.add_development_dependency 'rake'
|
|
39
|
+
spec.add_development_dependency 'rspec'
|
|
40
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: slippy_method_hooks
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- guckin
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2019-03-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pry
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rake
|
|
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: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
description:
|
|
70
|
+
email:
|
|
71
|
+
- donald.stephen.mcguckin@gmail.com
|
|
72
|
+
executables:
|
|
73
|
+
- slippy_method_hooks
|
|
74
|
+
extensions: []
|
|
75
|
+
extra_rdoc_files: []
|
|
76
|
+
files:
|
|
77
|
+
- ".gitignore"
|
|
78
|
+
- ".idea/encodings.xml"
|
|
79
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
|
80
|
+
- ".idea/misc.xml"
|
|
81
|
+
- ".idea/modules.xml"
|
|
82
|
+
- ".idea/slippy_method_hooks.iml"
|
|
83
|
+
- ".idea/vcs.xml"
|
|
84
|
+
- ".idea/workspace.xml"
|
|
85
|
+
- ".rspec"
|
|
86
|
+
- ".travis.yml"
|
|
87
|
+
- Gemfile
|
|
88
|
+
- LICENSE.txt
|
|
89
|
+
- README.md
|
|
90
|
+
- Rakefile
|
|
91
|
+
- bin/console
|
|
92
|
+
- bin/setup
|
|
93
|
+
- exe/slippy_method_hooks
|
|
94
|
+
- lib/slippy_method_hooks.rb
|
|
95
|
+
- lib/slippy_method_hooks/errors.rb
|
|
96
|
+
- lib/slippy_method_hooks/hooks.rb
|
|
97
|
+
- lib/slippy_method_hooks/version.rb
|
|
98
|
+
- slippy_method_hooks.gemspec
|
|
99
|
+
homepage: https://github.com/guckin/slippy_method_hooks
|
|
100
|
+
licenses:
|
|
101
|
+
- MIT
|
|
102
|
+
metadata:
|
|
103
|
+
allowed_push_host: https://rubygems.org/
|
|
104
|
+
homepage_uri: https://github.com/guckin/slippy_method_hooks
|
|
105
|
+
source_code_uri: https://github.com/guckin/slippy_method_hooks
|
|
106
|
+
post_install_message:
|
|
107
|
+
rdoc_options: []
|
|
108
|
+
require_paths:
|
|
109
|
+
- lib
|
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
|
+
requirements:
|
|
112
|
+
- - ">="
|
|
113
|
+
- !ruby/object:Gem::Version
|
|
114
|
+
version: '0'
|
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '0'
|
|
120
|
+
requirements: []
|
|
121
|
+
rubyforge_project:
|
|
122
|
+
rubygems_version: 2.7.3
|
|
123
|
+
signing_key:
|
|
124
|
+
specification_version: 4
|
|
125
|
+
summary: Method Hooks for ruby
|
|
126
|
+
test_files: []
|