ashikawa-core 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.devtools CHANGED
@@ -1,27 +1,26 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.0.3'
4
+ gem 'rake', '~> 10.0.4'
5
5
  gem 'rspec', '~> 2.13.0'
6
- gem 'yard', '~> 0.8.5'
6
+ gem 'yard', '~> 0.8.6'
7
7
  end
8
8
 
9
9
  group :yard do
10
- gem 'kramdown', '~> 0.14.2'
10
+ gem 'kramdown', '~> 1.0.1'
11
11
  end
12
12
 
13
13
  group :guard do
14
- gem 'guard', '~> 1.6.2'
14
+ gem 'guard', '~> 1.7.0'
15
15
  gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 2.4.1'
16
+ gem 'guard-rspec', '~> 2.5.3'
17
17
 
18
18
  # file system change event handling
19
+ gem 'listen', '~> 0.7.3'
19
20
  gem 'rb-fchange', '~> 0.0.6', :require => false
20
21
  gem 'rb-fsevent', '~> 0.9.3', :require => false
21
22
  gem 'rb-inotify', '~> 0.9.0', :require => false
22
23
 
23
- gem 'listen', '~> 0.7.3'
24
-
25
24
  # notification handling
26
25
  gem 'libnotify', '~> 0.8.0', :require => false
27
26
  gem 'rb-notifu', '~> 0.0.4', :require => false
@@ -29,25 +28,19 @@ group :guard do
29
28
  end
30
29
 
31
30
  group :metrics do
32
- gem 'flay', '~> 2.1.0'
33
- gem 'flog', '~> 3.2.2'
31
+ gem 'backports', '~> 3.3', '>= 3.3.0'
32
+ gem 'coveralls', '~> 0.6.5'
33
+ gem 'flay', '~> 2.2.0'
34
+ gem 'flog', '~> 3.2.3'
34
35
  gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
35
- gem 'metric_fu-roodi', '~> 2.2.1'
36
- gem 'yardstick', '~> 0.9.4'
37
-
38
- platforms :ruby_18, :ruby_19 do
39
- # this indirectly depends on ffi which does not build on ruby-head
40
- gem 'yard-spellcheck', '~> 0.1.5'
41
- end
36
+ gem 'simplecov', '~> 0.7.1'
37
+ gem 'yardstick', '~> 0.9.6'
38
+ gem 'yard-spellcheck', '~> 0.1.5'
42
39
 
43
40
  platforms :mri_19, :rbx do
44
41
  gem 'mutant', '~> 0.2.20'
45
42
  end
46
43
 
47
- platforms :mri_19 do
48
- gem 'simplecov', '~> 0.7.1'
49
- end
50
-
51
44
  platforms :rbx do
52
45
  gem 'pelusa', '~> 0.2.2'
53
46
  end
@@ -59,6 +52,6 @@ end
59
52
 
60
53
  platform :jruby do
61
54
  group :jruby do
62
- gem 'jruby-openssl', '~> 0.8.2'
55
+ gem 'jruby-openssl', '~> 0.8.5'
63
56
  end
64
57
  end
