rufus-json 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +5 -0
- data/Rakefile +47 -47
- data/lib/rufus/json.rb +15 -1
- data/rufus-json.gemspec +28 -64
- data/test/do_test.rb +10 -0
- metadata +40 -39
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
= rufus-json CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== rufus-json - 0.2.6 released 2011/05/20
|
6
|
+
|
7
|
+
- Rufus::Json .dump and .load (aliases to .encode/.decode). Thanks @tenderlove
|
8
|
+
|
9
|
+
|
5
10
|
== rufus-json - 0.2.5 released 2010/08/10
|
6
11
|
|
7
12
|
- Rufus::Json.encode(o) now accepting string, numbers, boolean and null
|
data/Rakefile
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
require 'lib/rufus/json.rb'
|
2
|
+
$:.unshift('.') # 1.9.2
|
4
3
|
|
5
4
|
require 'rubygems'
|
5
|
+
require 'rubygems/user_interaction' if Gem::RubyGemsVersion == '1.5.0'
|
6
|
+
|
6
7
|
require 'rake'
|
8
|
+
require 'rake/clean'
|
9
|
+
require 'rake/rdoctask'
|
7
10
|
|
8
11
|
|
9
12
|
#
|
10
|
-
#
|
13
|
+
# clean
|
11
14
|
|
12
|
-
|
13
|
-
CLEAN.include('pkg', 'tmp', 'html')
|
14
|
-
task :default => [ :clean ]
|
15
|
+
CLEAN.include('pkg', 'rdoc')
|
15
16
|
|
16
17
|
|
17
18
|
#
|
18
|
-
#
|
19
|
+
# test
|
19
20
|
|
20
|
-
|
21
|
+
#task :spec => :check_dependencies do
|
22
|
+
task :test do
|
23
|
+
sh 'ruby test/test.rb'
|
24
|
+
end
|
21
25
|
|
22
|
-
|
26
|
+
task :default => :test
|
23
27
|
|
24
|
-
gem.version = Rufus::Json::VERSION
|
25
|
-
gem.name = 'rufus-json'
|
26
28
|
|
27
|
-
|
29
|
+
#
|
30
|
+
# gem
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
gem.email = 'jmettraux@gmail.com'
|
33
|
-
gem.homepage = 'http://github.com/jmettraux/rufus-json/'
|
34
|
-
gem.authors = [ 'John Mettraux', 'Torsten Schoenebaum' ]
|
35
|
-
gem.rubyforge_project = 'rufus'
|
32
|
+
GEMSPEC_FILE = Dir['*.gemspec'].first
|
33
|
+
GEMSPEC = eval(File.read(GEMSPEC_FILE))
|
34
|
+
GEMSPEC.validate
|
36
35
|
|
37
|
-
gem.test_file = 'test/test.rb'
|
38
36
|
|
39
|
-
|
40
|
-
gem
|
41
|
-
|
42
|
-
|
43
|
-
#gem.add_development_dependency 'json-jruby'
|
44
|
-
gem.add_development_dependency 'rake'
|
45
|
-
gem.add_development_dependency 'yard'
|
46
|
-
gem.add_development_dependency 'jeweler'
|
37
|
+
desc %{
|
38
|
+
builds the gem and places it in pkg/
|
39
|
+
}
|
40
|
+
task :build do
|
47
41
|
|
48
|
-
|
42
|
+
sh "gem build #{GEMSPEC_FILE}"
|
43
|
+
sh "mkdir pkg" rescue nil
|
44
|
+
sh "mv #{GEMSPEC.name}-#{GEMSPEC.version}.gem pkg/"
|
49
45
|
end
|
50
|
-
Jeweler::GemcutterTasks.new
|
51
46
|
|
47
|
+
desc %{
|
48
|
+
builds the gem and pushes it to rubygems.org
|
49
|
+
}
|
50
|
+
task :push => :build do
|
51
|
+
|
52
|
+
sh "gem push pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
53
|
+
end
|
52
54
|
|
53
|
-
#
|
54
|
-
# DOC
|
55
55
|
|
56
|
-
|
56
|
+
#
|
57
|
+
# rdoc
|
58
|
+
#
|
59
|
+
# make sure to have rdoc 2.5.x to run that
|
57
60
|
|
58
|
-
|
61
|
+
Rake::RDocTask.new do |rd|
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
'-o', 'html/rufus-json', '--title',
|
63
|
-
"rufus-json #{Rufus::Json::VERSION}"
|
64
|
-
]
|
65
|
-
end
|
63
|
+
rd.main = 'README.txt'
|
64
|
+
rd.rdoc_dir = "rdoc/#{GEMSPEC.name}"
|
66
65
|
|
67
|
-
|
66
|
+
rd.rdoc_files.include('README.rdoc', 'CHANGELOG.txt', 'lib/**/*.rb')
|
68
67
|
|
69
|
-
|
70
|
-
abort "YARD is not available : sudo gem install yard"
|
71
|
-
end
|
68
|
+
rd.title = "#{GEMSPEC.name} #{GEMSPEC.version}"
|
72
69
|
end
|
73
70
|
|
74
71
|
|
75
72
|
#
|
76
|
-
#
|
73
|
+
# upload_rdoc
|
77
74
|
|
78
|
-
|
75
|
+
desc %{
|
76
|
+
upload the rdoc to rubyforge
|
77
|
+
}
|
78
|
+
task :upload_rdoc => [ :clean, :rdoc ] do
|
79
79
|
|
80
80
|
account = 'jmettraux@rubyforge.org'
|
81
81
|
webdir = '/var/www/gforge-projects/rufus'
|
82
82
|
|
83
|
-
sh "rsync -azv -e ssh
|
83
|
+
sh "rsync -azv -e ssh rdoc/#{GEMSPEC.name} #{account}:#{webdir}/"
|
84
84
|
end
|
85
85
|
|
data/lib/rufus/json.rb
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
module Rufus
|
27
27
|
module Json
|
28
28
|
|
29
|
-
VERSION = '0.2.
|
29
|
+
VERSION = '0.2.6'
|
30
30
|
|
31
31
|
# The JSON / JSON pure decoder
|
32
32
|
#
|
@@ -138,6 +138,13 @@ module Json
|
|
138
138
|
end
|
139
139
|
end
|
140
140
|
|
141
|
+
# An alias for .encode
|
142
|
+
#
|
143
|
+
def self.dump (o, opts={})
|
144
|
+
|
145
|
+
encode(o, opts)
|
146
|
+
end
|
147
|
+
|
141
148
|
# Decodes the given JSON string.
|
142
149
|
#
|
143
150
|
def self.decode (s)
|
@@ -148,6 +155,13 @@ module Json
|
|
148
155
|
raise ParserError.new(e.message)
|
149
156
|
end
|
150
157
|
|
158
|
+
# An alias for .decode
|
159
|
+
#
|
160
|
+
def self.load (s)
|
161
|
+
|
162
|
+
decode(s)
|
163
|
+
end
|
164
|
+
|
151
165
|
# Duplicates an object by turning it into JSON and back.
|
152
166
|
#
|
153
167
|
# Don't laugh, yajl-ruby makes that faster than a Marshal copy.
|
data/rufus-json.gemspec
CHANGED
@@ -1,73 +1,37 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), 'lib/rufus/json')
|
4
|
+
# bundler wants absolute path
|
5
|
+
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{rufus-json}
|
8
|
-
s.version = "0.2.5"
|
9
8
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.
|
9
|
+
s.name = 'rufus-json'
|
10
|
+
s.version = Rufus::Json::VERSION
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.authors = [ 'John Mettraux' ]
|
13
|
+
s.email = [ 'jmettraux@gmail.com' ]
|
14
|
+
s.homepage = 'http://github.com/jmettraux/rufus-json'
|
15
|
+
s.rubyforge_project = 'rufus'
|
16
|
+
s.summary = 'One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.'
|
17
|
+
|
18
|
+
s.description = %{
|
14
19
|
One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.
|
15
|
-
}
|
16
|
-
|
17
|
-
s.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"CHANGELOG.txt",
|
23
|
-
"CREDITS.txt",
|
24
|
-
"LICENSE.txt",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"lib/rufus-json.rb",
|
28
|
-
"lib/rufus/json.rb",
|
29
|
-
"rufus-json.gemspec",
|
30
|
-
"test/backend_test.rb",
|
31
|
-
"test/do_test.rb",
|
32
|
-
"test/nesting20.rb",
|
33
|
-
"test/test.rb"
|
34
|
-
]
|
35
|
-
s.homepage = %q{http://github.com/jmettraux/rufus-json/}
|
36
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
-
s.require_paths = ["lib"]
|
38
|
-
s.rubyforge_project = %q{rufus}
|
39
|
-
s.rubygems_version = %q{1.3.6}
|
40
|
-
s.summary = %q{One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.}
|
41
|
-
s.test_files = [
|
42
|
-
"test/test.rb"
|
20
|
+
}.strip
|
21
|
+
|
22
|
+
#s.files = `git ls-files`.split("\n")
|
23
|
+
s.files = Dir[
|
24
|
+
'Rakefile',
|
25
|
+
'lib/**/*.rb', 'spec/**/*.rb', 'test/**/*.rb',
|
26
|
+
'*.gemspec', '*.txt', '*.rdoc', '*.md'
|
43
27
|
]
|
44
28
|
|
45
|
-
|
46
|
-
|
47
|
-
|
29
|
+
s.add_development_dependency 'json'
|
30
|
+
s.add_development_dependency 'json_pure'
|
31
|
+
s.add_development_dependency 'yajl-ruby'
|
32
|
+
s.add_development_dependency 'activesupport'
|
33
|
+
s.add_development_dependency 'rake'
|
48
34
|
|
49
|
-
|
50
|
-
s.add_development_dependency(%q<json>, [">= 0"])
|
51
|
-
s.add_development_dependency(%q<yajl-ruby>, [">= 0"])
|
52
|
-
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
53
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
54
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
55
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<json>, [">= 0"])
|
58
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
59
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
60
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
61
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
62
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
63
|
-
end
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<json>, [">= 0"])
|
66
|
-
s.add_dependency(%q<yajl-ruby>, [">= 0"])
|
67
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
68
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
69
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
70
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
71
|
-
end
|
35
|
+
s.require_path = 'lib'
|
72
36
|
end
|
73
37
|
|
data/test/do_test.rb
CHANGED
@@ -48,6 +48,16 @@ class DoTest < Test::Unit::TestCase
|
|
48
48
|
assert_equal "[1,2,3]", Rufus::Json.encode([ 1, 2, 3 ])
|
49
49
|
end
|
50
50
|
|
51
|
+
def test_load
|
52
|
+
|
53
|
+
assert_equal [ 1, 2, 3 ], Rufus::Json.load("[ 1, 2, 3 ]")
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_dump
|
57
|
+
|
58
|
+
assert_equal "[1,2,3]", Rufus::Json.dump([ 1, 2, 3 ])
|
59
|
+
end
|
60
|
+
|
51
61
|
def test_encode_value # instead of object or array
|
52
62
|
|
53
63
|
assert_equal 'null', Rufus::Json.encode(nil)
|
metadata
CHANGED
@@ -1,147 +1,148 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 6
|
10
|
+
version: 0.2.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- John Mettraux
|
13
|
-
- Torsten Schoenebaum
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-05-20 00:00:00 +09:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: json
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
25
26
|
requirements:
|
26
27
|
- - ">="
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
28
30
|
segments:
|
29
31
|
- 0
|
30
32
|
version: "0"
|
31
33
|
type: :development
|
32
34
|
version_requirements: *id001
|
33
35
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
36
|
+
name: json_pure
|
35
37
|
prerelease: false
|
36
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
37
40
|
requirements:
|
38
41
|
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
40
44
|
segments:
|
41
45
|
- 0
|
42
46
|
version: "0"
|
43
47
|
type: :development
|
44
48
|
version_requirements: *id002
|
45
49
|
- !ruby/object:Gem::Dependency
|
46
|
-
name:
|
50
|
+
name: yajl-ruby
|
47
51
|
prerelease: false
|
48
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
49
54
|
requirements:
|
50
55
|
- - ">="
|
51
56
|
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
52
58
|
segments:
|
53
59
|
- 0
|
54
60
|
version: "0"
|
55
61
|
type: :development
|
56
62
|
version_requirements: *id003
|
57
63
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
64
|
+
name: activesupport
|
59
65
|
prerelease: false
|
60
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
61
68
|
requirements:
|
62
69
|
- - ">="
|
63
70
|
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
64
72
|
segments:
|
65
73
|
- 0
|
66
74
|
version: "0"
|
67
75
|
type: :development
|
68
76
|
version_requirements: *id004
|
69
77
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
78
|
+
name: rake
|
71
79
|
prerelease: false
|
72
80
|
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
73
82
|
requirements:
|
74
83
|
- - ">="
|
75
84
|
- !ruby/object:Gem::Version
|
85
|
+
hash: 3
|
76
86
|
segments:
|
77
87
|
- 0
|
78
88
|
version: "0"
|
79
89
|
type: :development
|
80
90
|
version_requirements: *id005
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
segments:
|
89
|
-
- 0
|
90
|
-
version: "0"
|
91
|
-
type: :development
|
92
|
-
version_requirements: *id006
|
93
|
-
description: "\n\
|
94
|
-
One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.\n "
|
95
|
-
email: jmettraux@gmail.com
|
91
|
+
description: One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.
|
92
|
+
email:
|
93
|
+
- jmettraux@gmail.com
|
96
94
|
executables: []
|
97
95
|
|
98
96
|
extensions: []
|
99
97
|
|
100
|
-
extra_rdoc_files:
|
101
|
-
|
102
|
-
- README.rdoc
|
98
|
+
extra_rdoc_files: []
|
99
|
+
|
103
100
|
files:
|
104
|
-
- CHANGELOG.txt
|
105
|
-
- CREDITS.txt
|
106
|
-
- LICENSE.txt
|
107
|
-
- README.rdoc
|
108
101
|
- Rakefile
|
109
|
-
- lib/rufus-json.rb
|
110
102
|
- lib/rufus/json.rb
|
111
|
-
- rufus-json.
|
103
|
+
- lib/rufus-json.rb
|
112
104
|
- test/backend_test.rb
|
113
105
|
- test/do_test.rb
|
114
106
|
- test/nesting20.rb
|
115
107
|
- test/test.rb
|
108
|
+
- rufus-json.gemspec
|
109
|
+
- CHANGELOG.txt
|
110
|
+
- CREDITS.txt
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.rdoc
|
116
113
|
has_rdoc: true
|
117
|
-
homepage: http://github.com/jmettraux/rufus-json
|
114
|
+
homepage: http://github.com/jmettraux/rufus-json
|
118
115
|
licenses: []
|
119
116
|
|
120
117
|
post_install_message:
|
121
|
-
rdoc_options:
|
122
|
-
|
118
|
+
rdoc_options: []
|
119
|
+
|
123
120
|
require_paths:
|
124
121
|
- lib
|
125
122
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
none: false
|
126
124
|
requirements:
|
127
125
|
- - ">="
|
128
126
|
- !ruby/object:Gem::Version
|
127
|
+
hash: 3
|
129
128
|
segments:
|
130
129
|
- 0
|
131
130
|
version: "0"
|
132
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
133
|
requirements:
|
134
134
|
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
+
hash: 3
|
136
137
|
segments:
|
137
138
|
- 0
|
138
139
|
version: "0"
|
139
140
|
requirements: []
|
140
141
|
|
141
142
|
rubyforge_project: rufus
|
142
|
-
rubygems_version: 1.
|
143
|
+
rubygems_version: 1.5.0
|
143
144
|
signing_key:
|
144
145
|
specification_version: 3
|
145
146
|
summary: One interface to various JSON ruby libs (yajl, json, json_pure, json-jruby, active_support). Has a preference for yajl.
|
146
|
-
test_files:
|
147
|
-
|
147
|
+
test_files: []
|
148
|
+
|