couchbase 3.0.0.beta.1-universal-darwin-19 → 3.0.0-universal-darwin-19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +227 -0
  3. data/.rubocop_todo.yml +47 -0
  4. data/CONTRIBUTING.md +110 -0
  5. data/Gemfile +4 -0
  6. data/README.md +3 -3
  7. data/Rakefile +1 -1
  8. data/couchbase.gemspec +40 -39
  9. data/examples/analytics.rb +123 -108
  10. data/examples/auth.rb +33 -0
  11. data/examples/crud.rb +16 -2
  12. data/examples/managing_analytics_indexes.rb +18 -4
  13. data/examples/managing_buckets.rb +17 -3
  14. data/examples/managing_collections.rb +22 -9
  15. data/examples/managing_query_indexes.rb +38 -18
  16. data/examples/managing_search_indexes.rb +21 -6
  17. data/examples/managing_view_indexes.rb +18 -4
  18. data/examples/query.rb +17 -3
  19. data/examples/query_with_consistency.rb +30 -20
  20. data/examples/search.rb +116 -101
  21. data/examples/search_with_consistency.rb +43 -30
  22. data/examples/subdocument.rb +42 -30
  23. data/examples/view.rb +19 -10
  24. data/ext/CMakeLists.txt +40 -2
  25. data/ext/build_version.hxx.in +1 -1
  26. data/ext/couchbase/bucket.hxx +190 -38
  27. data/ext/couchbase/cluster.hxx +22 -4
  28. data/ext/couchbase/configuration.hxx +14 -14
  29. data/ext/couchbase/couchbase.cxx +108 -12
  30. data/ext/couchbase/error_map.hxx +202 -2
  31. data/ext/couchbase/errors.hxx +8 -2
  32. data/ext/couchbase/io/dns_client.hxx +6 -6
  33. data/ext/couchbase/io/http_command.hxx +2 -2
  34. data/ext/couchbase/io/http_session.hxx +7 -11
  35. data/ext/couchbase/io/http_session_manager.hxx +3 -3
  36. data/ext/couchbase/io/mcbp_command.hxx +101 -44
  37. data/ext/couchbase/io/mcbp_session.hxx +144 -49
  38. data/ext/couchbase/io/retry_action.hxx +30 -0
  39. data/ext/couchbase/io/retry_context.hxx +39 -0
  40. data/ext/couchbase/io/retry_orchestrator.hxx +96 -0
  41. data/ext/couchbase/io/retry_reason.hxx +235 -0
  42. data/ext/couchbase/io/retry_strategy.hxx +156 -0
  43. data/ext/couchbase/operations/document_decrement.hxx +2 -0
  44. data/ext/couchbase/operations/document_exists.hxx +2 -0
  45. data/ext/couchbase/operations/document_get.hxx +2 -0
  46. data/ext/couchbase/operations/document_get_and_lock.hxx +2 -0
  47. data/ext/couchbase/operations/document_get_and_touch.hxx +2 -0
  48. data/ext/couchbase/operations/document_get_projected.hxx +2 -0
  49. data/ext/couchbase/operations/document_increment.hxx +2 -0
  50. data/ext/couchbase/operations/document_insert.hxx +2 -0
  51. data/ext/couchbase/operations/document_lookup_in.hxx +2 -0
  52. data/ext/couchbase/operations/document_mutate_in.hxx +3 -0
  53. data/ext/couchbase/operations/document_query.hxx +10 -0
  54. data/ext/couchbase/operations/document_remove.hxx +2 -0
  55. data/ext/couchbase/operations/document_replace.hxx +2 -0
  56. data/ext/couchbase/operations/document_search.hxx +8 -3
  57. data/ext/couchbase/operations/document_touch.hxx +2 -0
  58. data/ext/couchbase/operations/document_unlock.hxx +2 -0
  59. data/ext/couchbase/operations/document_upsert.hxx +2 -0
  60. data/ext/couchbase/operations/query_index_create.hxx +14 -4
  61. data/ext/couchbase/operations/query_index_drop.hxx +12 -2
  62. data/ext/couchbase/operations/query_index_get_all.hxx +11 -2
  63. data/ext/couchbase/origin.hxx +47 -17
  64. data/ext/couchbase/platform/backtrace.c +189 -0
  65. data/ext/couchbase/platform/backtrace.h +54 -0
  66. data/ext/couchbase/platform/terminate_handler.cc +122 -0
  67. data/ext/couchbase/platform/terminate_handler.h +36 -0
  68. data/ext/couchbase/protocol/cmd_get_cluster_config.hxx +6 -1
  69. data/ext/couchbase/protocol/status.hxx +14 -4
  70. data/ext/couchbase/version.hxx +2 -2
  71. data/ext/extconf.rb +39 -36
  72. data/ext/test/main.cxx +64 -16
  73. data/lib/couchbase.rb +0 -1
  74. data/lib/couchbase/analytics_options.rb +2 -4
  75. data/lib/couchbase/authenticator.rb +14 -0
  76. data/lib/couchbase/binary_collection.rb +9 -9
  77. data/lib/couchbase/binary_collection_options.rb +8 -6
  78. data/lib/couchbase/bucket.rb +18 -18
  79. data/lib/couchbase/cluster.rb +121 -90
  80. data/lib/couchbase/collection.rb +36 -38
  81. data/lib/couchbase/collection_options.rb +31 -17
  82. data/lib/couchbase/common_options.rb +1 -1
  83. data/lib/couchbase/datastructures/couchbase_list.rb +16 -16
  84. data/lib/couchbase/datastructures/couchbase_map.rb +18 -18
  85. data/lib/couchbase/datastructures/couchbase_queue.rb +13 -13
  86. data/lib/couchbase/datastructures/couchbase_set.rb +8 -7
  87. data/lib/couchbase/errors.rb +10 -3
  88. data/lib/couchbase/json_transcoder.rb +2 -2
  89. data/lib/couchbase/libcouchbase.bundle +0 -0
  90. data/lib/couchbase/management/analytics_index_manager.rb +37 -37
  91. data/lib/couchbase/management/bucket_manager.rb +25 -25
  92. data/lib/couchbase/management/collection_manager.rb +3 -3
  93. data/lib/couchbase/management/query_index_manager.rb +59 -14
  94. data/lib/couchbase/management/search_index_manager.rb +15 -12
  95. data/lib/couchbase/management/user_manager.rb +1 -1
  96. data/lib/couchbase/management/view_index_manager.rb +11 -5
  97. data/lib/couchbase/mutation_state.rb +12 -0
  98. data/lib/couchbase/query_options.rb +23 -9
  99. data/lib/couchbase/scope.rb +61 -1
  100. data/lib/couchbase/search_options.rb +40 -27
  101. data/lib/couchbase/subdoc.rb +31 -28
  102. data/lib/couchbase/version.rb +2 -2
  103. data/lib/couchbase/view_options.rb +0 -1
  104. metadata +20 -7
