loader 1.4.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/loader.iml +20 -0
- data/.idea/misc.xml +32 -0
- data/.idea/modules.xml +8 -0
- data/.idea/scopes/scope_settings.xml +5 -0
- data/.idea/vcs.xml +6 -0
- data/.idea/workspace.xml +429 -0
- data/README.md +65 -18
- data/VERSION +1 -1
- data/lib/loader.rb +5 -7
- data/lib/loader/autoload.rb +75 -0
- data/lib/loader/meta.rb +3 -197
- data/loader.gemspec +9 -8
- data/test/helper.rb +3 -0
- data/test/lib/cat.rb +3 -0
- data/test/lib/cat/sup.rb +1 -0
- data/test/lib/cat/tail.rb +5 -0
- data/test/lib/dog.rb +2 -0
- data/test/test.rb +2 -2
- data/test/test_autoload.rb +60 -0
- metadata +31 -7
- data/lib/loader/hash.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b01d5a136a9fe1cd41d33fb6abd0d96f550cb170
|
4
|
+
data.tar.gz: d7bfe5070965fa0edde43fefa3fce533e3e9901a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1126d66a04b941e43a2a00e3ed4ba72563e7bbe7edd4564fa4e8e621e84ec552565b6a13b05ddfd4786ae9b113940ddd797126c140462bf9ec33c1c7263b5e5f
|
7
|
+
data.tar.gz: 51c4cbb143628f513e0541da49b7ca0d1d88af1535ffed681de23bb9a2ccfffe5cd439187ca3a98f19d3d7e307862e6341589f857715bfbc36c94d528098027a
|
data/.gitignore
CHANGED
data/.idea/.name
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
loader
|
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 loader-1.4.2.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install loader-1.4.2.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v1.4.2 and build and push loader-1.4.2.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
|
data/.idea/encodings.xml
ADDED
data/.idea/loader.iml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="$MODULE_DIR$" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="$MODULE_DIR$/test" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="$MODULE_DIR$/lib" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager">
|
13
|
+
<content url="file://$MODULE_DIR$">
|
14
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
15
|
+
</content>
|
16
|
+
<orderEntry type="inheritedJdk" />
|
17
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.7.12, RVM: ruby-2.1.2) [gem]" level="application" />
|
19
|
+
</component>
|
20
|
+
</module>
|
data/.idea/misc.xml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="DaemonCodeAnalyzer">
|
4
|
+
<disable_hints />
|
5
|
+
</component>
|
6
|
+
<component name="DependencyValidationManager">
|
7
|
+
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
8
|
+
</component>
|
9
|
+
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
10
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
11
|
+
<OptionsSetting value="true" id="Add" />
|
12
|
+
<OptionsSetting value="true" id="Remove" />
|
13
|
+
<OptionsSetting value="true" id="Checkout" />
|
14
|
+
<OptionsSetting value="true" id="Update" />
|
15
|
+
<OptionsSetting value="true" id="Status" />
|
16
|
+
<OptionsSetting value="true" id="Edit" />
|
17
|
+
<ConfirmationsSetting value="0" id="Add" />
|
18
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
19
|
+
</component>
|
20
|
+
<component name="ProjectModuleManager">
|
21
|
+
<modules />
|
22
|
+
</component>
|
23
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.1.2" project-jdk-type="RUBY_SDK" />
|
24
|
+
<component name="PropertiesComponent">
|
25
|
+
<property name="options.lastSelected" value="preferences.general" />
|
26
|
+
<property name="options.splitter.main.proportions" value="0.3" />
|
27
|
+
<property name="options.splitter.details.proportions" value="0.2" />
|
28
|
+
</component>
|
29
|
+
<component name="RunManager">
|
30
|
+
<list size="0" />
|
31
|
+
</component>
|
32
|
+
</project>
|
data/.idea/modules.xml
ADDED
data/.idea/vcs.xml
ADDED
data/.idea/workspace.xml
ADDED
@@ -0,0 +1,429 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ChangeListManager">
|
4
|
+
<list default="true" id="5c648dae-24a7-407a-9171-382a75ebaebc" name="Default" comment="">
|
5
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/loader/autoload.rb" />
|
6
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/lib/cat.rb" />
|
7
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/lib/dog.rb" />
|
8
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/helper.rb" />
|
9
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/lib/cat/sup.rb" />
|
10
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/lib/cat/tail.rb" />
|
11
|
+
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/test/test_autoload.rb" />
|
12
|
+
<change type="DELETED" beforePath="$PROJECT_DIR$/lib/loader/hash.rb" afterPath="" />
|
13
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
|
14
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
|
15
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/VERSION" afterPath="$PROJECT_DIR$/VERSION" />
|
16
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/loader.gemspec" afterPath="$PROJECT_DIR$/loader.gemspec" />
|
17
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/loader.rb" afterPath="$PROJECT_DIR$/lib/loader.rb" />
|
18
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/loader/meta.rb" afterPath="$PROJECT_DIR$/lib/loader/meta.rb" />
|
19
|
+
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/test.rb" afterPath="$PROJECT_DIR$/test/test.rb" />
|
20
|
+
</list>
|
21
|
+
<ignored path="loader.iws" />
|
22
|
+
<ignored path=".idea/workspace.xml" />
|
23
|
+
<ignored path=".idea/dataSources.local.xml" />
|
24
|
+
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
25
|
+
<option name="TRACKING_ENABLED" value="true" />
|
26
|
+
<option name="SHOW_DIALOG" value="false" />
|
27
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
28
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
29
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
30
|
+
</component>
|
31
|
+
<component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
|
32
|
+
<component name="CreatePatchCommitExecutor">
|
33
|
+
<option name="PATCH_PATH" value="" />
|
34
|
+
</component>
|
35
|
+
<component name="DaemonCodeAnalyzer">
|
36
|
+
<disable_hints />
|
37
|
+
</component>
|
38
|
+
<component name="FavoritesManager">
|
39
|
+
<favorites_list name="loader" />
|
40
|
+
</component>
|
41
|
+
<component name="FileEditorManager">
|
42
|
+
<leaf />
|
43
|
+
</component>
|
44
|
+
<component name="Git.Settings">
|
45
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
46
|
+
</component>
|
47
|
+
<component name="IdeDocumentHistory">
|
48
|
+
<option name="CHANGED_PATHS">
|
49
|
+
<list>
|
50
|
+
<option value="$PROJECT_DIR$/lib/loader/hash.rb" />
|
51
|
+
<option value="$PROJECT_DIR$/lib/loader.rb" />
|
52
|
+
<option value="$PROJECT_DIR$/test/test.rb" />
|
53
|
+
<option value="$PROJECT_DIR$/test/helper.rb" />
|
54
|
+
<option value="$PROJECT_DIR$/test/lib/cat.rb" />
|
55
|
+
<option value="$PROJECT_DIR$/test/lib/cat/tail.rb" />
|
56
|
+
<option value="$PROJECT_DIR$/lib/loader/autoload.rb" />
|
57
|
+
<option value="$PROJECT_DIR$/loader.gemspec" />
|
58
|
+
<option value="$PROJECT_DIR$/lib/loader/meta.rb" />
|
59
|
+
<option value="$PROJECT_DIR$/test/lib/cat/sup.rb" />
|
60
|
+
<option value="$PROJECT_DIR$/README.md" />
|
61
|
+
<option value="$PROJECT_DIR$/test/lib/dog.rb" />
|
62
|
+
<option value="$PROJECT_DIR$/test/test_autoload.rb" />
|
63
|
+
</list>
|
64
|
+
</option>
|
65
|
+
</component>
|
66
|
+
<component name="JsGulpfileManager">
|
67
|
+
<detection-done>true</detection-done>
|
68
|
+
</component>
|
69
|
+
<component name="ProjectFrameBounds">
|
70
|
+
<option name="x" value="-2" />
|
71
|
+
<option name="y" value="-1" />
|
72
|
+
<option name="width" value="1370" />
|
73
|
+
<option name="height" value="741" />
|
74
|
+
</component>
|
75
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
|
76
|
+
<OptionsSetting value="true" id="Add" />
|
77
|
+
<OptionsSetting value="true" id="Remove" />
|
78
|
+
<OptionsSetting value="true" id="Checkout" />
|
79
|
+
<OptionsSetting value="true" id="Update" />
|
80
|
+
<OptionsSetting value="true" id="Status" />
|
81
|
+
<OptionsSetting value="true" id="Edit" />
|
82
|
+
<ConfirmationsSetting value="0" id="Add" />
|
83
|
+
<ConfirmationsSetting value="0" id="Remove" />
|
84
|
+
</component>
|
85
|
+
<component name="ProjectView">
|
86
|
+
<navigator currentView="ProjectPane" proportions="" version="1">
|
87
|
+
<flattenPackages />
|
88
|
+
<showMembers />
|
89
|
+
<showModules />
|
90
|
+
<showLibraryContents />
|
91
|
+
<hideEmptyPackages />
|
92
|
+
<abbreviatePackageNames />
|
93
|
+
<autoscrollToSource />
|
94
|
+
<autoscrollFromSource />
|
95
|
+
<sortByType />
|
96
|
+
</navigator>
|
97
|
+
<panes>
|
98
|
+
<pane id="ProjectPane">
|
99
|
+
<subPane>
|
100
|
+
<PATH>
|
101
|
+
<PATH_ELEMENT>
|
102
|
+
<option name="myItemId" value="loader" />
|
103
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
104
|
+
</PATH_ELEMENT>
|
105
|
+
</PATH>
|
106
|
+
<PATH>
|
107
|
+
<PATH_ELEMENT>
|
108
|
+
<option name="myItemId" value="loader" />
|
109
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
110
|
+
</PATH_ELEMENT>
|
111
|
+
<PATH_ELEMENT>
|
112
|
+
<option name="myItemId" value="loader" />
|
113
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
114
|
+
</PATH_ELEMENT>
|
115
|
+
</PATH>
|
116
|
+
<PATH>
|
117
|
+
<PATH_ELEMENT>
|
118
|
+
<option name="myItemId" value="loader" />
|
119
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
120
|
+
</PATH_ELEMENT>
|
121
|
+
<PATH_ELEMENT>
|
122
|
+
<option name="myItemId" value="loader" />
|
123
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
124
|
+
</PATH_ELEMENT>
|
125
|
+
<PATH_ELEMENT>
|
126
|
+
<option name="myItemId" value="test" />
|
127
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
128
|
+
</PATH_ELEMENT>
|
129
|
+
</PATH>
|
130
|
+
<PATH>
|
131
|
+
<PATH_ELEMENT>
|
132
|
+
<option name="myItemId" value="loader" />
|
133
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
134
|
+
</PATH_ELEMENT>
|
135
|
+
<PATH_ELEMENT>
|
136
|
+
<option name="myItemId" value="loader" />
|
137
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
138
|
+
</PATH_ELEMENT>
|
139
|
+
<PATH_ELEMENT>
|
140
|
+
<option name="myItemId" value="test" />
|
141
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
142
|
+
</PATH_ELEMENT>
|
143
|
+
<PATH_ELEMENT>
|
144
|
+
<option name="myItemId" value="lib" />
|
145
|
+
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
146
|
+
</PATH_ELEMENT>
|
147
|
+
</PATH>
|
148
|
+
</subPane>
|
149
|
+
</pane>
|
150
|
+
<pane id="Scope" />
|
151
|
+
</panes>
|
152
|
+
</component>
|
153
|
+
<component name="PropertiesComponent">
|
154
|
+
<property name="options.lastSelected" value="preferences.general" />
|
155
|
+
<property name="options.splitter.main.proportions" value="0.3" />
|
156
|
+
<property name="options.splitter.details.proportions" value="0.2" />
|
157
|
+
<property name="WebServerToolWindowFactoryState" value="false" />
|
158
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
159
|
+
</component>
|
160
|
+
<component name="RunManager">
|
161
|
+
<configuration default="true" type="RSpecRunConfigurationType" factoryName="RSpec">
|
162
|
+
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
|
163
|
+
<module name="" />
|
164
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
165
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
166
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
167
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
168
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
169
|
+
<envs />
|
170
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
171
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
172
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
173
|
+
<COVERAGE_PATTERN ENABLED="true">
|
174
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
175
|
+
</COVERAGE_PATTERN>
|
176
|
+
</EXTENSION>
|
177
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
178
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
179
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
180
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
181
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
|
182
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
|
183
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
184
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
|
185
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
|
186
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
|
187
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
188
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
189
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
190
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
191
|
+
<method />
|
192
|
+
</configuration>
|
193
|
+
<configuration default="true" type="RubyRunConfigurationType" factoryName="Ruby">
|
194
|
+
<module name="" />
|
195
|
+
<RUBY_RUN_CONFIG NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
196
|
+
<RUBY_RUN_CONFIG NAME="WORK DIR" VALUE="" />
|
197
|
+
<RUBY_RUN_CONFIG NAME="SHOULD_USE_SDK" VALUE="false" />
|
198
|
+
<RUBY_RUN_CONFIG NAME="ALTERN_SDK_NAME" VALUE="" />
|
199
|
+
<RUBY_RUN_CONFIG NAME="myPassParentEnvs" VALUE="true" />
|
200
|
+
<envs />
|
201
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
202
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
203
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
204
|
+
<COVERAGE_PATTERN ENABLED="true">
|
205
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
206
|
+
</COVERAGE_PATTERN>
|
207
|
+
</EXTENSION>
|
208
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
209
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_PATH" VALUE="" />
|
210
|
+
<RUBY_RUN_CONFIG NAME="SCRIPT_ARGS" VALUE="" />
|
211
|
+
<method />
|
212
|
+
</configuration>
|
213
|
+
<configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
|
214
|
+
<method />
|
215
|
+
</configuration>
|
216
|
+
<configuration default="true" type="TestUnitRunConfigurationType" factoryName="Test::Unit/Shoulda/Minitest">
|
217
|
+
<predefined_log_file id="RUBY_TESTUNIT" enabled="true" />
|
218
|
+
<module name="" />
|
219
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="-e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)" />
|
220
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="" />
|
221
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
|
222
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
|
223
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
224
|
+
<envs />
|
225
|
+
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
226
|
+
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
227
|
+
<EXTENSION ID="RubyCoverageRunConfigurationExtension" enabled="false" sample_coverage="true" track_test_folders="true" runner="rcov">
|
228
|
+
<COVERAGE_PATTERN ENABLED="true">
|
229
|
+
<PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
|
230
|
+
</COVERAGE_PATTERN>
|
231
|
+
</EXTENSION>
|
232
|
+
<EXTENSION ID="org.jetbrains.plugins.ruby.motion.run.MotionSimulatorRunExtension" />
|
233
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="" />
|
234
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
235
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
236
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_METHOD_NAME" VALUE="" />
|
237
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="TEST_SCRIPT" />
|
238
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="DRB" VALUE="false" />
|
239
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="ZEUS" VALUE="false" />
|
240
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
|
241
|
+
<RTEST_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_OPTIONS" VALUE="" />
|
242
|
+
<method />
|
243
|
+
</configuration>
|
244
|
+
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
|
245
|
+
<method />
|
246
|
+
</configuration>
|
247
|
+
<list size="0" />
|
248
|
+
</component>
|
249
|
+
<component name="ShelveChangesManager" show_recycled="false" />
|
250
|
+
<component name="TaskManager">
|
251
|
+
<task active="true" id="Default" summary="Default task">
|
252
|
+
<changelist id="5c648dae-24a7-407a-9171-382a75ebaebc" name="Default" comment="" />
|
253
|
+
<created>1422571116390</created>
|
254
|
+
<option name="number" value="Default" />
|
255
|
+
<updated>1422571116390</updated>
|
256
|
+
</task>
|
257
|
+
<servers />
|
258
|
+
</component>
|
259
|
+
<component name="ToolWindowManager">
|
260
|
+
<frame x="-2" y="-1" width="1370" height="741" extended-state="0" />
|
261
|
+
<editor active="false" />
|
262
|
+
<layout>
|
263
|
+
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
264
|
+
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
265
|
+
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32886904" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
266
|
+
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
267
|
+
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
268
|
+
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
269
|
+
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
|
270
|
+
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
271
|
+
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
272
|
+
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
273
|
+
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
|
274
|
+
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24963397" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
275
|
+
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
276
|
+
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
277
|
+
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
278
|
+
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
279
|
+
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
280
|
+
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
|
281
|
+
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
|
282
|
+
</layout>
|
283
|
+
</component>
|
284
|
+
<component name="Vcs.Log.UiProperties">
|
285
|
+
<option name="RECENTLY_FILTERED_USER_GROUPS">
|
286
|
+
<collection />
|
287
|
+
</option>
|
288
|
+
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
|
289
|
+
<collection />
|
290
|
+
</option>
|
291
|
+
</component>
|
292
|
+
<component name="VcsContentAnnotationSettings">
|
293
|
+
<option name="myLimit" value="2678400000" />
|
294
|
+
</component>
|
295
|
+
<component name="VcsManagerConfiguration">
|
296
|
+
<option name="myTodoPanelSettings">
|
297
|
+
<TodoPanelSettings />
|
298
|
+
</option>
|
299
|
+
</component>
|
300
|
+
<component name="XDebuggerManager">
|
301
|
+
<breakpoint-manager />
|
302
|
+
<watches-manager />
|
303
|
+
</component>
|
304
|
+
<component name="editorHistoryManager">
|
305
|
+
<entry file="file://$PROJECT_DIR$/lib/loader.rb">
|
306
|
+
<provider selected="true" editor-type-id="text-editor">
|
307
|
+
<state vertical-scroll-proportion="0.04245283" vertical-offset="0" max-vertical-offset="424">
|
308
|
+
<caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
|
309
|
+
<folding />
|
310
|
+
</state>
|
311
|
+
</provider>
|
312
|
+
</entry>
|
313
|
+
<entry file="file://$PROJECT_DIR$/test/helper.rb">
|
314
|
+
<provider selected="true" editor-type-id="text-editor">
|
315
|
+
<state vertical-scroll-proportion="0.04245283" vertical-offset="0" max-vertical-offset="424">
|
316
|
+
<caret line="1" column="26" selection-start-line="1" selection-start-column="26" selection-end-line="1" selection-end-column="26" />
|
317
|
+
<folding />
|
318
|
+
</state>
|
319
|
+
</provider>
|
320
|
+
</entry>
|
321
|
+
<entry file="file://$PROJECT_DIR$/test/lib/cat/tail.rb">
|
322
|
+
<provider selected="true" editor-type-id="text-editor">
|
323
|
+
<state vertical-scroll-proportion="0.055813953" vertical-offset="0" max-vertical-offset="645">
|
324
|
+
<caret line="2" column="4" selection-start-line="2" selection-start-column="4" selection-end-line="2" selection-end-column="4" />
|
325
|
+
<folding />
|
326
|
+
</state>
|
327
|
+
</provider>
|
328
|
+
</entry>
|
329
|
+
<entry file="file://$PROJECT_DIR$/test/lib/cat.rb">
|
330
|
+
<provider selected="true" editor-type-id="text-editor">
|
331
|
+
<state vertical-scroll-proportion="0.027906977" vertical-offset="0" max-vertical-offset="645">
|
332
|
+
<caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
|
333
|
+
<folding />
|
334
|
+
</state>
|
335
|
+
</provider>
|
336
|
+
</entry>
|
337
|
+
<entry file="file://$PROJECT_DIR$/lib/loader/autoload.rb">
|
338
|
+
<provider selected="true" editor-type-id="text-editor">
|
339
|
+
<state vertical-scroll-proportion="0.41705427" vertical-offset="55" max-vertical-offset="1440">
|
340
|
+
<caret line="18" column="63" selection-start-line="18" selection-start-column="63" selection-end-line="18" selection-end-column="63" />
|
341
|
+
<folding />
|
342
|
+
</state>
|
343
|
+
</provider>
|
344
|
+
</entry>
|
345
|
+
<entry file="file://$PROJECT_DIR$/test/test.rb">
|
346
|
+
<provider selected="true" editor-type-id="text-editor">
|
347
|
+
<state vertical-scroll-proportion="0.027906977" vertical-offset="0" max-vertical-offset="645">
|
348
|
+
<caret line="1" column="0" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
|
349
|
+
<folding />
|
350
|
+
</state>
|
351
|
+
</provider>
|
352
|
+
</entry>
|
353
|
+
<entry file="file://$PROJECT_DIR$/Gemfile">
|
354
|
+
<provider selected="true" editor-type-id="text-editor">
|
355
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="645">
|
356
|
+
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
357
|
+
<folding />
|
358
|
+
</state>
|
359
|
+
</provider>
|
360
|
+
</entry>
|
361
|
+
<entry file="file://$PROJECT_DIR$/test/lib/cat/sup.rb">
|
362
|
+
<provider selected="true" editor-type-id="text-editor">
|
363
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="424">
|
364
|
+
<caret line="0" column="18" selection-start-line="0" selection-start-column="18" selection-end-line="0" selection-end-column="18" />
|
365
|
+
<folding />
|
366
|
+
</state>
|
367
|
+
</provider>
|
368
|
+
</entry>
|
369
|
+
<entry file="file://$PROJECT_DIR$/lib/loader/meta.rb">
|
370
|
+
<provider selected="true" editor-type-id="text-editor">
|
371
|
+
<state vertical-scroll-proportion="0.1273585" vertical-offset="0" max-vertical-offset="1512">
|
372
|
+
<caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
|
373
|
+
<folding />
|
374
|
+
</state>
|
375
|
+
</provider>
|
376
|
+
</entry>
|
377
|
+
<entry file="file://$PROJECT_DIR$/lib/loader/require.rb">
|
378
|
+
<provider selected="true" editor-type-id="text-editor">
|
379
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1476">
|
380
|
+
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
381
|
+
<folding />
|
382
|
+
</state>
|
383
|
+
</provider>
|
384
|
+
</entry>
|
385
|
+
<entry file="file://$PROJECT_DIR$/test/lib/dog.rb">
|
386
|
+
<provider selected="true" editor-type-id="text-editor">
|
387
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="424">
|
388
|
+
<caret line="0" column="9" selection-start-line="0" selection-start-column="9" selection-end-line="0" selection-end-column="9" />
|
389
|
+
<folding />
|
390
|
+
</state>
|
391
|
+
</provider>
|
392
|
+
</entry>
|
393
|
+
<entry file="file://$PROJECT_DIR$/test/test_autoload.rb">
|
394
|
+
<provider selected="true" editor-type-id="text-editor">
|
395
|
+
<state vertical-scroll-proportion="0.49056605" vertical-offset="530" max-vertical-offset="1170">
|
396
|
+
<caret line="41" column="10" selection-start-line="41" selection-start-column="10" selection-end-line="41" selection-end-column="10" />
|
397
|
+
<folding />
|
398
|
+
</state>
|
399
|
+
</provider>
|
400
|
+
</entry>
|
401
|
+
<entry file="file://$PROJECT_DIR$/LICENSE">
|
402
|
+
<provider editor-type-id="com.intellij.database.editor.CsvTableFileEditorProvider">
|
403
|
+
<state />
|
404
|
+
</provider>
|
405
|
+
<provider selected="true" editor-type-id="text-editor">
|
406
|
+
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="468">
|
407
|
+
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
408
|
+
<folding />
|
409
|
+
</state>
|
410
|
+
</provider>
|
411
|
+
</entry>
|
412
|
+
<entry file="file://$PROJECT_DIR$/loader.gemspec">
|
413
|
+
<provider selected="true" editor-type-id="text-editor">
|
414
|
+
<state vertical-scroll-proportion="0.21167883" vertical-offset="57" max-vertical-offset="522">
|
415
|
+
<caret line="8" column="71" selection-start-line="8" selection-start-column="71" selection-end-line="8" selection-end-column="71" />
|
416
|
+
<folding />
|
417
|
+
</state>
|
418
|
+
</provider>
|
419
|
+
</entry>
|
420
|
+
<entry file="file://$PROJECT_DIR$/README.md">
|
421
|
+
<provider selected="true" editor-type-id="text-editor">
|
422
|
+
<state vertical-scroll-proportion="0.7293233" vertical-offset="1617" max-vertical-offset="2016">
|
423
|
+
<caret line="106" column="3" selection-start-line="106" selection-start-column="3" selection-end-line="106" selection-end-column="3" />
|
424
|
+
<folding />
|
425
|
+
</state>
|
426
|
+
</provider>
|
427
|
+
</entry>
|
428
|
+
</component>
|
429
|
+
</project>
|
data/README.md
CHANGED
@@ -1,22 +1,20 @@
|
|
1
1
|
loader
|
2
2
|
======
|
3
3
|
|
4
|
-
Ruby module for
|
4
|
+
Ruby module for Easy File lifting :)
|
5
5
|
|
6
6
|
### Introduction
|
7
7
|
|
8
8
|
Okey, before you even think about use this gem,
|
9
9
|
let's say this gem only for lazy ones...
|
10
|
-
|
11
|
-
|
12
|
-
into a constant,
|
13
|
-
maybe into some other config specific gem that make config objects from hash.
|
10
|
+
|
11
|
+
the basic idea is to have an easy to use relative require system and a namespace based Constant loading logic
|
14
12
|
|
15
13
|
The fun part is , that this stuffs can be used in gems (modules),
|
16
14
|
because it do not depend on the Dir.pwd or any kind of absolute path or
|
17
15
|
the File expand_path tricks that based on the application position.
|
18
16
|
|
19
|
-
The end goal is to make an easy ruby file loader for
|
17
|
+
The end goal is to make an easy ruby file loader for apps and gems.
|
20
18
|
|
21
19
|
### Examples
|
22
20
|
|
@@ -32,29 +30,78 @@ if you pass multiple string as argument it will be joined by file separator that
|
|
32
30
|
require_relative_directory "folder_name"
|
33
31
|
|
34
32
|
# for recursive use try the following
|
35
|
-
|
33
|
+
require_relative_directory_r "folder_name/path/etc"
|
34
|
+
|
35
|
+
|
36
|
+
```
|
37
|
+
|
38
|
+
If you like the basic idea that the app should not do any kind of Eager Load and become slow,
|
39
|
+
you can use the constant based autoload function
|
40
|
+
|
41
|
+
simple as this:
|
42
|
+
|
43
|
+
# lib/dog
|
44
|
+
```ruby
|
45
|
+
|
46
|
+
class Dog
|
47
|
+
def self.say
|
48
|
+
"Wuff"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
```
|
53
|
+
|
54
|
+
# lib/cat
|
55
|
+
```ruby
|
56
|
+
|
57
|
+
class Cat
|
58
|
+
#some meow here
|
59
|
+
end
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
# lib/cat/tail
|
64
|
+
```ruby
|
36
65
|
|
37
|
-
|
38
|
-
|
66
|
+
class Cat
|
67
|
+
class Tail
|
39
68
|
|
40
|
-
|
41
|
-
|
69
|
+
def self.grab
|
70
|
+
"MEOW!!!"
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
42
75
|
|
43
76
|
```
|
44
77
|
|
45
|
-
|
78
|
+
# lib/cat/pawn.rb
|
79
|
+
```ruby
|
80
|
+
|
81
|
+
class Cat
|
82
|
+
class Pawn
|
83
|
+
end
|
84
|
+
end
|
46
85
|
|
86
|
+
```
|
87
|
+
|
88
|
+
# lib/bootstrap
|
47
89
|
```ruby
|
48
90
|
|
49
91
|
require 'loader'
|
50
92
|
|
51
|
-
|
52
|
-
|
93
|
+
# from this point missing constants will be searched by file system path that is based on Object namespace
|
94
|
+
Loader.autoload
|
95
|
+
|
96
|
+
# no need to load the files , only when they required
|
97
|
+
Cat::Tail.grab #> "MEOW!!!"
|
53
98
|
|
54
|
-
|
55
|
-
|
99
|
+
class Cat
|
100
|
+
Pawn #> Pawn Constant loaded and returned
|
101
|
+
end
|
56
102
|
|
57
|
-
|
58
|
-
|
103
|
+
class Cat
|
104
|
+
Dog #> return Top lvl Dog Constant after file is loaded by this Constant request
|
105
|
+
end
|
59
106
|
|
60
107
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/loader.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
#encoding: UTF-8
|
2
|
-
module Loader
|
3
|
-
|
4
|
-
require "yaml"
|
5
|
-
|
6
|
-
require File.join(File.dirname(__FILE__),"loader","hash")
|
7
|
-
require File.join(File.dirname(__FILE__),"loader","meta")
|
8
|
-
require File.join(File.dirname(__FILE__),"loader","require")
|
9
2
|
|
3
|
+
module Loader
|
10
4
|
end
|
5
|
+
|
6
|
+
require 'loader/meta'
|
7
|
+
require 'loader/require'
|
8
|
+
require 'loader/autoload'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Loader
|
2
|
+
|
3
|
+
module AutoLoad
|
4
|
+
module Support
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def pwd
|
8
|
+
if !!ENV['BUNDLE_GEMFILE']
|
9
|
+
ENV['BUNDLE_GEMFILE'].split(File::Separator)[0..-2].join(File::Separator)
|
10
|
+
else
|
11
|
+
Dir.pwd
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def try_load_by(caller_class,name)
|
16
|
+
levels = generate_levels(caller_class, name)
|
17
|
+
['lib',nil].each do |folder|
|
18
|
+
levels.map{|str| File.join(*[pwd,folder,"#{underscore(str)}.rb"].compact)
|
19
|
+
}.sort{|a,b| b.length <=> a.length }.each do |path|
|
20
|
+
return if File.exist?(path) && require(path)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def generate_levels(klass, name)
|
26
|
+
levels = klass.to_s.split('::').reduce([]) { |m, c|
|
27
|
+
m << [(last_obj = m.last), c].compact.join('::');m
|
28
|
+
}.map { |str| [str, name].join('::') }
|
29
|
+
levels.unshift(name.to_s)
|
30
|
+
return levels
|
31
|
+
end
|
32
|
+
|
33
|
+
def try_fetch_constant(caller_class, name)
|
34
|
+
levels = Support.generate_levels(caller_class, name).map { |str| Regexp.escape(str) }
|
35
|
+
ObjectSpace.each_object(Module) { |obj|
|
36
|
+
if !!(obj.to_s =~ /^(#{levels.join('|')})$/)
|
37
|
+
return obj
|
38
|
+
end
|
39
|
+
};nil
|
40
|
+
end
|
41
|
+
|
42
|
+
# Based on ActiveSupport, removed inflections.
|
43
|
+
# https://github.com/rails/rails/blob/v4.1.0.rc1/activesupport/lib/active_support/inflector/methods.rb
|
44
|
+
def underscore(camel_cased_word)
|
45
|
+
word = camel_cased_word.to_s.gsub('::', '/')
|
46
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
47
|
+
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
48
|
+
word.tr!("-", "_")
|
49
|
+
word.downcase!
|
50
|
+
word
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def const_missing(name)
|
57
|
+
|
58
|
+
Support.try_load_by(self,name)
|
59
|
+
constant = Support.try_fetch_constant(self, name)
|
60
|
+
|
61
|
+
if constant
|
62
|
+
return constant
|
63
|
+
else
|
64
|
+
super
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.autoload
|
72
|
+
::Module.__send__(:prepend,Loader::AutoLoad)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
data/lib/loader/meta.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
module Loader
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
def __directory__
|
6
|
-
caller_folder(-1)
|
7
|
-
end
|
8
|
-
|
9
|
-
alias :__DIR__ :__directory__
|
3
|
+
class << self
|
10
4
|
|
11
|
-
def caller_file
|
5
|
+
def caller_file(skip=0)
|
12
6
|
|
13
7
|
raise unless skip.class <= Integer
|
14
8
|
skip += 1
|
@@ -40,10 +34,7 @@ module Loader
|
|
40
34
|
|
41
35
|
end
|
42
36
|
|
43
|
-
end
|
44
|
-
extend ObjectCallerEXT
|
45
37
|
|
46
|
-
class << self
|
47
38
|
|
48
39
|
# you can give optional file names that will be searched for
|
49
40
|
def caller_root(*args)
|
@@ -81,193 +72,8 @@ module Loader
|
|
81
72
|
|
82
73
|
alias :caller_root_folder :caller_root
|
83
74
|
|
84
|
-
# gives you a basic meta load framework for easy config use (yaml)
|
85
|
-
# basic system is
|
86
|
-
#
|
87
|
-
# root folder:
|
88
|
-
# - config
|
89
|
-
# -| "YAML files" #> development.yaml
|
90
|
-
#
|
91
|
-
# - lib
|
92
|
-
# -- module_name
|
93
|
-
# --- meta
|
94
|
-
# ---| "YAML files" #> rack.yaml
|
95
|
-
#
|
96
|
-
def metaloader_framework(opts={})
|
97
|
-
|
98
|
-
# defaults
|
99
|
-
begin
|
100
|
-
|
101
|
-
input_config_file = opts[:f] || opts[:config_file]
|
102
|
-
target_config_hash = opts[:o] || opts[:out] || opts[:config_obj] || {}
|
103
|
-
root_folder = opts[:r] || opts[:root] || caller_root_folder
|
104
|
-
config_folder = opts[:d] || opts[:config_folder] || File.join(root_folder,"{config,conf}")
|
105
|
-
lib_folder = opts[:l] || opts[:lib] || opts[:lib_folder] || File.join(root_folder,"{lib,libs}","**","meta")
|
106
|
-
environment = opts[:e] || opts[:env] || opts[:environment]
|
107
|
-
raise unless target_config_hash.class <= Hash
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
HashEXT.deep_merge! target_config_hash, Loader.meta( absolute: lib_folder )
|
112
|
-
|
113
|
-
# update by config
|
114
|
-
begin
|
115
|
-
|
116
|
-
# get config files
|
117
|
-
begin
|
118
|
-
config_yaml_paths= Array.new()
|
119
|
-
Dir.glob(File.join(config_folder,"*.{yaml,yml}")).uniq.each do |one_path|
|
120
|
-
|
121
|
-
case true
|
122
|
-
|
123
|
-
when one_path.downcase.include?('default')
|
124
|
-
config_yaml_paths[0]= one_path
|
125
|
-
|
126
|
-
when one_path.downcase.include?('development')
|
127
|
-
config_yaml_paths[1]= one_path
|
128
|
-
|
129
|
-
when one_path.downcase.include?('test')
|
130
|
-
config_yaml_paths[2]= one_path
|
131
|
-
|
132
|
-
when one_path.downcase.include?('production')
|
133
|
-
config_yaml_paths[3]= one_path
|
134
|
-
|
135
|
-
else
|
136
|
-
config_yaml_paths[config_yaml_paths.count]= one_path
|
137
|
-
|
138
|
-
end
|
139
|
-
|
140
|
-
end
|
141
|
-
config_yaml_paths.select!{|x| x != nil }
|
142
|
-
end
|
143
|
-
|
144
|
-
# params config load
|
145
|
-
unless input_config_file.nil?
|
146
|
-
begin
|
147
|
-
path= File.expand_path(input_config_file,"r")
|
148
|
-
File.open(path)
|
149
|
-
config_yaml_paths.push(path)
|
150
|
-
rescue Exception
|
151
|
-
config_yaml_paths.push(input_config_file)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
# load to last lvl environment
|
156
|
-
begin
|
157
|
-
config_yaml_paths.each do |one_yaml_file_path|
|
158
|
-
begin
|
159
|
-
yaml_data= YAML.load(File.open(one_yaml_file_path))
|
160
|
-
HashEXT.deep_merge!(target_config_hash,yaml_data)
|
161
|
-
|
162
|
-
unless environment.nil?
|
163
|
-
if one_yaml_file_path.include?(environment.to_s)
|
164
|
-
break
|
165
|
-
end
|
166
|
-
end
|
167
|
-
rescue Exception
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
end
|
173
|
-
|
174
|
-
return target_config_hash
|
175
|
-
|
176
|
-
end
|
177
|
-
alias :metaframework :metaloader_framework
|
178
|
-
|
179
|
-
# load meta folders rb files
|
180
|
-
# by default it will be the caller objects root folder (app root)
|
181
|
-
# else you must set with hand the path from your app root
|
182
|
-
# example:
|
183
|
-
#
|
184
|
-
# Loader.meta
|
185
|
-
#
|
186
|
-
# Loader.meta 'lib','**','config_files'
|
187
|
-
#
|
188
|
-
# Loader.meta root: "/home/...../my_app",'lib','**','meta'
|
189
|
-
#
|
190
|
-
# Loader.meta 'lib','**','meta',
|
191
|
-
# root: "/home/...../my_app"
|
192
|
-
#
|
193
|
-
# You can use the "absolute: string_path" option just alike so it wont try find your
|
194
|
-
# app root folder
|
195
|
-
#
|
196
|
-
# All will return a Hash obj with the loaded meta configs based on the
|
197
|
-
# yaml file name as key and the folder as the category
|
198
|
-
def meta( *args )
|
199
|
-
|
200
|
-
options= args.select{|e|(e.class <= ::Hash)}
|
201
|
-
args -= options
|
202
|
-
options= Hash[*options]
|
203
|
-
|
204
|
-
options ||= {}
|
205
|
-
|
206
|
-
if options[:absolute].nil?
|
207
|
-
|
208
|
-
if args.empty?
|
209
|
-
args= ["{lib,libs,library,libraries}","**","meta"]
|
210
|
-
end
|
211
|
-
|
212
|
-
if !options[:root].nil?
|
213
|
-
root_folder_path= options[:root]
|
214
|
-
else
|
215
|
-
root_folder_path= caller_root_folder
|
216
|
-
end
|
217
|
-
|
218
|
-
args.unshift(root_folder_path)
|
219
|
-
|
220
|
-
else
|
221
|
-
args= [options[:absolute]]
|
222
|
-
end
|
223
|
-
|
224
|
-
target_folder= File.join(*args)
|
225
|
-
|
226
|
-
# load ruby files from meta
|
227
|
-
begin
|
228
|
-
Dir.glob( File.join(target_folder,"*.{rb,ru}") ).each do |one_rb_file|
|
229
|
-
require one_rb_file
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
# load yaml files elements
|
234
|
-
begin
|
235
|
-
|
236
|
-
target_config_hash= Hash.new
|
237
|
-
Dir.glob(File.join(target_folder,"*.{yaml,yml}")).each do |config_object|
|
238
|
-
|
239
|
-
# defaults
|
240
|
-
begin
|
241
|
-
config_name_elements= config_object.split(File::SEPARATOR)
|
242
|
-
|
243
|
-
type= config_name_elements.pop.split('.')[0]
|
244
|
-
config_name_elements.pop
|
245
|
-
|
246
|
-
category= config_name_elements.pop
|
247
|
-
yaml_data= YAML.load(File.open(config_object))
|
248
|
-
end
|
249
|
-
|
250
|
-
# processing
|
251
|
-
begin
|
252
|
-
target_config_hash[category] ||= {}
|
253
|
-
target_config_hash[category][type] ||= {}
|
254
|
-
target_config_hash[category][type] = yaml_data
|
255
|
-
end
|
256
|
-
|
257
|
-
end
|
258
|
-
|
259
|
-
end
|
260
|
-
|
261
|
-
# return data
|
262
|
-
begin
|
263
|
-
return target_config_hash
|
264
|
-
end
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
|
269
75
|
end
|
270
76
|
|
271
77
|
end
|
272
78
|
|
273
|
-
Object.__send__ :include, Loader::ObjectCallerEXT
|
79
|
+
# Object.__send__ :include, Loader::ObjectCallerEXT
|
data/loader.gemspec
CHANGED
@@ -5,18 +5,19 @@
|
|
5
5
|
### Specification for the new Gem
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
|
8
|
-
spec.name =
|
9
|
-
spec.version = File.open(File.join(File.dirname(__FILE__),
|
10
|
-
spec.authors = [
|
11
|
-
spec.email = [
|
12
|
-
spec.description = %q{
|
13
|
-
spec.summary = %q{
|
14
|
-
|
8
|
+
spec.name = 'loader'
|
9
|
+
spec.version = File.open(File.join(File.dirname(__FILE__), 'VERSION')).read.split("\n")[0].chomp.gsub(' ','')
|
10
|
+
spec.authors = ['Adam Luzsi']
|
11
|
+
spec.email = ['adamluzsi@gmail.com']
|
12
|
+
spec.description = %q{ easy to use File loader that allow directories/project both Lazy Load and Eager load for files and constants. The Eager load for relative directory made for gems by default }
|
13
|
+
spec.summary = %q{ easy to use File loader that allow directories/project both Lazy Load and Eager load for files and constants. The Eager load for relative directory made for gems by default }
|
14
|
+
|
15
|
+
spec.homepage = 'https://github.com/adamluzsi/loader'
|
15
16
|
|
16
17
|
spec.files = `git ls-files`.split($/)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
20
|
|
20
|
-
spec.require_paths = [
|
21
|
+
spec.require_paths = ['lib']
|
21
22
|
|
22
23
|
end
|
data/test/helper.rb
ADDED
data/test/lib/cat.rb
ADDED
data/test/lib/cat/sup.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
puts 'hello world!'
|
data/test/lib/dog.rb
ADDED
data/test/test.rb
CHANGED
@@ -0,0 +1,60 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
describe Loader::AutoLoad do
|
3
|
+
|
4
|
+
before do
|
5
|
+
Loader::AutoLoad::Support.__send__(:define_singleton_method,:pwd){ __dir__ }
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'should raise an constant missing error than' do
|
9
|
+
|
10
|
+
-> {
|
11
|
+
begin
|
12
|
+
TEST
|
13
|
+
rescue Exception => e
|
14
|
+
e
|
15
|
+
end
|
16
|
+
}.call.is_a?(Exception).must_be :==, true
|
17
|
+
|
18
|
+
Loader.autoload
|
19
|
+
|
20
|
+
-> {
|
21
|
+
begin
|
22
|
+
TEST
|
23
|
+
rescue Exception => e
|
24
|
+
e
|
25
|
+
end
|
26
|
+
}.call.is_a?(Exception).must_be :==, false
|
27
|
+
|
28
|
+
-> {
|
29
|
+
begin
|
30
|
+
Cat::Tail
|
31
|
+
rescue Exception => e
|
32
|
+
e
|
33
|
+
end
|
34
|
+
}.call.is_a?(Exception).must_be :==, false
|
35
|
+
|
36
|
+
-> {
|
37
|
+
begin
|
38
|
+
|
39
|
+
class Cat
|
40
|
+
Dog
|
41
|
+
end
|
42
|
+
|
43
|
+
rescue Exception => e
|
44
|
+
e
|
45
|
+
end
|
46
|
+
}.call.is_a?(Exception).must_be :==, false
|
47
|
+
|
48
|
+
-> {
|
49
|
+
begin
|
50
|
+
BOOOM
|
51
|
+
rescue Exception => e
|
52
|
+
e
|
53
|
+
end
|
54
|
+
}.call.is_a?(Exception).must_be :==, true
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
# require_relative_directory_r 'lib'
|
59
|
+
|
60
|
+
end
|
metadata
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: "
|
14
|
-
|
13
|
+
description: " easy to use File loader that allow directories/project both Lazy Load
|
14
|
+
and Eager load for files and constants. The Eager load for relative directory made
|
15
|
+
for gems by default "
|
15
16
|
email:
|
16
17
|
- adamluzsi@gmail.com
|
17
18
|
executables: []
|
@@ -19,6 +20,15 @@ extensions: []
|
|
19
20
|
extra_rdoc_files: []
|
20
21
|
files:
|
21
22
|
- ".gitignore"
|
23
|
+
- ".idea/.name"
|
24
|
+
- ".idea/.rakeTasks"
|
25
|
+
- ".idea/encodings.xml"
|
26
|
+
- ".idea/loader.iml"
|
27
|
+
- ".idea/misc.xml"
|
28
|
+
- ".idea/modules.xml"
|
29
|
+
- ".idea/scopes/scope_settings.xml"
|
30
|
+
- ".idea/vcs.xml"
|
31
|
+
- ".idea/workspace.xml"
|
22
32
|
- Gemfile
|
23
33
|
- LICENSE
|
24
34
|
- README.md
|
@@ -34,12 +44,18 @@ files:
|
|
34
44
|
- examples/simple_require.rb
|
35
45
|
- files.rb
|
36
46
|
- lib/loader.rb
|
37
|
-
- lib/loader/
|
47
|
+
- lib/loader/autoload.rb
|
38
48
|
- lib/loader/meta.rb
|
39
49
|
- lib/loader/require.rb
|
40
50
|
- loader.gemspec
|
51
|
+
- test/helper.rb
|
52
|
+
- test/lib/cat.rb
|
53
|
+
- test/lib/cat/sup.rb
|
54
|
+
- test/lib/cat/tail.rb
|
55
|
+
- test/lib/dog.rb
|
41
56
|
- test/sub/test2.rb
|
42
57
|
- test/test.rb
|
58
|
+
- test/test_autoload.rb
|
43
59
|
homepage: https://github.com/adamluzsi/loader
|
44
60
|
licenses: []
|
45
61
|
metadata: {}
|
@@ -59,10 +75,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
75
|
version: '0'
|
60
76
|
requirements: []
|
61
77
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.4.5
|
63
79
|
signing_key:
|
64
80
|
specification_version: 4
|
65
|
-
summary:
|
81
|
+
summary: easy to use File loader that allow directories/project both Lazy Load and
|
82
|
+
Eager load for files and constants. The Eager load for relative directory made for
|
83
|
+
gems by default
|
66
84
|
test_files:
|
85
|
+
- test/helper.rb
|
86
|
+
- test/lib/cat.rb
|
87
|
+
- test/lib/cat/sup.rb
|
88
|
+
- test/lib/cat/tail.rb
|
89
|
+
- test/lib/dog.rb
|
67
90
|
- test/sub/test2.rb
|
68
91
|
- test/test.rb
|
92
|
+
- test/test_autoload.rb
|
data/lib/loader/hash.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
module Loader
|
2
|
-
module HashEXT
|
3
|
-
class << self
|
4
|
-
|
5
|
-
def deep_merge(self_hash,other_hash)
|
6
|
-
deep_merge!(self_hash.dup,other_hash)
|
7
|
-
end
|
8
|
-
|
9
|
-
def deep_merge!(self_hash,other_hash)
|
10
|
-
other_hash.each_pair do |k,v|
|
11
|
-
tv = self_hash[k]
|
12
|
-
self_hash[k] = tv.is_a?(::Hash) && v.is_a?(::Hash) ? deep_merge(tv,v) : v
|
13
|
-
end
|
14
|
-
self_hash
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|