undrive_google 1.1.1 → 1.1.2

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.
data/REEK ADDED
File without changes
data/RUBOCOP.md ADDED
@@ -0,0 +1,71 @@
1
+ # RuboCop Usage Guide
2
+
3
+ ## Overview
4
+
5
+ A tale of two RuboCop plugin gems.
6
+
7
+ ### RuboCop Gradual
8
+
9
+ This project uses `rubocop_gradual` instead of vanilla RuboCop for code style checking. The `rubocop_gradual` tool allows for gradual adoption of RuboCop rules by tracking violations in a lock file.
10
+
11
+ ### RuboCop LTS
12
+
13
+ This project uses `rubocop-lts` to ensure, on a best-effort basis, compatibility with Ruby >= 1.9.2.
14
+ RuboCop rules are meticulously configured by the `rubocop-lts` family of gems to ensure that a project is compatible with a specific version of Ruby. See: https://rubocop-lts.gitlab.io for more.
15
+
16
+ ## Checking RuboCop Violations
17
+
18
+ To check for RuboCop violations in this project, always use:
19
+
20
+ ```bash
21
+ bundle exec rake rubocop_gradual:check
22
+ ```
23
+
24
+ **Do not use** the standard RuboCop commands like:
25
+ - `bundle exec rubocop`
26
+ - `rubocop`
27
+
28
+ ## Understanding the Lock File
29
+
30
+ The `.rubocop_gradual.lock` file tracks all current RuboCop violations in the project. This allows the team to:
31
+
32
+ 1. Prevent new violations while gradually fixing existing ones
33
+ 2. Track progress on code style improvements
34
+ 3. Ensure CI builds don't fail due to pre-existing violations
35
+
36
+ ## Common Commands
37
+
38
+ - **Check violations**
39
+ - `bundle exec rake rubocop_gradual`
40
+ - `bundle exec rake rubocop_gradual:check`
41
+ - **(Safe) Autocorrect violations, and update lockfile if no new violations**
42
+ - `bundle exec rake rubocop_gradual:autocorrect`
43
+ - **Force update the lock file (w/o autocorrect) to match violations present in code**
44
+ - `bundle exec rake rubocop_gradual:force_update`
45
+
46
+ ## Workflow
47
+
48
+ 1. Before submitting a PR, run `bundle exec rake rubocop_gradual:autocorrect`
49
+ a. or just the default `bundle exec rake`, as autocorrection is a pre-requisite of the default task.
50
+ 2. If there are new violations, either:
51
+ - Fix them in your code
52
+ - Run `bundle exec rake rubocop_gradual:force_update` to update the lock file (only for violations you can't fix immediately)
53
+ 3. Commit the updated `.rubocop_gradual.lock` file along with your changes
54
+
55
+ ## Never add inline RuboCop disables
56
+
57
+ Do not add inline `rubocop:disable` / `rubocop:enable` comments anywhere in the codebase (including specs, except when following the few existing `rubocop:disable` patterns for a rule already being disabled elsewhere in the code). We handle exceptions in two supported ways:
58
+
59
+ - Permanent/structural exceptions: prefer adjusting the RuboCop configuration (e.g., in `.rubocop.yml`) to exclude a rule for a path or file pattern when it makes sense project-wide.
60
+ - Temporary exceptions while improving code: record the current violations in `.rubocop_gradual.lock` via the gradual workflow:
61
+ - `bundle exec rake rubocop_gradual:autocorrect` (preferred; will autocorrect what it can and update the lock only if no new violations were introduced)
62
+ - If needed, `bundle exec rake rubocop_gradual:force_update` (as a last resort when you cannot fix the newly reported violations immediately)
63
+
64
+ In general, treat the rules as guidance to follow; fix violations rather than ignore them. For example, RSpec conventions in this project expect `described_class` to be used in specs that target a specific class under test.
65
+
66
+ ## Benefits of rubocop_gradual
67
+
68
+ - Allows incremental adoption of code style rules
69
+ - Prevents CI failures due to pre-existing violations
70
+ - Provides a clear record of code style debt
71
+ - Enables focused efforts on improving code quality over time
data/SECURITY.md CHANGED
@@ -2,24 +2,20 @@
2
2
 
3
3
  ## Supported Versions
4
4
 
5
- | Version | Supported | EOL | Post-EOL / Enterprise |
6
- |---------|-----------|---------|---------------------------------------|
7
- | 1.0.x | ✅ | 04/2025 | [Tidelift Subscription][tidelift-ref] |
5
+ | Version | Supported |
6
+ |----------|-----------|
7
+ | 1.latest | ✅ |
8
8
 
9
- ### EOL Policy
9
+ ## Security contact information
10
10
 
11
- Non-commercial support for the oldest version of Ruby (which itself is going EOL) will be dropped each year in April.
12
-
13
- ## Reporting a Vulnerability
14
-
15
- To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).
11
+ To report a security vulnerability, please use the
12
+ [Tidelift security contact](https://tidelift.com/security).
16
13
  Tidelift will coordinate the fix and disclosure.
17
14
 
18
- ## UndriveGoogle for Enterprise
19
-
20
- Available as part of the Tidelift Subscription.
15
+ ## Additional Support
21
16
 
22
- The maintainers of undrive_google and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications
23
- Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.][tidelift-ref]
17
+ If you are interested in support for versions older than the latest release,
18
+ please consider sponsoring the project / maintainer @ https://liberapay.com/pboling/donate,
19
+ or find other sponsorship links in the [README].
24
20
 
