rufus-jig 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.txt CHANGED
@@ -1,6 +1,12 @@
1
1
 
2
2
  = rufus-jig CHANGELOG.txt
3
3
 
4
+
5
+ == rufus-jig - 0.1.13 released 2010/02/12
6
+
7
+ - implemented Rufus::Jig::Couch#post
8
+
9
+
4
10
  == rufus-jig - 0.1.12 released 2010/01/13
5
11
 
6
12
  - fixed bug with Couch and delete('missing')
data/Rakefile CHANGED
@@ -39,11 +39,10 @@ Jeweler::Tasks.new do |gem|
39
39
 
40
40
  gem.test_file = 'test/test.rb'
41
41
 
42
- #gem.add_dependency 'yajl-ruby'
43
- #gem.add_dependency 'json'
44
42
  gem.add_dependency 'rufus-lru'
45
43
  gem.add_dependency 'rufus-json'
46
- gem.add_development_dependency 'yard', '>= 0'
44
+ gem.add_development_dependency 'yard'
45
+ gem.add_development_dependency 'jeweler'
47
46
 
48
47
  # gemspec spec : http://www.rubygems.org/read/chapter/20
49
48
  end
@@ -121,6 +121,19 @@ module Rufus::Jig
121
121
  end
122
122
  end
123
123
 
124
+ def post (path, doc)
125
+
126
+ path = adjust(path)
127
+
128
+ opts = { :content_type => :json }
129
+
130
+ if et = etag(path)
131
+ opts[:etag] = et
132
+ end
133
+
134
+ @http.post(path, doc, opts)
135
+ end
136
+
124
137
  protected
125
138
 
126
139
  def adjust (path)
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Rufus
3
3
  module Jig
4
- VERSION = '0.1.12'
4
+ VERSION = '0.1.13'
5
5
  end
6
6
  end
