rufus-jig 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -2,7 +2,12 @@
2
2
  = rufus-jig CHANGELOG.txt
3
3
 
4
4
 
5
- == rufus-jig - 0.1.7 not yet released
5
+ == rufus-jig - 0.1.8 released 2009/12/25
6
+
7
+ - using rufus-json
8
+
9
+
10
+ == rufus-jig - 0.1.7 released 2009/12/23
6
11
 
7
12
  - implemented :force_json => true for services returning JSON in plain/text
8
13
  - :accept => :json as a shorcut for :accept -> 'application/json'
data/Rakefile CHANGED
@@ -41,6 +41,8 @@ Jeweler::Tasks.new do |gem|
41
41
 
42
42
  #gem.add_dependency 'yajl-ruby'
43
43
  #gem.add_dependency 'json'
44
+ gem.add_dependency 'rufus-lru'
45
+ gem.add_dependency 'rufus-json'
44
46
  gem.add_development_dependency 'yard', '>= 0'
45
47
 
46
48
  # gemspec spec : http://www.rubygems.org/read/chapter/20
@@ -248,7 +248,7 @@ module Rufus::Jig
248
248
 
249
249
  return data if data.nil? || data.is_a?(String)
250
250
 
251
- return Rufus::Jig::Json.encode(data) \
251
+ return Rufus::Json.encode(data) \
252
252
  if (opts['Content-Type'] || '').match(/^application\/json/)
253
253
 
254
254
  data.to_s
@@ -269,7 +269,7 @@ module Rufus::Jig
269
269
  ct = response.headers['Content-Type']
270
270
 
271
271
  if opts[:force_json] || (ct && ct.match(/^application\/json/))
272
- Rufus::Jig::Json.decode(b)
272
+ Rufus::Json.decode(b)
273
273
  else
274
274
  b
275
275
  end
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Rufus
3
3
  module Jig
4
- VERSION = '0.1.7'
4
+ VERSION = '0.1.8'
5
5
  end
6
6
  end
7
7
 
data/lib/rufus/jig.rb CHANGED
@@ -26,10 +26,11 @@
26
26
  module Rufus
27
27
  module Jig
28
28
 
29
+ require 'rufus/json'
30
+
29
31
  require 'rufus/jig/version'
30
32
 
31
33
  require 'rufus/jig/http'
32
- require 'rufus/jig/json'
33
34
 
34
35
  autoload :Couch, 'rufus/jig/couch'
35
36
  autoload :CouchError, 'rufus/jig/couch'
data/rufus-jig.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rufus-jig}
8
- s.version = "0.1.7"
8
+ s.version = "0.1.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["John Mettraux", "Kenneth Kalmer"]
12
- s.date = %q{2009-12-24}
12
+ s.date = %q{2009-12-25}
13
13
  s.description = %q{
14
14
  Json Internet Get.
15
15
 
@@ -34,7 +34,6 @@ Gem::Specification.new do |s|
34
34
  "lib/rufus/jig.rb",
35
35
  "lib/rufus/jig/couch.rb",
36
36
  "lib/rufus/jig/http.rb",
37
- "lib/rufus/jig/json.rb",
38
37
  "lib/rufus/jig/path.rb",
39
38
  "lib/rufus/jig/version.rb",
40
39
  "rufus-jig.gemspec",
@@ -67,11 +66,17 @@ Gem::Specification.new do |s|
67
66
  s.specification_version = 3
68
67
 
69
68
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
69
+ s.add_runtime_dependency(%q<rufus-lru>, [">= 0"])
70
+ s.add_runtime_dependency(%q<rufus-json>, [">= 0"])
70
71
  s.add_development_dependency(%q<yard>, [">= 0"])
71
72
  else
73
+ s.add_dependency(%q<rufus-lru>, [">= 0"])
74
+ s.add_dependency(%q<rufus-json>, [">= 0"])
72
75
  s.add_dependency(%q<yard>, [">= 0"])
73
76
  end
74
77
  else
78
+ s.add_dependency(%q<rufus-lru>, [">= 0"])
79
+ s.add_dependency(%q<rufus-json>, [">= 0"])
75
80
  s.add_dependency(%q<yard>, [">= 0"])
76
81
  end
77
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-jig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -10,9 +10,29 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-12-24 00:00:00 +09:00
13
+ date: 2009-12-25 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rufus-lru
18
+ type: :runtime
19
+ version_requirement:
20
+ version_requirements: !ruby/object:Gem::Requirement
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: rufus-json
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ version:
16
36
  - !ruby/object:Gem::Dependency
17
37
  name: yard
18
38
  type: :development
@@ -44,7 +64,6 @@ files:
44
64
  - lib/rufus/jig.rb
45
65
  - lib/rufus/jig/couch.rb
46
66
  - lib/rufus/jig/http.rb
47
- - lib/rufus/jig/json.rb
48
67
  - lib/rufus/jig/path.rb
49
68
  - lib/rufus/jig/version.rb
50
69
  - rufus-jig.gemspec
@@ -1,93 +0,0 @@
1
- #--
2
- # Copyright (c) 2009-2009, John Mettraux, jmettraux@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
-
25
-
26
- module Rufus::Jig
27
-
28
- #
29
- # Dealing with multiple JSON libs. Favours yajl-ruby.
30
- #
31
- # Lifted from http://github.com/jmettraux/ruote
32
- #
33
- module Json
34
-
35
- # The JSON / JSON pure decoder
36
- #
37
- JSON = [
38
- lambda { |o| o.to_json },
39
- lambda { |s| ::JSON.parse(s) }
40
- ]
41
-
42
- # The Rails ActiveSupport::JSON decoder
43
- #
44
- ACTIVE_SUPPORT = [
45
- lambda { |o| o.to_json },
46
- lambda { |s| ActiveSupport::JSON.decode(s) }
47
- ]
48
-
49
- # http://github.com/brianmario/yajl-ruby/
50
- #
51
- YAJL = [
52
- lambda { |o| Yajl::Encoder.encode(o) },
53
- lambda { |s| Yajl::Parser.parse(s) }
54
- ]
55
-
56
- # The "raise an exception because there's no backend" backend
57
- #
58
- NONE = [ lambda { |s| raise 'no JSON backend found' } ] * 2
59
-
60
- @backend = if defined?(::Yajl)
61
- YAJL
62
- elsif defined?(::JSON)
63
- JSON
64
- elsif defined?(ActiveSupport::JSON)
65
- ACTIVE_SUPPORT
66
- else
67
- NONE
68
- end
69
-
70
- # Forces a decoder JSON/ACTIVE_SUPPORT or any lambda pair that knows
71
- # how to deal with JSON.
72
- #
73
- def self.backend= (b)
74
-
75
- @backend = b
76
- end
77
-
78
- # Encodes the given object to JSON.
79
- #
80
- def self.encode (o)
81
-
82
- @backend[0].call(o)
83
- end
84
-
85
- # Decodes the given JSON string.
86
- #
87
- def self.decode (s)
88
-
89
- @backend[1].call(s)
90
- end
91
- end
92
- end
93
-