lt-lcms 0.5.0 → 0.6.1

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.dockerignore +15 -0
  3. data/.github/workflows/.keep +0 -0
  4. data/.gitignore +1 -0
  5. data/.rubocop.yml +5 -2
  6. data/.ruby-version +1 -1
  7. data/CHANGELOG.md +19 -1
  8. data/Dockerfile +17 -0
  9. data/Gemfile.lock +79 -107
  10. data/README.md +6 -2
  11. data/Steepfile +30 -0
  12. data/docker-compose.yml +8 -0
  13. data/docker-entrypoint.sh +3 -0
  14. data/lib/lt/lcms/lesson/downloader/base.rb +2 -0
  15. data/lib/lt/lcms/lesson/downloader/gdoc.rb +4 -4
  16. data/lib/lt/lcms/lesson/uploader/gdoc.rb +1 -1
  17. data/lib/lt/lcms/version.rb +1 -1
  18. data/lt-lcms.gemspec +8 -7
  19. data/rbs_collection.yaml +24 -0
  20. data/sig/lt/lcms/lesson/downloader/base.rbs +33 -0
  21. data/sig/lt/lcms/lesson/downloader/gdoc.rbs +34 -0
  22. data/sig/lt/lcms/lesson/downloader/gslide.rbs +19 -0
  23. data/sig/lt/lcms/lesson/downloader/gspreadsheet.rbs +17 -0
  24. data/sig/lt/lcms/lesson/downloader/pdf.rbs +15 -0
  25. data/sig/lt/lcms/lesson/downloader.rbs +8 -0
  26. data/sig/lt/lcms/lesson/uploader/gdoc.rbs +17 -0
  27. data/sig/lt/lcms/version.rbs +5 -0
  28. data/sig/lt/lcms.rbs +4 -0
  29. data/sig/polifill/google-api-client.rbs +5 -0
  30. data/sig/polifill/httparty.rbs +5 -0
  31. data/vendor/rbs/lt-google-api/lib/lt/google/api/auth/cli.rbs +22 -0
  32. data/vendor/rbs/lt-google-api/lib/lt/google/api/auth/credentials.rbs +28 -0
  33. data/vendor/rbs/lt-google-api/lib/lt/google/api/auth/service.rbs +36 -0
  34. data/vendor/rbs/lt-google-api/lib/lt/google/api/drive.rbs +30 -0
  35. data/vendor/rbs/lt-google-api/lib/lt/google/api/version.rbs +7 -0
  36. data/vendor/rbs/lt-google-api/lib/lt/google/api.rbs +6 -0
  37. data/vendor/rbs/lt-google-api/polifill/google-api-clients.rbs +15 -0
  38. data/vendor/rbs/lt-google-api/polifill/googleauth.rbs +31 -0
  39. data/vendor/rbs/lt-google-api/polifill/rails.rbs +5 -0
  40. metadata +43 -22
  41. data/.github/workflows/rubocop-analysis.yml +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5e933c5e37f0d126011fd282627b7e32ce6b7161479dd9a6c9fb3f175b4dbad
4
- data.tar.gz: 44e7764f8a516e049a4a937d0ca0167f82f303d31abda8dbd2c3fa3eb168caf9
3
+ metadata.gz: 530ab52b721b8dddbd8ef8f5481bc32b34094f8cffd45b4fb42fea7a846efc52
4
+ data.tar.gz: 7b2c1e6c09a3973022b56d9688aeb67fd6d3d8165d64428684e442d34c163686
5
5
  SHA512:
6
- metadata.gz: b4f08ae299d437e8434f2f854b87b1bec0dccec89988b58aae298cbe5859fc9ee54b5f99f6a5d313e5120d8bf9bf9ccd5ebca80bb7659dcdfdf1e9bbbef4589b
7
- data.tar.gz: 67871dac1055d75a8e460f8ffd58a36cc92d9d2ea640e8d2286f57130c264812f60201ee317ec2fb7dd65b7ec516b861089ca570d08ca78fde695fcb9f98b7b8
6
+ metadata.gz: 7eec77c5a06061576548bd15aa6ca03ebec62a723c7035fac0d01e51026ef9c3efa9ec42acf72b2e43038901781ada6a4852bbdeb452a564e448a3f2d2b9bdcb
7
+ data.tar.gz: 56cd3e7bc068162f013e8a2af3c351b119b945eaa3e9fee3adce83851179890f52e4ea67cd4fbe50a0a97b97ad766de7bc7c193e20d130aa3eb0d6d325ec58db
data/.dockerignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # Ignore IDE specific files
11
+ .idea/
12
+
13
+ # Misc
14
+ .DS_Store
15
+ .gem_rbs_collection/
File without changes
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
 
8
8
  # Misc
9
9
  .DS_Store
10
+ .gem_rbs_collection/
data/.rubocop.yml CHANGED
@@ -13,7 +13,10 @@ AllCops:
13
13
  - db/schema.rb
14
14
  - node_modules/**/*
15
15
  NewCops: enable
16
- TargetRubyVersion: 3.2
16
+ TargetRubyVersion: 2.7
17
+
18
+ Gemspec/DevelopmentDependencies:
19
+ EnforcedStyle: gemspec
17
20
 