7
7
 
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.12"
8
+ s.version = "0.1.13"
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{2010-01-13}
12
+ s.date = %q{2010-02-12}
13
13
  s.description = %q{
14
14
  Json Interwebs Get.
15
15
 
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
  "test/ct_0_couch.rb",
44
44
  "test/ct_1_couchdb.rb",
45
45
  "test/ct_2_couchdb_options.rb",
46
+ "test/ct_3_couchdb_views.rb",
46
47
  "test/server.rb",
47
48
  "test/test.rb",
48
49
  "test/ut_0_http_get.rb",
@@ -71,15 +72,18 @@ Gem::Specification.new do |s|
71
72
  s.add_runtime_dependency(%q<rufus-lru>, [">= 0"])
72
73
  s.add_runtime_dependency(%q<rufus-json>, [">= 0"])
73
74
  s.add_development_dependency(%q<yard>, [">= 0"])
75
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
74
76
  else
75
77
  s.add_dependency(%q<rufus-lru>, [">= 0"])
76
78
  s.add_dependency(%q<rufus-json>, [">= 0"])
77
79
  s.add_dependency(%q<yard>, [">= 0"])
80
+ s.add_dependency(%q<jeweler>, [">= 0"])
78
81
  end
79
82
  else
80
83
  s.add_dependency(%q<rufus-lru>, [">= 0"])
81
84
  s.add_dependency(%q<rufus-json>, [">= 0"])
82
85
  s.add_dependency(%q<yard>, [">= 0"])
86
+ s.add_dependency(%q<jeweler>, [">= 0"])
83
87
  end
84
88
  end
85
89
 
@@ -0,0 +1,79 @@
1
+
2
+ #
3
+ # testing rufus-jig
4
+ #
5
+ # Fri Feb 12 13:17:18 JST 2010
6
+ #
7
+
8
+ require File.join(File.dirname(__FILE__), 'couch_base')
9
+
10
+
11
+ class CtCouchDbViewsTest < Test::Unit::TestCase
12
+
13
+ def setup
14
+
15
+ h = Rufus::Jig::Http.new('127.0.0.1', 5984)
16
+
17
+ begin
18
+ h.delete('/rufus_jig_test')
19
+ rescue Exception => e
20
+ #p e
21
+ end
22
+
23
+ h.put('/rufus_jig_test', '')
24
+
25
+ h.put('/rufus_jig_test/c0', '{"_id":"c0","type":"espresso"}')
26
+ h.put('/rufus_jig_test/c1', '{"_id":"c1","type":"ristretto"}')
27
+ h.put('/rufus_jig_test/c2', '{"_id":"c2","type":"macchiato"}')
28
+ h.put('/rufus_jig_test/c3', '{"_id":"c3","type":"capuccino"}')
29
+ h.put('/rufus_jig_test/c4', '{"_id":"c4","type":"macchiato"}')
30
+
31
+ h.put(
32
+ '/rufus_jig_test/_design/my_test',
33
+ {
34
+ '_id' => '_design/my_test',
35
+ 'views' => {
36
+ 'my_view' => {
37
+ 'map' => "function (doc) { emit(doc['type'], null); }"
38
+ }
39
+ }
40
+ },
41
+ :content_type => :json)
42
+
43
+ h.close
44
+
45
+ @c = Rufus::Jig::Couch.new('127.0.0.1', 5984, 'rufus_jig_test')
46
+ end
47
+
48
+ def teardown
49
+
50
+ @c.close
51
+ end
52
+
53
+ def test_get
54
+
55
+ #"_design/ruote/_view/by_wfid?key=%22#{m[1]}%22" +
56
+
57
+ #p @c.get('_design/my_test/_view/my_view?limit=2')
58
+ assert_equal(
59
+ {"total_rows"=>5, "rows"=>[{"id"=>"c3", "value"=>nil, "key"=>"capuccino"}, {"id"=>"c0", "value"=>nil, "key"=>"espresso"}], "offset"=>0},
60
+ @c.get('_design/my_test/_view/my_view?limit=2'))
61
+ end
62
+
63
+ def test_get_key
64
+
65
+ #p @c.get('_design/my_test/_view/my_view?key=%22macchiato%22')
66
+ assert_equal(
67
+ {"total_rows"=>5, "rows"=>[{"id"=>"c2", "value"=>nil, "key"=>"macchiato"}, {"id"=>"c4", "value"=>nil, "key"=>"macchiato"}], "offset"=>2},
68
+ @c.get('_design/my_test/_view/my_view?key=%22macchiato%22'))
69
+ end
70
+
71
+ def test_post_keys
72
+
73
+ #p @c.post('_design/my_test/_view/my_view', { 'keys' => [ 'espresso', 'macchiato' ] })
74
+ assert_equal(
75
+ {"total_rows"=>5, "rows"=>[{"id"=>"c0", "value"=>nil, "key"=>"espresso"}, {"id"=>"c2", "value"=>nil, "key"=>"macchiato"}, {"id"=>"c4", "value"=>nil, "key"=>"macchiato"}], "offset"=>1},
76
+ @c.post('_design/my_test/_view/my_view', { 'keys' => [ 'espresso', 'macchiato' ] }))
77
+ end
78
+ end
79
+
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.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2010-01-13 00:00:00 +09:00
13
+ date: 2010-02-12 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -43,6 +43,16 @@ dependencies:
43
43
  - !ruby/object:Gem::Version
44
44
  version: "0"
45
45
  version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: jeweler
48
+ type: :development
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
46
56
  description: "\n Json Interwebs Get.\n\n An HTTP client, greedy with JSON content, GETting conditionally.\n\n Uses Patron and Yajl-ruby whenever possible.\n "
47
57
  email: jmettraux@gmail.com
48
58
  executables: []
@@ -73,6 +83,7 @@ files:
73
83
  - test/ct_0_couch.rb
74
84
  - test/ct_1_couchdb.rb
75
85
  - test/ct_2_couchdb_options.rb
86
+ - test/ct_3_couchdb_views.rb
76
87
  - test/server.rb
77
88
  - test/test.rb
78
89
  - test/ut_0_http_get.rb