ashikawa-core 0.7.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +0 -4
  5. data/Gemfile +1 -1
  6. data/Gemfile.devtools +24 -18
  7. data/README.md +6 -11
  8. data/ashikawa-core.gemspec +7 -6
  9. data/config/flay.yml +2 -2
  10. data/config/flog.yml +2 -1
  11. data/config/reek.yml +68 -84
  12. data/config/rubocop.yml +99 -0
  13. data/config/yardstick.yml +1 -1
  14. data/lib/ashikawa-core/collection.rb +74 -21
  15. data/lib/ashikawa-core/configuration.rb +26 -0
  16. data/lib/ashikawa-core/connection.rb +5 -2
  17. data/lib/ashikawa-core/cursor.rb +28 -16
  18. data/lib/ashikawa-core/database.rb +89 -12
  19. data/lib/ashikawa-core/document.rb +32 -5
  20. data/lib/ashikawa-core/edge.rb +3 -0
  21. data/lib/ashikawa-core/exceptions/client_error.rb +3 -3
  22. data/lib/ashikawa-core/exceptions/server_error.rb +3 -3
  23. data/lib/ashikawa-core/figure.rb +17 -5
  24. data/lib/ashikawa-core/index.rb +4 -0
  25. data/lib/ashikawa-core/key_options.rb +54 -0
  26. data/lib/ashikawa-core/query.rb +39 -74
  27. data/lib/ashikawa-core/request_preprocessor.rb +2 -2
  28. data/lib/ashikawa-core/response_preprocessor.rb +21 -12
  29. data/lib/ashikawa-core/transaction.rb +113 -0
  30. data/lib/ashikawa-core/version.rb +1 -1
  31. data/spec/acceptance/basic_spec.rb +40 -12
  32. data/spec/acceptance/index_spec.rb +2 -1
  33. data/spec/acceptance/query_spec.rb +18 -17
  34. data/spec/acceptance/transactions_spec.rb +30 -0
  35. data/spec/fixtures/collections/all.json +90 -30
  36. data/spec/fixtures/cursor/edges.json +23 -0
  37. data/spec/setup/arangodb.sh +7 -6
  38. data/spec/unit/collection_spec.rb +89 -13
  39. data/spec/unit/connection_spec.rb +23 -14
  40. data/spec/unit/cursor_spec.rb +15 -4
  41. data/spec/unit/database_spec.rb +58 -17
  42. data/spec/unit/document_spec.rb +24 -4
  43. data/spec/unit/edge_spec.rb +1 -1
  44. data/spec/unit/exception_spec.rb +4 -2
  45. data/spec/unit/figure_spec.rb +17 -10
  46. data/spec/unit/index_spec.rb +1 -1
  47. data/spec/unit/key_options_spec.rb +25 -0
  48. data/spec/unit/query_spec.rb +1 -1
  49. data/spec/unit/spec_helper.rb +20 -2
  50. data/spec/unit/transaction_spec.rb +153 -0
  51. data/tasks/adjustments.rake +23 -14
  52. metadata +31 -41
  53. data/.rvmrc +0 -1
  54. data/config/roodi.yml +0 -17
  55. data/spec/spec_helper.rb +0 -27
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e67c306a17ae75239990205c7eb4d9e76313a5d9
4
+ data.tar.gz: 5a4436d1232aafb207df6eda4606917526fde084
5
+ SHA512:
6
+ metadata.gz: d150eb95dd6fc151c8240b9f85a2cd775a08d0c525f34aa79f4a6fc0e3deef1f58f62a216d5f797be4d2e25e4fabec8eaa77f8749bec5cee74d5f8b9f34d020c
7
+ data.tar.gz: 46cf85918734b9f2bcf6422d56e151e1b517ed53446795b42c7e7eef1d554b170dfeb81d61ca80d802764c72fe02ac49b737d236221ca581adff51ace9645d97
data/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p0
data/.travis.yml CHANGED
@@ -2,16 +2,12 @@ language: ruby
2
2
  before_script:
3
3
  - ./spec/setup/arangodb.sh
4
4
  rvm:
5
- - 1.8.7
6
5
  - 1.9.2
7
6
  - 1.9.3
8
7
  - 2.0.0
9
- - jruby-18mode
10
8
  - jruby-19mode
11
9
  - jruby-head
12
- - rbx-18mode
13
10
  - rbx-19mode
14
- - ree
15
11
  - ruby-head
16
12
  matrix:
17
13
  allow_failures:
