couchrest 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3d7f21797193d533b8396e309590abd196de7a39
4
+ data.tar.gz: caf0fb70ff021d2fadfdca002f9ee86e4ef0ae96
5
+ SHA512:
6
+ metadata.gz: a51e81e310ecb977bccd96cbac43aeaef93968eb60a32326ff3adb001c8234470278f732cfc168e73b3b12c72573c2db085e8ebd1653e827c06f03069a5c0ca8
7
+ data.tar.gz: e5fec96c5310f5b85f0f0808da98d1cf853554a643b6c5567950fac895e0b8774c439886bd33133cf9b5f7c848ceb433194e800c3ad78d4e03037fe2a46bc2d5
data/.travis.yml CHANGED
@@ -1,8 +1,7 @@
1
1
  rvm:
2
+ - 2.2.0
3
+ - 2.1.0
2
4
  - 2.0.0
3
5
  - 1.9.3
4
- - 1.9.2
5
- - 1.8.7
6
- - ree-1.8.7
7
6
  - jruby
8
- services: couchdb
7
+ services: couchdb
data/README.md CHANGED
@@ -8,31 +8,17 @@ to CouchDB's API endpoints so you don't have to.
8
8
 
9
9
  CouchRest is designed to make a simple base for application and framework-specific object oriented APIs. CouchRest is Object-Mapper agnostic, the parsed JSON it returns from CouchDB shows up as subclasses of Ruby's Hash. Naked JSON, just as it was mean to be.
10
10
 
11
- **Note: CouchRest only support CouchDB 0.9.0 or newer. Some features requires CouchDB 0.10.0 or newer.**
11
+ ## CouchDB Version
12
12
 
