bucket_client 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.idea/bucket_client.iml +46 -48
- data/.idea/runConfigurations/Integration_Test.xml +1 -1
- data/.idea/runConfigurations/Unit_Test.xml +1 -1
- data/integration/aws_blob_spec.rb +18 -0
- data/integration/azure_blob_spec.rb +15 -0
- data/integration/azure_bucket_spec.rb +1 -1
- data/integration/dev_blob_spec.rb +14 -0
- data/integration/do_blob_spec.rb +15 -0
- data/integration/gcp_blob_spec.rb +16 -0
- data/lib/bucket_client/aws/aws_client.rb +1 -1
- data/lib/bucket_client/azure/azure_client.rb +1 -1
- data/lib/bucket_client/digital_ocean/digital_ocean_client.rb +1 -1
- data/lib/bucket_client/gcp/gcp_client.rb +1 -1
- data/lib/bucket_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2e7878f4f4ed3bd12228c1a4d8dbb66a4e431e86422b1d0304f579121f4cde5
|
4
|
+
data.tar.gz: 9b080d870a4058cfcb1f4271f8dc386306208b965229554b7307d5e5a8dc53c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f81d2598301637ad9a57b996c5628cfa6e60e314d59f89944069782861476fbcf9deaed91da0854308de038e521c45f9334e591acb9bbfa7b0386c80d48387ad
|
7
|
+
data.tar.gz: 10709c8fdb6598c7b92b33b97e6a7034f77c243de3177898a0f96f49796ffb62c514b62e4db0169b83dd04aab978f7185c2827644b3539a0e85d8145ec37a122
|
data/.idea/bucket_client.iml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
<module type="RUBY_MODULE" version="4">
|
3
3
|
<component name="ModuleRunConfigurationManager">
|
4
4
|
<shared>
|
5
|
-
<configuration default="false" name="
|
5
|
+
<configuration default="false" name="Integration Test" type="RSpecRunConfigurationType" factoryName="RSpec">
|
6
6
|
<module name="bucket_client" />
|
7
7
|
<predefined_log_file enabled="true" id="RUBY_RSPEC" />
|
8
8
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
|
@@ -12,7 +12,7 @@
|
|
12
12
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
13
13
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
14
14
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
15
|
-
<EXTENSION ID="
|
15
|
+
<EXTENSION ID="RubyDockerContainerSettingsRunConfigurationExtension" dockerComposeCommand="EXEC" />
|
16
16
|
<EXTENSION ID="net.ashald.envfile">
|
17
17
|
<option name="IS_ENABLED" value="false" />
|
18
18
|
<option name="IS_SUBST" value="false" />
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<ENTRY IS_ENABLED="true" PARSER="runconfig" />
|
23
23
|
</ENTRIES>
|
24
24
|
</EXTENSION>
|
25
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/
|
25
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/integration" />
|
26
26
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
27
27
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
28
28
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
@@ -37,7 +37,7 @@
|
|
37
37
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
|
38
38
|
<method v="2" />
|
39
39
|
</configuration>
|
40
|
-
<configuration default="false" name="
|
40
|
+
<configuration default="false" name="Unit Test" type="RSpecRunConfigurationType" factoryName="RSpec" singleton="false">
|
41
41
|
<module name="bucket_client" />
|
42
42
|
<predefined_log_file enabled="true" id="RUBY_RSPEC" />
|
43
43
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
|
@@ -47,7 +47,7 @@
|
|
47
47
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
48
48
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
49
49
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
50
|
-
<EXTENSION ID="
|
50
|
+
<EXTENSION ID="RubyDockerContainerSettingsRunConfigurationExtension" dockerComposeCommand="EXEC" />
|
51
51
|
<EXTENSION ID="net.ashald.envfile">
|
52
52
|
<option name="IS_ENABLED" value="false" />
|
53
53
|
<option name="IS_SUBST" value="false" />
|
@@ -57,7 +57,7 @@
|
|
57
57
|
<ENTRY IS_ENABLED="true" PARSER="runconfig" />
|
58
58
|
</ENTRIES>
|
59
59
|
</EXTENSION>
|
60
|
-
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/
|
60
|
+
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
|
61
61
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
|
62
62
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
|
63
63
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="" />
|
@@ -76,48 +76,46 @@
|
|
76
76
|
</component>
|
77
77
|
<component name="NewModuleRootManager">
|
78
78
|
<content url="file://$MODULE_DIR$" />
|
79
|
-
<orderEntry type="
|
79
|
+
<orderEntry type="jdk" jdkName="Remote: ruby-2.6.0-p0" jdkType="RUBY_SDK" />
|
80
80
|
<orderEntry type="sourceFolder" forTests="false" />
|
81
|
-
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.6.0, ruby-2.6.0-p0) [gem]" level="application" />
|
82
|
-
<orderEntry type="library" scope="PROVIDED" name="azure-core (v0.1.15, ruby-2.6.0-p0) [gem]" level="application" />
|
83
|
-
<orderEntry type="library" scope="PROVIDED" name="azure-storage-blob (v1.1.0, ruby-2.6.0-p0) [gem]" level="application" />
|
84
|
-
<orderEntry type="library" scope="PROVIDED" name="azure-storage-common (v1.1.0, ruby-2.6.0-p0) [gem]" level="application" />
|
85
|
-
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, ruby-2.6.0-p0) [gem]" level="application" />
|
86
|
-
<orderEntry type="library" scope="PROVIDED" name="declarative (v0.0.10, ruby-2.6.0-p0) [gem]" level="application" />
|
87
|
-
<orderEntry type="library" scope="PROVIDED" name="declarative-option (v0.1.0, ruby-2.6.0-p0) [gem]" level="application" />
|
88
|
-
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, ruby-2.6.0-p0) [gem]" level="application" />
|
89
|
-
<orderEntry type="library" scope="PROVIDED" name="digest-crc (v0.4.1, ruby-2.6.0-p0) [gem]" level="application" />
|
90
|
-
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.1, ruby-2.6.0-p0) [gem]" level="application" />
|
91
|
-
<orderEntry type="library" scope="PROVIDED" name="faraday (v0.15.4, ruby-2.6.0-p0) [gem]" level="application" />
|
92
|
-
<orderEntry type="library" scope="PROVIDED" name="faraday_middleware (v0.13.1, ruby-2.6.0-p0) [gem]" level="application" />
|
93
|
-
<orderEntry type="library" scope="PROVIDED" name="google-api-client (v0.28.4, ruby-2.6.0-p0) [gem]" level="application" />
|
94
|
-
<orderEntry type="library" scope="PROVIDED" name="google-cloud-core (v1.3.0, ruby-2.6.0-p0) [gem]" level="application" />
|
95
|
-
<orderEntry type="library" scope="PROVIDED" name="google-cloud-env (v1.0.5, ruby-2.6.0-p0) [gem]" level="application" />
|
96
|
-
<orderEntry type="library" scope="PROVIDED" name="google-cloud-storage (v1.17.0, ruby-2.6.0-p0) [gem]" level="application" />
|
97
|
-
<orderEntry type="library" scope="PROVIDED" name="googleauth (v0.8.0, ruby-2.6.0-p0) [gem]" level="application" />
|
98
|
-
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, ruby-2.6.0-p0) [gem]" level="application" />
|
99
|
-
<orderEntry type="library" scope="PROVIDED" name="jwt (v2.1.0, ruby-2.6.0-p0) [gem]" level="application" />
|
100
|
-
<orderEntry type="library" scope="PROVIDED" name="kirin_http (v0.1.1, ruby-2.6.0-p0) [gem]" level="application" />
|
101
|
-
<orderEntry type="library" scope="PROVIDED" name="memoist (v0.16.0, ruby-2.6.0-p0) [gem]" level="application" />
|
102
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.2.2, ruby-2.6.0-p0) [gem]" level="application" />
|
103
|
-
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2018.0812, ruby-2.6.0-p0) [gem]" level="application" />
|
104
|
-
<orderEntry type="library" scope="PROVIDED" name="mimemagic (v0.3.3, ruby-2.6.0-p0) [gem]" level="application" />
|
105
|
-
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, ruby-2.6.0-p0) [gem]" level="application" />
|
106
|
-
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.13.1, ruby-2.6.0-p0) [gem]" level="application" />
|
107
|
-
<orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, ruby-2.6.0-p0) [gem]" level="application" />
|
108
|
-
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.1, ruby-2.6.0-p0) [gem]" level="application" />
|
109
|
-
<orderEntry type="library" scope="PROVIDED" name="os (v1.0.0, ruby-2.6.0-p0) [gem]" level="application" />
|
110
|
-
<orderEntry type="library" scope="PROVIDED" name="ox (v2.10.0, ruby-2.6.0-p0) [gem]" level="application" />
|
111
|
-
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v3.0.3, ruby-2.6.0-p0) [gem]" level="application" />
|
112
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
113
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
114
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
115
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.
|
116
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-
|
117
|
-
<orderEntry type="library" scope="PROVIDED" name="rspec-
|
118
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
119
|
-
<orderEntry type="library" scope="PROVIDED" name="
|
120
|
-
<orderEntry type="library" scope="PROVIDED" name="signet (v0.11.0, ruby-2.6.0-p0) [gem]" level="application" />
|
121
|
-
<orderEntry type="library" scope="PROVIDED" name="uber (v0.1.0, ruby-2.6.0-p0) [gem]" level="application" />
|
81
|
+
<orderEntry type="library" scope="PROVIDED" name="addressable (v2.6.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
82
|
+
<orderEntry type="library" scope="PROVIDED" name="azure-core (v0.1.15, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
83
|
+
<orderEntry type="library" scope="PROVIDED" name="azure-storage-blob (v1.1.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
84
|
+
<orderEntry type="library" scope="PROVIDED" name="azure-storage-common (v1.1.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
85
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.17.2, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
86
|
+
<orderEntry type="library" scope="PROVIDED" name="declarative (v0.0.10, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
87
|
+
<orderEntry type="library" scope="PROVIDED" name="declarative-option (v0.1.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
88
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
89
|
+
<orderEntry type="library" scope="PROVIDED" name="digest-crc (v0.4.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
90
|
+
<orderEntry type="library" scope="PROVIDED" name="dotenv (v2.7.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
91
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday (v0.15.4, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
92
|
+
<orderEntry type="library" scope="PROVIDED" name="faraday_middleware (v0.13.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
93
|
+
<orderEntry type="library" scope="PROVIDED" name="google-api-client (v0.28.4, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
94
|
+
<orderEntry type="library" scope="PROVIDED" name="google-cloud-core (v1.3.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
95
|
+
<orderEntry type="library" scope="PROVIDED" name="google-cloud-env (v1.0.5, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
96
|
+
<orderEntry type="library" scope="PROVIDED" name="google-cloud-storage (v1.17.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
97
|
+
<orderEntry type="library" scope="PROVIDED" name="googleauth (v0.8.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
98
|
+
<orderEntry type="library" scope="PROVIDED" name="httpclient (v2.8.3, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
99
|
+
<orderEntry type="library" scope="PROVIDED" name="jwt (v2.1.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
100
|
+
<orderEntry type="library" scope="PROVIDED" name="kirin_http (v0.1.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
101
|
+
<orderEntry type="library" scope="PROVIDED" name="memoist (v0.16.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
102
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.2.2, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
103
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2018.0812, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
104
|
+
<orderEntry type="library" scope="PROVIDED" name="mimemagic (v0.3.3, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
105
|
+
<orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
106
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_json (v1.13.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
107
|
+
<orderEntry type="library" scope="PROVIDED" name="multipart-post (v2.0.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
108
|
+
<orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.1, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
109
|
+
<orderEntry type="library" scope="PROVIDED" name="os (v1.0.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
110
|
+
<orderEntry type="library" scope="PROVIDED" name="ox (v2.10.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
111
|
+
<orderEntry type="library" scope="PROVIDED" name="public_suffix (v3.0.3, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
112
|
+
<orderEntry type="library" scope="PROVIDED" name="representable (v3.0.4, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
113
|
+
<orderEntry type="library" scope="PROVIDED" name="retriable (v3.1.2, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
114
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
115
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.2, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
116
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
117
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
118
|
+
<orderEntry type="library" scope="PROVIDED" name="signet (v0.11.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
119
|
+
<orderEntry type="library" scope="PROVIDED" name="uber (v0.1.0, Remote: ruby-2.6.0-p0) [gem]" level="application" />
|
122
120
|
</component>
|
123
121
|
</module>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
10
10
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
11
11
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
12
|
-
<EXTENSION ID="
|
12
|
+
<EXTENSION ID="RubyDockerContainerSettingsRunConfigurationExtension" dockerComposeCommand="EXEC" />
|
13
13
|
<EXTENSION ID="net.ashald.envfile">
|
14
14
|
<option name="IS_ENABLED" value="false" />
|
15
15
|
<option name="IS_SUBST" value="false" />
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
|
10
10
|
<EXTENSION ID="BundlerRunConfigurationExtension" bundleExecEnabled="false" />
|
11
11
|
<EXTENSION ID="JRubyRunConfigurationExtension" NailgunExecEnabled="false" />
|
12
|
-
<EXTENSION ID="
|
12
|
+
<EXTENSION ID="RubyDockerContainerSettingsRunConfigurationExtension" dockerComposeCommand="EXEC" />
|
13
13
|
<EXTENSION ID="net.ashald.envfile">
|
14
14
|
<option name="IS_ENABLED" value="false" />
|
15
15
|
<option name="IS_SUBST" value="false" />
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "bucket_client/aws/aws_bucket"
|
2
2
|
require "bucket_client/aws/aws_client"
|
3
3
|
require "kirin_http"
|
4
|
+
require "base64"
|
4
5
|
|
5
6
|
describe BucketClient::AWSBucket do
|
6
7
|
http = KirinHttp::BasicClient.new
|
@@ -62,6 +63,16 @@ describe BucketClient::AWSBucket do
|
|
62
63
|
expect(result).to be_truthy
|
63
64
|
expect(result.value).to eq "https://s3-#{region}.amazonaws.com/#{key}/#{file}"
|
64
65
|
end
|
66
|
+
|
67
|
+
it 'should succeed on MD files' do
|
68
|
+
f = "readme.md"
|
69
|
+
readme = "IyBSZWFkIG1lDQpISSBISSE="
|
70
|
+
readme_bin = Base64.decode64 readme
|
71
|
+
result = bucket.put_blob readme_bin, f
|
72
|
+
expect(result).to be_truthy
|
73
|
+
expect(result.value).to eq "https://s3-#{region}.amazonaws.com/#{key}/#{f}"
|
74
|
+
end
|
75
|
+
|
65
76
|
end
|
66
77
|
|
67
78
|
describe 'exist_blob' do
|
@@ -90,6 +101,13 @@ describe BucketClient::AWSBucket do
|
|
90
101
|
result = bucket.delete_blob file
|
91
102
|
expect(result.success).to be_truthy
|
92
103
|
end
|
104
|
+
|
105
|
+
it 'should delete MD file too' do
|
106
|
+
f = "readme.md"
|
107
|
+
result = bucket.delete_blob f
|
108
|
+
expect(result.success).to be_truthy
|
109
|
+
end
|
110
|
+
|
93
111
|
end
|
94
112
|
|
95
113
|
describe "create_blob" do
|
@@ -60,6 +60,15 @@ describe BucketClient::AzureBucket do
|
|
60
60
|
expect(result.success).to be_truthy
|
61
61
|
expect(result.value).to eq "https://#{id}.blob.core.windows.net/#{key}/#{file}"
|
62
62
|
end
|
63
|
+
|
64
|
+
it 'should succeed with MD files' do
|
65
|
+
f = "readme.md"
|
66
|
+
readme = "IyBSZWFkIG1lDQpISSBISSE="
|
67
|
+
readme_bin = Base64.decode64 readme
|
68
|
+
result = bucket.put_blob readme_bin, f
|
69
|
+
expect(result).to be_truthy
|
70
|
+
expect(result.value).to eq "https://#{id}.blob.core.windows.net/#{key}/#{f}"
|
71
|
+
end
|
63
72
|
end
|
64
73
|
|
65
74
|
describe 'exist_blob' do
|
@@ -88,6 +97,12 @@ describe BucketClient::AzureBucket do
|
|
88
97
|
result = bucket.delete_blob file
|
89
98
|
expect(result.success).to be_truthy
|
90
99
|
end
|
100
|
+
|
101
|
+
it 'should delete MD file too' do
|
102
|
+
f = "readme.md"
|
103
|
+
result = bucket.delete_blob f
|
104
|
+
expect(result.success).to be_truthy
|
105
|
+
end
|
91
106
|
end
|
92
107
|
|
93
108
|
describe "create_blob" do
|
@@ -58,6 +58,15 @@ describe BucketClient::LocalBucket do
|
|
58
58
|
expect(result).to be_truthy
|
59
59
|
expect(result.value).to eq "#{host}/#{key}/#{file}"
|
60
60
|
end
|
61
|
+
|
62
|
+
it 'should succeed with MD file' do
|
63
|
+
f = "readme.md"
|
64
|
+
readme = "IyBSZWFkIG1lDQpISSBISSE="
|
65
|
+
readme_bin = Base64.decode64 readme
|
66
|
+
result = bucket.put_blob readme_bin, f
|
67
|
+
expect(result).to be_truthy
|
68
|
+
expect(result.value).to eq "#{host}/#{key}/#{f}"
|
69
|
+
end
|
61
70
|
end
|
62
71
|
|
63
72
|
describe 'exist_blob' do
|
@@ -85,7 +94,12 @@ describe BucketClient::LocalBucket do
|
|
85
94
|
it 'should pass as blob exist' do
|
86
95
|
result = bucket.delete_blob file
|
87
96
|
expect(result.success).to be_truthy
|
97
|
+
end
|
88
98
|
|
99
|
+
it 'should delete MD file too' do
|
100
|
+
f = "readme.md"
|
101
|
+
result = bucket.delete_blob f
|
102
|
+
expect(result.success).to be_truthy
|
89
103
|
end
|
90
104
|
end
|
91
105
|
|
data/integration/do_blob_spec.rb
CHANGED
@@ -62,6 +62,15 @@ describe BucketClient::DigitalOceanBucket do
|
|
62
62
|
expect(result).to be_truthy
|
63
63
|
expect(result.value).to eq "https://#{region}.digitaloceanspaces.com/#{key}/#{file}"
|
64
64
|
end
|
65
|
+
|
66
|
+
it 'should succeed with md file' do
|
67
|
+
f = "readme.md"
|
68
|
+
readme = "IyBSZWFkIG1lDQpISSBISSE="
|
69
|
+
readme_bin = Base64.decode64 readme
|
70
|
+
result = bucket.put_blob readme_bin, f
|
71
|
+
expect(result).to be_truthy
|
72
|
+
expect(result.value).to eq "https://#{region}.digitaloceanspaces.com/#{key}/#{f}"
|
73
|
+
end
|
65
74
|
end
|
66
75
|
|
67
76
|
describe 'exist_blob' do
|
@@ -90,6 +99,12 @@ describe BucketClient::DigitalOceanBucket do
|
|
90
99
|
result = bucket.delete_blob file
|
91
100
|
expect(result.success).to be_truthy
|
92
101
|
end
|
102
|
+
|
103
|
+
it 'should delete MD file too' do
|
104
|
+
f = "readme.md"
|
105
|
+
result = bucket.delete_blob f
|
106
|
+
expect(result.success).to be_truthy
|
107
|
+
end
|
93
108
|
end
|
94
109
|
|
95
110
|
describe "create_blob" do
|
@@ -60,6 +60,16 @@ describe BucketClient::GCPBucket do
|
|
60
60
|
expect(result.success).to be_truthy
|
61
61
|
expect(result.value).to eq "https://storage.googleapis.com/#{key}/#{file}"
|
62
62
|
end
|
63
|
+
|
64
|
+
it 'should succeed for MD file' do
|
65
|
+
f = "readme.md"
|
66
|
+
readme = "IyBSZWFkIG1lDQpISSBISSE="
|
67
|
+
readme_bin = Base64.decode64 readme
|
68
|
+
result = bucket.put_blob readme_bin, f
|
69
|
+
expect(result).to be_truthy
|
70
|
+
expect(result.value).to eq "https://storage.googleapis.com/#{key}/#{f}"
|
71
|
+
end
|
72
|
+
|
63
73
|
end
|
64
74
|
|
65
75
|
describe 'exist_blob' do
|
@@ -88,6 +98,12 @@ describe BucketClient::GCPBucket do
|
|
88
98
|
result = bucket.delete_blob file
|
89
99
|
expect(result.success).to be_truthy
|
90
100
|
end
|
101
|
+
|
102
|
+
it 'should delete MD file too' do
|
103
|
+
f = "readme.md"
|
104
|
+
result = bucket.delete_blob f
|
105
|
+
expect(result.success).to be_truthy
|
106
|
+
end
|
91
107
|
end
|
92
108
|
|
93
109
|
describe "create_blob" do
|
@@ -103,7 +103,7 @@ module BucketClient
|
|
103
103
|
|
104
104
|
def put_blob(payload, uri)
|
105
105
|
mime = MimeMagic.by_magic payload
|
106
|
-
type = mime
|
106
|
+
type = mime&.type || "text/plain"
|
107
107
|
resp = @http.query(:put, uri, payload, type, "text/plain")
|
108
108
|
success = resp.code === 200
|
109
109
|
if success
|
@@ -142,7 +142,7 @@ module BucketClient
|
|
142
142
|
mime = MimeMagic.by_magic payload
|
143
143
|
data = break_uri uri
|
144
144
|
begin
|
145
|
-
type = mime
|
145
|
+
type = mime&.type || "text/plain"
|
146
146
|
@client.create_block_blob data[:bucket], data[:blob], payload, {:content_type => type}
|
147
147
|
OperationResult.new(true, "OK", uri, 204)
|
148
148
|
rescue Azure::Core::Http::HTTPError => e
|
@@ -127,7 +127,7 @@ module BucketClient
|
|
127
127
|
|
128
128
|
def put_blob(payload, uri)
|
129
129
|
mime = MimeMagic.by_magic payload
|
130
|
-
type = mime
|
130
|
+
type = mime&.type || "text/plain"
|
131
131
|
resp = @http.query :put, uri, payload, type, "application/xml"
|
132
132
|
return OperationResult.new(false, resp.content, nil, 400) unless resp.code === 200
|
133
133
|
url = Addressable::URI.parse uri
|
@@ -111,7 +111,7 @@ module BucketClient
|
|
111
111
|
bucket = @client.bucket data[:bucket]
|
112
112
|
f = StringIO.new
|
113
113
|
f << payload
|
114
|
-
type = mime
|
114
|
+
type = mime&.type || "text/plain"
|
115
115
|
file = bucket.create_file f, data[:blob], cache_control: "no-cache", content_type: type
|
116
116
|
OperationResult.new(true, "OK", file.public_url, 200)
|
117
117
|
rescue StandardError => e
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bucket_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kirinnee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kirin_http
|