couchbase-orm 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fa31c17c17c2f5aa58e37caeb1de415a5f6bdbd
4
- data.tar.gz: 947864f906f017a58da63e18300d094983b23cea
3
+ metadata.gz: f2b06085f930736b6220efb0e13013cc287a7891
4
+ data.tar.gz: b078737e87c3d752b317471fdf36b750b3a0d37d
5
5
  SHA512:
6
- metadata.gz: a3b28f4857e50ae2dc5501e165f2fbb231d1188d2b718c0148dd15d2aa8183b8592bc221a790ccf91bfb783275733fd050f7f570f3adc6e9f56aa388df59ec9e
7
- data.tar.gz: bee79ce83b2748f54adda680bd46d956577054b6c8407285e2d7fddb206d4eaf4082a4b1c9d6288aea269b2a006ee9e9fd75f46d02e7436c94f29be3fcd70e83
6
+ metadata.gz: e9e09cdc7885a995e5abff1dcd8282f1fda44060bda39d9690a1fc3a7ca909bc074816fecfde8e31cbbfd58ee582ef56de44f13b4d94991dc89fb9aa21a82d3e
7
+ data.tar.gz: d4bbe1ca233678304c2e1f811140f970ee796031483d5bdcfe50d228994d5158d6053223b25278ea0bc270acb0f39d4aced787dc6f3b4280230ed24a2bfefce6
@@ -1,34 +1,35 @@
1
1
  language: ruby
2
2
  rvm:
3
- - ruby-2.3.1
4
- - ruby-2.2.5
3
+ - ruby-2.4.2
4
+ - ruby-2.3.5
5
5
  - ruby-head
6
- - rubinius-3.62
7
- - rubinius
8
- - jruby-9.1.5.0
6
+ - jruby-9.1.13.0
9
7
  - jruby-head
8
+ - rubinius
9
+ - rubinius-3.86
10
10
  branches:
11
11
  only:
12
12
  - master
13
13
  before_install:
14
14
  - git submodule update --init --recursive
15
15
  - gem install ffi
16
- - sudo apt-get install libev-dev
17
- - sudo wget http://packages.couchbase.com/releases/4.5.1/couchbase-server-enterprise_4.5.1-ubuntu14.04_amd64.deb
18
- - sudo dpkg -i couchbase-server-enterprise_4.5.1-ubuntu14.04_amd64.deb
19
- - sleep 4
16
+ - sudo apt-get install libev-dev python-httplib2
17
+ - sudo wget https://packages.couchbase.com/releases/5.0.0/couchbase-server-enterprise_5.0.0-ubuntu14.04_amd64.deb
18
+ - sudo dpkg -i couchbase-server-enterprise_5.0.0-ubuntu14.04_amd64.deb
19
+ - sleep 8
20
20
  - sudo service couchbase-server status
21
21
  - /opt/couchbase/bin/couchbase-cli cluster-init -c 127.0.0.1:8091 --cluster-username=admin --cluster-password=password --cluster-ramsize=320 --cluster-index-ramsize=256 --cluster-fts-ramsize=256 --services=data,index,query,fts
22
- - sleep 4
22
+ - sleep 5
23
23
  - /opt/couchbase/bin/couchbase-cli server-info -c 127.0.0.1:8091 -u admin -p password
24
24
  - /opt/couchbase/bin/couchbase-cli bucket-create -c 127.0.0.1:8091 -u admin -p password --bucket=default --bucket-type=couchbase --bucket-ramsize=160 --bucket-replica=0 --wait
25
- before_script:
26
- - rake compile
25
+ - sleep 1
26
+ - /opt/couchbase/bin/couchbase-cli user-manage -c 127.0.0.1:8091 -u admin -p password --set --rbac-username tester --rbac-password password123 --rbac-name "Auto Tester" --roles admin --auth-domain local
27
+ - export TRAVIS_TEST=true
27
28
  matrix:
28
29
  allow_failures:
29
30
  - rvm: jruby-head
