drumherum 0.1.31 → 0.1.32
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.
- data/History.rdoc +3 -0
- data/lib/drumherum/smart_init.rb +37 -8
- data/version.rb +1 -1
- metadata +2 -2
data/History.rdoc
CHANGED
data/lib/drumherum/smart_init.rb
CHANGED
|
@@ -150,6 +150,9 @@ end
|
|
|
150
150
|
#
|
|
151
151
|
module SmartInit
|
|
152
152
|
|
|
153
|
+
|
|
154
|
+
# require 'perception'
|
|
155
|
+
|
|
153
156
|
# @!group Included in Object
|
|
154
157
|
|
|
155
158
|
def smart_init(__file__ = nil)
|
|
@@ -160,27 +163,53 @@ module SmartInit
|
|
|
160
163
|
|
|
161
164
|
patharray = dir_caller.split('/')
|
|
162
165
|
patharray = dir_caller.split("\\") if patharray.size == 1
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
projectname = 'ERROR'
|
|
167
|
+
|
|
168
|
+
(patharray.size-2).times do |i|
|
|
169
|
+
|
|
170
|
+
# found name/lib/name?
|
|
171
|
+
if (patharray[-2] == 'lib' && patharray[-1] == patharray[-3])
|
|
172
|
+
projectname = patharray[-1]
|
|
173
|
+
patharray.pop(2)
|
|
174
|
+
break
|
|
175
|
+
|
|
176
|
+
# found lib one level down?
|
|
177
|
+
elsif File.directory?( File.join(patharray, 'lib') )
|
|
178
|
+
projectname = patharray[-1]
|
|
179
|
+
break
|
|
180
|
+
|
|
181
|
+
else
|
|
182
|
+
patharray.pop
|
|
183
|
+
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
end # do
|
|
168
187
|
|
|
188
|
+
|
|
189
|
+
# see "projectname = #{projectname}"
|
|
190
|
+
# see patharray
|
|
191
|
+
# see
|
|
169
192
|
Drumherum::directory_main = patharray.dup
|
|
193
|
+
|
|
194
|
+
# /projectname/lib/projectname
|
|
195
|
+
newpath = File.join(patharray,'lib', projectname)
|
|
196
|
+
unless $:.include?(newpath)
|
|
197
|
+
$:.unshift(newpath)
|
|
198
|
+
end
|
|
170
199
|
|
|
171
|
-
#
|
|
200
|
+
# /projectname/lib
|
|
172
201
|
newpath = File.join(patharray,'lib')
|
|
173
202
|
unless $:.include?(newpath)
|
|
174
203
|
$:.unshift(newpath)
|
|
175
204
|
end
|
|
176
205
|
|
|
177
|
-
#
|
|
206
|
+
# /projectname
|
|
178
207
|
newpath = File.join(patharray)
|
|
179
208
|
unless $:.include?(newpath)
|
|
180
209
|
$:.unshift(newpath)
|
|
181
210
|
end
|
|
182
211
|
|
|
183
|
-
|
|
212
|
+
# see $LOAD_PATH
|
|
184
213
|
|
|
185
214
|
end #def
|
|
186
215
|
|
data/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: drumherum
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.32
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-11-
|
|
12
|
+
date: 2012-11-12 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: hoe
|