redcard 1.0.0 → 1.1.0
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/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/README.md +73 -33
- data/lib/redcard.rb +2 -2
- data/lib/redcard/maglev/1.0.rb +3 -0
- data/lib/redcard/maglev/1.1.rb +3 -0
- data/lib/redcard/maglev/2.0.rb +3 -0
- data/lib/redcard/version.rb +1 -1
- data/redcard.gemspec +3 -4
- data/spec/check_spec.rb +3 -3
- data/spec/maglev/1.0_spec.rb +58 -0
- data/spec/maglev/1.1_spec.rb +63 -0
- data/spec/maglev/2.0_spec.rb +63 -0
- data/spec/maglev_spec.rb +27 -0
- data/spec/rubinius/2.0_spec.rb +3 -6
- data/spec/rubinius_spec.rb +2 -2
- data/spec/spec_helper.rb +24 -18
- data/spec/verify_spec.rb +3 -3
- metadata +75 -51
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,25 +1,11 @@
|
|
1
1
|
# RedCard
|
2
2
|
|
3
|
+
[](https://travis-ci.org/brixen/redcard)
|
4
|
+
|
3
5
|
RedCard provides a standard way to ensure that the running Ruby implementation
|
4
6
|
matches the desired language version, implementation, and implementation
|
5
7
|
version.
|
6
8
|
|
7
|
-
|
8
|
-
## Why Do We Need It?
|
9
|
-
|
10
|
-
Once upon a time, Ruby was a very simple universe. There was a single Ruby
|
11
|
-
implementation and a single stable version. Now there are multiple current
|
12
|
-
language versions, multiple implementations, and numerous versions of those
|
13
|
-
multiple implementations.
|
14
|
-
|
15
|
-
In an ideal world, every Ruby implementation would provide the same features
|
16
|
-
and all such features would have consistent behavior. In the real world, this
|
17
|
-
is not the case. Hence, the need arises to have some facility for restricting
|
18
|
-
the conditions under which an application or library runs. RedCard provides
|
19
|
-
various mechanisms for specifying what language version, implementation, and
|
20
|
-
implementation version are required.
|
21
|
-
|
22
|
-
|
23
9
|
NOTE: In this documentation, Ruby version specifies the version of the Ruby
|
24
10
|
programming language itself. Historically, the word "Ruby" could have applied
|
25
11
|
to the language or the original implementation of the language. We refer to
|
@@ -31,27 +17,62 @@ implementation versions.
|
|
31
17
|
## Be Liberal
|
32
18
|
|
33
19
|
RedCard provides an API for specifying multiple implementations and versions.
|
20
|
+
There are two aspects of this API.
|
34
21
|
|
35
|
-
|
22
|
+
The first one, `RedCard.verify`, will raise an exception if the requirements
|
23
|
+
are not satisfied.
|
36
24
|
|
37
25
|
The parameter, requirements, is an Array of Symbols or Strings with an
|
38
26
|
optional final Hash of implementations as keys and implementation versions as
|
39
27
|
values.
|
40
28
|
|
41
|
-
|
29
|
+
```ruby
|
30
|
+
RedCard.verify *requirements
|
31
|
+
```
|
32
|
+
|
33
|
+
The following examples illustrate `RedCard.verify`:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
# Requires any version JRuby or Rubinius
|
37
|
+
RedCard.verify :rubinius, :jruby
|
42
38
|
|
43
|
-
|
44
|
-
|
39
|
+
# Requires Ruby language 1.9 and MRI or Rubinius
|
40
|
+
RedCard.verify :mri, :rubinius, "1.9"
|
45
41
|
|
46
|
-
|
47
|
-
|
42
|
+
# Requires Ruby language 1.9.3 or 2.0
|
43
|
+
RedCard.verify "1.9.3", "2.0"
|
48
44
|
|
49
|
-
|
50
|
-
|
45
|
+
# Requires Ruby language 1.9 and Rubinius version 2.0
|
46
|
+
RedCard.verify "1.9", :rubinius => "2.0"
|
47
|
+
```
|
51
48
|
|
52
|
-
|
53
|
-
|
49
|
+
The second one, `RedCard.check` will return `true` if the requirements are
|
50
|
+
satisfied and `false` if they are not. The requirements parameter has the same
|
51
|
+
specification as for `RedCard.verify`.
|
54
52
|
|
53
|
+
```ruby
|
54
|
+
RedCard.check *requirements
|
55
|
+
```
|
56
|
+
|
57
|
+
The following examples illustrate `RedCard.check`:
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
if RedCard.check :rubinius
|
61
|
+
# Use Rubinius-specific features
|
62
|
+
end
|
63
|
+
|
64
|
+
if RedCard.check :mri, :rubinius, "1.9"
|
65
|
+
# Use Ruby language 1.9 features on MRI or Rubinius
|
66
|
+
end
|
67
|
+
|
68
|
+
if RedCard.check "1.9.3", "2.0"
|
69
|
+
# Use Ruby language features found in 1.9.3 or 2.0
|
70
|
+
end
|
71
|
+
|
72
|
+
if RedCard.check "1.9", :rubinius => "2.0"
|
73
|
+
# Use Ruby language 1.9 features on Rubinius version 2.0
|
74
|
+
end
|
75
|
+
```
|
55
76
|
|
56
77
|
## Be Conservative
|
57
78
|
|
@@ -59,15 +80,34 @@ RedCard provides some convenience files that define restrictive requirements.
|
|
59
80
|
Using these, you can easily restrict the application to a single language
|
60
81
|
version, implementation, and implementation version.
|
61
82
|
|
83
|
+
Requiring the file runs `RedCard.check` with certain parameters matching the
|
84
|
+
specification described by the required files.
|
85
|
+
|
62
86
|
The following examples illustrate this:
|
63
87
|
|
64
|
-
|
65
|
-
|
88
|
+
```ruby
|
89
|
+
# Requires at minimum Ruby version 1.9 but accepts anything greater
|
90
|
+
require 'redcard/1.9'
|
91
|
+
|
92
|
+
# Requires Rubinius 2.0
|
93
|
+
require 'redcard/rubinius/2.0'
|
66
94
|
|
67
|
-
|
68
|
-
|
95
|
+
# Requires Ruby 1.9 and Rubinius
|
96
|
+
require 'redcard/1.9'
|
97
|
+
require 'redcard/rubinius'
|
98
|
+
```
|
99
|
+
|
100
|
+
## Why Do We Need It?
|
69
101
|
|
70
|
-
|
71
|
-
|
72
|
-
|
102
|
+
Once upon a time, Ruby was a very simple universe. There was a single Ruby
|
103
|
+
implementation and a single stable version. Now there are multiple current
|
104
|
+
language versions, multiple implementations, and numerous versions of those
|
105
|
+
multiple implementations.
|
73
106
|
|
107
|
+
In an ideal world, every Ruby implementation would provide the same features
|
108
|
+
and all such features would have consistent behavior. In the real world, this
|
109
|
+
is not the case. Hence, the need arises to have some facility for restricting
|
110
|
+
the conditions under which an application or library runs. RedCard provides
|
111
|
+
various mechanisms for specifying what language version, implementation, and
|
112
|
+
implementation version are required without resorting to horrific hacks such
|
113
|
+
as `if RUBY_VERSION =~ /^1\.8/`.
|
data/lib/redcard.rb
CHANGED
data/lib/redcard/version.rb
CHANGED
data/redcard.gemspec
CHANGED
@@ -17,12 +17,11 @@ RedCard provides a standard way to ensure that the running Ruby implementation
|
|
17
17
|
matches the desired language version, implementation, and implementation
|
18
18
|
version.
|
19
19
|
EOS
|
20
|
-
gem.has_rdoc
|
21
|
-
gem.extra_rdoc_files
|
20
|
+
gem.has_rdoc = true
|
21
|
+
gem.extra_rdoc_files = %w[ README.md LICENSE ]
|
22
22
|
gem.rubygems_version = %q{1.3.5}
|
23
|
-
gem.rubyforge_project = 'http://rubyforge.org/projects/mspec'
|
24
23
|
|
25
|
-
gem.rdoc_options << '--title' << '
|
24
|
+
gem.rdoc_options << '--title' << 'RedCard Gem' <<
|
26
25
|
'--main' << 'README' <<
|
27
26
|
'--line-numbers'
|
28
27
|
|
data/spec/check_spec.rb
CHANGED
@@ -64,7 +64,7 @@ describe "RedCard.check" do
|
|
64
64
|
|
65
65
|
context "when RUBY_ENGINE is 'rbx'" do
|
66
66
|
before do
|
67
|
-
|
67
|
+
redcard_engine_version "rbx", "1.0.0"
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns true for '1.9', :rbx" do
|
@@ -77,7 +77,7 @@ describe "RedCard.check" do
|
|
77
77
|
|
78
78
|
context "when Rubinius::VERSION is '2.0.0'" do
|
79
79
|
before do
|
80
|
-
redcard_engine_version "2.0.0"
|
80
|
+
redcard_engine_version "rbx", "2.0.0"
|
81
81
|
end
|
82
82
|
|
83
83
|
it "returns true for '1.9', :rbx => '2.0'" do
|
@@ -97,7 +97,7 @@ describe "RedCard.check" do
|
|
97
97
|
|
98
98
|
context "when RUBY_ENGINE is 'rbx'" do
|
99
99
|
before do
|
100
|
-
|
100
|
+
redcard_engine_version "rbx", "1.0.0"
|
101
101
|
end
|
102
102
|
|
103
103
|
it "returns true for :rbx" do
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "MagLev version requirement" do
|
4
|
+
before do
|
5
|
+
redcard_save_state
|
6
|
+
redcard_unload "redcard/maglev/1.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
redcard_restore_state
|
11
|
+
end
|
12
|
+
|
13
|
+
it "succeeds if RUBY_ENGINE is 'maglev' and MAGLEV_VERSION is greater than or equal to 1.0" do
|
14
|
+
redcard_version "1.8.7"
|
15
|
+
redcard_engine_version "maglev", "1.0.0"
|
16
|
+
expect { require 'redcard/maglev/1.0' }.not_to raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
20
|
+
redcard_version "1.8.7"
|
21
|
+
redcard_engine_version "topaz", "1.0.0"
|
22
|
+
expect { require 'redcard/maglev/1.0' }.to raise_error(RedCard::InvalidRubyError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'rbx'" do
|
26
|
+
redcard_version "1.8.7"
|
27
|
+
redcard_engine_version "rbx", "1.0.0"
|
28
|
+
expect { require 'redcard/maglev/1.0' }.to raise_error(RedCard::InvalidRubyError)
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "MagLev's Ruby-version dependency" do
|
34
|
+
|
35
|
+
before do
|
36
|
+
redcard_save_state
|
37
|
+
redcard_unload "redcard/1.8"
|
38
|
+
redcard_unload "redcard/1.9"
|
39
|
+
redcard_unload "redcard/maglev/1.0"
|
40
|
+
end
|
41
|
+
|
42
|
+
after do
|
43
|
+
redcard_restore_state
|
44
|
+
end
|
45
|
+
|
46
|
+
it "succeeds if MAGLEV_VERSION is 1.0 and RUBY_VERSION is not greater than 1.8" do
|
47
|
+
redcard_version "1.8.7"
|
48
|
+
redcard_engine_version "maglev", "1.0.0"
|
49
|
+
expect { require 'redcard/maglev/1.0' }.not_to raise_error
|
50
|
+
end
|
51
|
+
|
52
|
+
it "raises an InvalidRubyVersionError if MAGLEV_VERSION is 1.0 and RUBY_VERSION is greater than 1.8" do
|
53
|
+
redcard_version "1.9.3"
|
54
|
+
redcard_engine_version "maglev", "1.0.0"
|
55
|
+
expect { require 'redcard/maglev/1.0' }.to raise_error(RedCard::InvalidRubyVersionError)
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "MagLev version requirement" do
|
4
|
+
before do
|
5
|
+
redcard_save_state
|
6
|
+
redcard_unload "redcard/maglev/1.1"
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
redcard_restore_state
|
11
|
+
end
|
12
|
+
|
13
|
+
it "succeeds if RUBY_ENGINE is 'maglev' and MAGLEV_VERSION is greater than or equal to 1.1" do
|
14
|
+
redcard_version "1.8.7"
|
15
|
+
redcard_engine_version "maglev", "1.1.0"
|
16
|
+
expect { require 'redcard/maglev/1.1' }.not_to raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
20
|
+
redcard_version "1.8.7"
|
21
|
+
redcard_engine_version "topaz", "1.1.0"
|
22
|
+
expect { require 'redcard/maglev/1.1' }.to raise_error(RedCard::InvalidRubyError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'rbx'" do
|
26
|
+
redcard_version "1.8.7"
|
27
|
+
redcard_engine_version "rbx", "1.1.0"
|
28
|
+
expect { require 'redcard/maglev/1.1' }.to raise_error(RedCard::InvalidRubyError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises an InvalidEngineVersionError if MAGLEV_VERSION is less than 1.1" do
|
32
|
+
redcard_version "1.8.7"
|
33
|
+
redcard_engine_version "maglev", "1.0.0"
|
34
|
+
expect { require 'redcard/maglev/1.1' }.to raise_error(RedCard::InvalidRubyError)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "MagLev's Ruby-version dependency" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
redcard_save_state
|
42
|
+
redcard_unload "redcard/1.8"
|
43
|
+
redcard_unload "redcard/1.9"
|
44
|
+
redcard_unload "redcard/maglev/1.1"
|
45
|
+
end
|
46
|
+
|
47
|
+
after do
|
48
|
+
redcard_restore_state
|
49
|
+
end
|
50
|
+
|
51
|
+
it "succeeds if MAGLEV_VERSION is 1.1 and RUBY_VERSION is not greater than 1.8" do
|
52
|
+
redcard_version "1.8.7"
|
53
|
+
redcard_engine_version "maglev", "1.1.0"
|
54
|
+
expect { require 'redcard/maglev/1.1' }.not_to raise_error
|
55
|
+
end
|
56
|
+
|
57
|
+
it "raises an InvalidRubyVersionError if MAGLEV_VERSION is 1.1 and RUBY_VERSION is greater than 1.8" do
|
58
|
+
redcard_version "1.9.3"
|
59
|
+
redcard_engine_version "maglev", "1.1.0"
|
60
|
+
expect { require 'redcard/maglev/1.1' }.to raise_error(RedCard::InvalidRubyVersionError)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "MagLev version requirement" do
|
4
|
+
before do
|
5
|
+
redcard_save_state
|
6
|
+
redcard_unload "redcard/maglev/2.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
redcard_restore_state
|
11
|
+
end
|
12
|
+
|
13
|
+
it "succeeds if RUBY_ENGINE is 'maglev' and MAGLEV_VERSION is greater than or equal to 2.0" do
|
14
|
+
redcard_version "1.9.3"
|
15
|
+
redcard_engine_version "maglev", "2.0.0"
|
16
|
+
expect { require 'redcard/maglev/2.0' }.not_to raise_error
|
17
|
+
end
|
18
|
+
|
19
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
20
|
+
redcard_version "1.9.3"
|
21
|
+
redcard_engine_version "topaz", "2.0.0"
|
22
|
+
expect { require 'redcard/maglev/2.0' }.to raise_error(RedCard::InvalidRubyError)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'rbx'" do
|
26
|
+
redcard_version "1.9.3"
|
27
|
+
redcard_engine_version "rbx", "2.0.0"
|
28
|
+
expect { require 'redcard/maglev/2.0' }.to raise_error(RedCard::InvalidRubyError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises an InvalidEngineVersionError if MAGLEV_VERSION is less than 2.0" do
|
32
|
+
redcard_version "1.9.3"
|
33
|
+
redcard_engine_version "maglev", "1.0.0"
|
34
|
+
expect { require 'redcard/maglev/2.0' }.to raise_error(RedCard::InvalidRubyError)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "MagLev's Ruby-version dependency" do
|
39
|
+
|
40
|
+
before do
|
41
|
+
redcard_save_state
|
42
|
+
redcard_unload "redcard/1.8"
|
43
|
+
redcard_unload "redcard/1.9"
|
44
|
+
redcard_unload "redcard/maglev/2.0"
|
45
|
+
end
|
46
|
+
|
47
|
+
after do
|
48
|
+
redcard_restore_state
|
49
|
+
end
|
50
|
+
|
51
|
+
it "succeeds if MAGLEV_VERSION is 2.0 and RUBY_VERSION is not less than 1.9" do
|
52
|
+
redcard_version "1.9.3"
|
53
|
+
redcard_engine_version "maglev", "2.0.0"
|
54
|
+
expect { require 'redcard/maglev/2.0' }.not_to raise_error
|
55
|
+
end
|
56
|
+
|
57
|
+
it "raises an InvalidRubyVersionError if MAGLEV_VERSION is 2.0 and RUBY_VERSION less than 1.9" do
|
58
|
+
redcard_version "1.8.7"
|
59
|
+
redcard_engine_version "maglev", "2.0.0"
|
60
|
+
expect { require 'redcard/maglev/2.0' }.to raise_error(RedCard::InvalidRubyVersionError)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
data/spec/maglev_spec.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Ruby engine requirement" do
|
4
|
+
before do
|
5
|
+
redcard_save_state
|
6
|
+
redcard_unload "redcard/maglev"
|
7
|
+
end
|
8
|
+
|
9
|
+
after do
|
10
|
+
redcard_restore_state
|
11
|
+
end
|
12
|
+
|
13
|
+
it "succeeds if RUBY_ENGINE is 'maglev'" do
|
14
|
+
redcard_engine_version "maglev", "1.0.0"
|
15
|
+
expect { require 'redcard/maglev' }.not_to raise_error
|
16
|
+
end
|
17
|
+
|
18
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
19
|
+
redcard_engine_version "topaz", "1.0.0"
|
20
|
+
expect { require 'redcard/maglev' }.to raise_error(RedCard::InvalidRubyEngineError)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'rbx'" do
|
24
|
+
redcard_engine_version "rbx", "1.0.0"
|
25
|
+
expect { require 'redcard/maglev' }.to raise_error(RedCard::InvalidRubyEngineError)
|
26
|
+
end
|
27
|
+
end
|
data/spec/rubinius/2.0_spec.rb
CHANGED
@@ -11,20 +11,17 @@ describe "Rubinius version requirement" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "succeeds if RUBY_ENGINE is 'rbx' and Rubinius::VERSION is greater than or equal to 2.0" do
|
14
|
-
|
15
|
-
redcard_engine_version "2.0.0"
|
14
|
+
redcard_engine_version "rbx", "2.0.0"
|
16
15
|
expect { require 'redcard/rubinius/2.0' }.not_to raise_error
|
17
16
|
end
|
18
17
|
|
19
18
|
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
20
|
-
|
21
|
-
redcard_engine_version "2.0.0"
|
19
|
+
redcard_engine_version "topaz", "2.0.0"
|
22
20
|
expect { require 'redcard/rubinius/2.0' }.to raise_error(RedCard::InvalidRubyError)
|
23
21
|
end
|
24
22
|
|
25
23
|
it "raises an InvalidEngineVersionError if Rubinius::VERSION is less than 2.0" do
|
26
|
-
|
27
|
-
redcard_engine_version "1.2.4"
|
24
|
+
redcard_engine_version "rbx", "1.2.4"
|
28
25
|
expect { require 'redcard/rubinius/2.0' }.to raise_error(RedCard::InvalidRubyError)
|
29
26
|
end
|
30
27
|
end
|
data/spec/rubinius_spec.rb
CHANGED
@@ -11,12 +11,12 @@ describe "Ruby engine requirement" do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "succeeds if RUBY_ENGINE is 'rbx'" do
|
14
|
-
|
14
|
+
redcard_engine_version "rbx", "1.0.0"
|
15
15
|
expect { require 'redcard/rubinius' }.not_to raise_error
|
16
16
|
end
|
17
17
|
|
18
18
|
it "raises an InvalidRubyEngineError if RUBY_ENGINE is 'topaz'" do
|
19
|
-
|
19
|
+
redcard_engine_version "topaz", "1.0.0"
|
20
20
|
expect { require 'redcard/rubinius' }.to raise_error(RedCard::InvalidRubyEngineError)
|
21
21
|
end
|
22
22
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -18,9 +18,6 @@ class RedCard
|
|
18
18
|
$VERBOSE = nil
|
19
19
|
@ruby_version = RUBY_VERSION
|
20
20
|
@ruby_engine = RedCard.engine
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.save_engine_version
|
24
21
|
@engine_version = RedCard.engine_version
|
25
22
|
end
|
26
23
|
|
@@ -28,7 +25,7 @@ class RedCard
|
|
28
25
|
$VERBOSE = nil
|
29
26
|
Object.const_set :RUBY_VERSION, @ruby_version
|
30
27
|
|
31
|
-
engine_version = @engine_version
|
28
|
+
engine_version = @engine_version
|
32
29
|
Object.const_set :RUBY_ENGINE, @ruby_engine
|
33
30
|
|
34
31
|
$VERBOSE = @verbose
|
@@ -42,26 +39,39 @@ class RedCard
|
|
42
39
|
Object.const_set :RUBY_ENGINE, engine
|
43
40
|
end
|
44
41
|
|
42
|
+
# When version is nil, we unset the constant for that Ruby engine.
|
45
43
|
def self.engine_version=(version)
|
46
44
|
case RedCard.engine
|
47
45
|
# when "ironruby"
|
48
46
|
# TODO
|
49
47
|
when "jruby"
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
if version
|
49
|
+
Object.const_set :JRUBY_VERSION, version
|
50
|
+
else
|
51
|
+
Object.send :remove_const, :JRUBY_VERSION
|
52
|
+
end
|
53
|
+
when "maglev"
|
54
|
+
if version
|
55
|
+
Object.const_set :MAGLEV_VERSION, version
|
56
|
+
else
|
57
|
+
Object.send :remove_const, :MAGLEV_VERSION
|
58
|
+
end
|
53
59
|
when "rbx"
|
54
|
-
|
55
|
-
Object.const_set :Rubinius, Module.new
|
60
|
+
if version
|
61
|
+
Object.const_set :Rubinius, Module.new unless defined?(::Rubinius)
|
62
|
+
Object.const_get(:Rubinius).const_set(:VERSION, version)
|
63
|
+
else
|
64
|
+
Object.send :remove_const, :Rubinius
|
56
65
|
end
|
57
|
-
Object.const_get(:Rubinius).const_set(:VERSION, version)
|
58
66
|
when "ruby"
|
59
67
|
RUBY_VERSION
|
60
68
|
when "topaz"
|
61
|
-
|
62
|
-
Object.const_set :Topaz, Module.new
|
69
|
+
if version
|
70
|
+
Object.const_set :Topaz, Module.new unless defined?(::Topaz)
|
71
|
+
Object.const_get(:Topaz).const_set(:VERSION, version)
|
72
|
+
else
|
73
|
+
Object.send :remove_const, :Topaz
|
63
74
|
end
|
64
|
-
Object.const_get(:Topaz).const_set(:VERSION, version)
|
65
75
|
end
|
66
76
|
end
|
67
77
|
end
|
@@ -84,11 +94,7 @@ def redcard_version(version)
|
|
84
94
|
RedCard::Specs.version = version
|
85
95
|
end
|
86
96
|
|
87
|
-
def
|
97
|
+
def redcard_engine_version(engine, version)
|
88
98
|
RedCard::Specs.engine = engine
|
89
|
-
end
|
90
|
-
|
91
|
-
def redcard_engine_version(version)
|
92
|
-
RedCard::Specs.save_engine_version
|
93
99
|
RedCard::Specs.engine_version = version
|
94
100
|
end
|
data/spec/verify_spec.rb
CHANGED
@@ -64,7 +64,7 @@ describe "RedCard.verify" do
|
|
64
64
|
|
65
65
|
context "when RUBY_ENGINE is 'rbx'" do
|
66
66
|
before do
|
67
|
-
|
67
|
+
redcard_engine_version "rbx", "1.0.0"
|
68
68
|
end
|
69
69
|
|
70
70
|
it "returns nil for '1.9', :rbx" do
|
@@ -77,7 +77,7 @@ describe "RedCard.verify" do
|
|
77
77
|
|
78
78
|
context "when Rubinius::VERSION is '2.0.0'" do
|
79
79
|
before do
|
80
|
-
redcard_engine_version "2.0.0"
|
80
|
+
redcard_engine_version "rbx", "2.0.0"
|
81
81
|
end
|
82
82
|
|
83
83
|
it "returns nil for '1.9', :rbx => '2.0'" do
|
@@ -97,7 +97,7 @@ describe "RedCard.verify" do
|
|
97
97
|
|
98
98
|
context "when RUBY_ENGINE is 'rbx'" do
|
99
99
|
before do
|
100
|
-
|
100
|
+
redcard_engine_version "rbx", "1.0.0"
|
101
101
|
end
|
102
102
|
|
103
103
|
it "returns nil for :rbx" do
|
metadata
CHANGED
@@ -1,57 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcard
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 3461773182973075480
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 1.1.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Brian Shirai
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2013-03-23 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: rake
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0.9'
|
22
|
-
type: :development
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0.9'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: rspec
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
33
24
|
none: false
|
34
|
-
requirements:
|
25
|
+
requirements:
|
35
26
|
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 2854635824043747355
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 9
|
32
|
+
version: "0.9"
|
38
33
|
type: :development
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
39
37
|
prerelease: false
|
40
|
-
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
39
|
none: false
|
42
|
-
requirements:
|
40
|
+
requirements:
|
43
41
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
hash: 979869434391979972
|
44
|
+
segments:
|
45
|
+
- 2
|
46
|
+
- 8
|
47
|
+
version: "2.8"
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
46
50
|
description:
|
47
|
-
email:
|
51
|
+
email:
|
48
52
|
- brixen@gmail.com
|
49
53
|
executables: []
|
54
|
+
|
50
55
|
extensions: []
|
51
|
-
|
56
|
+
|
57
|
+
extra_rdoc_files:
|
52
58
|
- README.md
|
53
59
|
- LICENSE
|
54
|
-
files:
|
60
|
+
files:
|
55
61
|
- .gitignore
|
56
62
|
- .travis.yml
|
57
63
|
- Gemfile
|
@@ -67,6 +73,9 @@ files:
|
|
67
73
|
- lib/redcard/jruby.rb
|
68
74
|
- lib/redcard/jruby/1.7.rb
|
69
75
|
- lib/redcard/maglev.rb
|
76
|
+
- lib/redcard/maglev/1.0.rb
|
77
|
+
- lib/redcard/maglev/1.1.rb
|
78
|
+
- lib/redcard/maglev/2.0.rb
|
70
79
|
- lib/redcard/rubinius.rb
|
71
80
|
- lib/redcard/rubinius/2.0.rb
|
72
81
|
- lib/redcard/topaz.rb
|
@@ -74,43 +83,58 @@ files:
|
|
74
83
|
- redcard.gemspec
|
75
84
|
- spec/1.9_spec.rb
|
76
85
|
- spec/check_spec.rb
|
86
|
+
- spec/maglev/1.0_spec.rb
|
87
|
+
- spec/maglev/1.1_spec.rb
|
88
|
+
- spec/maglev/2.0_spec.rb
|
89
|
+
- spec/maglev_spec.rb
|
77
90
|
- spec/rubinius/2.0_spec.rb
|
78
91
|
- spec/rubinius_spec.rb
|
79
92
|
- spec/spec_helper.rb
|
80
93
|
- spec/verify_spec.rb
|
81
94
|
homepage: https://github.com/brixen/redcard
|
82
95
|
licenses: []
|
96
|
+
|
83
97
|
post_install_message:
|
84
|
-
rdoc_options:
|
98
|
+
rdoc_options:
|
85
99
|
- --title
|
86
|
-
-
|
100
|
+
- RedCard Gem
|
87
101
|
- --main
|
88
102
|
- README
|
89
103
|
- --line-numbers
|
90
|
-
require_paths:
|
104
|
+
require_paths:
|
91
105
|
- lib
|
92
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
107
|
none: false
|
94
|
-
requirements:
|
95
|
-
- -
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
|
98
|
-
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
hash: 2002549777813010636
|
112
|
+
segments:
|
113
|
+
- 0
|
114
|
+
version: "0"
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
116
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
hash: 2002549777813010636
|
121
|
+
segments:
|
122
|
+
- 0
|
123
|
+
version: "0"
|
104
124
|
requirements: []
|
105
|
-
|
106
|
-
|
125
|
+
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 1.8.25
|
107
128
|
signing_key:
|
108
129
|
specification_version: 3
|
109
|
-
summary: RedCard provides a standard way to ensure that the running Ruby implementation
|
110
|
-
|
111
|
-
test_files:
|
130
|
+
summary: RedCard provides a standard way to ensure that the running Ruby implementation matches the desired language version, implementation, and implementation version.
|
131
|
+
test_files:
|
112
132
|
- spec/1.9_spec.rb
|
113
133
|
- spec/check_spec.rb
|
134
|
+
- spec/maglev/1.0_spec.rb
|
135
|
+
- spec/maglev/1.1_spec.rb
|
136
|
+
- spec/maglev/2.0_spec.rb
|
137
|
+
- spec/maglev_spec.rb
|
114
138
|
- spec/rubinius/2.0_spec.rb
|
115
139
|
- spec/rubinius_spec.rb
|
116
140
|
- spec/spec_helper.rb
|