bkblz 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bkblz +6 -2
- data/lib/bkblz/task/download_file.rb +7 -1
- data/lib/bkblz/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47f032205c5b3348111f4cf170501fa08952ba7817cdc0c3ae06fba4c68c2a7d
|
4
|
+
data.tar.gz: d5a9dbae5c9fef54cbdc0e03520d283fe7634fc1b01cb537c81731ee0113d338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ac101a0d32a08d63ec18a156cc087b9401267ddaa37554fb4eadad5700f2a042b498953493d2c2c44127474665d6da688913814ab2620af20f17906d3fe7d50
|
7
|
+
data.tar.gz: 10bcde19f56e2488cb19879af0cbf46caa1a2221c987fd4cebf6237ad9c34d5b15671b5fa3142d21125325b5d36162969ab74d8e8bb0462c74362eda34a707ca
|
data/bin/bkblz
CHANGED
@@ -139,6 +139,7 @@ module Bkblz
|
|
139
139
|
|
140
140
|
desc "downloadbyname <bucket> <name> <dir>", "downloads file by <bucket> " +
|
141
141
|
"and <name> to directory <dir>"
|
142
|
+
option :strip_prefix, :desc => "prefix to strip from filename when writing locally"
|
142
143
|
def downloadbyname(bucket_name, file_name, dir_path)
|
143
144
|
parse_opts
|
144
145
|
|
@@ -147,7 +148,8 @@ module Bkblz
|
|
147
148
|
:file_name => file_name,
|
148
149
|
:bucket_name => bucket_name,
|
149
150
|
:dir_path => dir_path,
|
150
|
-
:use_filename => true
|
151
|
+
:use_filename => true,
|
152
|
+
:strip_prefix => options[:strip_prefix]
|
151
153
|
}
|
152
154
|
end
|
153
155
|
|
@@ -157,6 +159,7 @@ module Bkblz
|
|
157
159
|
|
158
160
|
# TODO(erick): Rename to downloadbyid
|
159
161
|
desc "download <id> <dir>", "downloads file <id> to directory <dir>"
|
162
|
+
option :strip_prefix, :desc => "prefix to strip from filename when writing locally"
|
160
163
|
def download(file_id, dir_path)
|
161
164
|
parse_opts
|
162
165
|
|
@@ -164,7 +167,8 @@ module Bkblz
|
|
164
167
|
Bkblz::Task::DownloadFile.run Bkblz.config, {
|
165
168
|
:file_id => file_id,
|
166
169
|
:dir_path => dir_path,
|
167
|
-
:use_filename =>
|
170
|
+
:use_filename => false,
|
171
|
+
:strip_prefix => options[:strip_prefix]
|
168
172
|
}
|
169
173
|
end
|
170
174
|
|
@@ -5,6 +5,7 @@ module Bkblz
|
|
5
5
|
class DownloadFile < BaseTask
|
6
6
|
|
7
7
|
task_param :dir_path, :required => true
|
8
|
+
task_param :strip_prefix
|
8
9
|
|
9
10
|
# for downalod by id
|
10
11
|
task_param :file_id
|
@@ -33,7 +34,12 @@ module Bkblz
|
|
33
34
|
raise "unable to write to directory %s" % dir_path
|
34
35
|
end
|
35
36
|
|
36
|
-
|
37
|
+
out_file_name = download_file_info.file_name
|
38
|
+
unless params[:strip_prefix].nil?
|
39
|
+
out_file_name.gsub! params[:strip_prefix], ""
|
40
|
+
end
|
41
|
+
|
42
|
+
f_path = ::File.join dir_path, out_file_name
|
37
43
|
if ::File.exists?(f_path) && !::File.writable?(f_path)
|
38
44
|
raise "unable to write to existing file: %s" % f_path
|
39
45
|
end
|
data/lib/bkblz/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bkblz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erick Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -140,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.7.7
|
143
|
+
rubygems_version: 3.1.4
|
145
144
|
signing_key:
|
146
145
|
specification_version: 4
|
147
146
|
summary: Bkblz GEM for the Backblaze B2 API. https://www.backblaze.com/b2/docs/
|