undrive_google 1.0.3 → 1.1.1

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: e9fb5d9dbad9a6e4a820430436b8e5f733e2ab11fa1c75c47f31345e13acef8e
4
+ data.tar.gz: de4747adb16f2359ff0fc1ecd745a9805d3d65aa01c060e747b4a28affbb7dfb
5
5
  SHA512:
6
- metadata.gz: 530ded67ba7e198d26904929375a07f1bb09b66442abbccc287187f14f68a7b098ed6da4f4388c1b2b1114fd8768dd14fb7b1a1dbc19962d6176190b982ec3c1
7
- data.tar.gz: 8cf1db466b609713de60873ff2622b3c1f647e8a9f1c8fdb4d5bdc207b59e890ab55f77ec0fe1c594f3eaac7d71df796aa92c5b4ed4fd1382c9354f919eb735e
6
+ metadata.gz: a8d2057ed2476b2259dfbf4c9fb81f2722d1fc157c5ceaf49ec7273510e1fe331d7afa9f82fe2820fae728326fedfa5f066191360938eb9206f45d34a3843ea6
7
+ data.tar.gz: c82cfd0486539c4ed20ac2c53b181368ebf1e49ef87edd205ccfa87e252b6f835e921186e3ab35dc099cf6f5e90a5dd5ad16399ca5396f3de33a139a254438aa
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -10,6 +10,19 @@ 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.1 - 2022-11-29
14
+ ### Fixed
15
+ - Support renaming of HTML zip archives that have assets (e.g. /images/*)
16
+
17
+ ## 1.1.0 - 2022-11-29
18
+ ### Added
19
+ - Integration test for unzip transformation with complex zip file (Peter's Resume!)
20
+ ### Changed
21
+ - rename_proc now defaults to `nil` (meaning not renaming)
22
+ - Set it you need files renamed according to a pattern
23
+ ### Fixed
24
+ - Support HTML zip archives that have assets (e.g. /images/*)
25
+
13
26
  ## 1.0.3 - 2022-11-01
14
27
  ### Added
15
28
  - 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:
@@ -48,7 +52,7 @@ source "https://rubygems.org"
48
52
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
49
53
  git_source(:gitlab) { |repo_name| "https://gitlab.com/#{repo_name}" }
50
54
 
51
- gem "undrive_google", "~> 1.0.3"
55
+ gem "undrive_google", "~> 1.1"
52
56
 
53
57
  # See: https://github.com/gimite/google-drive-ruby/pull/427
54
58
  gem "google_drive", github: "pboling/google-drive-ruby", branch: "pboling-epub-mimetype"
@@ -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,17 +24,13 @@ 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
- @html_path = File.join(destination, f.name)
36
- zip_file.extract(f, @html_path) unless File.exist?(@html_path)
30
+ path = File.join(destination, f.name)
31
+ FileUtils.mkdir_p(File.dirname(path))
32
+ zip_file.extract(f, path) unless File.exist?(path)
33
+ @html_path = path if File.extname(path) == ".html"
37
34
  end
38
35
  end
39
36
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module UndriveGoogle
4
4
  module Version
5
- VERSION = "1.0.3"
5
+ VERSION = "1.1.1"
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.1
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.1
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