undrive_google 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0081f9e7ae701e26550ffe3e37cf522a2b10d5a907abb62445e386e0940c1a25'
4
- data.tar.gz: c7d6711773d08db4e5069662f232b05fdeb7e49c0a885bd98723067ff8541101
3
+ metadata.gz: 21db54609693c71de63f96619b5fa2d00b19d3bd1cd5ebe6c361b462c01159f6
4
+ data.tar.gz: a61c20ce99a83bdf0c73d982e8c91b6d9e8382e1047597e14872ee62a939c7bc
5
5
  SHA512:
6
- metadata.gz: 530ded67ba7e198d26904929375a07f1bb09b66442abbccc287187f14f68a7b098ed6da4f4388c1b2b1114fd8768dd14fb7b1a1dbc19962d6176190b982ec3c1
7
- data.tar.gz: 8cf1db466b609713de60873ff2622b3c1f647e8a9f1c8fdb4d5bdc207b59e890ab55f77ec0fe1c594f3eaac7d71df796aa92c5b4ed4fd1382c9354f919eb735e
6
+ metadata.gz: 6b127a2fbe3f90aac9aa13f97ef67a247f852cfc4bb141e103aa693833b3e5b71045f77661f0e4c663379dc5be0563e21bfdca9d37cfc808071c48f218238ec5
7
+ data.tar.gz: 211717e95caded549e29b6d89316abc1b32ee5ead71ebfd18b534a3c0b1c8b06bb3305e17f787e6284f7a957f42dde0a4ea7610540c35f22ef733b822d06af4f
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -10,6 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
10
10
  ### Fixed
11
11
  ### Removed
12
12
 
13
+ ## 1.1.0 - 2022-11-29
14
+ ### Added
15
+ - Integration test for unzip transformation with complex zip file (Peter's Resume!)
16
+ ### Changed
17
+ - rename_proc now defaults to `nil` (meaning not renaming)
18
+ - Set it you need files renamed according to a pattern
19
+ ### Fixed
20
+ - Support HTML zip archives that have assets (e.g. /images/*)
21
+
13
22
  ## 1.0.3 - 2022-11-01
14
23
  ### Added
15
24
  - Support for sweep option
data/README.md CHANGED
@@ -36,7 +36,11 @@ gem "rubyzip", github: "rubyzip/rubyzip", branch: "master"
36
36
  When liberating your files, ensure the script will use the Gemfile if it isn't in the same directory where you are running the `undrive_google` command:
37
37
  ```shell
38
38
  BUNDLE_GEMFILE=path/to/Gemfile bundle update
39
- BUNDLE_GEMFILE=path/to/Gemfile undrive_google -c path/to/config
39
+ BUNDLE_GEMFILE=path/to/Gemfile bundle exec undrive_google -c path/to/config
40
+ ```
41
+ NOTE: If the Gemfile and the config are in the same, current, directory, you can simply run:
42
+ ```shell
43
+ bundle exec undrive_google
40
44
  ```
41
45
 
42
46
  My complete `Gemfile` looks like this:
@@ -57,7 +61,7 @@ gem "google_drive", github: "pboling/google-drive-ruby", branch: "pboling-epub-m
57
61
  gem "rubyzip", github: "rubyzip/rubyzip", branch: "master"
58
62
  ```
59
63
 
60
- My config file looks like this (sanitized a bit):
64
+ My `undrive_google.yml` config file looks like this (sanitized a bit):
61
65
  ```yaml
62
66
  file_id: "the-key-to-my-google-drive-file(find-in-the-url)"
63
67
  key_file: serviceid-1234567890.json
@@ -181,9 +185,10 @@ keep_zip: true
181
185
  # Only applies to files not explicitly specified with rename-<type>
182
186
  # Will never apply to the html file unzipped from the .zip
183
187
  # Used as: file_name.gsub(rename_pattern[0], rename_pattern[1])
184
- rename_pattern:
185
- - "_"
186
- - " "
188
+ # By default, no renaming, must be specified
189
+ # rename_pattern:
190
+ # - "_"
191
+ # - " "
187
192
 
188
193
  # [PATH]
189
194
  dir: '' # defaults to current working directory
@@ -41,6 +41,7 @@ module UndriveGoogle
41
41
  def rename
42
42
  exact_name = Options.instance.rename[extension]
43
43
  return exact_name if exact_name
44
+ return file.title unless Options.instance.rename_proc
44
45
 
45
46
  Options.instance.rename[extension] = Options.instance.rename_proc.call(file.title)
46
47
  end
@@ -151,7 +151,7 @@ module UndriveGoogle
151
151
  self.unzip = true
152
152
  self.keep_zip = true
153
153
  self.rename = {}
154
- self.rename_proc = RENAME_PROC
154
+ self.rename_proc = nil
155
155
  self.title = nil
156
156
  self.dir = nil
157
157
  self.lang = "en"
@@ -4,10 +4,11 @@ module UndriveGoogle
4
4
  module Transformations
5
5
  # Download a particular version of the file.
6
6
  class Unzip
7
- attr_accessor :file_path, :html_path
7
+ attr_accessor :file_path, :html_path, :destination
8
8
 
9
- def initialize(file_path)
9
+ def initialize(file_path, destination = nil)
10
10
  @file_path = file_path
11
+ @destination = destination || File.dirname(file_path)
11
12
  end
12
13
 
13
14
  # @return nil
@@ -23,16 +24,11 @@ module UndriveGoogle
23
24
 
24
25
  private
25
26
 
26
- def destination
27
- File.dirname(file_path)
28
- end
29
-
30
27
  def extract_zip(file, destination)
31
- FileUtils.mkdir_p(destination)
32
-
33
28
  Zip::File.open(file) do |zip_file|
34
29
  zip_file.each do |f|
35
30
  @html_path = File.join(destination, f.name)
31
+ FileUtils.mkdir_p(File.dirname(@html_path))
36
32
  zip_file.extract(f, @html_path) unless File.exist?(@html_path)
37
33
  end
38
34
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module UndriveGoogle
4
4
  module Version
5
- VERSION = "1.0.3"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: undrive_google
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -36,7 +36,7 @@ cert_chain:
36
36
  gwGrEXGQGDZ0NIgBcmvMOqlXjkGQwQvugKycJ024z89+fz2332vdZIKTrSxJrXGk
37
37
  4/bR9A==
38
38
  -----END CERTIFICATE-----
39
- date: 2022-11-01 00:00:00.000000000 Z
39
+ date: 2022-11-29 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: google_drive
@@ -139,7 +139,7 @@ metadata:
139
139
  source_code_uri: https://git.sr.ht/~galtzo/undrive_google
140
140
  changelog_uri: https://git.sr.ht/~galtzo/undrive_google
141
141
  bug_tracker_uri: https://todo.sr.ht/~galtzo/undrive_google
142
- documentation_uri: https://www.rubydoc.info/gems/undrive_google/1.0.3
142
+ documentation_uri: https://www.rubydoc.info/gems/undrive_google/1.1.0
143
143
  wiki_uri: https://man.sr.ht/~galtzo/undrive_google/
144
144
  funding_uri: https://liberapay.com/pboling
145
145
  mailing_list_uri: https://lists.sr.ht/~galtzo/undrive_google-devel
@@ -159,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  requirements: []
162
- rubygems_version: 3.3.24
162
+ rubygems_version: 3.3.26
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: "\U0001F3F4 Liberate files from your Google Drive"
metadata.gz.sig CHANGED
Binary file