rubinjam 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/rubinjam +1 -1
- data/lib/rubinjam/version.rb +1 -1
- data/lib/rubinjam.rb +28 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ad8b2a441f97b43165b8de34a5d5f4f497d9252
|
4
|
+
data.tar.gz: ff1a5400580c19c7a302783fe2844ede15db39e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eabcb9d642ad130f409c6518ded37d8ddd1a7e8794bc74f4351bbcc1f7fdefb4da6b68d4b627b3bdf405787619aa7c9912da809749233625e420b998ceb7811e
|
7
|
+
data.tar.gz: 1a1a9c87aecc77722ea5a2f3e12e1202462da8dac8e85d7eab9dcd6f9a4d69569b56bad82e31ca9ac9eb29e4bc61706e8285a46235411702e6662664119a6a3e
|
data/bin/rubinjam
CHANGED
data/lib/rubinjam/version.rb
CHANGED
data/lib/rubinjam.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "tmpdir"
|
2
2
|
require "bundler"
|
3
3
|
require "rubinjam/version"
|
4
|
+
require "shellwords"
|
4
5
|
|
5
6
|
module Rubinjam
|
6
7
|
class << self
|
@@ -18,8 +19,8 @@ module Rubinjam
|
|
18
19
|
Dir.mktmpdir do |dir|
|
19
20
|
Dir.chdir(dir) do
|
20
21
|
# unpack
|
21
|
-
command =
|
22
|
-
command << "-v" << version if version
|
22
|
+
command = "gem unpack #{Shellwords.escape(gem)}"
|
23
|
+
command << " -v" << version if version
|
23
24
|
IO.popen(command).read
|
24
25
|
|
25
26
|
# bundle
|
@@ -56,7 +57,7 @@ module Rubinjam
|
|
56
57
|
end
|
57
58
|
|
58
59
|
def libs_from_paths(paths)
|
59
|
-
paths.select { |p|
|
60
|
+
paths.select { |p| File.directory?(p) }.inject({}) do |all, path|
|
60
61
|
Dir.chdir path do
|
61
62
|
all.merge!(Hash[Dir["**/*.rb"].map { |f| [f.sub(/\.rb$/, ""), File.read(f)] }])
|
62
63
|
end
|
@@ -82,13 +83,34 @@ module Rubinjam
|
|
82
83
|
LIBRARIES = {
|
83
84
|
#{libraries.map { |name,content| "#{name.inspect} => #{content.inspect}" }.join(",\n ")}
|
84
85
|
}
|
86
|
+
|
87
|
+
ROOT = File.expand_path("../", __FILE__) << "/lib/"
|
88
|
+
|
89
|
+
module AutoloadFix
|
90
|
+
def self.included(base)
|
91
|
+
base.class_eval do
|
92
|
+
alias autoload_without_rubinjam autoload
|
93
|
+
def autoload(const, file)
|
94
|
+
if Rubinjam::LIBRARIES[file]
|
95
|
+
require file
|
96
|
+
else
|
97
|
+
autoload_without_rubinjam(const, file)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
85
103
|
end
|
86
104
|
|
105
|
+
Module.send(:include, Rubinjam::AutoloadFix)
|
106
|
+
include Rubinjam::AutoloadFix
|
107
|
+
|
87
108
|
def require(file)
|
88
|
-
|
109
|
+
normalized_file = file.sub(Rubinjam::ROOT, "")
|
110
|
+
if code = Rubinjam::LIBRARIES[normalized_file]
|
89
111
|
return if code == :loaded
|
90
|
-
eval(code, TOPLEVEL_BINDING, "rubinjam/\#{
|
91
|
-
Rubinjam::LIBRARIES[
|
112
|
+
eval(code, TOPLEVEL_BINDING, "rubinjam/\#{normalized_file}.rb")
|
113
|
+
Rubinjam::LIBRARIES[normalized_file] = :loaded
|
92
114
|
else
|
93
115
|
super
|
94
116
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinjam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|