18
21
  Layout/LineLength:
19
22
  Max: 120
@@ -31,7 +34,7 @@ Metrics/BlockLength:
31
34
  Exclude:
32
35
  - '**/*_spec.rb'
33
36
  - 'config/routes.rb'
34
- ExcludedMethods: ['guard', 'included']
37
+ AllowedMethods: ['guard', 'included']
35
38
 
36
39
  Metrics/ClassLength:
37
40
  Max: 250
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.2.1
1
+ 2.7.7
data/CHANGELOG.md CHANGED
@@ -4,7 +4,25 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [Unreleased](https://github.com/learningtapestry/lcms-engine/compare/v0.5.0...HEAD)
7
+ ## [Unreleased](https://github.com/learningtapestry/lcms-engine/compare/v0.6.1...HEAD)
8
+
9
+ ## [0.6.1](https://github.com/learningtapestry/lt-lcms/compare/v0.6.1...v0.6.0) - 2025-06-21
10
+
11
+ ### Added
12
+
13
+ - Bump lt-google-api to 0.3.2
14
+
15
+ ## [0.6.0](https://github.com/learningtapestry/lt-lcms/compare/v0.5.0...v0.6.0) - 2023-12-23
16
+ ### Added
17
+
18
+ - Added Docker support [@paranoicsan](https://github.com/paranoicsan)
19
+ - Added RBS support [@paranoicsan](https://github.com/paranoicsan)
20
+
21
+ ### Changed
22
+
23
+ - Updated dependencies [@paranoicsan](https://github.com/paranoicsan)
24
+ - Ruby updated to 2.7.7 [@shlag3n](https://github.com/shlag3n) at the main branch, 3.x version will be at separate branch ruby-3-upgrade
25
+ - Bump lt-google-api to 0.3.0 to upgrade google api to 0.11 [@shlag3n](https://github.com/shlag3n)
8
26
 
9
27
  ## [0.5.0](https://github.com/learningtapestry/lt-lcms/compare/v0.4.4...v0.5.0) - 2023-07-07
10
28
 
data/Dockerfile ADDED
@@ -0,0 +1,17 @@
1
+ FROM ruby:2.7.7
2
+
3
+ ENV APP_PATH=/app/
4
+ ENV LANG=C.UTF-8
5
+ ENV GIT_AUTHOR_NAME="Joe Doe"
6
+ ENV GIT_AUTHOR_EMAIL=joe@doe.com
7
+
8
+ WORKDIR $APP_PATH
9
+
10
+ COPY . $APP_PATH
11
+
12
+ ENV BUNDLER_VERSION=2.4.22
13
+ RUN gem install bundler:"$BUNDLER_VERSION" \
14
+ && bundle install --jobs `expr $(cat /proc/cpuinfo | grep -c "cpu cores") - 1` --retry 3 \
15
+ && rm -rf /usr/local/bundle/cache/*.gem \
16
+ && find /usr/local/bundle/gems/ -name "*.c" -delete \
17
+ && find /usr/local/bundle/gems/ -name "*.o" -delete
data/Gemfile.lock CHANGED
@@ -1,156 +1,128 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lt-lcms (0.4.4)
5
- google-api-client (~> 0.38)
6
- httparty (~> 0.18)
7
- lt-google-api (~> 0.2, >= 0.2.4)
4
+ lt-lcms (0.6.1)
5
+ google-apis-core (~> 0.16.0)
6
+ httparty (~> 0.22)
7
+ lt-google-api (~> 0.3.2)
8
8
  nokogiri (~> 1.10, >= 1.10.8)
9
9
  rubyzip (~> 2)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (6.1.4)
15
- concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 1.6, < 2)
17
- minitest (>= 5.1)
18
- tzinfo (~> 2.0)
19
- zeitwerk (~> 2.3)
20
- addressable (2.8.0)
21
- public_suffix (>= 2.0.2, < 5.0)
22
- ast (2.4.2)
23
- childprocess (4.1.0)
24
- concurrent-ruby (1.1.9)
14
+ addressable (2.8.7)
15
+ public_suffix (>= 2.0.2, < 7.0)
16
+ ast (2.4.3)
17
+ base64 (0.3.0)
18
+ childprocess (5.1.0)
19
+ logger (~> 1.5)
20
+ csv (3.3.5)
25
21
  declarative (0.0.20)
26
- faraday (1.5.1)
27
- faraday-em_http (~> 1.0)
28
- faraday-em_synchrony (~> 1.0)
29
- faraday-excon (~> 1.1)
30
- faraday-httpclient (~> 1.0.1)
31
- faraday-net_http (~> 1.0)
32
- faraday-net_http_persistent (~> 1.1)
33
- faraday-patron (~> 1.0)
34
- multipart-post (>= 1.2, < 3)
22
+ faraday (2.8.1)
23
+ base64
24
+ faraday-net_http (>= 2.0, < 3.1)
35
25
  ruby2_keywords (>= 0.0.4)
36
- faraday-em_http (1.0.0)
37
- faraday-em_synchrony (1.0.0)
38
- faraday-excon (1.1.0)
39
- faraday-httpclient (1.0.1)
40
- faraday-net_http (1.0.1)
41
- faraday-net_http_persistent (1.2.0)
42
- faraday-patron (1.0.0)
43
- gems (1.2.0)
44
- google-api-client (0.53.0)
45
- google-apis-core (~> 0.1)
46
- google-apis-generator (~> 0.1)
47
- google-apis-core (0.4.0)
26
+ faraday-net_http (3.0.2)
27
+ google-apis-core (0.16.0)
48
28
  addressable (~> 2.5, >= 2.5.1)
49
- googleauth (>= 0.16.2, < 2.a)
50
- httpclient (>= 2.8.1, < 3.a)
29
+ googleauth (~> 1.9)
30
+ httpclient (>= 2.8.3, < 3.a)
51
31
  mini_mime (~> 1.0)
32
+ mutex_m
52
33
  representable (~> 3.0)
53
34
  retriable (>= 2.0, < 4.a)
54
- rexml
55
- webrick
56
- google-apis-discovery_v1 (0.6.0)
57
- google-apis-core (>= 0.4, < 2.a)
58
- google-apis-generator (0.4.0)
59
- activesupport (>= 5.0)
60
- gems (~> 1.2)
61
- google-apis-core (>= 0.4, < 2.a)
62
- google-apis-discovery_v1 (~> 0.5)
63
- thor (>= 0.20, < 2.a)
64
- googleauth (0.16.2)
65
- faraday (>= 0.17.3, < 2.0)
35
+ google-apis-drive_v3 (0.63.0)
36
+ google-apis-core (>= 0.15.0, < 2.a)
37
+ google-cloud-env (2.1.1)
38
+ faraday (>= 1.0, < 3.a)
39
+ googleauth (1.11.2)
40
+ faraday (>= 1.0, < 3.a)
41
+ google-cloud-env (~> 2.1)
66
42
  jwt (>= 1.4, < 3.0)
67
- memoist (~> 0.16)
68
43
  multi_json (~> 1.11)
69
44
  os (>= 0.9, < 2.0)
70
- signet (~> 0.14)
71
- httparty (0.18.1)
72
- mime-types (~> 3.0)
45
+ signet (>= 0.16, < 2.a)
46
+ httparty (0.23.1)
47
+ csv
48
+ mini_mime (>= 1.0.0)
73
49
  multi_xml (>= 0.5.2)
74
- httpclient (2.8.3)
75
- i18n (1.8.10)
76
- concurrent-ruby (~> 1.0)
50
+ httpclient (2.9.0)
51
+ mutex_m
77
52
  iniparse (1.5.0)
78
- json (2.6.3)
79
- jwt (2.2.3)
80
- language_server-protocol (3.17.0.3)
81
- lt-google-api (0.2.4)
82
- google-api-client (~> 0.46)
83
- googleauth (~> 0.14)
84
- memoist (0.16.2)
85
- mime-types (3.3.1)
86
- mime-types-data (~> 3.2015)
87
- mime-types-data (3.2021.0704)
88
- mini_mime (1.1.0)
89
- minitest (5.14.4)
53
+ json (2.12.2)
54
+ jwt (2.10.1)
55
+ base64
56
+ language_server-protocol (3.17.0.5)
57
+ lint_roller (1.1.0)
58
+ logger (1.7.0)
59
+ lt-google-api (0.3.2)
60
+ google-apis-drive_v3 (~> 0.63.0)
61
+ googleauth (~> 1.11.2)
62
+ mini_mime (1.1.5)
90
63
  multi_json (1.15.0)
91
64
  multi_xml (0.6.0)
92
- multipart-post (2.1.1)
93
- nokogiri (1.15.3-x86_64-linux)
65
+ mutex_m (0.3.0)
66
+ nokogiri (1.15.7-aarch64-linux)
94
67
  racc (~> 1.4)
95
- os (1.1.1)
96
- overcommit (0.58.0)
97
- childprocess (>= 0.6.3, < 5)
68
+ os (1.1.4)
69
+ overcommit (0.67.1)
70
+ childprocess (>= 0.6.3, < 6)
98
71
  iniparse (~> 1.4)
99
- rexml (~> 3.2)
100
- parallel (1.23.0)
101
- parser (3.2.2.3)
72
+ rexml (>= 3.3.9)
73
+ parallel (1.27.0)
74
+ parser (3.3.8.0)
102
75
  ast (~> 2.4.1)
103
76
  racc
104
- public_suffix (4.0.6)
105
- racc (1.7.1)
77
+ prism (1.4.0)
78
+ public_suffix (5.1.1)
79
+ racc (1.8.1)
106
80
  rainbow (3.1.1)
107
- rake (13.0.3)
108
- regexp_parser (2.8.1)
109
- representable (3.1.1)
81
+ rake (13.3.0)
82
+ regexp_parser (2.10.0)
83
+ representable (3.2.0)
110
84
  declarative (< 0.1.0)
111
85
  trailblazer-option (>= 0.1.1, < 0.2.0)
112
86
  uber (< 0.2.0)
113
87
  retriable (3.1.2)
114
- rexml (3.2.5)
115
- rubocop (1.54.1)
88
+ rexml (3.4.1)
89
+ rubocop (1.77.0)
116
90
  json (~> 2.3)
117
- language_server-protocol (>= 3.17.0)
91
+ language_server-protocol (~> 3.17.0.2)
92
+ lint_roller (~> 1.1.0)
118
93
  parallel (~> 1.10)
119
- parser (>= 3.2.2.3)
94
+ parser (>= 3.3.0.2)
120
95
  rainbow (>= 2.2.2, < 4.0)
121
- regexp_parser (>= 1.8, < 3.0)
122
- rexml (>= 3.2.5, < 4.0)
123
- rubocop-ast (>= 1.28.0, < 2.0)
96
+ regexp_parser (>= 2.9.3, < 3.0)
97
+ rubocop-ast (>= 1.45.1, < 2.0)
124
98
  ruby-progressbar (~> 1.7)
125
- unicode-display_width (>= 2.4.0, < 3.0)
126
- rubocop-ast (1.29.0)
127
- parser (>= 3.2.1.0)
99
+ unicode-display_width (>= 2.4.0, < 4.0)
100
+ rubocop-ast (1.45.1)
101
+ parser (>= 3.3.7.2)
102
+ prism (~> 1.4)
128
103
  ruby-progressbar (1.13.0)
129
104
  ruby2_keywords (0.0.5)
130
- rubyzip (2.3.2)
131
- signet (0.15.0)
132
- addressable (~> 2.3)
133
- faraday (>= 0.17.3, < 2.0)
105
+ rubyzip (2.4.1)
106
+ signet (0.19.0)
107
+ addressable (~> 2.8)
108
+ faraday (>= 0.17.5, < 3.a)
134
109
  jwt (>= 1.5, < 3.0)
135
110
  multi_json (~> 1.10)
136
- thor (1.1.0)
137
- trailblazer-option (0.1.1)
138
- tzinfo (2.0.4)
139
- concurrent-ruby (~> 1.0)
111
+ trailblazer-option (0.1.2)
140
112
  uber (0.1.0)
141
- unicode-display_width (2.4.2)
142
- webrick (1.7.0)
143
- zeitwerk (2.4.2)
113
+ unicode-display_width (3.1.4)
114
+ unicode-emoji (~> 4.0, >= 4.0.4)
115
+ unicode-emoji (4.0.4)
144
116
 
145
117
  PLATFORMS
146
- x86_64-linux
118
+ aarch64-linux
147
119
 
148
120
  DEPENDENCIES
149
- bundler (~> 1.16)
121
+ bundler (~> 2.4)
150
122
  lt-lcms!
151
- overcommit (~> 0.57)
123
+ overcommit (~> 0.60)
152
124
  rake (~> 13.0)
153
125
  rubocop (~> 1.54)
154
126
 
155
127
  BUNDLED WITH
156
- 2.4.6
128
+ 2.4.22
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # Lt::Lcms
2
2
 
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/07fa3d2919744d3bf328/maintainability)](https://codeclimate.com/github/learningtapestry/lt-lcms/maintainability)
4
3
  [![Codeship Status for learningtapestry/lt-lcms](https://app.codeship.com/projects/b151f4e0-26f8-0137-ffc2-3e508df156a9/status?branch=master)](https://app.codeship.com/projects/330485)
5
4
 
6
-
7
5
  ## Installation
8
6
 
9
7
  Add this line to your application's Gemfile:
@@ -34,6 +32,12 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
34
32
 
35
33
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
36
34
 
35
+ ### Docker
36
+
37
+ ```shell
38
+ docker buildx build --platform linux/arm64/v8,linux/amd64 -t learningtapestry/lt-lcms:legacy --push .
39
+ ```
40
+
37
41
  ## Contributing
38
42
 
39
43
  Bug reports and pull requests are welcome on GitHub at https://github.com/learningtapestry/lt-lcms.
data/Steepfile ADDED
@@ -0,0 +1,30 @@
1
+ # D = Steep::Diagnostic
2
+ #
3
+ target :lib do
4
+ signature "sig", "vendor/rbs"
5
+
6
+ check "lib" # Directory name
7
+ # # check "Gemfile" # File name
8
+ # check "app/models/**/*.rb" # Glob
9
+ # # ignore "lib/templates/*.rb"
10
+ #
11
+ # # library "pathname" # Standard libraries
12
+ # # library "strong_json" # Gems
13
+ library "cgi", "rbs", "tempfile"
14
+ #
15
+ # # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
16
+ # # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
17
+ # # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
18
+ # # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
19
+ # # configure_code_diagnostics do |hash| # You can setup everything yourself
20
+ # # hash[D::Ruby::NoMethod] = :information
21
+ # # end
22
+ end
23
+
24
+ # target :test do
25
+ # signature "sig", "sig-private"
26
+ #
27
+ # check "test"
28
+ #
29
+ # # library "pathname" # Standard libraries
30
+ # end
@@ -0,0 +1,8 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ app:
5
+ image: learningtapestry/lt-lcms:legacy
6
+ command: bash -c "bundle install && tail -f /dev/null"
7
+ volumes:
8
+ - .:/app
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ set -e
3
+ exec "$@"
@@ -36,6 +36,8 @@ module Lt
36
36
  self
37
37
  rescue ::Google::Apis::RateLimitError
38
38
  raise unless options[:import_retry]
39
+
40
+ retry_attempt = retry_attempt.to_i
39
41
  raise if retry_attempt >= MAX_RETRY_COUNT
40
42
 
41
43
  sleep RETRY_DELAYES[retry_attempt] * rand(1.0..5.0)
@@ -43,15 +43,15 @@ module Lt
43
43
  return html unless (match = html.scan(GOOGLE_DRAWING_RE))
44
44
 
45
45
  bearer = @credentials.fetch_access_token!['access_token']
46
- headers = { 'Authorization' => "Bearer #{bearer}" }
47
46
 
48
47
  match.to_a.uniq.each do |url|
49
48
  upd_url = updated_drawing_url_for(url)
50
- response = HTTParty.get CGI.unescapeHTML(upd_url), headers: headers
49
+ response = HTTParty.get CGI.unescapeHTML(upd_url), headers: { 'Authorization' => "Bearer #{bearer}" }
51
50
 
52
51
  next unless response.code == 200
53
52
 
54
- new_src = "data:#{response.content_type};base64, #{Base64.encode64(response)}\" drawing_url=\"#{upd_url}"
53
+ new_src =
54
+ "data:#{response.content_type};base64, #{Base64.encode64(response.to_s)}\" drawing_url=\"#{upd_url}"
55
55
  html = html.gsub(url, new_src)
56
56
  end
57
57
 
@@ -64,7 +64,7 @@ module Lt
64
64
 
65
65
  dpi_ratio = options[:dpi].to_f / BASE_DPI
66
66
  uri = URI.parse(url)
67
- query = CGI.parse(uri.query).transform_values(&:first)
67
+ query = CGI.parse(uri.query.to_s).transform_values(&:first)
68
68
  query['w'] = (query['w'].to_i * dpi_ratio).round.to_s
69
69
  query['h'] = (query['h'].to_i * dpi_ratio).round.to_s
70
70
  URI::HTTPS.build(host: uri.host, path: uri.path, query: query.to_query).to_s
@@ -14,7 +14,7 @@ module Lt
14
14
  name: name,
15
15
  mime_type: Lt::Google::Api::Drive::MIME_FILE
16
16
  }
17
- file_metadata[:parents] = [parent_folder_id] if parent_folder_id.present?
17
+ file_metadata[:parents] = Array.wrap(parent_folder_id) unless parent_folder_id.nil?
18
18
  file = service.create_file(
19
19
  file_metadata,
20
20
  fields: 'id',
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Lt
4
4
  module Lcms
5
- VERSION = '0.5.0'
5
+ VERSION = '0.6.1'
6
6
  end
7
7
  end
data/lt-lcms.gemspec CHANGED
@@ -15,15 +15,16 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
15
15
  spec.description = ''
16
16
  spec.license = 'Apache-2.0'
17
17
 
18
- spec.required_ruby_version = '>= 3.2'
18
+ spec.required_ruby_version = '>= 2.7'
19
19
 
20
20
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
21
21
  # to allow pushing to a single host or delete this section to allow pushing to any host.
22
22
  if spec.respond_to?(:metadata)
23
23
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
24
+ spec.metadata['rubygems_mfa_required'] = 'true'
24
25
  else
25
26
  raise 'RubyGems 2.0 or newer is required to protect against ' \
26
- 'public gem pushes.'
27
+ 'public gem pushes.'
27
28
  end
28
29
 
29
30
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
@@ -33,14 +34,14 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
33
34
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
35
  spec.require_paths = ['lib']
35
36
 
36
- spec.add_dependency 'google-api-client', '~> 0.38'
37
- spec.add_dependency 'httparty', '~> 0.18'
38
- spec.add_dependency 'lt-google-api', '~> 0.2', '>= 0.2.4'
37
+ spec.add_dependency 'google-apis-core', '~> 0.16.0'
38
+ spec.add_dependency 'httparty', '~> 0.22'
39
+ spec.add_dependency 'lt-google-api', '~> 0.3.2'
39
40
  spec.add_dependency 'nokogiri', '~> 1.10', '>= 1.10.8'
40
41
  spec.add_dependency 'rubyzip', '~> 2'
41
42
 
42
- spec.add_development_dependency 'bundler', '~> 1.16'
43
- spec.add_development_dependency 'overcommit', '~> 0.57'
43
+ spec.add_development_dependency 'bundler', '~> 2.4'
44
+ spec.add_development_dependency 'overcommit', '~> 0.60'
44
45
  spec.add_development_dependency 'rake', '~> 13.0'
45
46
  spec.add_development_dependency 'rubocop', '~> 1.54'
46
47
  end
@@ -0,0 +1,24 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ gems:
17
+ # Skip loading rbs gem's RBS.
18
+ # It's unnecessary if you don't use rbs as a library.
19
+ - name: rbs
20
+ ignore: true
21
+ - name: steep
22
+ ignore: true
23
+ - name: concurrent-ruby
24
+ ignore: true
@@ -0,0 +1,33 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ class Base
6
+ RETRY_DELAYES: ::Array[untyped]
7
+
8
+ MAX_RETRY_COUNT: untyped
9
+
10
+ MIME_TYPE_EXPORT: "text/plain"
11
+
12
+ def self.file_id_for: (untyped url) -> untyped
13
+
14
+ attr_reader content: untyped
15
+
16
+ def initialize: (untyped credentials, untyped file_url, ?::Hash[untyped, untyped] opts) -> void
17
+
18
+ def download: (?mime_type: untyped) ?{ (untyped) -> untyped } -> untyped
19
+
20
+ def file: () -> untyped
21
+
22
+ def file_id: () -> untyped
23
+
24
+ private
25
+
26
+ attr_reader options: untyped
27
+
28
+ def service: () -> untyped
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,34 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ class Gdoc < Base
6
+ GOOGLE_DRAWING_RE: ::Regexp
7
+
8
+ GOOGLE_URL_RE: ::Regexp
9
+
10
+ MIME_TYPE: "application/vnd.google-apps.document"
11
+
12
+ MIME_TYPE_EXPORT: "text/html"
13
+
14
+ def self.gdoc_file_url: (untyped id) -> ::String
15
+
16
+ def download: () -> untyped
17
+
18
+ private
19
+
20
+ attr_reader options: untyped
21
+
22
+ BASE_DPI: ::Float
23
+
24
+ def fix_links: (untyped html) -> untyped
25
+
26
+ def handle_google_drawings: (untyped html) -> untyped
27
+
28
+ # Update drawing url w/h parameters to download in better quality than default 72 dpi
29
+ def updated_drawing_url_for: (untyped url) -> untyped
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,19 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ class Gslide < Lt::Lcms::Lesson::Downloader::Base
6
+ MIME_TYPE: "application/vnd.google-apps.presentation"
7
+
8
+ MIME_TYPE_EXPORT: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
9
+
10
+ def self.gdoc_file_url: (untyped id) -> ::String
11
+
12
+ def initialize: (untyped credentials, untyped file_url, ?::Hash[untyped, untyped] opts) -> void
13
+
14
+ def file_id: () -> untyped
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,17 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ class Gspreadsheet < Lt::Lcms::Lesson::Downloader::Base
6
+ MIME_TYPE: "application/vnd.google-apps.spreadsheet"
7
+
8
+ MIME_TYPE_EXPORT: "application/x-vnd.oasis.opendocument.spreadsheet"
9
+
10
+ def self.gdoc_file_url: (untyped id) -> ::String
11
+
12
+ def download_sheet: (untyped sheet_name) -> untyped
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ class PDF < Base
6
+ MIME_TYPE: "application/pdf"
7
+
8
+ def self.gdoc_file_url: (untyped id) -> ::String
9
+
10
+ def pdf_content: () -> untyped
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Downloader
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ module Lt
2
+ module Lcms
3
+ module Lesson
4
+ module Uploader
5
+ class Gdoc
6
+ def initialize: (untyped credentials) -> void
7
+
8
+ def upload: (untyped name, untyped content, untyped content_type, ?untyped? parent_folder_id) -> untyped
9
+
10
+ private
11
+
12
+ def service: () -> untyped
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Lt
2
+ module Lcms
3
+ VERSION: "0.5.0"
4
+ end
5
+ end
data/sig/lt/lcms.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Lt
2
+ module Lcms
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module Google
2
+ module Apis
3
+ RateLimitError: untyped
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module HTTParty
2
+ class Response
3
+ def content_type: -> String
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ module Auth
5
+ class Cli
6
+ self.@authorizer: untyped
7
+
8
+ @credentials: untyped
9
+
10
+ CONFIG_SECRET_FILE: untyped
11
+ CONFIG_TOKEN_FILE: untyped
12
+ SCOPE: ::Array["https://www.googleapis.com/auth/drive" | "https://www.googleapis.com/auth/documents"]
13
+ USER_ID: "default"
14
+
15
+ def self.authorizer: -> untyped
16
+ def authorizer: -> untyped
17
+ def credentials: -> untyped
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ module Auth
5
+ module Credentials
6
+ interface _ActionController_Redirecting
7
+ def redirect_to: (String | Symbol | untyped options) -> untyped
8
+ end
9
+ include _ActionController_Redirecting
10
+
11
+ @google_auth_options: untyped
12
+ @google_credentials: untyped
13
+ @service: untyped
14
+
15
+ extend ActiveSupport::Concern
16
+
17
+ attr_reader google_credentials: untyped
18
+
19
+ def obtain_google_credentials: (?::Hash[untyped, untyped] options) -> untyped
20
+
21
+ private
22
+
23
+ def service: -> untyped
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,36 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ module Auth
5
+ class Service
6
+ self.@authorizer_for: untyped
7
+
8
+ @context: untyped
9
+ @options: untyped
10
+ @credentials: untyped
11
+ @user_id: untyped
12
+ @user_token: untyped
13
+
14
+ REDIS_PREFIX: "lt-google-api"
15
+
16
+ def self.authorizer_for: (untyped callback_path) -> untyped
17
+ def self.redis: -> untyped
18
+
19
+ attr_reader context: untyped
20
+
21
+ def initialize: (untyped context, ?::Hash[untyped, untyped] options) -> void
22
+ def authorization_url: -> untyped
23
+ def authorizer: -> untyped
24
+ def credentials: -> untyped
25
+ def user_id: -> untyped
26
+
27
+ private
28
+
29
+ def redis: -> untyped
30
+ def remove_expired_token: -> (nil | untyped)
31
+ def user_token: -> untyped
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ class Drive
5
+ @service: untyped
6
+
7
+ FOLDER_RE: ::Regexp
8
+ MIME_FILE: "application/vnd.google-apps.document"
9
+ MIME_FOLDER: "application/vnd.google-apps.folder"
10
+
11
+ attr_reader service: untyped
12
+
13
+ def self.build: (untyped credentials) -> untyped
14
+ def self.file_url_for: (untyped file_id) -> ::String
15
+ def self.folder_id_for: (untyped url) -> untyped
16
+
17
+ def initialize: (untyped credentials) -> void
18
+ def copy: (untyped file_ids, untyped folder_id) -> untyped
19
+ def copy_files: (untyped folder_id, untyped target_id) -> untyped
20
+ def create_folder: (untyped name, ?untyped? parent_id) -> untyped
21
+ def list_file_ids_in: (untyped folder_id, ?mime_type: untyped, ?with_subfolders: bool) -> untyped
22
+ def fetch_folders: (untyped name, untyped folder_id) -> untyped
23
+
24
+ private
25
+
26
+ def list: (untyped folder_id) -> untyped
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,7 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ VERSION: "0.2.4"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module Lt
2
+ module Google
3
+ module Api
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ module Google
2
+ module Apis
3
+ # RateLimitError: untyped
4
+
5
+ module DriveV3
6
+ class DriveService
7
+ def initialize: (*untyped?) -> untyped
8
+ end
9
+
10
+ class File
11
+ def initialize: (*untyped?) -> untyped
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Google
2
+ module Auth
3
+ class ClientId
4
+ def self.from_file: (*untyped?) -> untyped
5
+ def initialize: (*untyped?) -> untyped
6
+ end
7
+
8
+ class TokenStore
9
+ end
10
+
11
+ class UserAuthorizer
12
+ def initialize: (*untyped?) -> untyped
13
+ end
14
+
15
+ class WebUserAuthorizer
16
+ def initialize: (*untyped?) -> untyped
17
+ end
18
+
19
+ module Stores
20
+ class FileTokenStore
21
+ def initialize: (*untyped?) -> untyped
22
+ end
23
+
24
+ class RedisTokenStore < TokenStore
25
+ DEFAULT_KEY_PREFIX: untyped
26
+
27
+ def initialize: (*untyped?) -> untyped
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ module Rails
2
+ def self.application: -> untyped
3
+ def self.logger: -> untyped
4
+ def self.root: -> untyped
5
+ end
metadata CHANGED
@@ -1,63 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lt-lcms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kuznetsov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-07 00:00:00.000000000 Z
11
+ date: 2025-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: google-api-client
14
+ name: google-apis-core
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.38'
19
+ version: 0.16.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.38'
26
+ version: 0.16.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httparty
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.18'
33
+ version: '0.22'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.18'
40
+ version: '0.22'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: lt-google-api
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.2'
48
- - - ">="
49
- - !ruby/object:Gem::Version
50
- version: 0.2.4
47
+ version: 0.3.2
51
48
  type: :runtime
52
49
  prerelease: false
53
50
  version_requirements: !ruby/object:Gem::Requirement
54
51
  requirements:
55
52
  - - "~>"
56
53
  - !ruby/object:Gem::Version
57
- version: '0.2'
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- version: 0.2.4
54
+ version: 0.3.2
61
55
  - !ruby/object:Gem::Dependency
62
56
  name: nokogiri
63
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,28 +92,28 @@ dependencies:
98
92
  requirements:
99
93
  - - "~>"
100
94
  - !ruby/object:Gem::Version
101
- version: '1.16'
95
+ version: '2.4'
102
96
  type: :development
103
97
  prerelease: false
104
98
  version_requirements: !ruby/object:Gem::Requirement
105
99
  requirements:
106
100
  - - "~>"
107
101
  - !ruby/object:Gem::Version
108
- version: '1.16'
102
+ version: '2.4'
109
103
  - !ruby/object:Gem::Dependency
110
104
  name: overcommit
111
105
  requirement: !ruby/object:Gem::Requirement
112
106
  requirements:
113
107
  - - "~>"
114
108
  - !ruby/object:Gem::Version
115
- version: '0.57'
109
+ version: '0.60'
116
110
  type: :development
117
111
  prerelease: false
118
112
  version_requirements: !ruby/object:Gem::Requirement
119
113
  requirements:
120
114
  - - "~>"
121
115
  - !ruby/object:Gem::Version
122
- version: '0.57'
116
+ version: '0.60'
123
117
  - !ruby/object:Gem::Dependency
124
118
  name: rake
125
119
  requirement: !ruby/object:Gem::Requirement
@@ -157,21 +151,26 @@ extensions: []
157
151
  extra_rdoc_files: []
158
152
  files:
159
153
  - ".codeclimate.yml"
160
- - ".github/workflows/rubocop-analysis.yml"
154
+ - ".dockerignore"
155
+ - ".github/workflows/.keep"
161
156
  - ".gitignore"
162
157
  - ".overcommit.yml"
163
158
  - ".rubocop.yml"
164
159
  - ".ruby-gemset"
165
160
  - ".ruby-version"
166
161
  - CHANGELOG.md
162
+ - Dockerfile
167
163
  - Gemfile
168
164
  - Gemfile.lock
169
165
  - LICENSE
170
166
  - README.md
171
167
  - Rakefile
168
+ - Steepfile
172
169
  - bin/console
173
170
  - bin/overcommit
174
171
  - bin/setup
172
+ - docker-compose.yml
173
+ - docker-entrypoint.sh
175
174
  - lib/lt/lcms.rb
176
175
  - lib/lt/lcms/lesson/downloader.rb
177
176
  - lib/lt/lcms/lesson/downloader/base.rb
@@ -182,11 +181,33 @@ files:
182
181
  - lib/lt/lcms/lesson/uploader/gdoc.rb
183
182
  - lib/lt/lcms/version.rb
184
183
  - lt-lcms.gemspec
184
+ - rbs_collection.yaml
185
+ - sig/lt/lcms.rbs
186
+ - sig/lt/lcms/lesson/downloader.rbs
187
+ - sig/lt/lcms/lesson/downloader/base.rbs
188
+ - sig/lt/lcms/lesson/downloader/gdoc.rbs
189
+ - sig/lt/lcms/lesson/downloader/gslide.rbs
190
+ - sig/lt/lcms/lesson/downloader/gspreadsheet.rbs
191
+ - sig/lt/lcms/lesson/downloader/pdf.rbs
192
+ - sig/lt/lcms/lesson/uploader/gdoc.rbs
193
+ - sig/lt/lcms/version.rbs
194
+ - sig/polifill/google-api-client.rbs
195
+ - sig/polifill/httparty.rbs
196
+ - vendor/rbs/lt-google-api/lib/lt/google/api.rbs
197
+ - vendor/rbs/lt-google-api/lib/lt/google/api/auth/cli.rbs
198
+ - vendor/rbs/lt-google-api/lib/lt/google/api/auth/credentials.rbs
199
+ - vendor/rbs/lt-google-api/lib/lt/google/api/auth/service.rbs
200
+ - vendor/rbs/lt-google-api/lib/lt/google/api/drive.rbs
201
+ - vendor/rbs/lt-google-api/lib/lt/google/api/version.rbs
202
+ - vendor/rbs/lt-google-api/polifill/google-api-clients.rbs
203
+ - vendor/rbs/lt-google-api/polifill/googleauth.rbs
204
+ - vendor/rbs/lt-google-api/polifill/rails.rbs
185
205
  homepage: https://github.com/learningtapestry/lt-lcms
186
206
  licenses:
187
207
  - Apache-2.0
188
208
  metadata:
189
209
  allowed_push_host: https://rubygems.org
210
+ rubygems_mfa_required: 'true'
190
211
  post_install_message:
191
212
  rdoc_options: []
192
213
  require_paths:
@@ -195,14 +216,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
195
216
  requirements:
196
217
  - - ">="
197
218
  - !ruby/object:Gem::Version
198
- version: '3.2'
219
+ version: '2.7'
199
220
  required_rubygems_version: !ruby/object:Gem::Requirement
200
221
  requirements:
201
222
  - - ">="
202
223
  - !ruby/object:Gem::Version
203
224
  version: '0'
204
225
  requirements: []
205
- rubygems_version: 3.0.3.1
226
+ rubygems_version: 3.1.6
206
227
  signing_key:
207
228
  specification_version: 4
208
229
  summary: Contains set of classes to work with Google Docs based lesson objects
@@ -1,38 +0,0 @@
1
- name: "Rubocop"
2
-
3
- on: pull_request
4
-
5
- jobs:
6
- rubocop:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- fail-fast: false
10
-
11
- steps:
12
- - name: Checkout repository
13
- uses: actions/checkout@v2
14
-
15
- # If running on a self-hosted runner, check it meets the requirements
16
- # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners
17
- - name: Set up Ruby
18
- uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: 3.2.1
21
-
22
- - name: Install specific bundler version
23
- run: gem install bundler -v 2.4.6
24
-
25
- - name: Cache gems
26
- uses: actions/cache@v1
27
- with:
28
- path: vendor/bundle
29
- key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
30
- restore-keys: |
31
- ${{ runner.os }}-rubocop-
32
- - name: Install gems
33
- run: |
34
- bundle config path vendor/bundle
35
- bundle config set without 'default doc job cable storage ujs test db'
36
- bundle install --jobs 4 --retry 3
37
- - name: Run RuboCop
38
- run: bundle exec rubocop --parallel