13
- ## Important Upgrade Notice
13
+ Tested on latest stable release (1.6.X), but little has changed in the last few year and should work on older versions. Also known to work fine on [Cloudant](http://cloudant.com).
14
14
 
15
- ### 2011-04-04: Time#to_json no longer overwritten!
16
-
17
- Now sticking to JSON standard format. Ensure you views using Time will be ordered correctly after upgrade!
18
-
19
- ## Easy Install
15
+ ## Install
20
16
 
21
17
  $ sudo gem install couchrest
22
-
23
- ## Relax, it's RESTful
24
-
25
- CouchRest rests on top of a HTTP abstraction layer using by default Heroku’s excellent REST Client Ruby HTTP wrapper.
26
18
 
27
19
  ## Modelling
28
20
 
29
- For more complete modelling support based on Rails 3's ActiveModel, please checkout CouchRest's sister project: [CouchRest Model](https://github.com/couchrest/couchrest_model).
30
-
31
- ## Extended Document
32
-
33
- As of May 2010 support for the popular CouchRest::ExtendedDocument mixin has been moved to its own gem: [couchrest_extended_document](http://github.com/couchrest/couchrest_extended_document).
34
-
35
- If you're starting a new project however, we recommend you use the more actively maintained [CouchRest Model](https://github.com/couchrest/couchrest_model) project, supported by the same team of developers.
21
+ For more complete modelling support based on ActiveModel, please checkout CouchRest's sister project: [CouchRest Model](https://github.com/couchrest/couchrest_model).
36
22
 
37
23
  ## Running the Specs
38
24
 
@@ -43,12 +29,10 @@ the dependencies and then run the tests:
43
29
  $ bundle install
44
30
  $ bundle exec rake
45
31
 
46
- To date, the couchrest specs have been show to run on:
32
+ To date, the couchrest specs have been shown to run on:
47
33
 
48
- * Ruby 1.8.7
49
- * Ruby 1.9.2
50
- * Ruby 1.9.3
51
- * JRuby 1.5.6
34
+ * MRI Ruby 1.9.3 and later
35
+ * JRuby
52
36
 
53
37
  ## Docs
54
38
 
@@ -62,5 +46,5 @@ Please post bugs, suggestions and patches to the bug tracker at [http://github.c
62
46
 
63
47
  Follow us on Twitter: [http://twitter.com/couchrest](http://twitter.com/couchrest)
64
48
 
65
- Also, check [http://twitter.com/#search?q=%23couchrest](http://twitter.com/#search?q=%23couchrest)
49
+ Also, check [https://twitter.com/search?q=couchrest](https://twitter.com/search?q=couchrest)
66
50
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.0
1
+ 1.2.1
data/couchrest.gemspec CHANGED
@@ -3,6 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{couchrest}
5
5
  s.version = `cat VERSION`.strip
6
+ s.license = "Apache License 2.0"
6
7
 
7
8
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
8
9
  s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber", "Sam Lown"]
@@ -26,11 +27,10 @@ Gem::Specification.new do |s|
26
27
  s.rubygems_version = %q{1.3.7}
27
28
  s.summary = %q{Lean and RESTful interface to CouchDB.}
28
29
 
29
- s.add_dependency(%q<rest-client>, ["~> 1.6.1"])
30
- s.add_dependency(%q<mime-types>, ["~> 1.15"])
31
- s.add_dependency(%q<multi_json>, ["~> 1.0"])
30
+ s.add_dependency(%q<rest-client>, ["~> 1.8.0"])
31
+ s.add_dependency(%q<mime-types>, [">= 1.15"])
32
+ s.add_dependency(%q<multi_json>, "~> 1.7", '~> 1.0')
32
33
  s.add_development_dependency(%q<json>, [">= 1.7.0"])
33
34
  s.add_development_dependency(%q<rspec>, "~> 2.6.0")
34
35
  s.add_development_dependency(%q<rake>)
35
- s.add_development_dependency(%q<multi_json>, "~> 1.7") # needed for json decode json objects
36
36
  end
data/history.txt CHANGED
@@ -1,3 +1,13 @@
1
+ == 1.2.1 - 2015-06-25
2
+
3
+ * Changes
4
+ * Adding design doc #info method (@samlown)
5
+ * License in gemspec (@kuahyeow)
6
+ * Preserve the first change in continuous feeds (@azul)
7
+ * Rest-client dependency upgrade (@janraasch)
8
+ * Dropping support for older ruby's, adding new ones in Travis config (@samlown)
9
+ * Depends on any version of mime-types above 1.15 (hope this doesn't break anything) (@samlown)
10
+
1
11
  == 1.2.0 - 2013-05-25
2
12
 
3
13
  * Changes
@@ -60,6 +60,11 @@ JAVASCRIPT
60
60
  self['_id'] = "_design/#{newname}"
61
61
  end
62
62
 
63
+ # Provide information about the status of the design document.
64
+ def info
65
+ CouchRest.get "#{database.root}/#{id}/_info"
66
+ end
67
+
63
68
  def save
64
69
  raise ArgumentError, "_design docs require a name" unless name && name.length > 0
65
70
  super
@@ -29,10 +29,13 @@ module CouchRest
29
29
  first = nil
30
30
  prev = nil
31
31
  IO.popen(cmd) do |f|
32
- first = f.gets # discard header
33
- while line = f.gets
32
+ while line = f.gets
34
33
  row = parse_line(line)
35
- block.call row unless row.nil? # last line "}]" discarded
34
+ if row.nil?
35
+ first ||= line # save the header for later if we can't parse it.
36
+ else
37
+ block.call row
38
+ end
36
39
  prev = line
37
40
  end
38
41
  end
@@ -189,6 +189,18 @@ describe CouchRest::Database do
189
189
  c['results'].length.should eql(3)
190
190
  end
191
191
 
192
+ it "should include all changes in continuous feed" do
193
+ changes = []
194
+ begin
195
+ c = @db.changes("feed" => "continuous", "since" => "0") do |change|
196
+ changes << change
197
+ raise RuntimeError.new # escape from infinite loop
198
+ end
199
+ rescue RuntimeError
200
+ end
201
+ changes.first["seq"].should eql(1)
202
+ end
203
+
192
204
  it "should provide id of last document" do
193
205
  c = @db.changes
194
206
  doc = @db.get(c['results'].last['id'])
@@ -202,5 +202,25 @@ describe CouchRest::Design do
202
202
  end
203
203
  end
204
204
 
205
+ describe "requesting info" do
206
+
207
+ before(:all) do
208
+ @db = reset_test_db!
209
+ @des = CouchRest::Design.new
210
+ @des.name = "test"
211
+ @des.view_by :code, :map => "function(d){ if(d['code']) { emit(d['code'], 1); } }", :reduce => "function(k,v,r){ return sum(v); }"
212
+ @des.database = @db
213
+ @des.save
214
+ @db.bulk_save([{"code" => "a", "age" => 2},
215
+ {"code" => 'b', "age" => 4},{"code" => 'c', "age" => 9}])
216
+ end
217
+
218
+ it "should provide a summary info hash" do
219
+ info = @des.info
220
+ info['name'].should eql("test")
221
+ info.should include("view_index")
222
+ end
223
+
224
+ end
205
225
 
206
226
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
5
- prerelease:
4
+ version: 1.2.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - J. Chris Anderson
@@ -13,120 +12,98 @@ authors:
13
12
  autorequire:
14
13
  bindir: bin
15
14
  cert_chain: []
16
- date: 2013-05-25 00:00:00.000000000 Z
15
+ date: 2015-06-25 00:00:00.000000000 Z
17
16
  dependencies:
18
17
  - !ruby/object:Gem::Dependency
19
18
  name: rest-client
20
19
  requirement: !ruby/object:Gem::Requirement
21
- none: false
22
20
  requirements:
23
- - - ~>
21
+ - - "~>"
24
22
  - !ruby/object:Gem::Version
25
- version: 1.6.1
23
+ version: 1.8.0
26
24
  type: :runtime
27
25
  prerelease: false
28
26
  version_requirements: !ruby/object:Gem::Requirement
29
- none: false
30
27
  requirements:
31
- - - ~>
28
+ - - "~>"
32
29
  - !ruby/object:Gem::Version
33
- version: 1.6.1
30
+ version: 1.8.0
34
31
  - !ruby/object:Gem::Dependency
35
32
  name: mime-types
36
33
  requirement: !ruby/object:Gem::Requirement
37
- none: false
38
34
  requirements:
39
- - - ~>
35
+ - - ">="
40
36
  - !ruby/object:Gem::Version
41
37
  version: '1.15'
42
38
  type: :runtime
43
39
  prerelease: false
44
40
  version_requirements: !ruby/object:Gem::Requirement
45
- none: false
46
41
  requirements:
47
- - - ~>
42
+ - - ">="
48
43
  - !ruby/object:Gem::Version
49
44
  version: '1.15'
50
45
  - !ruby/object:Gem::Dependency
51
46
  name: multi_json
52
47
  requirement: !ruby/object:Gem::Requirement
53
- none: false
54
48
  requirements:
55
- - - ~>
49
+ - - "~>"
50
+ - !ruby/object:Gem::Version
51
+ version: '1.7'
52
+ - - "~>"
56
53
  - !ruby/object:Gem::Version
57
54
  version: '1.0'
58
55
  type: :runtime
59
56
  prerelease: false
60
57
  version_requirements: !ruby/object:Gem::Requirement
61
- none: false
62
58
  requirements:
63
- - - ~>
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ - - "~>"
64
63
  - !ruby/object:Gem::Version
65
64
  version: '1.0'
66
65
  - !ruby/object:Gem::Dependency
67
66
  name: json
68
67
  requirement: !ruby/object:Gem::Requirement
69
- none: false
70
68
  requirements:
71
- - - ! '>='
69
+ - - ">="
72
70
  - !ruby/object:Gem::Version
73
71
  version: 1.7.0
74
72
  type: :development
75
73
  prerelease: false
76
74
  version_requirements: !ruby/object:Gem::Requirement
77
- none: false
78
75
  requirements:
79
- - - ! '>='
76
+ - - ">="
80
77
  - !ruby/object:Gem::Version
81
78
  version: 1.7.0
82
79
  - !ruby/object:Gem::Dependency
83
80
  name: rspec
84
81
  requirement: !ruby/object:Gem::Requirement
85
- none: false
86
82
  requirements:
87
- - - ~>
83
+ - - "~>"
88
84
  - !ruby/object:Gem::Version
89
85
  version: 2.6.0
90
86
  type: :development
91
87
  prerelease: false
92
88
  version_requirements: !ruby/object:Gem::Requirement
93
- none: false
94
89
  requirements:
95
- - - ~>
90
+ - - "~>"
96
91
  - !ruby/object:Gem::Version
97
92
  version: 2.6.0
98
93
  - !ruby/object:Gem::Dependency
99
94
  name: rake
100
95
  requirement: !ruby/object:Gem::Requirement
101
- none: false
102
96
  requirements:
103
- - - ! '>='
97
+ - - ">="
104
98
  - !ruby/object:Gem::Version
105
99
  version: '0'
106
100
  type: :development
107
101
  prerelease: false
108
102
  version_requirements: !ruby/object:Gem::Requirement
109
- none: false
110
103
  requirements:
111
- - - ! '>='
104
+ - - ">="
112
105
  - !ruby/object:Gem::Version
113
106
  version: '0'
114
- - !ruby/object:Gem::Dependency
115
- name: multi_json
116
- requirement: !ruby/object:Gem::Requirement
117
- none: false
118
- requirements:
119
- - - ~>
120
- - !ruby/object:Gem::Version
121
- version: '1.7'
122
- type: :development
123
- prerelease: false
124
- version_requirements: !ruby/object:Gem::Requirement
125
- none: false
126
- requirements:
127
- - - ~>
128
- - !ruby/object:Gem::Version
129
- version: '1.7'
130
107
  description: CouchRest provides a simple interface on top of CouchDB's RESTful HTTP
131
108
  API, as well as including some utility scripts for managing views and attachments.
132
109
  email: jchris@apache.org
@@ -137,8 +114,8 @@ extra_rdoc_files:
137
114
  - README.md
138
115
  - THANKS.md
139
116
  files:
140
- - .gitignore
141
- - .travis.yml
117
+ - ".gitignore"
118
+ - ".travis.yml"
142
119
  - Gemfile
143
120
  - LICENSE
144
121
  - README.md
@@ -196,32 +173,29 @@ files:
196
173
  - utils/remap.rb
197
174
  - utils/subset.rb
198
175
  homepage: http://github.com/couchrest/couchrest
199
- licenses: []
176
+ licenses:
177
+ - Apache License 2.0
178
+ metadata: {}
200
179
  post_install_message:
201
180
  rdoc_options:
202
- - --charset=UTF-8
181
+ - "--charset=UTF-8"
203
182
  require_paths:
204
183
  - lib
205
184
  required_ruby_version: !ruby/object:Gem::Requirement
206
- none: false
207
185
  requirements:
208
- - - ! '>='
186
+ - - ">="
209
187
  - !ruby/object:Gem::Version
210
188
  version: '0'
211
- segments:
212
- - 0
213
- hash: 1010445868410705054
214
189
  required_rubygems_version: !ruby/object:Gem::Requirement
215
- none: false
216
190
  requirements:
217
- - - ! '>'
191
+ - - ">"
218
192
  - !ruby/object:Gem::Version
219
193
  version: 1.3.1
220
194
  requirements: []
221
195
  rubyforge_project:
222
- rubygems_version: 1.8.25
196
+ rubygems_version: 2.4.6
223
197
  signing_key:
224
- specification_version: 3
198
+ specification_version: 4
225
199
  summary: Lean and RESTful interface to CouchDB.
226
200
  test_files:
227
201
  - spec/couchrest/couchrest_spec.rb