25
- [tidelift-ref]: https://tidelift.com/subscription/pkg/rubygems-undrive_google?utm_source=rubygems-undrive_google&utm_medium=referral&utm_campaign=enterprise&utm_term=repo
21
+ [README]: README.md
@@ -16,7 +16,7 @@ module UndriveGoogle
16
16
  return if Dir.empty?(dir)
17
17
 
18
18
  puts "Sweeping directory clean #{dir}" if Options.instance.verbose
19
- FileUtils.rm_rf Dir.glob("#{dir}/*")
19
+ FileUtils.rm_rf(Dir.glob("#{dir}/*"))
20
20
  end
21
21
  end
22
22
  end
@@ -4,6 +4,7 @@ module UndriveGoogle
4
4
  # A file on Google Drive
5
5
  class CaptiveFile
6
6
  include Singleton
7
+
7
8
  attr_accessor :options, :exports
8
9
 
9
10
  # @return nil
@@ -4,6 +4,7 @@ module UndriveGoogle
4
4
  # Defines the CLI behavior & provides the Google Drive Session
5
5
  class CLI
6
6
  include Singleton
7
+
7
8
  attr_reader :parser, :options, :session
8
9
 
9
10
  # Options specified on the command line are collected in *@options*.
@@ -5,9 +5,20 @@ module UndriveGoogle
5
5
  class Options
6
6
  include Singleton
7
7
 
8
- attr_accessor :config_yaml, :key_file, :file_id, :file_by, :extensions, :unzip,
9
- :keep_zip, :rename, :rename_proc, :lang, :title,
10
- :dir, :sweep, :verbose
8
+ attr_accessor :config_yaml,
9
+ :key_file,
10
+ :file_id,
11
+ :file_by,
12
+ :extensions,
13
+ :unzip,
14
+ :keep_zip,
15
+ :rename,
16
+ :rename_proc,
17
+ :lang,
18
+ :title,
19
+ :dir,
20
+ :sweep,
21
+ :verbose
11
22
 
12
23
  def initialize
13
24
  load_yaml(true)
@@ -15,7 +26,7 @@ module UndriveGoogle
15
26
 
16
27
  def define_options(parser)
17
28
  parser.banner = "Usage: undrive_google [options]"
18
- parser.separator ""
29
+ parser.separator("")
19
30
 
20
31
  # Handle YAML, as default overrides
21
32
  config_yaml_option(parser)
@@ -34,7 +45,7 @@ module UndriveGoogle
34
45
  sweep_option(parser)
35
46
  verbose_option(parser)
36
47
 
37
- parser.separator ""
48
+ parser.separator("")
38
49
 
39
50
  # Print an options summary.
40
51
  parser.on_tail("-h", "--help", "Show this message") do
@@ -47,30 +58,46 @@ module UndriveGoogle
47
58
 
48
59
  # CLI options will take precedence over values in YAML
49
60
  def config_yaml_option(parser)
50
- parser.on("-c", "--config-yaml PATH", String,
51
- "Path to UndriveGoogle config YAML file") do |config_yaml|
61
+ parser.on(
62
+ "-c",
63
+ "--config-yaml PATH",
64
+ String,
65
+ "Path to UndriveGoogle config YAML file",
66
+ ) do |config_yaml|
52
67
  self.config_yaml = config_yaml
53
68
  load_yaml
54
69
  end
55
70
  end
56
71
 
57
72
  def key_file_option(parser)