data/Gemfile CHANGED
@@ -3,6 +3,6 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in ashikawa-core.gemspec
4
4
  gemspec
5
5
 
6
- gem 'devtools', :git => 'https://github.com/datamapper/devtools.git'
6
+ gem 'devtools', :git => 'https://github.com/rom-rb/devtools.git'
7
7
 
8
8
  eval File.read('Gemfile.devtools')
data/Gemfile.devtools CHANGED
@@ -1,22 +1,24 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  group :development do
4
- gem 'rake', '~> 10.0.4'
5
- gem 'rspec', '~> 2.13.0'
6
- gem 'yard', '~> 0.8.6'
4
+ gem 'rake', '~> 10.1.0'
5
+ gem 'rspec', '~> 2.14.1'
6
+ gem 'yard', '~> 0.8.6.2'
7
7
  end
8
8
 
9
9
  group :yard do
10
- gem 'kramdown', '~> 1.0.1'
10
+ gem 'kramdown', '~> 1.1.0'
11
11
  end
12
12
 
13
13
  group :guard do
14
- gem 'guard', '~> 1.7.0'
14
+ gem 'guard', '~> 1.8.1'
15
15
  gem 'guard-bundler', '~> 1.0.0'
16
- gem 'guard-rspec', '~> 2.5.3'
16
+ gem 'guard-rspec', '~> 3.0.2'
17
+ gem 'guard-rubocop', '~> 0.2.0'
18
+ gem 'guard-mutant', '~> 0.0.1'
17
19
 
18
20
  # file system change event handling
19
- gem 'listen', '~> 0.7.3'
21
+ gem 'listen', '~> 1.2.2'
20
22
  gem 'rb-fchange', '~> 0.0.6', :require => false
21
23
  gem 'rb-fsevent', '~> 0.9.3', :require => false
22
24
  gem 'rb-inotify', '~> 0.9.0', :require => false
@@ -28,17 +30,21 @@ group :guard do
28
30
  end
29
31
 
30
32
  group :metrics do
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'
35
- gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
36
- gem 'simplecov', '~> 0.7.1'
37
- gem 'yardstick', '~> 0.9.6'
38
- gem 'yard-spellcheck', '~> 0.1.5'
39
-
40
- platforms :mri_19, :rbx do
41
- gem 'mutant', '~> 0.2.20'
33
+ gem 'coveralls', '~> 0.6.7'
34
+ gem 'flay', '~> 2.3.1'
35
+ gem 'flog', '~> 4.1.1'
36
+ gem 'reek', '~> 1.3.1', :git => 'https://github.com/troessner/reek.git'
37
+ gem 'rubocop', '~> 0.10.0', :git => 'https://github.com/bbatsov/rubocop.git'
38
+ gem 'simplecov', '~> 0.7.1'
39
+ gem 'yardstick', '~> 0.9.6'
40
+
41
+ platforms :ruby_19, :ruby_20 do
42
+ gem 'mutant', '~> 0.3.0.beta17'
43
+ gem 'yard-spellcheck', '~> 0.1.5'
44
+ end
45
+
46
+ platforms :ruby_19 do
47
+ gem 'json', '~> 1.8.0'
42
48
  end
43
49
 
44
50
  platforms :rbx do
