gcloud 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +13 -5
  2. data/AUTHENTICATION.md +71 -0
  3. data/CHANGELOG.md +5 -0
  4. data/README.md +10 -15
  5. data/lib/gcloud.rb +30 -0
  6. data/lib/gcloud/backoff.rb +3 -0
  7. data/lib/gcloud/credentials.rb +47 -30
  8. data/lib/gcloud/datastore.rb +246 -15
  9. data/lib/gcloud/datastore/connection.rb +4 -2
  10. data/lib/gcloud/datastore/credentials.rb +3 -1
  11. data/lib/gcloud/datastore/dataset.rb +130 -25
  12. data/lib/gcloud/datastore/dataset/lookup_results.rb +1 -0
  13. data/lib/gcloud/datastore/dataset/query_results.rb +7 -5
  14. data/lib/gcloud/datastore/entity.rb +99 -17
  15. data/lib/gcloud/datastore/errors.rb +13 -2
  16. data/lib/gcloud/datastore/key.rb +133 -2
  17. data/lib/gcloud/datastore/properties.rb +6 -1
  18. data/lib/gcloud/datastore/proto.rb +2 -1
  19. data/lib/gcloud/datastore/query.rb +4 -4
  20. data/lib/gcloud/datastore/transaction.rb +3 -0
  21. data/lib/gcloud/storage.rb +280 -13
  22. data/lib/gcloud/storage/bucket.rb +248 -11
  23. data/lib/gcloud/storage/bucket/acl.rb +631 -4
  24. data/lib/gcloud/storage/bucket/list.rb +1 -0
  25. data/lib/gcloud/storage/connection.rb +1 -0
  26. data/lib/gcloud/storage/credentials.rb +3 -1
  27. data/lib/gcloud/storage/errors.rb +9 -1
  28. data/lib/gcloud/storage/file.rb +231 -6
  29. data/lib/gcloud/storage/file/acl.rb +365 -2
  30. data/lib/gcloud/storage/file/list.rb +1 -0
  31. data/lib/gcloud/storage/file/verifier.rb +1 -0
  32. data/lib/gcloud/storage/project.rb +119 -10
  33. data/lib/gcloud/version.rb +18 -3
  34. metadata +33 -80
  35. data/.gemtest +0 -0
  36. data/.rubocop.yml +0 -17
  37. data/Manifest.txt +0 -66
  38. data/Rakefile +0 -35
  39. data/gcloud.gemspec +0 -63
  40. data/rakelib/console.rake +0 -28
  41. data/rakelib/manifest.rake +0 -24
  42. data/rakelib/proto.rake +0 -17
  43. data/rakelib/rubocop.rake +0 -17
  44. data/rakelib/test.rake +0 -144
  45. data/test/gcloud/datastore/proto/test_cursor.rb +0 -36
  46. data/test/gcloud/datastore/proto/test_direction.rb +0 -60
  47. data/test/gcloud/datastore/proto/test_operator.rb +0 -76
  48. data/test/gcloud/datastore/proto/test_value.rb +0 -231
  49. data/test/gcloud/datastore/test_connection.rb +0 -93
  50. data/test/gcloud/datastore/test_credentials.rb +0 -38
  51. data/test/gcloud/datastore/test_dataset.rb +0 -413
  52. data/test/gcloud/datastore/test_entity.rb +0 -161
  53. data/test/gcloud/datastore/test_entity_exclude.rb +0 -225
  54. data/test/gcloud/datastore/test_key.rb +0 -189
  55. data/test/gcloud/datastore/test_query.rb +0 -271
  56. data/test/gcloud/datastore/test_transaction.rb +0 -121
  57. data/test/gcloud/storage/test_backoff.rb +0 -127
  58. data/test/gcloud/storage/test_bucket.rb +0 -270
  59. data/test/gcloud/storage/test_bucket_acl.rb +0 -253
  60. data/test/gcloud/storage/test_default_acl.rb +0 -256
  61. data/test/gcloud/storage/test_file.rb +0 -221
  62. data/test/gcloud/storage/test_file_acl.rb +0 -367
  63. data/test/gcloud/storage/test_project.rb +0 -180
  64. data/test/gcloud/storage/test_storage.rb +0 -29
  65. data/test/gcloud/storage/test_verifier.rb +0 -62
  66. data/test/gcloud/test_version.rb +0 -8
  67. data/test/helper.rb +0 -91
