multi_json 0.0.3 → 0.0.4
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/Rakefile +17 -13
- data/VERSION +1 -1
- data/lib/multi_json.rb +11 -4
- data/multi_json.gemspec +6 -6
- data/spec/{x_to_json_spec.rb → multi_json_spec.rb} +5 -1
- data/spec/spec_helper.rb +6 -2
- metadata +5 -5
data/Rakefile
CHANGED
@@ -14,25 +14,29 @@ begin
|
|
14
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
15
|
end
|
16
16
|
Jeweler::GemcutterTasks.new
|
17
|
+
|
18
|
+
task :spec => :check_dependencies
|
17
19
|
rescue LoadError
|
18
20
|
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
spec
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
28
|
-
spec.libs << 'lib' << 'spec'
|
29
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
-
spec.rcov = true
|
31
|
-
end
|
23
|
+
begin
|
24
|
+
require 'spec/rake/spectask'
|
25
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
28
|
+
end
|
32
29
|
|
33
|
-
|
30
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
31
|
+
spec.libs << 'lib' << 'spec'
|
32
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
33
|
+
spec.rcov = true
|
34
|
+
end
|
34
35
|
|
35
|
-
task :default => :spec
|
36
|
+
task :default => :spec
|
37
|
+
rescue LoadError
|
38
|
+
puts "RSpec (or a dependency) not available. Install it with: gem install rspec"
|
39
|
+
end
|
36
40
|
|
37
41
|
require 'rake/rdoctask'
|
38
42
|
Rake::RDocTask.new do |rdoc|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/multi_json.rb
CHANGED
@@ -7,6 +7,13 @@ module MultiJson
|
|
7
7
|
self.engine = self.default_engine
|
8
8
|
@engine
|
9
9
|
end
|
10
|
+
|
11
|
+
REQUIREMENT_MAP = [
|
12
|
+
["yajl", :yajl],
|
13
|
+
["json", :json_gem],
|
14
|
+
["active_support", :active_support],
|
15
|
+
["json/pure", :json_pure]
|
16
|
+
]
|
10
17
|
|
11
18
|
# The default engine based on what you currently
|
12
19
|
# have loaded and installed. First checks to see
|
@@ -16,11 +23,11 @@ module MultiJson
|
|
16
23
|
return :yajl if defined?(::Yajl)
|
17
24
|
return :json_gem if defined?(::JSON)
|
18
25
|
return :active_support if defined?(::ActiveSupport::JSON)
|
19
|
-
|
20
|
-
|
26
|
+
|
27
|
+
REQUIREMENT_MAP.each do |(library, engine)|
|
21
28
|
begin
|
22
|
-
require
|
23
|
-
return
|
29
|
+
require library
|
30
|
+
return engine
|
24
31
|
rescue LoadError
|
25
32
|
next
|
26
33
|
end
|
data/multi_json.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{multi_json}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Bleigh"]
|
12
|
-
s.date = %q{2010-06-
|
12
|
+
s.date = %q{2010-06-19}
|
13
13
|
s.description = %q{A gem to provide swappable JSON backends utilizing Yajl::Ruby, the JSON gem, ActiveSupport, or JSON pure.}
|
14
14
|
s.email = %q{michael@intridea.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/multi_json/engines/json_pure.rb",
|
31
31
|
"lib/multi_json/engines/yajl.rb",
|
32
32
|
"multi_json.gemspec",
|
33
|
+
"spec/multi_json_spec.rb",
|
33
34
|
"spec/spec.opts",
|
34
|
-
"spec/spec_helper.rb"
|
35
|
-
"spec/x_to_json_spec.rb"
|
35
|
+
"spec/spec_helper.rb"
|
36
36
|
]
|
37
37
|
s.homepage = %q{http://github.com/intridea/multi_json}
|
38
38
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -40,8 +40,8 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.rubygems_version = %q{1.3.6}
|
41
41
|
s.summary = %q{A gem to provide swappable JSON backends.}
|
42
42
|
s.test_files = [
|
43
|
-
"spec/
|
44
|
-
"spec/
|
43
|
+
"spec/multi_json_spec.rb",
|
44
|
+
"spec/spec_helper.rb"
|
45
45
|
]
|
46
46
|
|
47
47
|
if s.respond_to? :specification_version then
|
@@ -31,7 +31,11 @@ describe "MultiJson" do
|
|
31
31
|
%w(active_support json_gem json_pure yajl).each do |engine|
|
32
32
|
context engine do
|
33
33
|
before do
|
34
|
-
|
34
|
+
begin
|
35
|
+
MultiJson.engine = engine
|
36
|
+
rescue LoadError
|
37
|
+
pending "Engine #{engine} couldn't be loaded (not installed?)"
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
describe '.encode' do
|
data/spec/spec_helper.rb
CHANGED
@@ -4,8 +4,12 @@ require 'multi_json'
|
|
4
4
|
require 'spec'
|
5
5
|
require 'spec/autorun'
|
6
6
|
require 'rubygems'
|
7
|
-
|
8
|
-
|
7
|
+
begin
|
8
|
+
require 'bundler'
|
9
|
+
Bundler.setup
|
10
|
+
rescue LoadError
|
11
|
+
$stderr.puts "Bundler (or a dependency) not available."
|
12
|
+
end
|
9
13
|
|
10
14
|
Spec::Runner.configure do |config|
|
11
15
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Michael Bleigh
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-19 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -54,9 +54,9 @@ files:
|
|
54
54
|
- lib/multi_json/engines/json_pure.rb
|
55
55
|
- lib/multi_json/engines/yajl.rb
|
56
56
|
- multi_json.gemspec
|
57
|
+
- spec/multi_json_spec.rb
|
57
58
|
- spec/spec.opts
|
58
59
|
- spec/spec_helper.rb
|
59
|
-
- spec/x_to_json_spec.rb
|
60
60
|
has_rdoc: true
|
61
61
|
homepage: http://github.com/intridea/multi_json
|
62
62
|
licenses: []
|
@@ -88,5 +88,5 @@ signing_key:
|
|
88
88
|
specification_version: 3
|
89
89
|
summary: A gem to provide swappable JSON backends.
|
90
90
|
test_files:
|
91
|
+
- spec/multi_json_spec.rb
|
91
92
|
- spec/spec_helper.rb
|
92
|
-
- spec/x_to_json_spec.rb
|