opalracer 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/README.md +5 -3
- data/lib/opalracer.rb +9 -9
- data/opalracer.gemspec +5 -5
- 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: 5e2fa725aa2fdacd7a5e9a767448fe850cf32558
|
4
|
+
data.tar.gz: 805545a0fc0369d619d271f9bfe6086d73998744
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa03159c0db858de848185961e7fc4e7058bc220e6723fad5e54c0b1428137375a0a0ea018e48156a8a6f287916cb1e094b96dfda22899f65ead1c31c758a8ce
|
7
|
+
data.tar.gz: d658654fcf99cd6572092b8f967a8f2fe235a4b277dcd78bcf302473ca02942d4cbb9b5c1bdfe81c2f735a28406b4be251af005910de620f6e986c0eef73ff3a
|
data/README.md
CHANGED
@@ -39,7 +39,9 @@ A fair question.
|
|
39
39
|
When you're a responsible human, you can create code that plays well
|
40
40
|
with the rest of the world. You can avoid defining lots of globals. You
|
41
41
|
can avoid reaching into external objects and altering them. And you can
|
42
|
-
carefully manage your own dependencies.
|
42
|
+
carefully manage your own dependencies. Ruby can give you no guarantees
|
43
|
+
that your code will not be affected by a rogue gem or library. Sometimes
|
44
|
+
you really just need some isolation.
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
+
OpalRacer is admittedly a silly hack, but it does allow you to make
|
47
|
+
certain guarantees about how various worlds of Ruby can interact.
|
data/lib/opalracer.rb
CHANGED
@@ -2,25 +2,25 @@ require 'opal'
|
|
2
2
|
require 'therubyracer'
|
3
3
|
|
4
4
|
class OpalRacer
|
5
|
-
VERSION = '0.
|
5
|
+
VERSION = '0.2.0'
|
6
|
+
|
7
|
+
def self.opal_build
|
8
|
+
@opal_build ||= Opal::Builder.new.build('opal').to_s
|
9
|
+
end
|
6
10
|
|
7
11
|
def initialize
|
8
12
|
@builder = Opal::Builder.new
|
9
|
-
|
10
13
|
@v8 = V8::Context.new
|
11
14
|
@v8['console'] = self
|
12
|
-
@v8.eval
|
15
|
+
@v8.eval self.class.opal_build
|
13
16
|
end
|
14
17
|
|
15
18
|
def log(*str)
|
16
19
|
puts(*str)
|
17
20
|
end
|
18
21
|
|
19
|
-
def eval_ruby(
|
20
|
-
|
21
|
-
|
22
|
-
@v8.eval "var $_result = #{code.processed.last.to_s} ($_result == null ? 'nil' : $_result.$inspect());"
|
23
|
-
rescue => e
|
24
|
-
puts "#{e.message}\n\t#{e.backtrace.join("\n\t")}"
|
22
|
+
def eval_ruby(ruby, file: nil)
|
23
|
+
file ||= __FILE__
|
24
|
+
@v8.eval Opal::Builder.new.build_str(ruby, file)
|
25
25
|
end
|
26
26
|
end
|
data/opalracer.gemspec
CHANGED
@@ -10,17 +10,17 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ['stevecrozz@gmail.com']
|
11
11
|
spec.summary = %q{Run Ruby within Ruby, but without the other Ruby}
|
12
12
|
spec.description = %q{An isolated Ruby runtime that lets you execute Ruby scripts in isolation from the main Ruby interpreter}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/stevecrozz/opalracer'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'therubyracer'
|
22
22
|
spec.add_runtime_dependency 'opal'
|
23
23
|
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
25
|
+
spec.add_development_dependency 'pry-byebug'
|
26
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opalracer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Crosby
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: pry-byebug
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|