@@ -1,12 +1,25 @@
1
- require 'couchbase'
2
-
3
- include Couchbase
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+
17
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
4
18
 
5
19
  options = Cluster::ClusterOptions.new
6
20
  options.authenticate("Administrator", "password")
7
21
  cluster = Cluster.connect("couchbase://localhost", options)
8
22
 
9
-
10
23
  bucket_name = "tiny_social"
11
24
  dataverse_name = "TinySocial"
12
25
 
@@ -31,116 +44,116 @@ collection = cluster.bucket(bucket_name).default_collection
31
44
 
32
45
  # Documents for GleambookUsers dataset
33
46
  [
34
- {
35
- "id" => 1,
36
- "alias" => "Margarita",
37
- "name" => "MargaritaStoddard",
38
- "nickname" => "Mags",
39
- "userSince" => "2012-08-20T10:10:00",
40
- "friendIds" => [2, 3, 6, 10],
41
- "employment" => [
42
- {
43
- "organizationName" => "Codetechno",
44
- "start-date" => "2006-08-06"
45
- },
46
- {
47
- "organizationName" => "geomedia",
48
- "start-date" => "2010-06-17",
49
- "end-date" => "2010-01-26"
50
- }
51
- ],
52
- "gender" => "F"
53
- },
54
- {
55
- "id" => 2,
56
- "alias" => "Isbel",
57
- "name" => "IsbelDull",
58
- "nickname" => "Izzy",
59
- "userSince" => "2011-01-22T10:10:00",
60
- "friendIds" => [1, 4],
61
- "employment" => [
62
- {
63
- "organizationName" => "Hexviafind",
64
- "startDate" => "2010-04-27"
65
- }
66
- ]
67
- },
68
- {
69
- "id" => 3,
70
- "alias" => "Emory",
71
- "name" => "EmoryUnk",
72
- "userSince" => "2012-07-10T10:10:00",
73
- "friendIds" => [1, 5, 8, 9],
74
- "employment" => [
75
- {
76
- "organizationName" => "geomedia",
77
- "startDate" => "2010-06-17",
78
- "endDate" => "2010-01-26"
79
- }
80
- ]
81
- }
47
+ {
48
+ "id" => 1,
49
+ "alias" => "Margarita",
50
+ "name" => "MargaritaStoddard",
51
+ "nickname" => "Mags",
52
+ "userSince" => "2012-08-20T10:10:00",
53
+ "friendIds" => [2, 3, 6, 10],
54
+ "employment" => [
55
+ {
56
+ "organizationName" => "Codetechno",
57
+ "start-date" => "2006-08-06",
58
+ },
59
+ {
60
+ "organizationName" => "geomedia",
61
+ "start-date" => "2010-06-17",
62
+ "end-date" => "2010-01-26",
63
+ },
64
+ ],
65
+ "gender" => "F",
66
+ },
67
+ {
68
+ "id" => 2,
69
+ "alias" => "Isbel",
70
+ "name" => "IsbelDull",
71
+ "nickname" => "Izzy",
72
+ "userSince" => "2011-01-22T10:10:00",
73
+ "friendIds" => [1, 4],
74
+ "employment" => [
75
+ {
76
+ "organizationName" => "Hexviafind",
77
+ "startDate" => "2010-04-27",
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ "id" => 3,
83
+ "alias" => "Emory",
84
+ "name" => "EmoryUnk",
85
+ "userSince" => "2012-07-10T10:10:00",
86
+ "friendIds" => [1, 5, 8, 9],
87
+ "employment" => [
88
+ {
89
+ "organizationName" => "geomedia",
90
+ "startDate" => "2010-06-17",
91
+ "endDate" => "2010-01-26",
92
+ },
93
+ ],
94
+ },
82
95
  ].each do |document|
83
- collection.upsert("user:#{document["id"]}",
96
+ collection.upsert("user:#{document['id']}",
84
97
  document.merge({"type" => "user"}))
85
98
  end
86
99
 
87
100
  # Documents for GleambookMessages dataset
88
101
  [
89
- {
90
- "messageId" => 2,
91
- "authorId" => 1,
92
- "inResponseTo" => 4,
93
- "senderLocation" => [41.66, 80.87],
94
- "message" => " dislike x-phone its touch-screen is horrible"
95
- },
96
- {
97
- "messageId" => 3,
98
- "authorId" => 2,
99
- "inResponseTo" => 4,
100
- "senderLocation" => [48.09, 81.01],
101
- "message" => " like product-y the plan is amazing"
102
- },
103
- {
104
- "messageId" => 4,
105
- "authorId" => 1,
106
- "inResponseTo" => 2,
107
- "senderLocation" => [37.73, 97.04],
108
- "message" => " can't stand acast the network is horrible:("
109
- },
110
- {
111
- "messageId" => 6,
112
- "authorId" => 2,
113
- "inResponseTo" => 1,
114
- "senderLocation" => [31.5, 75.56],
115
- "message" => " like product-z its platform is mind-blowing"
116
- },
117
- {
118
- "messageId" => 8,
119
- "authorId" => 1,
120
- "inResponseTo" => 11,
121
- "senderLocation" => [40.33, 80.87],
122
- "message" => " like ccast the 3G is awesome:)"
123
- },
124
- {
125
- "messageId" => 10,
126
- "authorId" => 1,
127
- "inResponseTo" => 12,
128
- "senderLocation" => [42.5, 70.01],
129
- "message" => " can't stand product-w the touch-screen is terrible"
130
- },
131
- {
132
- "messageId" => 11,
133
- "authorId" => 1,
134
- "inResponseTo" => 1,
135
- "senderLocation" => [38.97, 77.49],
136
- "message" => " can't stand acast its plan is terrible"
137
- }
102
+ {
103
+ "messageId" => 2,
104
+ "authorId" => 1,
105
+ "inResponseTo" => 4,
106
+ "senderLocation" => [41.66, 80.87],
107
+ "message" => " dislike x-phone its touch-screen is horrible",
108
+ },
109
+ {
110
+ "messageId" => 3,
111
+ "authorId" => 2,
112
+ "inResponseTo" => 4,
113
+ "senderLocation" => [48.09, 81.01],
114
+ "message" => " like product-y the plan is amazing",
115
+ },
116
+ {
117
+ "messageId" => 4,
118
+ "authorId" => 1,
119
+ "inResponseTo" => 2,
120
+ "senderLocation" => [37.73, 97.04],
121
+ "message" => " can't stand acast the network is horrible:(",
122
+ },
123
+ {
124
+ "messageId" => 6,
125
+ "authorId" => 2,
126
+ "inResponseTo" => 1,
127
+ "senderLocation" => [31.5, 75.56],
128
+ "message" => " like product-z its platform is mind-blowing",
129
+ },
130
+ {
131
+ "messageId" => 8,
132
+ "authorId" => 1,
133
+ "inResponseTo" => 11,
134
+ "senderLocation" => [40.33, 80.87],
135
+ "message" => " like ccast the 3G is awesome:)",
136
+ },
137
+ {
138
+ "messageId" => 10,
139
+ "authorId" => 1,
140
+ "inResponseTo" => 12,
141
+ "senderLocation" => [42.5, 70.01],
142
+ "message" => " can't stand product-w the touch-screen is terrible",
143
+ },
144
+ {
145
+ "messageId" => 11,
146
+ "authorId" => 1,
147
+ "inResponseTo" => 1,
148
+ "senderLocation" => [38.97, 77.49],
149
+ "message" => " can't stand acast its plan is terrible",
150
+ },
138
151
  ].each do |document|
139
- collection.upsert("message:#{document["messageId"]}",
152
+ collection.upsert("message:#{document['messageId']}",
140
153
  document.merge({"type" => "message"}))
141
154
  end
142
155
 
143
- if cluster.analytics_indexes.get_all_datasets.any? {|ds| ds.dataverse_name == dataverse_name}
156
+ if cluster.analytics_indexes.get_all_datasets.any? { |ds| ds.dataverse_name == dataverse_name }
144
157
  # there are datasets on our dataverse, drop everything and re-create
145
158
  options = Management::AnalyticsIndexManager::DisconnectLinkOptions.new
146
159
  options.dataverse_name = dataverse_name
@@ -166,9 +179,11 @@ cluster.analytics_indexes.connect_link(options)
166
179
  sleep(1)
167
180
 
168
181
  puts "---- inner join"
169
- res = cluster.analytics_query("SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id")
182
+ res = cluster.analytics_query(
183
+ "SELECT * FROM #{dataverse_name}.GleambookUsers u, #{dataverse_name}.GleambookMessages m WHERE m.authorId = u.id"
184
+ )
170
185
  res.rows.each do |row|
171
- puts "#{row["u"]["name"]}: #{row["m"]["message"].inspect}"
186
+ puts "#{row['u']['name']}: #{row['m']['message'].inspect}"
172
187
  end
173
188
 
174
189
  # The query language supports SQL's notion of left outer join.
@@ -180,7 +195,7 @@ res = cluster.analytics_query("
180
195
  LEFT OUTER JOIN GleambookMessages m ON m.authorId = u.id
181
196
  ")
182
197
  res.rows.each do |row|
183
- puts "#{row["uname"]}: #{row["message"].inspect}"
198
+ puts "#{row['uname']}: #{row['message'].inspect}"
184
199
  end
185
200
 
186
201
  # Named parameters
@@ -215,7 +230,7 @@ FROM GleambookUsers AS user
215
230
  WHERE len(user.friendIds) > $1
216
231
  ", options)
217
232
  res.rows.each do |row|
218
- puts "#{row["name"]}: #{row["friendIds"].size}"
233
+ puts "#{row['name']}: #{row['friendIds'].size}"
219
234
  end
220
235
 
221
236
  # More query examples at https://docs.couchbase.com/server/current/analytics/3_query.html
@@ -0,0 +1,33 @@
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
17
+
18
+ options = Cluster::ClusterOptions.new
19
+ # initializes {PasswordAuthenticator} internally
20
+ options.authenticate("Administrator", "password")
21
+ Cluster.connect("couchbase://localhost", options)
22
+
23
+ # the same as above, but more explicit
24
+ options.authenticator = PasswordAuthenticator.new("Administrator", "password")
25
+ Cluster.connect("couchbase://localhost", options)
26
+
27
+ # shorter version, more useful for interactive sessions
28
+ Cluster.connect("couchbase://localhost", "Administrator", "password")
29
+
30
+ # authentication with TLS client certificate
31
+ # @see https://docs.couchbase.com/server/current/manage/manage-security/configure-client-certificates.html
32
+ options.authenticator = CertificateAuthenticator.new("/tmp/certificate.pem", "/tmp/private.key")
33
+ Cluster.connect("couchbases://localhost?trust_certificate=/tmp/ca.pem", options)
@@ -1,5 +1,19 @@
1
- require 'couchbase'
2
- include Couchbase
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
3
17
 
4
18
  options = Cluster::ClusterOptions.new
5
19
  options.authenticate("Administrator", "password")
@@ -1,10 +1,24 @@
1
- require 'couchbase'
2
- include Couchbase
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
3
17
 
4
18
  def measure(msg)
5
19
  start = Time.now
6
20
  yield
7
- printf "%s in %.2f seconds\n", msg, Time.now - start
21
+ printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
8
22
  end
9
23
 
10
24
  options = Cluster::ClusterOptions.new
@@ -47,7 +61,7 @@ manager.create_index("breweries_loc_idx", "beers", {"geo.lon" => "double", "geo.
47
61
 
48
62
  puts "---- Indexes currently defined on the cluster:"
49
63
  manager.get_all_indexes.each_with_index do |index, i|
50
- puts "#{i}. #{index.dataverse_name}.#{index.dataset_name}.#{index.name} #{"(primary)" if index.primary?}"
64
+ puts "#{i}. #{index.dataverse_name}.#{index.dataset_name}.#{index.name} #{'(primary)' if index.primary?}"
51
65
  end
52
66
 
53
67
  # Drops one of the indexes
@@ -1,10 +1,24 @@
1
- require 'couchbase'
2
- include Couchbase
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
3
17
 
4
18
  def measure(msg)
5
19
  start = Time.now
6
20
  yield
7
- printf "%s in %.2f seconds\n", msg, Time.now - start
21
+ printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
8
22
  end
9
23
 
10
24
  options = Cluster::ClusterOptions.new
@@ -1,10 +1,24 @@
1
- require 'couchbase'
2
- include Couchbase
1
+ # Copyright 2020 Couchbase, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "couchbase"
16
+ include Couchbase # rubocop:disable Style/MixinUsage for brevity
3
17
 
4
18
  def measure(msg)
5
19
  start = Time.now
6
20
  yield
7
- printf "%s in %.2f seconds\n", msg, Time.now - start
21
+ printf "%<msg>s in %<elapsed>.2f seconds\n", msg: msg, elapsed: Time.now - start
8
22
  end
9
23
 
10
24
  bucket_name = "travel-sample"
@@ -15,7 +29,6 @@ options.authenticate("Administrator", "password")
15
29
  cluster = Cluster.connect("couchbase://localhost", options)
16
30
  bucket = cluster.bucket(bucket_name)
17
31
 
18
-
19
32
  scopes = bucket.collections.get_all_scopes
20
33
  puts "There are #{scopes.size} on the bucket \"#{bucket_name}\""
21
34
 
@@ -26,7 +39,7 @@ scopes.each do |scope|
26
39
  end
27
40
  end
28
41
 
29
- if scopes.any? {|scope| scope.name == scope_name }
42
+ if scopes.any? { |scope| scope.name == scope_name }
30
43
  measure("Scope \"#{scope_name}\" has been removed") { bucket.collections.drop_scope(scope_name) }
31
44
  end
32
45
  measure("Scope \"#{scope_name}\" has been created") { bucket.collections.create_scope(scope_name) }
@@ -43,8 +56,8 @@ end
43
56
 
44
57
  scope = bucket.collections.get_scope(scope_name)
45
58
  puts "Scope \"#{scope_name}\" has #{scope.collections.size} collections"
46
- scope.collections.each do |collection|
47
- puts " * \"#{collection.name}\""
59
+ scope.collections.each do |c|
60
+ puts " * \"#{c.name}\""
48
61
  end
49
62
 
50
63
  measure("Collection \"#{collection.name}\" on scope \"#{collection.scope_name}\" has been dropped") do
@@ -53,6 +66,6 @@ end
53
66
 
54
67
  scope = bucket.collections.get_scope(scope_name)
55
68
  puts "Scope \"#{scope_name}\" has #{scope.collections.size} collections"
56
- scope.collections.each do |collection|
57
- puts " * \"#{collection.name}\""
69
+ scope.collections.each do |c|
70
+ puts " * \"#{c.name}\""
58
71
  end