require-extra 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -11,13 +11,21 @@
|
|
11
11
|
#++
|
12
12
|
|
13
13
|
module Kernel
|
14
|
-
|
15
|
-
|
14
|
+
def required? (name, from=$")
|
15
|
+
regexp = /(\A|\/)#{Regexp.escape(name)}(\.[^.]+)?$/
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
from.any? {|file|
|
18
|
+
file =~ regexp
|
19
|
+
}
|
20
|
+
end
|
21
21
|
|
22
|
-
|
22
|
+
alias is_required? required?
|
23
|
+
|
24
|
+
def require! (what)
|
25
|
+
begin
|
26
|
+
require what; true
|
27
|
+
rescue Exception
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
23
31
|
end
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# 0. You just DO WHAT THE FUCK YOU WANT TO.
|
11
11
|
#++
|
12
12
|
|
13
|
-
require '
|
13
|
+
require 'require/extra'
|
14
14
|
require 'refining'
|
15
15
|
|
16
16
|
module Kernel
|
@@ -24,7 +24,7 @@ module Kernel
|
|
24
24
|
else
|
25
25
|
RequireWatch[name] << block
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end; alias on_required on_require
|
28
28
|
|
29
29
|
refine_method :require do |old, path|
|
30
30
|
old.call(path).tap {
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: require-extra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- meh.
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-09-23 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: refining
|
@@ -32,8 +32,8 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
|
34
34
|
files:
|
35
|
-
- lib/
|
36
|
-
- lib/
|
35
|
+
- lib/require/on.rb
|
36
|
+
- lib/require/extra.rb
|
37
37
|
homepage: http://github.com/meh/ruby-required
|
38
38
|
licenses: []
|
39
39
|
|