rubinius-toolset 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -0
- data/README.md +6 -1
- data/lib/rubinius/toolset.rb +32 -0
- data/lib/rubinius/toolset/version.rb +1 -1
- data/rubinius-toolset.gemspec +2 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/toolset_spec.rb +63 -0
- metadata +27 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2aad3df20490e7a2c8e152d1eddb761507af34f
|
4
|
+
data.tar.gz: 4906ca7ef0d5e91d91027c161a4c9c042334a34b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a08a7edbad2974977ca83fd4932452ac70d557744940eff7927cda5463dac33e346459b8604894392e148c053edc4112c054f25b5724fd064f716638a25905ed
|
7
|
+
data.tar.gz: 7778d1ffef79250342255372009cf36551a9f094f6f8e446bb3c110ee8703fd29bdbbe66a6e034c35cb0fe64e21bbc65d8b87b1161efc4d97fe2f88ccbec19c7
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Rubinius::Toolset
|
2
2
|
|
3
|
-
|
3
|
+
Rubinius::ToolSet provides a registry for code tools. These include
|
4
|
+
the Rubinius bytecode compiler and parser. These, in turn, depend on
|
5
|
+
other components like the AST and bytecode emitter and serializer.
|
6
|
+
|
7
|
+
ToolSets provide a mechanism for other languages to reuse as much of
|
8
|
+
the Rubinius code tools as are suitable for that language.
|
4
9
|
|
5
10
|
## Installation
|
6
11
|
|
data/lib/rubinius/toolset.rb
CHANGED
@@ -2,18 +2,22 @@ require "rubinius/toolset/version"
|
|
2
2
|
|
3
3
|
module Rubinius
|
4
4
|
module ToolSet
|
5
|
+
# Returns the module enclosing the current toolset.
|
5
6
|
def self.current
|
6
7
|
@current ||= Module.new
|
7
8
|
end
|
8
9
|
|
10
|
+
# Start a new toolset module by clearing out the current one
|
9
11
|
def self.start
|
10
12
|
@current = nil
|
11
13
|
end
|
12
14
|
|
15
|
+
# Access the Hash containing the finished toolset modules
|
13
16
|
def self.map
|
14
17
|
@map ||= {}
|
15
18
|
end
|
16
19
|
|
20
|
+
# Finish the current toolset module by registering it with a name
|
17
21
|
def self.finish(name)
|
18
22
|
ts = current::TS
|
19
23
|
ts.const_set :ToolSet, ts
|
@@ -21,8 +25,36 @@ module Rubinius
|
|
21
25
|
const_set name.to_s.capitalize.to_sym, ts
|
22
26
|
end
|
23
27
|
|
28
|
+
# Get a finished toolset module by name
|
24
29
|
def self.get(name)
|
25
30
|
map[name]
|
26
31
|
end
|
32
|
+
|
33
|
+
# Set the current toolset module as a constant on Rubinius::ToolSet
|
34
|
+
def self.attach(name)
|
35
|
+
return unless name
|
36
|
+
|
37
|
+
map[name] = current
|
38
|
+
|
39
|
+
name = name.to_s.split("_").map { |x| x.capitalize }.join
|
40
|
+
const_set name, current
|
41
|
+
|
42
|
+
current.const_set :TS, current
|
43
|
+
current::TS.const_set :ToolSet, current
|
44
|
+
end
|
45
|
+
|
46
|
+
# Create a new toolset, optionally with a name. The module enclosing the
|
47
|
+
# toolset yielded to the block.
|
48
|
+
def self.create(name=nil)
|
49
|
+
loaded_features = $LOADED_FEATURES
|
50
|
+
$LOADED_FEATURES.clear
|
51
|
+
|
52
|
+
start
|
53
|
+
attach name
|
54
|
+
|
55
|
+
yield current
|
56
|
+
ensure
|
57
|
+
$LOADED_FEATURES.replace loaded_features
|
58
|
+
end
|
27
59
|
end
|
28
60
|
end
|
data/rubinius-toolset.gemspec
CHANGED
@@ -24,5 +24,6 @@ the Rubinius code tools as are suitable for that language.
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.3"
|
27
|
-
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "mspec", "~> 1.5"
|
28
29
|
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
describe "Rubinius::ToolSet.current" do
|
2
|
+
it "returns a Module" do
|
3
|
+
Rubinius::ToolSet.current.should be_an_instance_of(Module)
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
describe "Rubinius::ToolSet.finish" do
|
8
|
+
before do
|
9
|
+
Rubinius::ToolSet.start
|
10
|
+
module Rubinius::ToolSet.current::TS; end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "adds name to the ToolSet map" do
|
14
|
+
Rubinius::ToolSet.finish :testing
|
15
|
+
Rubinius::ToolSet.map.keys.should include(:testing)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "sets a constant on ToolSet with the capitalized name" do
|
19
|
+
Rubinius::ToolSet.finish :name
|
20
|
+
Rubinius::ToolSet::Name.should be_an_instance_of(Module)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "Rubinius::ToolSet.create" do
|
25
|
+
it "it resets $LOADED_FEATURES while running the block" do
|
26
|
+
Rubinius::ToolSet.create do
|
27
|
+
$LOADED_FEATURES.should == []
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it "yields an anonymous Module to the block if no name is given" do
|
32
|
+
Rubinius::ToolSet.create do |m|
|
33
|
+
m.should be_an_instance_of(Module)
|
34
|
+
m.name.should be_nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it "sets .current to the module that is yielded to the block" do
|
39
|
+
Rubinius::ToolSet.create do |m|
|
40
|
+
m.should equal(Rubinius::ToolSet.current)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "accepts an optional name for the toolset module" do
|
45
|
+
Rubinius::ToolSet.create :a_tool_set do |m|
|
46
|
+
m.name.should == "Rubinius::ToolSet::AToolSet"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "creates a temporary module named 'TS' on the current toolset module" do
|
51
|
+
Rubinius::ToolSet.create :spec do |m|
|
52
|
+
m.should equal(m::TS)
|
53
|
+
m::TS.name.should == "Rubinius::ToolSet::Spec"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it "creates a ToolSet module under the TS module" do
|
58
|
+
Rubinius::ToolSet.create :spec do |m|
|
59
|
+
m::TS.should equal(m::TS::ToolSet)
|
60
|
+
m::TS::ToolSet.name.should == "Rubinius::ToolSet::Spec"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubinius-toolset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Shirai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,30 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: mspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '1.5'
|
41
55
|
description: |
|
42
56
|
Rubinius::ToolSet provides a registry for code tools. These include
|
43
57
|
the Rubinius bytecode compiler and parser. These, in turn, depend on
|
@@ -52,6 +66,7 @@ extensions: []
|
|
52
66
|
extra_rdoc_files: []
|
53
67
|
files:
|
54
68
|
- ".gitignore"
|
69
|
+
- ".travis.yml"
|
55
70
|
- Gemfile
|
56
71
|
- LICENSE
|
57
72
|
- README.md
|
@@ -59,6 +74,8 @@ files:
|
|
59
74
|
- lib/rubinius/toolset.rb
|
60
75
|
- lib/rubinius/toolset/version.rb
|
61
76
|
- rubinius-toolset.gemspec
|
77
|
+
- spec/spec_helper.rb
|
78
|
+
- spec/toolset_spec.rb
|
62
79
|
homepage: https://github.com/rubinius/rubinius-toolset
|
63
80
|
licenses:
|
64
81
|
- BSD
|
@@ -79,9 +96,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
96
|
version: '0'
|
80
97
|
requirements: []
|
81
98
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.2.1
|
83
100
|
signing_key:
|
84
101
|
specification_version: 4
|
85
102
|
summary: A registry for Rubinius code tools
|
86
|
-
test_files:
|
87
|
-
|
103
|
+
test_files:
|
104
|
+
- spec/spec_helper.rb
|
105
|
+
- spec/toolset_spec.rb
|