data/.gemtest DELETED
File without changes
data/.rubocop.yml DELETED
@@ -1,17 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - "gcloud.gemspec"
4
- - "Rakefile"
5
- - "lib/gcloud/proto/**/*"
6
- - "rakelib/**/*"
7
- - "regression/**/*"
8
- - "test/**/*"
9
-
10
- Style/StringLiterals:
11
- EnforcedStyle: double_quotes
12
- Style/MethodDefParentheses:
13
- EnforcedStyle: require_no_parentheses
14
- Style/NumericLiterals:
15
- Enabled: false
16
- Metrics/ClassLength:
17
- Enabled: false
data/Manifest.txt DELETED
@@ -1,66 +0,0 @@
1
- .rubocop.yml
2
- CHANGELOG.md
3
- CONTRIBUTING.md
4
- LICENSE
5
- Manifest.txt
6
- README.md
7
- Rakefile
8
- gcloud.gemspec
9
- lib/gcloud.rb
10
- lib/gcloud/backoff.rb
11
- lib/gcloud/credentials.rb
12
- lib/gcloud/datastore.rb
13
- lib/gcloud/datastore/connection.rb
14
- lib/gcloud/datastore/credentials.rb
15
- lib/gcloud/datastore/dataset.rb
16
- lib/gcloud/datastore/dataset/lookup_results.rb
17
- lib/gcloud/datastore/dataset/query_results.rb
18
- lib/gcloud/datastore/entity.rb
19
- lib/gcloud/datastore/errors.rb
20
- lib/gcloud/datastore/key.rb
21
- lib/gcloud/datastore/properties.rb
22
- lib/gcloud/datastore/proto.rb
23
- lib/gcloud/datastore/query.rb
24
- lib/gcloud/datastore/transaction.rb
25
- lib/gcloud/proto/datastore_v1.pb.rb
26
- lib/gcloud/storage.rb
27
- lib/gcloud/storage/bucket.rb
28
- lib/gcloud/storage/bucket/acl.rb
29
- lib/gcloud/storage/bucket/list.rb
30
- lib/gcloud/storage/connection.rb
31
- lib/gcloud/storage/credentials.rb
32
- lib/gcloud/storage/errors.rb
33
- lib/gcloud/storage/file.rb
34
- lib/gcloud/storage/file/acl.rb
35
- lib/gcloud/storage/file/list.rb
36
- lib/gcloud/storage/file/verifier.rb
37
- lib/gcloud/storage/project.rb
38
- lib/gcloud/version.rb
39
- rakelib/console.rake
40
- rakelib/manifest.rake
41
- rakelib/proto.rake
42
- rakelib/rubocop.rake
43
- rakelib/test.rake
44
- test/gcloud/datastore/proto/test_cursor.rb
45
- test/gcloud/datastore/proto/test_direction.rb
46
- test/gcloud/datastore/proto/test_operator.rb
47
- test/gcloud/datastore/proto/test_value.rb
48
- test/gcloud/datastore/test_connection.rb
49
- test/gcloud/datastore/test_credentials.rb
50
- test/gcloud/datastore/test_dataset.rb
51
- test/gcloud/datastore/test_entity.rb
52
- test/gcloud/datastore/test_entity_exclude.rb
53
- test/gcloud/datastore/test_key.rb
54
- test/gcloud/datastore/test_query.rb
55
- test/gcloud/datastore/test_transaction.rb
56
- test/gcloud/storage/test_backoff.rb
57
- test/gcloud/storage/test_bucket.rb
58
- test/gcloud/storage/test_bucket_acl.rb
59
- test/gcloud/storage/test_default_acl.rb
60
- test/gcloud/storage/test_file.rb
61
- test/gcloud/storage/test_file_acl.rb
62
- test/gcloud/storage/test_project.rb
63
- test/gcloud/storage/test_storage.rb
64
- test/gcloud/storage/test_verifier.rb
65
- test/gcloud/test_version.rb
66
- test/helper.rb
data/Rakefile DELETED
@@ -1,35 +0,0 @@
1
- require "rubygems"
2
- require "hoe"
3
-
4
- Hoe.plugin :git
5
- Hoe.plugin :gemspec
6
- Hoe.plugin :minitest
7
-
8
- Hoe.spec "gcloud" do
9
- developer "Silvano Luciani", "silvano@google.com"
10
- developer "Mike Moore", "mike@blowmage.com"
11
-
12
- self.summary = "API Client library for Google Cloud"
13
- self.description = "Gcloud is the official library for interacting with Google Cloud."
14
- self.urls = ["http://googlecloudplatform.github.io/gcloud-ruby/"]
15
-
16
- self.history_file = "CHANGELOG.md"
17
- self.readme_file = "README.md"
18
- self.testlib = :minitest
19
-
20
- self.spec_extras[:rdoc_options] = ["--main", "README.md",
21
- "--exclude", "lib/gcloud/proto/",
22
- "--exclude", "Manifest.txt"]
23
-
24
- license "Apache-2.0"
25
-
26
- dependency "beefcake", "~> 1.0"
27
- dependency "google-api-client", "~> 0.8.3"
28
- dependency "mime-types", "~> 2.4"
29
- dependency "digest-crc", "~> 0.4"
30
- dependency "rubocop", "~> 0.27", :dev
31
- # TODO: Remove httpclient if/when the default faraday provider can upload without broken pipe errors
32
- dependency "httpclient", "~> 2.5", :dev
33
- dependency "simplecov", "~> 0.9", :dev
34
- dependency "coveralls", "~> 0.7", :dev
35
- end
data/gcloud.gemspec DELETED
@@ -1,63 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: gcloud 0.1.0.20150331154730 ruby lib
3
-
4
- Gem::Specification.new do |s|
5
- s.name = "gcloud"
6
- s.version = "0.1.0.20150331154730"
7
-
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib"]
10
- s.authors = ["Silvano Luciani", "Mike Moore"]
11
- s.date = "2015-03-31"
12
- s.description = "Gcloud is the official library for interacting with Google Cloud."
13
- s.email = ["silvano@google.com", "mike@blowmage.com"]
14
- s.extra_rdoc_files = ["CHANGELOG.md", "CONTRIBUTING.md", "Manifest.txt", "README.md"]
15
- s.files = [".gemtest", ".rubocop.yml", "CHANGELOG.md", "CONTRIBUTING.md", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "gcloud.gemspec", "lib/gcloud.rb", "lib/gcloud/backoff.rb", "lib/gcloud/credentials.rb", "lib/gcloud/datastore.rb", "lib/gcloud/datastore/connection.rb", "lib/gcloud/datastore/credentials.rb", "lib/gcloud/datastore/dataset.rb", "lib/gcloud/datastore/dataset/lookup_results.rb", "lib/gcloud/datastore/dataset/query_results.rb", "lib/gcloud/datastore/entity.rb", "lib/gcloud/datastore/errors.rb", "lib/gcloud/datastore/key.rb", "lib/gcloud/datastore/properties.rb", "lib/gcloud/datastore/proto.rb", "lib/gcloud/datastore/query.rb", "lib/gcloud/datastore/transaction.rb", "lib/gcloud/proto/datastore_v1.pb.rb", "lib/gcloud/storage.rb", "lib/gcloud/storage/bucket.rb", "lib/gcloud/storage/bucket/acl.rb", "lib/gcloud/storage/bucket/list.rb", "lib/gcloud/storage/connection.rb", "lib/gcloud/storage/credentials.rb", "lib/gcloud/storage/errors.rb", "lib/gcloud/storage/file.rb", "lib/gcloud/storage/file/acl.rb", "lib/gcloud/storage/file/list.rb", "lib/gcloud/storage/file/verifier.rb", "lib/gcloud/storage/project.rb", "lib/gcloud/version.rb", "rakelib/console.rake", "rakelib/manifest.rake", "rakelib/proto.rake", "rakelib/rubocop.rake", "rakelib/test.rake", "test/gcloud/datastore/proto/test_cursor.rb", "test/gcloud/datastore/proto/test_direction.rb", "test/gcloud/datastore/proto/test_operator.rb", "test/gcloud/datastore/proto/test_value.rb", "test/gcloud/datastore/test_connection.rb", "test/gcloud/datastore/test_credentials.rb", "test/gcloud/datastore/test_dataset.rb", "test/gcloud/datastore/test_entity.rb", "test/gcloud/datastore/test_entity_exclude.rb", "test/gcloud/datastore/test_key.rb", "test/gcloud/datastore/test_query.rb", "test/gcloud/datastore/test_transaction.rb", "test/gcloud/storage/test_backoff.rb", "test/gcloud/storage/test_bucket.rb", "test/gcloud/storage/test_bucket_acl.rb", "test/gcloud/storage/test_default_acl.rb", "test/gcloud/storage/test_file.rb", "test/gcloud/storage/test_file_acl.rb", "test/gcloud/storage/test_project.rb", "test/gcloud/storage/test_storage.rb", "test/gcloud/storage/test_verifier.rb", "test/gcloud/test_version.rb", "test/helper.rb"]
16
- s.homepage = "http://googlecloudplatform.github.io/gcloud-ruby/"
17
- s.licenses = ["Apache-2.0"]
18
- s.rdoc_options = ["--main", "README.md", "--exclude", "lib/gcloud/proto/", "--exclude", "Manifest.txt"]
19
- s.rubygems_version = "2.4.6"
20
- s.summary = "API Client library for Google Cloud"
21
-
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
24
-
25
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
26
- s.add_runtime_dependency(%q<beefcake>, ["~> 1.0"])
27
- s.add_runtime_dependency(%q<google-api-client>, ["~> 0.8.3"])
28
- s.add_runtime_dependency(%q<mime-types>, ["~> 2.4"])
29
- s.add_runtime_dependency(%q<digest-crc>, ["~> 0.4"])
30
- s.add_development_dependency(%q<minitest>, ["~> 5.5"])
31
- s.add_development_dependency(%q<rdoc>, ["~> 4.0"])
32
- s.add_development_dependency(%q<rubocop>, ["~> 0.27"])
33
- s.add_development_dependency(%q<httpclient>, ["~> 2.5"])
34
- s.add_development_dependency(%q<simplecov>, ["~> 0.9"])
35
- s.add_development_dependency(%q<coveralls>, ["~> 0.7"])
36
- s.add_development_dependency(%q<hoe>, ["~> 3.13"])
37
- else
38
- s.add_dependency(%q<beefcake>, ["~> 1.0"])
39
- s.add_dependency(%q<google-api-client>, ["~> 0.8.3"])
40
- s.add_dependency(%q<mime-types>, ["~> 2.4"])
41
- s.add_dependency(%q<digest-crc>, ["~> 0.4"])
42
- s.add_dependency(%q<minitest>, ["~> 5.5"])
43
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
44
- s.add_dependency(%q<rubocop>, ["~> 0.27"])
45
- s.add_dependency(%q<httpclient>, ["~> 2.5"])
46
- s.add_dependency(%q<simplecov>, ["~> 0.9"])
47
- s.add_dependency(%q<coveralls>, ["~> 0.7"])
48
- s.add_dependency(%q<hoe>, ["~> 3.13"])
49
- end
50
- else
51
- s.add_dependency(%q<beefcake>, ["~> 1.0"])
52
- s.add_dependency(%q<google-api-client>, ["~> 0.8.3"])
53
- s.add_dependency(%q<mime-types>, ["~> 2.4"])
54
- s.add_dependency(%q<digest-crc>, ["~> 0.4"])
55
- s.add_dependency(%q<minitest>, ["~> 5.5"])
56
- s.add_dependency(%q<rdoc>, ["~> 4.0"])
57
- s.add_dependency(%q<rubocop>, ["~> 0.27"])
58
- s.add_dependency(%q<httpclient>, ["~> 2.5"])
59
- s.add_dependency(%q<simplecov>, ["~> 0.9"])
60
- s.add_dependency(%q<coveralls>, ["~> 0.7"])
61
- s.add_dependency(%q<hoe>, ["~> 3.13"])
62
- end
63
- end
data/rakelib/console.rake DELETED
@@ -1,28 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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
- task :console do
16
- require "irb"
17
- require "irb/completion"
18
- require "pp"
19
-
20
- lib = File.expand_path("../../lib/", __FILE__)
21
- $:.unshift lib unless $:.include?(lib)
22
-
23
- require "gcloud"
24
- require "gcloud/datastore"
25
-
26
- ARGV.clear
27
- IRB.start
28
- end
@@ -1,24 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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
- desc "Update the Manifest file."
16
- task :manifest do
17
- exclude_regexp = /regression*|\.travis\.yml|rakelib\/travis.rake|keyfile.json*|rakelib\/gh-pages.rake|Gemfile*/
18
- `rake git:manifest`
19
- new_manifest = []
20
- File.open("Manifest.txt").each do |line|
21
- new_manifest << line unless line =~ exclude_regexp
22
- end
23
- File.write "Manifest.txt", new_manifest.join
24
- end
data/rakelib/proto.rake DELETED
@@ -1,17 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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
- task :compile do
16
- `BEEFCAKE_NAMESPACE=Gcloud::Datastore::Proto protoc --beefcake_out lib/gcloud/proto -I proto proto/datastore_v1.proto`
17
- end
data/rakelib/rubocop.rake DELETED
@@ -1,17 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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 "rubocop/rake_task"
16
-
17
- RuboCop::RakeTask.new
data/rakelib/test.rake DELETED
@@ -1,144 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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 "rake/testtask"
16
-
17
- namespace :test do
18
-
19
- desc "Runs tests with coverage."
20
- task :coverage, :project, :keyfile do |t, args|
21
- project = args[:project]
22
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["DATASTORE_TEST_PROJECT"]
23
- keyfile = args[:keyfile]
24
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["DATASTORE_TEST_KEYFILE"]
25
- if project.nil? || keyfile.nil?
26
- fail "You must provide a project and keyfile. e.g. rake test:regression[test123, /path/to/keyfile.json] or GCLOUD_TEST_PROJECT=test123 GCLOUD_TEST_KEYFILE=/path/to/keyfile.json rake test:regression"
27
- end
28
- # always overwrite when running tests
29
- ENV["DATASTORE_PROJECT"] = project
30
- ENV["DATASTORE_KEYFILE"] = keyfile
31
- ENV["STORAGE_PROJECT"] = project
32
- ENV["STORAGE_KEYFILE"] = keyfile
33
-
34
- require "simplecov"
35
- SimpleCov.start("test_frameworks") { command_name "Minitest" }
36
-
37
- # Rake::Task["test"].execute
38
- $LOAD_PATH.unshift "lib", "test", "regression"
39
- Dir.glob("{test,regression}/**/test*.rb").each { |file| require_relative "../#{file}"}
40
- end
41
-
42
- desc "Runs tests with coveralls."
43
- task :coveralls, :project, :keyfile do |t, args|
44
- project = args[:project]
45
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["DATASTORE_TEST_PROJECT"]
46
- keyfile = args[:keyfile]
47
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["DATASTORE_TEST_KEYFILE"]
48
- if project.nil? || keyfile.nil?
49
- fail "You must provide a project and keyfile. e.g. rake test:regression[test123, /path/to/keyfile.json] or GCLOUD_TEST_PROJECT=test123 GCLOUD_TEST_KEYFILE=/path/to/keyfile.json rake test:regression"
50
- end
51
- # always overwrite when running tests
52
- ENV["DATASTORE_PROJECT"] = project
53
- ENV["DATASTORE_KEYFILE"] = keyfile
54
- ENV["STORAGE_PROJECT"] = project
55
- ENV["STORAGE_KEYFILE"] = keyfile
56
-
57
- require "simplecov"
58
- require "coveralls"
59
- SimpleCov.formatter = Coveralls::SimpleCov::Formatter
60
- SimpleCov.start("test_frameworks") { command_name "Minitest" }
61
-
62
- $LOAD_PATH.unshift "lib", "test", "regression"
63
- Dir.glob("{test,regression}/**/test*.rb").each { |file| require_relative "../#{file}"}
64
- end
65
-
66
- desc "Runs the regression tests."
67
- task :regression, :project, :keyfile do |t, args|
68
- project = args[:project]
69
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["DATASTORE_TEST_PROJECT"]
70
- keyfile = args[:keyfile]
71
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["DATASTORE_TEST_KEYFILE"]
72
- if project.nil? || keyfile.nil?
73
- fail "You must provide a project and keyfile. e.g. rake test:regression[test123, /path/to/keyfile.json] or GCLOUD_TEST_PROJECT=test123 GCLOUD_TEST_KEYFILE=/path/to/keyfile.json rake test:regression"
74
- end
75
- # always overwrite when running tests
76
- ENV["DATASTORE_PROJECT"] = project
77
- ENV["DATASTORE_KEYFILE"] = keyfile
78
- ENV["STORAGE_PROJECT"] = project
79
- ENV["STORAGE_KEYFILE"] = keyfile
80
-
81
- $LOAD_PATH.unshift "lib", "test", "regression"
82
- Dir.glob("regression/**/test*.rb").each { |file| require_relative "../#{file}"}
83
- end
84
-
85
- namespace :regression do
86
-
87
- desc "Runs the datastore regression tests."
88
- task :datastore, :project, :keyfile do |t, args|
89
- project = args[:project]
90
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["DATASTORE_TEST_PROJECT"]
91
- keyfile = args[:keyfile]
92
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["DATASTORE_TEST_KEYFILE"]
93
- if project.nil? || keyfile.nil?
94
- fail "You must provide a project and keyfile. e.g. rake test:regression:datastore[test123, /path/to/keyfile.json] or DATASTORE_TEST_PROJECT=test123 DATASTORE_TEST_KEYFILE=/path/to/keyfile.json rake test:regression:datastore"
95
- end
96
- # always overwrite when running tests
97
- ENV["DATASTORE_PROJECT"] = project
98
- ENV["DATASTORE_KEYFILE"] = keyfile
99
-
100
- $LOAD_PATH.unshift "lib", "test", "regression"
101
- Dir.glob("regression/datastore/**/test*.rb").each { |file| require_relative "../#{file}"}
102
- end
103
-
104
- desc "Runs the storage regression tests."
105
- task :storage, :project, :keyfile do |t, args|
106
- project = args[:project]
107
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["STORAGE_TEST_PROJECT"]
108
- keyfile = args[:keyfile]
109
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["STORAGE_TEST_KEYFILE"]
110
- if project.nil? || keyfile.nil?
111
- fail "You must provide a project and keyfile. e.g. rake test:regression:storage[test123, /path/to/keyfile.json] or STORAGE_TEST_PROJECT=test123 STORAGE_TEST_KEYFILE=/path/to/keyfile.json rake test:regression:storage"
112
- end
113
- # always overwrite when running tests
114
- ENV["STORAGE_PROJECT"] = project
115
- ENV["STORAGE_KEYFILE"] = keyfile
116
-
117
- $LOAD_PATH.unshift "lib", "test", "regression"
118
- Dir.glob("regression/storage/**/test*.rb").each { |file| require_relative "../#{file}"}
119
- end
120
-
121
- namespace :storage do
122
- desc "Removes *ALL* buckets and files. Use with caution."
123
- task :cleanup do |t, args|
124
- project = args[:project]
125
- project ||= ENV["GCLOUD_TEST_PROJECT"] || ENV["STORAGE_TEST_PROJECT"]
126
- keyfile = args[:keyfile]
127
- keyfile ||= ENV["GCLOUD_TEST_KEYFILE"] || ENV["STORAGE_TEST_KEYFILE"]
128
- if project.nil? || keyfile.nil?
129
- fail "You must provide a project and keyfile. e.g. rake test:regression:storage:cleanup[test123, /path/to/keyfile.json] or STORAGE_TEST_PROJECT=test123 STORAGE_TEST_KEYFILE=/path/to/keyfile.json rake test:regression:storage:cleanup"
130
- end
131
- # always overwrite when running tests
132
- ENV["STORAGE_PROJECT"] = project
133
- ENV["STORAGE_KEYFILE"] = keyfile
134
-
135
- $LOAD_PATH.unshift "lib"
136
- require "gcloud/storage"
137
- puts "Cleaning up existing buckets and files"
138
- Gcloud.storage.buckets.each { |b| b.files.map(&:delete); b.delete }
139
- end
140
- end
141
-
142
- end
143
-
144
- end
@@ -1,36 +0,0 @@
1
- # Copyright 2014 Google Inc. All rights reserved.
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 "helper"
16
- require "gcloud/datastore/entity"
17
- require "gcloud/datastore/key"
18
-
19
- ##
20
- # These tests are not part of the public API.
21
- # These tests are testing the implementation.
22
- # Similar to testing private methods.
23
-
24
- describe "Proto Cursor methods" do
25
- let(:raw_cursor) {
26
- "\x13\xE0\x01\x00\xEB".force_encoding Encoding::ASCII_8BIT }
27
- let(:encoded_cursor) { "E+ABAOs=" }
28
-
29
- it "encodes the bytestream" do
30
- encoded_cursor.must_equal Gcloud::Datastore::Proto.encode_cursor(raw_cursor)
31
- end
32
-
33
- it "decodes the bytestream" do
34
- raw_cursor.must_equal Gcloud::Datastore::Proto.decode_cursor(encoded_cursor)
35
- end
36
- end