data/README.md CHANGED
@@ -62,3 +62,4 @@ If you want to contribute to the project, see CONTRIBUTING.md for details. It co
62
62
  * Lucas Dohmen ([@moonglum](https://github.com/moonglum)): Developer
63
63
  * Tobias Eilert ([@EinLama](https://github.com/EinLama)): Contributor
64
64
  * Markus Schirp ([@mbj](https://github.com/mbj)): Contributor
65
+ * Ettore Berardi ([@ettomatic](https://github.com/ettomatic)): Contributor
@@ -22,7 +22,7 @@ Gem::Specification.new do |gem|
22
22
  gem.require_paths = ["lib"]
23
23
 
24
24
  gem.add_dependency "faraday", "~> 0.8.6"
25
- gem.add_dependency "multi_json", "~> 1.6.1"
25
+ gem.add_dependency "multi_json", "~> 1.7.2"
26
26
  gem.add_dependency "null_logger", "~> 0.0.1"
27
27
  gem.add_dependency "backports", [ '~> 3.0', '>= 3.0.3' ]
28
28
  end
@@ -40,6 +40,7 @@ FeatureEnvy:
40
40
  - Ashikawa::Core::Index#parse_raw_index
41
41
  - Ashikawa::Core::Query#allowed_options
42
42
  - Ashikawa::Core::Query#prepare_request_data
43
+ - Ashikawa::Core::Cursor#parse_documents_cursor
43
44
  enabled: true
44
45
  ClassVariable:
45
46
  exclude: []
data/config/yardstick.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- threshold: 98.1
2
+ threshold: 98.2
@@ -80,11 +80,34 @@ module Ashikawa
80
80
  def parse_raw_cursor(raw_cursor)
81
81
  @id = raw_cursor['id']
82
82
  @has_more = raw_cursor['hasMore']
83
- @length = raw_cursor['count'].to_i if raw_cursor.has_key?('count')
84
- @current = raw_cursor['result']
83
+ if raw_cursor['result']
84
+ parse_documents_cursor(raw_cursor)
85
+ elsif raw_cursor['document']
86
+ parse_document_cursor(raw_cursor)
87
+ end
85
88
  self
86
89
  end
87
90
 
91
+ # Parse the cursor for multiple documents
92
+ #
93
+ # @param [Hash] raw_cursor
94
+ # @return self
95
+ # @api private
96
+ def parse_documents_cursor(raw_cursor)
97
+ @current = raw_cursor['result']
98
+ @length = raw_cursor['count'].to_i if raw_cursor.has_key?('count')
99
+ end
100
+
101
+ # Parse the cursor for a single document
102
+ #
103
+ # @param [Hash] raw_cursor
104
+ # @return self
105
+ # @api private
106
+ def parse_document_cursor(raw_cursor)
107
+ @current = [raw_cursor['document']]
108
+ @length = 1
109
+ end
110
+
88
111
  # Get a new batch from the server
89
112
  #
90
113
  # @return [Boolean] Is there a next batch?
@@ -71,10 +71,9 @@ module Ashikawa
71
71
  # query = Ashikawa::Core::Query.new(collection)
72
72
  # query.first_example({ "color" => "red"}) # => #<Document id=2444 color="red">
73
73
  def first_example(example = {})
74
- response = simple_query_request("simple/first-example",
74
+ simple_query_request("simple/first-example",
75
75
  { :example => example },
76
76
  [:example])
77
- response.first
78
77
  end
79
78
 
80
79
  # Looks for documents in a collection based on location
@@ -1,6 +1,6 @@
1
1
  module Ashikawa
2
2
  module Core
3
3
  # Current version of Ashikawa::Core
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
5
5
  end
6
6
  end
@@ -55,6 +55,12 @@ describe "Queries" do
55
55
  result.length.should == 1
56
56
  end
57
57
 
58
+ it "should be possible to query first document by example" do
59
+ subject << { "name" => "Single Document" }
60
+ result = subject.query.first_example :name => "Single Document"
61
+ result.length.should == 1
62
+ end
63
+
58
64
  describe "query by geo coordinates" do
59
65
  before :each do
60
66
  subject.add_index :geo, :on => [:latitude, :longitude]
@@ -52,7 +52,7 @@ describe Ashikawa::Core::Query do
52
52
  collection.should_receive(:send_request).with("simple/first-example", :put =>
53
53
  {"collection" => "example_1", "example" => { :hello => "world"}})
54
54
 
55
- Ashikawa::Core::Document.should_receive(:new)
55
+ Ashikawa::Core::Cursor.should_receive(:new)
56
56
 
57
57
  subject.first_example example
58
58
  end
@@ -10,7 +10,6 @@ Rake::Task["ci"].clear
10
10
  # * Acceptance, no integration tests
11
11
  # * Special Case: ArangoDB needed for Acceptance Tests
12
12
 
13
-
14
13
  desc 'Run all specs'
15
14
  task :spec => %w[ spec:unit spec:acceptance ]
16
15
 
@@ -39,8 +38,8 @@ end
39
38
  # * On the CI, ArangoDB is already running so use the special acceptance task
40
39
 
41
40
  namespace :ci do
42
- desc 'Run all metrics except mutant'
43
- task :metrics => %w[ metrics:verify_measurements metrics:flog metrics:flay metrics:reek metrics:roodi ]
41
+ desc 'Run all metrics except mutant and reek'
42
+ task :metrics => %w[ metrics:coverage spec:integration metrics:yardstick:verify metrics:flog metrics:flay ]
44
43
  end
45
44
 
46
45
  desc 'Run all metrics and specs'
metadata CHANGED
@@ -1,105 +1,96 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ashikawa-core
3
- version: !ruby/object:Gem::Version
4
- hash: 1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 1
10
- version: 0.7.1
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - moonglum
14
9
  - EinLama
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2013-03-05 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
13
+ date: 2013-04-19 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: faraday
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
25
18
  none: false
26
- requirements:
19
+ requirements:
27
20
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 51
30
- segments:
31
- - 0
32
- - 8
33
- - 6
21
+ - !ruby/object:Gem::Version
34
22
  version: 0.8.6
35
23
  type: :runtime
36
- requirement: *id001
37
- - !ruby/object:Gem::Dependency
38
24
  prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 0.8.6
31
+ - !ruby/object:Gem::Dependency
39
32
  name: multi_json
40
- version_requirements: &id002 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
41
34
  none: false
42
- requirements:
35
+ requirements:
43
36
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 13
46
- segments:
47
- - 1
48
- - 6
49
- - 1
50
- version: 1.6.1
37
+ - !ruby/object:Gem::Version
38
+ version: 1.7.2
51
39
  type: :runtime
52
- requirement: *id002
53
- - !ruby/object:Gem::Dependency
54
40
  prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 1.7.2
47
+ - !ruby/object:Gem::Dependency
55
48
  name: null_logger
56
- version_requirements: &id003 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
57
50
  none: false
58
- requirements:
51
+ requirements:
59
52
  - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 29
62
- segments:
63
- - 0
64
- - 0
65
- - 1
53
+ - !ruby/object:Gem::Version
66
54
  version: 0.0.1
67
55
  type: :runtime
68
- requirement: *id003
69
- - !ruby/object:Gem::Dependency
70
56
  prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: 0.0.1
63
+ - !ruby/object:Gem::Dependency
71
64
  name: backports
72
- version_requirements: &id004 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
73
66
  none: false
74
- requirements:
67
+ requirements:
75
68
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 3
80
- - 0
81
- version: "3.0"
82
- - - ">="
83
- - !ruby/object:Gem::Version
84
- hash: 1
85
- segments:
86
- - 3
87
- - 0
88
- - 3
69
+ - !ruby/object:Gem::Version
70
+ version: '3.0'
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
89
73
  version: 3.0.3
90
74
  type: :runtime
91
- requirement: *id004
92
- description: Ashikawa Core is a wrapper around the ArangoDB REST API. It provides low level access and will be used in different ArangoDB ODMs and other tools.
93
- email:
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ~>
80
+ - !ruby/object:Gem::Version
81
+ version: '3.0'
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: 3.0.3
85
+ description: Ashikawa Core is a wrapper around the ArangoDB REST API. It provides
86
+ low level access and will be used in different ArangoDB ODMs and other tools.
87
+ email:
94
88
  - me@moonglum.net
95
89
  - tobias.eilert@me.com
96
90
  executables: []
97
-
98
91
  extensions: []
99
-
100
92
  extra_rdoc_files: []
101
-
102
- files:
93
+ files:
103
94
  - .gitignore
104
95
  - .rspec
105
96
  - .rvmrc
@@ -115,8 +106,8 @@ files:
115
106
  - config/flay.yml
116
107
  - config/flog.yml
117
108
  - config/mutant.yml
109
+ - config/reek.yml
118
110
  - config/roodi.yml
119
- - config/site.reek
120
111
  - config/yardstick.yml
121
112
  - lib/ashikawa-core.rb
122
113
  - lib/ashikawa-core/collection.rb
@@ -190,40 +181,33 @@ files:
190
181
  - tasks/adjustments.rake
191
182
  homepage: http://triagens.github.com/ashikawa-core
192
183
  licenses: []
193
-
194
184
  post_install_message:
195
185
  rdoc_options: []
196
-
197
- require_paths:
186
+ require_paths:
198
187
  - lib
199
- required_ruby_version: !ruby/object:Gem::Requirement
188
+ required_ruby_version: !ruby/object:Gem::Requirement
200
189
  none: false
201
- requirements:
202
- - - ">="
203
- - !ruby/object:Gem::Version
204
- hash: 57
205
- segments:
206
- - 1
207
- - 8
208
- - 7
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
209
193
  version: 1.8.7
210
- required_rubygems_version: !ruby/object:Gem::Requirement
194
+ required_rubygems_version: !ruby/object:Gem::Requirement
211
195
  none: false
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- hash: 3
216
- segments:
196
+ requirements:
197
+ - - ! '>='
198
+ - !ruby/object:Gem::Version
199
+ version: '0'
200
+ segments:
217
201
  - 0
218
- version: "0"
219
- requirements:
202
+ hash: 1495105476276020209
203
+ requirements:
220
204
  - ArangoDB, v1.2
221
205
  rubyforge_project: ashikawa-core
222
206
  rubygems_version: 1.8.25
223
207
  signing_key:
224
208
  specification_version: 3
225
209
  summary: Ashikawa Core is a wrapper around the ArangoDB REST API
226
- test_files:
210
+ test_files:
227
211
  - spec/acceptance/arango_helper.rb
228
212
  - spec/acceptance/basic_spec.rb
229
213
  - spec/acceptance/index_spec.rb