bkblz 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f294d136a3d0f442f0b416e5f7b6559d675f6f0ab041eee9429bdcbece338eb
4
- data.tar.gz: caac5d40546eb5de9e41ebb1e63ceece8a91dd33d94f7a6c995fa6dc8bd2cf5c
3
+ metadata.gz: 47f032205c5b3348111f4cf170501fa08952ba7817cdc0c3ae06fba4c68c2a7d
4
+ data.tar.gz: d5a9dbae5c9fef54cbdc0e03520d283fe7634fc1b01cb537c81731ee0113d338
5
5
  SHA512:
6
- metadata.gz: d20fe9ccad91955038065f733f5f503a0552f4397c92256ff137d8793d0b992f6e30a8cdb0085906113f5588cfe2f840f8a887055f39714baecc45f20b346726
7
- data.tar.gz: a424d090a142412fde903cc7a1dc510fd705c7a88767e279e70d1d10b428231ccbc11155c5ca7b72d960a5c12ada2f88776a0765c9fe93067373cf493d77fdbd
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 => options[:by_name]
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
- f_path = ::File.join dir_path, download_file_info.file_name
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
@@ -1,3 +1,3 @@
1
1
  module Bkblz
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
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.13
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: 2019-01-09 00:00:00.000000000 Z
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
- rubyforge_project:
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/