data/README.md CHANGED
@@ -1,18 +1,12 @@
1
- # Ashikawa Core
1
+ # Ashikawa Core [![Gem Version](https://badge.fury.io/rb/ashikawa-core.png)](http://badge.fury.io/rb/ashikawa-core) [![Build Status](https://secure.travis-ci.org/triAGENS/ashikawa-core.png?branch=master)](http://travis-ci.org/triAGENS/ashikawa-core) [![Dependency Status](https://gemnasium.com/triAGENS/ashikawa-core.png)](https://gemnasium.com/triAGENS/ashikawa-core) [![Code Climate](https://codeclimate.com/github/triAGENS/ashikawa-core.png)](https://codeclimate.com/github/triAGENS/ashikawa-core) [![Coverage Status](https://coveralls.io/repos/triAGENS/ashikawa-core/badge.png?branch=coverall)](https://coveralls.io/r/triAGENS/ashikawa-core)
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/ashikawa-core.png)](http://badge.fury.io/rb/ashikawa-core)
4
- [![Build Status](https://secure.travis-ci.org/triAGENS/ashikawa-core.png?branch=master)](http://travis-ci.org/triAGENS/ashikawa-core)
5
- [![Dependency Status](https://gemnasium.com/triAGENS/ashikawa-core.png)](https://gemnasium.com/triAGENS/ashikawa-core)
6
- [![Code Climate](https://codeclimate.com/github/triAGENS/ashikawa-core.png)](https://codeclimate.com/github/triAGENS/ashikawa-core)
7
-
8
- 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 projects related to the database. It is always working with the stable version of ArangoDB, this is currently version **1.2**. If you want to access an ArangoDB instance running version **1.1.2** refer to version [0.6](https://github.com/triAGENS/ashikawa-core/tree/0.6.0) of this gem (or just update ;) ).
3
+ 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 projects related to the database. It is always working with the stable version of ArangoDB, this is currently version **1.3**. If you want to access an ArangoDB instance running version **1.2** or use Ruby 1.8 refer to version [0.7](https://github.com/triAGENS/ashikawa-core/tree/0.7) of this gem (or just update ;) ).
9
4
 
10
5
  All tests run on Travis CI for the following versions of Ruby:
11
6
 
12
- * MRI 1.8.7, 1.9.2, 1.9.3 and 2.0.0
13
- * Rubinius 1.8 and 1.9 mode
14
- * JRuby 1.8 and 1.9 mode
15
- * REE
7
+ * MRI 1.9.2, 1.9.3 and 2.0.0
8
+ * Rubinius 1.9 mode
9
+ * JRuby 1.9 mode
16
10
 
17
11
  We also run on JRuby and MRI Head, but they are allowed failures (Please see [Travis](http://travis-ci.org/triAGENS/ashikawa-core) for their build status).
18
12
 
@@ -63,3 +57,4 @@ If you want to contribute to the project, see CONTRIBUTING.md for details. It co
63
57
  * Tobias Eilert ([@EinLama](https://github.com/EinLama)): Contributor
64
58
  * Markus Schirp ([@mbj](https://github.com/mbj)): Contributor
65
59
  * Ettore Berardi ([@ettomatic](https://github.com/ettomatic)): Contributor
60
+ * Samuel Richardson ([@Rodeoclash](https://github.com/Rodeoclash)): Contributor
@@ -5,14 +5,15 @@ require "ashikawa-core/version"
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "ashikawa-core"
7
7
  gem.version = Ashikawa::Core::VERSION
8
- gem.authors = ["moonglum", "EinLama"]
9
- gem.email = ["me@moonglum.net", "tobias.eilert@me.com"]
8
+ gem.authors = ["moonglum"]
9
+ gem.email = ["me@moonglum.net"]
10
10
  gem.homepage = "http://triagens.github.com/ashikawa-core"
11
11
  gem.summary = "Ashikawa Core is a wrapper around the ArangoDB REST API"
12
12
  gem.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."
13
+ gem.license = "Apache License 2.0"
13
14
 
14
- gem.required_ruby_version = '>= 1.8.7'
15
- gem.requirements << "ArangoDB, v1.2"
15
+ gem.required_ruby_version = '>= 1.9.2'
16
+ gem.requirements << "ArangoDB, v1.3"
16
17
 
17
18
  gem.rubyforge_project = "ashikawa-core"
18
19
 
@@ -22,7 +23,7 @@ Gem::Specification.new do |gem|
22
23
  gem.require_paths = ["lib"]
23
24
 
24
25
  gem.add_dependency "faraday", "~> 0.8.6"
25
- gem.add_dependency "multi_json", "~> 1.7.2"
26
+ gem.add_dependency "json", "~> 1.8.0"
26
27
  gem.add_dependency "null_logger", "~> 0.0.1"
27
- gem.add_dependency "backports", [ '~> 3.0', '>= 3.0.3' ]
28
+ gem.add_dependency "equalizer", "~> 0.0.5"
28
29
  end
data/config/flay.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  ---
2
- threshold: 14
3
- total_score: 265
2
+ threshold: 12
3
+ total_score: 318
data/config/flog.yml CHANGED
@@ -1,2 +1,3 @@
1
1
  ---
2
- threshold: 11.3
2
+ threshold: 15.4
3
+
data/config/reek.yml CHANGED
@@ -1,120 +1,104 @@
1
1
  ---
2
- UncommunicativeParameterName:
3
- accept: []
2
+ Attribute:
3
+ enabled: false
4
4
  exclude: []
5
+ BooleanParameter:
5
6
  enabled: true
6
- reject:
7
- - !ruby/regexp /^.$/
8
- - !ruby/regexp /[0-9]$/
9
- - !ruby/regexp /[A-Z]/
10
- LargeClass:
11
- max_methods: 10
12
- exclude:
13
- - Ashikawa::Core::Figure
14
- - Ashikawa::Core::Query
15
- - Ashikawa::Core::Collection
16
- enabled: true
17
- max_instance_variables: 5
18
- UncommunicativeMethodName:
19
- accept: []
20
7
  exclude: []
8
+ ClassVariable:
21
9
  enabled: true
22
- reject:
23
- - !ruby/regexp /^[a-z]$/
24
- - !ruby/regexp /[0-9]$/
25
- - !ruby/regexp /[A-Z]/
26
- LongParameterList:
27
- max_params: 3
28
- exclude:
29
- - Ashikawa::Core::Query#wrapped_request
30
- enabled: true
31
- overrides: {}
32
- FeatureEnvy:
33
- exclude:
34
- - Ashikawa::Core::RequestPreprocessor
35
- - Ashikawa::Core::ResponsePreprocessor
36
- - Ashikawa::Core::Database#initialize
37
- - Ashikawa::Core::Database#create_collection
38
- - Ashikawa::Core::Connection#http_verb
39
- - Ashikawa::Core::Connection#initialize
40
- - Ashikawa::Core::Index#parse_raw_index
41
- - Ashikawa::Core::Query#allowed_options
42
- - Ashikawa::Core::Query#prepare_request_data
43
- - Ashikawa::Core::Cursor#parse_documents_cursor
10
+ exclude: []
11
+ ControlParameter:
44
12
  enabled: true
45
- ClassVariable:
46
13
  exclude: []
14
+ DataClump:
47
15
  enabled: true
48
- BooleanParameter:
49
16
  exclude: []
17
+ max_copies: 2
18
+ min_clump_size: 2
19
+ DuplicateMethodCall:
50
20
  enabled: true
21
+ exclude:
22
+ - Ashikawa::Core::ResponsePreprocessor#handle_status
23
+ max_calls: 1
24
+ allow_calls: []
25
+ FeatureEnvy:
26
+ enabled: false
27
+ exclude: []
51
28
  IrresponsibleModule:
29
+ enabled: true
52
30
  exclude: []
31
+ LongParameterList:
53
32
  enabled: true
54
- UncommunicativeModuleName:
55
- accept: []
56
33
  exclude: []
34
+ max_params: 3
35
+ overrides: {}
36
+ LongYieldList:
57
37
  enabled: true
58
- reject: []
38
+ exclude: []
39
+ max_params: 1
59
40
  NestedIterators:
41
+ enabled: true
42
+ exclude: []
43
+ max_allowed_nesting: 2
60
44
  ignore_iterators: []
45
+ NilCheck:
46
+ enabled: true
47
+ exclude:
48
+ - Ashikawa::Core::Database#setup_new_connection
49
+ RepeatedConditional:
50
+ enabled: true
61
51
  exclude:
62
- - Ashikawa::Core::Query#prepare_request_data
52
+ - Ashikawa::Core::Query
53
+ max_ifs: 1
54
+ TooManyInstanceVariables:
55
+ enabled: true
56
+ exclude: []
57
+ max_instance_variables: 12
58
+ TooManyMethods:
63
59
  enabled: true
64
- max_allowed_nesting: 1
65
- LongMethod:
66
- max_statements: 4
67
60
  exclude:
68
- - Ashikawa::Core::ResponsePreprocessor#handle_status
69
- - Ashikawa::Core::Database#create_collection
70
- - Ashikawa::Core::Cursor#parse_raw_cursor
71
- - Ashikawa::Core::Document#parse_raw_document
72
- - Ashikawa::Core::Index#parse_raw_index
73
- - Ashikawa::Core::Collection#parse_raw_collection
74
- - Ashikawa::Core::Connection#authenticate_with
75
- enabled: true
76
- Duplication:
77
- allow_calls: []
61
+ - Ashikawa::Core::Collection
62
+ max_methods: 15
63
+ TooManyStatements:
64
+ enabled: true
78
65
  exclude: []
66
+ max_statements: 5
67
+ UncommunicativeMethodName:
79
68
  enabled: true
80
- max_calls: 1
81
- UncommunicativeVariableName:
69
+ exclude: []
70
+ reject:
71
+ - !ruby/regexp /^[a-z]$/
72
+ - !ruby/regexp /[0-9]$/
73
+ - !ruby/regexp /[A-Z]/
82
74
  accept: []
75
+ UncommunicativeModuleName:
76
+ enabled: true
83
77
  exclude: []
78
+ reject:
79
+ - !ruby/regexp /^.$/
80
+ - !ruby/regexp /[0-9]$/
81
+ accept: []
82
+ UncommunicativeParameterName:
84
83
  enabled: true
84
+ exclude: []
85
85
  reject:
86
86
  - !ruby/regexp /^.$/
87
87
  - !ruby/regexp /[0-9]$/
88
88
  - !ruby/regexp /[A-Z]/
89
- SimulatedPolymorphism:
90
- exclude:
91
- - Ashikawa::Core::Query
92
- enabled: true
93
- max_ifs: 1
94
- DataClump:
95
- exclude:
96
- - Ashikawa::Core::Query
89
+ accept: []
90
+ UncommunicativeVariableName:
97
91
  enabled: true
98
- max_copies: 2
99
- min_clump_size: 2
100
- ControlCouple:
101
92
  exclude: []
93
+ reject:
94
+ - !ruby/regexp /^.$/
95
+ - !ruby/regexp /[0-9]$/
96
+ - !ruby/regexp /[A-Z]/
97
+ accept: []
98
+ UnusedParameters:
102
99
  enabled: true
103
- LongYieldList:
104
- max_params: 1
105
100
  exclude: []
106
- enabled: true
107
101
  UtilityFunction:
108
- max_helper_calls: 0
109
- exclude: []
110
102
  enabled: false
111
- NilCheck:
112
- enabled: true
113
- exclude:
114
- - Ashikawa::Core::Database#setup_new_connection
115
- - Ashikawa::Core::Document#check_if_persisted!
116
- - Ashikawa::Core::Query#prepare_request_data
117
- - Ashikawa::Core::Query#wrapped_request
118
- Attribute:
119
103
  exclude: []
120
- enabled: false
104
+ max_helper_calls: 0
@@ -0,0 +1,99 @@
1
+ AllCops:
2
+ Includes:
3
+ - '../**/*.rake'
4
+ Excludes:
5
+ - '../vendor/**'
6
+
7
+ # Avoid parameter lists longer than five parameters.
8
+ ParameterLists:
9
+ Max: 3
10
+ CountKeywordArgs: true
11
+
12
+ # Avoid more than `Max` levels of nesting.
13
+ BlockNesting:
14
+ Max: 3
15
+
16
+ # Align with the style guide.
17
+ CollectionMethods:
18
+ PreferredMethods:
19
+ collect: 'map'
20
+ inject: 'reduce'
21
+ find: 'detect'
22
+ find_all: 'select'
23
+
24
+ # Do not force public/protected/private keyword to be indented at the same
25
+ # level as the def keyword. My personal preference is to outdent these keywords
26
+ # because I think when scanning code it makes it easier to identify the
27
+ # sections of code and visually separate them. When the keyword is at the same
28
+ # level I think it sort of blends in with the def keywords and makes it harder
29
+ # to scan the code and see where the sections are.
30
+ AccessControl:
31
+ Enabled: false
32
+
33
+ HashSyntax:
34
+ Enabled: false
35
+
36
+ StringLiterals:
37
+ Enabled: false
38
+
39
+ Void:
40
+ Enabled: false
41
+
42
+ LineLength:
43
+ Enabled: false
44
+
45
+ SpaceAroundBraces:
46
+ Enabled: false
47
+
48
+ SpaceInsideHashLiteralBraces:
49
+ Enabled: false
50
+
51
+ AlignParameters:
52
+ Enabled: false
53
+
54
+ Blocks:
55
+ Enabled: false
56
+
57
+ SymbolName:
58
+ Enabled: false
59
+
60
+ NumericLiterals:
61
+ Enabled: false
62
+
63
+ SpaceInsideBrackets:
64
+ Enabled: false
65
+
66
+ WordArray:
67
+ Enabled: false
68
+
69
+ Lambda:
70
+ Enabled: false
71
+
72
+ RegexpLiteral:
73
+ Enabled: false
74
+
75
+ ConstantName:
76
+ Enabled: false
77
+
78
+ AvoidPerlisms:
79
+ Enabled: false
80
+
81
+ AvoidPerlBackrefs:
82
+ Enabled: false
83
+
84
+ TrivialAccessors:
85
+ Enabled: false
86
+
87
+ Alias:
88
+ Enabled: false
89
+
90
+ Loop:
91
+ Enabled: false
92
+
93
+ # Do not agree at all
94
+ AndOr:
95
+ Enabled: false
96
+
97
+ # This is done by YARD Stick
98
+ Documentation:
99
+ Enabled: false