30
31
  - rvm: ruby-head
31
32
  - rvm: rubinius
32
- - rvm: rubinius-3.62
33
+ - rvm: rubinius-3.86
33
34
  sudo: required
34
35
  dist: trusty
data/README.md CHANGED
@@ -1,32 +1,41 @@
1
1
  # Couchbase ORM for Rails
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/acaprojects/couchbase-orm.svg)](http://travis-ci.org/acaprojects/couchbase-orm)
4
+
3
5
  ## Rails integration
4
6
 
5
7
  To generate config you can use `rails generate couchbase_orm:config`:
6
8
 
7
- $ rails generate couchbase_orm:config
8
- create config/couchbase.yml
9
+ $ rails generate couchbase_orm:config dev_bucket dev_user dev_password
10
+ => create config/couchbase.yml
9
11
 
10
12
  It will generate this `config/couchbase.yml` for you:
11
13
 
12
14
  common: &common
13
15
  hosts: localhost
14
- password:
16
+ username: dev_user
17
+ password: dev_password
15
18
 
16
19
  development:
17
20
  <<: *common
18
- bucket: default
21
+ bucket: dev_bucket
19
22
 
20
23
  test:
21
24
  <<: *common
22
- bucket: app_name_test
23
- password: for_test_bucket
25
+ bucket: dev_bucket_test
24
26
 
25
27
  # set these environment variables on your production server
26
28
  production:
27
- hosts: <%= ENV['COUCHBASE_HOST'] || ENV['COUCHBASE_HOSTS'] %>
28
- bucket: <%= ENV['COUCHBASE_BUCKET'] %>
29
- password: <%= ENV['COUCHBASE_PASSWORD'] %>
29
+ hosts: <%= ENV['COUCHBASE_HOST'] || ENV['COUCHBASE_HOSTS'] %>
30
+ bucket: <%= ENV['COUCHBASE_BUCKET'] %>
31
+ username: <%= ENV['COUCHBASE_USER'] %>
32
+ password: <%= ENV['COUCHBASE_PASSWORD'] %>
33
+
34
+ Views are generated on application load if they don't exist or mismatch.
35
+ This works fine in production however by default in development models are lazy loaded.
36
+
37
+ # config/environments/development.rb
38
+ config.eager_load = true
30
39
 
31
40
 
32
41
  ## Examples
@@ -167,7 +176,7 @@ The request above pulls the same database document each time and returns it. A s
167
176
  | Stat | Couchbase Ruby Model | Couchbase-ORM |
168
177
  | :--- | :--- | :--- |
169
178
  |Transactions|2500 hits|2500 hits|
170
- |Elapsed time|12.24 secs|8.20 secs|
171
- |Response time|0.88 secs|0.47 secs|
172
- |Transaction rate|204.25 trans/sec|304.88 trans/sec|
179
+ |Elapsed time|12.24 secs|6.82 secs|
180
+ |Response time|0.88 secs|0.34 secs|
181
+ |Transaction rate|204.25 trans/sec|366.57 trans/sec|
173
182
  |Request Code|[ruby-model-app](https://github.com/QuayPay/coauth/blob/95bbf5e5c3b3340e5af2da494b90c91c5e3d6eaa/app/controllers/auth/authorities_controller.rb#L6)|[couch-orm-app](https://github.com/QuayPay/coauth/blob/87f6fdeaab784ba252a5d38bbcf9e6b0477bb504/app/controllers/auth/authorities_controller.rb#L8)|
data/Rakefile CHANGED
@@ -1,75 +1,15 @@
1
1
  require 'rubygems'
2
2
  require 'rspec/core/rake_task' # testing framework
3
3
  require 'yard' # yard documentation
4
- require 'ffi' # loads the extension
5
- require 'rake/clean' # for the :clobber rake task
6
- require File.expand_path('../lib/libcouchbase/ext/tasks', __FILE__) # platform specific rake tasks used by compile
7
-
8
-
9
4
 
10
5
  # By default we don't run network tests
11
- task :default => :limited_spec
12
- RSpec::Core::RakeTask.new(:limited_spec) do |t|
13
- # Exclude full text search tests until we can automate index creation
14
- t.rspec_opts = "--tag ~full_text_search --tag ~n1ql_query"
15
- end
16
- RSpec::Core::RakeTask.new(:spec)
6
+ task :default => :test
17
7
 
8
+ RSpec::Core::RakeTask.new(:spec)
18
9
 
19
10
  desc 'Run all tests'
20
11
  task :test => [:spec]
21
12
 
22
-
23
13
  YARD::Rake::YardocTask.new do |t|
24
- t.files = ['lib/**/*.rb', '-', 'ext/README.md', 'README.md']
25
- end
26
-
27
-
28
- desc 'Compile libcouchbase from submodule'
29
- if FFI::Platform.windows?
30
- task :compile => ["ext/bin/libcouchbase.#{FFI::Platform::LIBSUFFIX}"]
31
- CLOBBER.include("ext/bin/libcouchbase.#{FFI::Platform::LIBSUFFIX}")
32
- else
33
- task :compile => ["ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}"]
34
- CLOBBER.include("ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}")
35
- end
36
-
37
-
38
- # NOTE:: Generated on OSX
39
- desc 'Generate the FFI bindings'
40
- task :generate_bindings do
41
- require "ffi/gen"
42
-
43
- # NOTE:: you must export the include dir:
44
- # export CPATH=./ext/libcouchbase/include/
45
- #
46
- # Once generated we need to:
47
- # * adjust the ffi_lib path:
48
- # ffi_lib ::File.expand_path("../../../../ext/libcouchbase/build/lib/libcouchbase_libuv.#{FFI::Platform::LIBSUFFIX}", __FILE__)
49
- # * Rename some structs strings to pointers
50
- # create_st3.rb -> connstr, username, passwd
51
- # cmdhttp.rb -> body, reqhandle, content_type, username, password, host
52
- # cmdfts.rb -> query
53
- # respfts.rb -> row
54
- # respviewquery.rb -> value, geometry, docid
55
- # respn1ql.rb -> row
56
-
57
- FFI::Gen.generate(
58
- module_name: "Libcouchbase::Ext",
59
- ffi_lib: "libcouchbase",
60
- require_path: "libcouchbase/ext/libcouchbase",
61
- headers: [
62
- "./ext/libcouchbase/include/libcouchbase/couchbase.h",
63
- "./ext/libcouchbase/include/libcouchbase/error.h",
64
- "./ext/libcouchbase/include/libcouchbase/views.h",
65
- "./ext/libcouchbase/include/libcouchbase/subdoc.h",
66
- "./ext/libcouchbase/include/libcouchbase/n1ql.h",
67
- "./ext/libcouchbase/include/libcouchbase/cbft.h",
68
- "./ext/libcouchbase/include/libcouchbase/kvbuf.h"
69
- ],
70
- # Searching for stdarg.h
71
- cflags: ["-I/System/Library/Frameworks/Kernel.framework/Versions/A/Headers"],
72
- prefixes: ["LCB_", "lcb_"],
73
- output: "libcouchbase.rb"
74
- )
14
+ t.files = ['lib/**/*.rb', '-', 'README.md']
75
15
  end
@@ -13,14 +13,14 @@ Gem::Specification.new do |gem|
13
13
  gem.required_ruby_version = '>= 2.1.0'
14
14
  gem.require_paths = ["lib"]
15
15
 
16
- gem.add_runtime_dependency 'libcouchbase', '~> 1.0'
16
+ gem.add_runtime_dependency 'libcouchbase', '~> 1.2'
17
17
  gem.add_runtime_dependency 'activemodel', '>= 4.0', '< 6.0'
18
18
  gem.add_runtime_dependency 'radix', '~> 2.2' # converting numbers to and from any base
19
19
 
20
- gem.add_development_dependency 'rake', '~> 11.2'
21
- gem.add_development_dependency 'rspec', '~> 3.5'
20
+ gem.add_development_dependency 'rake', '~> 12.2'
21
+ gem.add_development_dependency 'rspec', '~> 3.7'
22
22
  gem.add_development_dependency 'yard', '~> 0.9'
23
- gem.add_development_dependency 'minitest', '~> 5.9'
23
+ gem.add_development_dependency 'minitest', '~> 5.10'
24
24
 
25
25
  gem.files = `git ls-files`.split("\n")
26
26
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true, encoding: ASCII-8BIT
2
2
 
3
3
  module CouchbaseOrm
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
@@ -1,21 +1,4 @@
1
1
  # encoding: utf-8
2
- #
3
- # Author:: Couchbase <info@couchbase.com>
4
- # Copyright:: 2012 Couchbase, Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
2
 
20
3
  require 'rails/generators/couchbase_orm_generator'
21
4
 
@@ -23,7 +6,9 @@ module CouchbaseOrm
23
6
  module Generators
24
7
  class ConfigGenerator < Rails::Generators::Base
25
8
  desc 'Creates a Couchbase configuration file at config/couchbase.yml'
26
- argument :database_name, :type => :string, :optional => true
9
+ argument :bucket_name, type: :string, optional: true
10
+ argument :username, type: :string, optional: true
11
+ argument :password, type: :string, optional: true
27
12
 
28
13
  def self.source_root
29
14
  @_couchbase_source_root ||= File.expand_path('../templates', __FILE__)
@@ -1,18 +1,19 @@
1
1
  common: &common
2
2
  hosts: localhost
3
- password:
3
+ username: <%= username || bucket_name || app_name %>
4
+ password: <%= password %>
4
5
 
5
6
  development:
6
7
  <<: *common
7
- bucket: <%= database_name || 'default' %>
8
+ bucket: <%= bucket_name || app_name %>
8
9
 
9
10
  test:
10
11
  <<: *common
11
- bucket: <%= database_name || app_name %>_test
12
- password: for_test_bucket
12
+ bucket: <%= bucket_name || app_name %>_test
13
13
 
14
14
  # set these environment variables on your production server
15
15
  production:
16
16
  hosts: <%%= ENV['COUCHBASE_HOST'] || ENV['COUCHBASE_HOSTS'] %>
17
17
  bucket: <%%= ENV['COUCHBASE_BUCKET'] %>
18
+ username: <%%= ENV['COUCHBASE_USER'] %>
18
19
  password: <%%= ENV['COUCHBASE_PASSWORD'] %>
@@ -1,6 +1,12 @@
1
1
  # frozen_string_literal: true, encoding: ASCII-8BIT
2
2
 
3
3
 
4
+ if ENV['TRAVIS_TEST']
5
+ require 'libcouchbase'
6
+ Libcouchbase::Defaults.username = 'tester'
7
+ Libcouchbase::Defaults.password = 'password123'
8
+ end
9
+
4
10
  require 'couchbase-orm'
5
11
  require 'minitest/assertions'
6
12
  require 'active_model/lint'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: couchbase-orm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen von Takach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-18 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libcouchbase
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '1.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '1.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -64,28 +64,28 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '11.2'
67
+ version: '12.2'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '11.2'
74
+ version: '12.2'
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: rspec
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '3.5'
81
+ version: '3.7'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '3.5'
88
+ version: '3.7'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: yard
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -106,14 +106,14 @@ dependencies:
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: '5.9'
109
+ version: '5.10'
110
110
  type: :development
111
111
  prerelease: false
112
112
  version_requirements: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
- version: '5.9'
116
+ version: '5.10'
117
117
  description: A Couchbase ORM for Rails
118
118
  email:
119
119
  - steve@cotag.me
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  version: '0'
176
176
  requirements: []
177
177
  rubyforge_project:
178
- rubygems_version: 2.6.12
178
+ rubygems_version: 2.6.14
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: Couchbase ORM for Rails