58
- parser.on("-k", "--key-file PATH", String,
59
- "Path to Google Service Account Keys JSON file") do |key_file|
73
+ parser.on(
74
+ "-k",
75
+ "--key-file PATH",
76
+ String,
77
+ "Path to Google Service Account Keys JSON file",
78
+ ) do |key_file|
60
79
  self.key_file = key_file
61
80
  end
62
81
  end
63
82
 
64
83
  def file_id_option(parser)
65
- parser.on("-i", "--file-id ID", String,
66
- "ID used to find file (key or title)") do |file_id|
84
+ parser.on(
85
+ "-i",
86
+ "--file-id ID",
87
+ String,
88
+ "ID used to find file (key or title)",
89
+ ) do |file_id|
67
90
  self.file_id = file_id
68
91
  end
69
92
  end
70
93
 
71
94
  def by_option(parser)
72
- parser.on("-b", "--file-by [TYPE]", %i[key title],
73
- "Select type of ID used to find file (key, title)") do |file_by|
95
+ parser.on(
96
+ "-b",
97
+ "--file-by [TYPE]",
98
+ %i[key title],
99
+ "Select type of ID used to find file (key, title)",
100
+ ) do |file_by|
74
101
  self.file_by = file_by
75
102
  end
76
103
  end
@@ -108,8 +135,12 @@ module UndriveGoogle
108
135
  end
109
136
 
110
137
  def dir_option(parser)
111
- parser.on("-d", "--dir PATH", String,
112
- "Path to directory where liberated files will go") do |dir|
138
+ parser.on(
139
+ "-d",
140
+ "--dir PATH",
141
+ String,
142
+ "Path to directory where liberated files will go",
143
+ ) do |dir|
113
144
  self.dir = dir.strip
114
145
  end
115
146
  end
@@ -128,8 +159,11 @@ module UndriveGoogle
128
159
 
129
160
  def sweep_option(parser)
130
161
  # Boolean switch.
131
- parser.on("-s", "--[no-]sweep",
132
- "Delete all files from directory specified by -d or --dir prior to liberation") do |sweep|
162
+ parser.on(
163
+ "-s",
164
+ "--[no-]sweep",
165
+ "Delete all files from directory specified by -d or --dir prior to liberation",
166
+ ) do |sweep|
133
167
  self.sweep = sweep
134
168
  end
135
169
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module UndriveGoogle
4
- Transformation = Struct.new(:download,
5
- :unzip,
6
- :fix_html,
7
- :rename_html,
8
- :delete_zip,
9
- keyword_init: true) do
4
+ Transformation = Struct.new(
5
+ :download,
6
+ :unzip,
7
+ :fix_html,
8
+ :rename_html,
9
+ :delete_zip,
10
+ keyword_init: true,
11
+ ) do
10
12
  def liberate!
11
13
  each(&:process)
12
14
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module UndriveGoogle
4
4
  module Version
5
- VERSION = "1.1.1"
5
+ VERSION = "1.1.2"
6
6
  end
7
7
  end
@@ -11,7 +11,7 @@ require "singleton" # The Ruby Singleton library
11
11
  begin
12
12
  require "zip"
13
13
  rescue LoadError
14
- warn "[WARN] Failed to load gem rubyzip, so unzip (and thus html) options will not work."
14
+ warn("[WARN] Failed to load gem rubyzip, so unzip (and thus html) options will not work.")
15
15
  end
16
16
  require "version_gem"
17
17
  require "google_drive"
@@ -42,14 +42,14 @@ module UndriveGoogle
42
42
 
43
43
  FILE_BY = {
44
44
  title: :title,
45
- key: :key
45
+ key: :key,
46
46
  }.freeze
47
47
  # epub is conditionally in DL_FILE_TYPES depending on the google_drive gem used.
48
48
  DL_FILE_TYPES = if HAS_EPUB
49
- %i[docx odt rtf pdf txt zip epub].freeze
50
- else
51
- %i[docx odt rtf pdf txt zip].freeze
52
- end
49
+ %i[docx odt rtf pdf txt zip epub].freeze
50
+ else
51
+ %i[docx odt rtf pdf txt zip].freeze
52
+ end
53
53
  # html is not in DL_FILE_TYPES because you can't download it directly.
54
54
  # html is downloaded as zip, and must then be unzipped.
55
55
  ALL_FILE_TYPES = DL_FILE_TYPES + %i[html].freeze
@@ -0,0 +1,4 @@
1
+ module UndriveGoogle
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
data.tar.gz.sig CHANGED
Binary file