lcms-engine 0.4.0 → 0.4.2

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: 88efc618857b500fa9f4b31269da6e6ea6a0a145a226d2e7a49a27b7c55d110c
4
- data.tar.gz: 415213ff1df9648d44a20769e4b71dae28fc5ad4bd9d351d0ca7e04f1ee5788e
3
+ metadata.gz: f62a92500b6de3f3297fad22f2883475be96122185eee2f171556bebf5f441c2
4
+ data.tar.gz: 9b9755e44e422b3ed1168e49505900810bce1ac20317e7e24d85bdb1521fe65b
5
5
  SHA512:
6
- metadata.gz: 13e737a28539e68498435df2c79c9b8e4b3e088cdd50e24172365fe3835923664381c7a16dc076fb4b5983e6797e2ae940399d362bd11f8e557b8579d4d9e3fd
7
- data.tar.gz: 184b331a41a3836775f235288015d4a2b1aa9d5d9053bb0bfb1eef04fa963005c89044082b44afc5ba3b874f73cb1c5eeb69a6afe755a8fd8a040b5d0446310d
6
+ metadata.gz: 71a158b6aa734fd82ca1bb95294353fa22a95093178c26bcc086873b395dbaff1bbaaa62cb034dc68eead231fa05160e269f971e409a1d36d217cef29bae9926
7
+ data.tar.gz: e779924ac23fc221fee963365937893b411922a8bca9fdcf9ed21441076fc2940995f1af45f4d119fc4b0a723833e4cddde365237212729eb4b13727c428e8d3
data/CHANGELOG.md CHANGED
@@ -4,9 +4,21 @@ 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.4.0...HEAD)
7
+ ## [Unreleased](https://github.com/learningtapestry/lcms-engine/compare/v0.4.2...HEAD)
8
8
 
9
- ## [Unreleased](https://github.com/learningtapestry/lcms-engine/compare/v0.3.1...v0.4.0)
9
+ ## [0.4.2](https://github.com/learningtapestry/lcms-engine/compare/v0.4.1...v0.4.2) - 2022.10.18
10
+
11
+ ### Changed
12
+
13
+ - Allow `ImportStatus` page customization - [@paranoicsan](https://github.com/paranoicsan)
14
+
15
+ ## [0.4.1](https://github.com/learningtapestry/lcms-engine/compare/v0.4.0...v0.4.1) - 2022.10.13
16
+
17
+ ### Changed
18
+
19
+ - `Lcms::Engine::AdminMaterialsQuery` now filters by metadata in case-insensitive way - [@paranoicsan](https://github.com/paranoicsan)
20
+
21
+ ## [0.4.0](https://github.com/learningtapestry/lcms-engine/compare/v0.3.1...v0.4.0) - 2022.09.28
10
22
 
11
23
  ### Added
12
24
 
data/Gemfile.lock CHANGED
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- lcms-engine (0.3.1)
13
+ lcms-engine (0.4.2)
14
14
  active_model_serializers (~> 0.10.10)
15
15
  activejob-retry (~> 0.6.3)
16
16
  acts-as-taggable-on (~> 7.0)
@@ -162,10 +162,10 @@ GEM
162
162
  autoprefixer-rails (9.8.6.5)
163
163
  execjs
164
164
  aws-eventstream (1.2.0)
165
- aws-partitions (1.638.0)
166
- aws-record (2.7.0)
165
+ aws-partitions (1.646.0)
166
+ aws-record (2.8.0)
167
167
  aws-sdk-dynamodb (~> 1.18)
168
- aws-sdk-core (3.156.0)
168
+ aws-sdk-core (3.160.0)
169
169
  aws-eventstream (~> 1, >= 1.0.2)
170
170
  aws-partitions (~> 1, >= 1.525.0)
171
171
  aws-sigv4 (~> 1.1)
@@ -176,7 +176,7 @@ GEM
176
176
  aws-sdk-kms (1.58.0)
177
177
  aws-sdk-core (~> 3, >= 3.127.0)
178
178
  aws-sigv4 (~> 1.1)
179
- aws-sdk-rails (3.6.3)
179
+ aws-sdk-rails (3.6.4)
180
180
  aws-record (~> 2)
181
181
  aws-sdk-ses (~> 1)
182
182
  aws-sdk-sqs (~> 1)
@@ -196,7 +196,7 @@ GEM
196
196
  aws-sessionstore-dynamodb (2.0.1)
197
197
  aws-sdk-dynamodb (~> 1)
198
198
  rack (~> 2)
199
- aws-sigv4 (1.5.1)
199
+ aws-sigv4 (1.5.2)
200
200
  aws-eventstream (~> 1, >= 1.0.2)
201
201
  axiom-types (0.1.1)
202
202
  descendants_tracker (~> 0.0.4)
@@ -303,7 +303,7 @@ GEM
303
303
  erubi (1.11.0)
304
304
  et-orbi (1.2.7)
305
305
  tzinfo
306
- excon (0.92.5)
306
+ excon (0.93.0)
307
307
  execjs (2.8.1)
308
308
  factory_bot (5.2.0)
309
309
  activesupport (>= 4.2.0)
@@ -364,7 +364,7 @@ GEM
364
364
  google-api-client (0.53.0)
365
365
  google-apis-core (~> 0.1)
366
366
  google-apis-generator (~> 0.1)
367
- google-apis-core (0.9.0)
367
+ google-apis-core (0.9.1)
368
368
  addressable (~> 2.5, >= 2.5.1)
369
369
  googleauth (>= 0.16.2, < 2.a)
370
370
  httpclient (>= 2.8.1, < 3.a)
@@ -375,10 +375,10 @@ GEM
375
375
  webrick
376
376
  google-apis-discovery_v1 (0.12.0)
377
377
  google-apis-core (>= 0.9.0, < 2.a)
378
- google-apis-generator (0.10.0)
378
+ google-apis-generator (0.11.0)
379
379
  activesupport (>= 5.0)
380
380
  gems (~> 1.2)
381
- google-apis-core (>= 0.9.0, < 2.a)
381
+ google-apis-core (>= 0.9.1, < 2.a)
382
382
  google-apis-discovery_v1 (~> 0.5)
383
383
  thor (>= 0.20, < 2.a)
384
384
  googleauth (0.17.1)
@@ -484,7 +484,7 @@ GEM
484
484
  json (> 1.8.4)
485
485
  rails (> 4.2.0)
486
486
  sassc-rails (>= 2.1)
487
- pg (1.4.3)
487
+ pg (1.4.4)
488
488
  pg_search (2.3.6)
489
489
  activerecord (>= 5.2)
490
490
  activesupport (>= 5.2)
@@ -504,7 +504,7 @@ GEM
504
504
  rack (2.2.4)
505
505
  rack-mini-profiler (2.3.4)
506
506
  rack (>= 1.2.0)
507
- rack-protection (3.0.1)
507
+ rack-protection (3.0.2)
508
508
  rack
509
509
  rack-proxy (0.7.4)
510
510
  rack
@@ -570,7 +570,7 @@ GEM
570
570
  multi_json (~> 1.0)
571
571
  redis-namespace (~> 1.6)
572
572
  sinatra (>= 0.9.2)
573
- resque-scheduler (4.6.0)
573
+ resque-scheduler (4.7.0)
574
574
  mono_logger (~> 1.0)
575
575
  redis (>= 3.3)
576
576
  resque (>= 1.27)
@@ -663,10 +663,10 @@ GEM
663
663
  json (>= 1.8, < 3)
664
664
  simplecov-html (~> 0.10.0)
665
665
  simplecov-html (0.10.2)
666
- sinatra (3.0.1)
666
+ sinatra (3.0.2)
667
667
  mustermann (~> 3.0)
668
668
  rack (~> 2.2, >= 2.2.4)
669
- rack-protection (= 3.0.1)
669
+ rack-protection (= 3.0.2)
670
670
  tilt (~> 2.0)
671
671
  spring (2.1.1)
672
672
  spring-commands-rspec (1.0.4)
data/README.md CHANGED
@@ -10,22 +10,16 @@ Our initial goal is gathering the common code among the current LCMS implementat
10
10
  (Odell, Unbound ED and OpenSciEd) and provide a unified codebase that can be maintained and developed
11
11
  separately, simplifying the client applications in the process.
12
12
 
13
+ ## Requirements
14
+ - Ruby 2.7.x
15
+ - Rails 6.1 or higher
16
+ - Postgres 9.6 or higher
17
+
13
18
  ## Current development
14
19
 
15
20
  | Branch | Rails version |
16
21
  |--------|---------------|
17
- | master | Rails 6.1.4.6 |
18
- | 0.3.x | Rails 5.2.4.5 |
19
-
20
- This is still a [work in progress](https://github.com/learningtapestry/lcms-engine/issues/3). The
21
- initial phase of the project consisted in extracting as much code as possible from the client
22
- projects and set the engine as the core foundation for further development and optimizations.
23
-
24
- Once the integrations with the client projects are successful, phase 1 will be complete and we'll be
25
- able to start phase 2, which ideally should involve optimizing the code and giving the engine some
26
- default features and customization possibilities. This should allow any Rails application to use a
27
- basic LCMS that works out of the box just by including the gem and setting some configuration
28
- options.
22
+ | master | Rails 6.1.7 |
29
23
 
30
24
  ## Guidelines
31
25
 
@@ -82,17 +76,9 @@ Other kinds of assets, like ERB views, images, stylesheets or javascript files,
82
76
  overridden as easily as Ruby classes and modules, but you can always provide your own versions of
83
77
  the same files, overwriting the ones provided by the engine.
84
78
 
85
- ## Requirements
86
- - Ruby 2.7 or higher
87
- - Rails 6.1 or higher
88
- - Postgres 9.6 or higher
89
-
90
79
  ## Installation
91
80
  Add this to the Gemfile:
92
81
  ```ruby
93
- gem 'lcms-engine','~> 0.3' # Rails 5.2
94
- ```
95
- ```ruby
96
82
  gem 'lcms-engine' # Rails 6.1
97
83
  ```
98
84
 
@@ -78,12 +78,12 @@ class ImportStatus extends React.Component {
78
78
  return _.map(this.links, (link, idx) => (
79
79
  <a
80
80
  key={`pl-${idx}`}
81
- href={linkWithParams(link, { id: job.model.id })}
81
+ href={typeof job.model === 'undefined' ? link : linkWithParams(link, { id: job.model.id })}
82
82
  className="o-adm-materials__resource button primary u-margin-left--small u-margin-bottom--zero"
83
83
  target="_blank"
84
84
  rel="noreferrer"
85
85
  >
86
- <i className="fas fa-eye"></i>
86
+ <i className="fa fa-eye" aria-hidden="true"></i>
87
87
  </a>
88
88
  ));
89
89
  }
@@ -112,7 +112,7 @@ class ImportStatus extends React.Component {
112
112
  <li className={`o-adm-materials__result o-adm-materials__result--${status}`} key={key}>
113
113
  <div className="u-flex align-justify align-middle">
114
114
  <a href={job.link} target="_blank" className="o-adm-materials__link" rel="noreferrer">
115
- {job.link}
115
+ {job.status !== 'done' ? job.text || job.link : 'Done'}
116
116
  </a>
117
117
  {job.status !== 'done' ? this.spinner() : null}
118
118
  {job.status === 'done' && job.ok ? <span>{this.resourceButton(job)}</span> : null}
@@ -149,7 +149,7 @@ class ImportStatus extends React.Component {
149
149
  }
150
150
 
151
151
  ImportStatus.propTypes = {
152
- jobs: PropTypes.array,
152
+ jobs: PropTypes.object,
153
153
  links: PropTypes.array,
154
154
  type: PropTypes.string,
155
155
  path: PropTypes.string,
@@ -30,7 +30,7 @@ module Lcms
30
30
 
31
31
  @scope =
32
32
  if STRICT_METADATA.include?(key.to_s)
33
- @scope.where_metadata(key => q[key])
33
+ @scope.where_metadata(key => q[key].to_s.downcase)
34
34
  else
35
35
  @scope.where_metadata_like(key, q[key])
36
36
  end
@@ -3,7 +3,7 @@
3
3
  <span>
4
4
  <%= link_to preview_download_path(id: download, slug: resource.slug), class: 'resource-attachment',
5
5
  data: { no_turbolink: true }, target: '_blank' do %>
6
- <i class="fas fa-eye" aria-hidden="true"></i>
6
+ <i class="<i class="fa fa-eye" aria-hidden="true"></i>" aria-hidden="true"></i>
7
7
  <% end %>
8
8
  </span>
9
9
  <% end %>
@@ -1 +1,14 @@
1
1
  # How to build and publish gem
2
+
3
+ Increase the version in `lib/lcms/engine/version.rb` and update `CHANGELOG.md`.
4
+
5
+ Build the gem
6
+ ```bash
7
+ $ gem build lcms-engine.gemspec
8
+ ```
9
+
10
+ Publish it replacing `x-y-z` with correct version number.
11
+ ```bash
12
+ $ gem signin
13
+ $ gem push lcms-engine-x-y-z.gem
14
+ ```
@@ -0,0 +1,31 @@
1
+ # PDF Generation
2
+
3
+ We're using [puppeteer](https://pptr.dev/) with headless chrome for PDF generation.
4
+
5
+ ## PDF security policy
6
+ After fresh server installation ImageMagick security policies have to be updated. Complete the following steps:
7
+
8
+ 1. Locate the file `/etc/ImageMagick-6/policy.xml`
9
+ 2. Find the policy for PDF format. It looks like this
10
+ ```xml
11
+ <policy domain="coder" rights="none" pattern="PDF" />
12
+ ```
13
+ 3. Change it to this
14
+ ```xml
15
+ <policy domain="coder" rights="read|write" pattern="PDF" />
16
+ ```
17
+
18
+ ## Local development
19
+ 1. install google chrome (see details on #google-chrome-version)
20
+ 2. set `ENABLE_BASE64_CACHING` as `false` or don't forger to clean cache on pdf related css/images changes (see below)
21
+ 3. install `puppeteer`: `nvm use && yarn install`
22
+ 4. set up own s3 bucket to avoid overwriting conflicts (`AWS_S3_BUCKET_NAME`)
23
+
24
+ ## Deployment
25
+ 1. on setting up new stack: add blank pages to s3 bucket (`rake openscied_core:s3_blank_page`)
26
+ 2. on deploying new version with changes at pdf related css/images: clean cached assets (`rake cache:reset_base64`)
27
+
28
+ ## Google Chrome version
29
+ Chrome version is set as `70`, if we need to use newer release
30
+ 1. check PDF generation
31
+ 2. change deployment [hook](https://github.com/learningtapestry/openscied-lcms/blob/master/.cloud66/install_chrome.sh#L3) and redeploy (_NOTE_: maybe add `CHROME_VERSION` env variable?)
data/lcms-engine.gemspec CHANGED
@@ -15,11 +15,17 @@ Gem::Specification.new do |s|
15
15
  s.summary = 'Rails engine for LCMS applications'
16
16
  s.description = 'Implements common components and features for Rails-based LCMS systems'
17
17
  s.license = 'Apache-2.0'
18
- s.metadata['rubygems_mfa_required'] = 'true'
18
+ s.metadata = {
19
+ 'homepage_uri' => 'https://github.com/learningtapestry/lcms-engine',
20
+ 'changelog_uri' => 'https://github.com/learningtapestry/lcms-engine/blob/master/CHANGELOG.md',
21
+ 'rubygems_mfa_required' => 'true',
22
+ 'source_code_uri' => 'https://github.com/learningtapestry/lcms-engine',
23
+ 'bug_tracker_uri' => 'https://github.com/learningtapestry/lcms-engine/issues'
24
+ }
19
25
 
20
26
  s.files = `git ls-files`.split("\n")
21
27
 
22
- s.required_ruby_version = '>= 2.7'
28
+ s.required_ruby_version = '~> 2.7'
23
29
 
24
30
  s.add_dependency 'activejob-retry', '~> 0.6.3'
25
31
  s.add_dependency 'active_model_serializers', '~> 0.10.10'
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Lcms
4
4
  module Engine
5
- VERSION = '0.4.0'
5
+ VERSION = '0.4.2'
6
6
  RAILS_5_VERSION = 5.2
7
7
  end
8
8
  end
@@ -21,14 +21,21 @@ describe Lcms::Engine::AdminMaterialsQuery do
21
21
  end
22
22
 
23
23
  context 'strict metadata fields' do
24
- let(:query) { { lesson: 1, grade: 'grade 1', subject: Faker::Lorem.word } }
24
+ let(:query) { { lesson: 1, grade: 'Grade 1', subject: Faker::Lorem.word } }
25
25
 
26
26
  it 'filters by metadata using explicit comparison' do
27
27
  expect(scope).to receive(:where_metadata_like).with(:lesson, 1).and_return(scope)
28
- expect(scope).to receive(:where_metadata).with(query.slice(:grade)).and_return(scope)
28
+ expect(scope).to receive(:where_metadata).with(hash_including(grade: query[:grade].downcase)).and_return(scope)
29
29
  expect(scope).to receive(:where_metadata).with(query.slice(:subject)).and_return(scope)
30
30
  subject
31
31
  end
32
+
33
+ it 'filters case-insensitive' do
34
+ allow(scope).to receive(:where_metadata).with(query.slice(:subject)).and_return(scope)
35
+ allow(scope).to receive(:where_metadata_like).with(:lesson, 1).and_return(scope)
36
+ expect(scope).to receive(:where_metadata).with(hash_including(grade: query[:grade].downcase)).and_return(scope)
37
+ subject
38
+ end
32
39
  end
33
40
  end
34
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lcms-engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Kuznetsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-09-28 00:00:00.000000000 Z
13
+ date: 2022-10-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activejob-retry
@@ -176,22 +176,22 @@ dependencies:
176
176
  name: bullet
177
177
  requirement: !ruby/object:Gem::Requirement
178
178
  requirements:
179
- - - "~>"
180
- - !ruby/object:Gem::Version
181
- version: '6.1'
182
179
  - - ">="
183
180
  - !ruby/object:Gem::Version
184
181
  version: 6.1.0
182
+ - - "~>"
183
+ - !ruby/object:Gem::Version
184
+ version: '6.1'
185
185
  type: :runtime
186
186
  prerelease: false
187
187
  version_requirements: !ruby/object:Gem::Requirement
188
188
  requirements:
189
- - - "~>"
190
- - !ruby/object:Gem::Version
191
- version: '6.1'
192
189
  - - ">="
193
190
  - !ruby/object:Gem::Version
194
191
  version: 6.1.0
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '6.1'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: carrierwave
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -834,62 +834,62 @@ dependencies:
834
834
  name: resque
835
835
  requirement: !ruby/object:Gem::Requirement
836
836
  requirements:
837
- - - "~>"
838
- - !ruby/object:Gem::Version
839
- version: '2.0'
840
837
  - - ">="
841
838
  - !ruby/object:Gem::Version
842
839
  version: 2.0.0
840
+ - - "~>"
841
+ - !ruby/object:Gem::Version
842
+ version: '2.0'
843
843
  type: :runtime
844
844
  prerelease: false
845
845
  version_requirements: !ruby/object:Gem::Requirement
846
846
  requirements:
847
- - - "~>"
848
- - !ruby/object:Gem::Version
849
- version: '2.0'
850
847
  - - ">="
851
848
  - !ruby/object:Gem::Version
852
849
  version: 2.0.0
850
+ - - "~>"
851
+ - !ruby/object:Gem::Version
852
+ version: '2.0'
853
853
  - !ruby/object:Gem::Dependency
854
854
  name: resque-scheduler
855
855
  requirement: !ruby/object:Gem::Requirement
856
856
  requirements:
857
- - - "~>"
858
- - !ruby/object:Gem::Version
859
- version: '4.4'
860
857
  - - ">="
861
858
  - !ruby/object:Gem::Version
862
859
  version: 4.4.0
860
+ - - "~>"
861
+ - !ruby/object:Gem::Version
862
+ version: '4.4'
863
863
  type: :runtime
864
864
  prerelease: false
865
865
  version_requirements: !ruby/object:Gem::Requirement
866
866
  requirements:
867
- - - "~>"
868
- - !ruby/object:Gem::Version
869
- version: '4.4'
870
867
  - - ">="
871
868
  - !ruby/object:Gem::Version
872
869
  version: 4.4.0
870
+ - - "~>"
871
+ - !ruby/object:Gem::Version
872
+ version: '4.4'
873
873
  - !ruby/object:Gem::Dependency
874
874
  name: rest-client
875
875
  requirement: !ruby/object:Gem::Requirement
876
876
  requirements:
877
- - - "~>"
878
- - !ruby/object:Gem::Version
879
- version: '2.1'
880
877
  - - ">="
881
878
  - !ruby/object:Gem::Version
882
879
  version: 2.1.0
880
+ - - "~>"
881
+ - !ruby/object:Gem::Version
882
+ version: '2.1'
883
883
  type: :runtime
884
884
  prerelease: false
885
885
  version_requirements: !ruby/object:Gem::Requirement
886
886
  requirements:
887
- - - "~>"
888
- - !ruby/object:Gem::Version
889
- version: '2.1'
890
887
  - - ">="
891
888
  - !ruby/object:Gem::Version
892
889
  version: 2.1.0
890
+ - - "~>"
891
+ - !ruby/object:Gem::Version
892
+ version: '2.1'
893
893
  - !ruby/object:Gem::Dependency
894
894
  name: retriable
895
895
  requirement: !ruby/object:Gem::Requirement
@@ -2027,6 +2027,7 @@ files:
2027
2027
  - docs/env-variables.md
2028
2028
  - docs/google-cloud-platform-setup.md
2029
2029
  - docs/how-to-build-and-publish.md
2030
+ - docs/pdf-generation.md
2030
2031
  - lcms-engine.gemspec
2031
2032
  - lib/asset_helper.rb
2032
2033
  - lib/doc_template.rb
@@ -2391,14 +2392,18 @@ homepage: https://github.com/learningtapestry/lcms-engine
2391
2392
  licenses:
2392
2393
  - Apache-2.0
2393
2394
  metadata:
2395
+ homepage_uri: https://github.com/learningtapestry/lcms-engine
2396
+ changelog_uri: https://github.com/learningtapestry/lcms-engine/blob/master/CHANGELOG.md
2394
2397
  rubygems_mfa_required: 'true'
2398
+ source_code_uri: https://github.com/learningtapestry/lcms-engine
2399
+ bug_tracker_uri: https://github.com/learningtapestry/lcms-engine/issues
2395
2400
  post_install_message:
2396
2401
  rdoc_options: []
2397
2402
  require_paths:
2398
2403
  - lib
2399
2404
  required_ruby_version: !ruby/object:Gem::Requirement
2400
2405
  requirements:
2401
- - - ">="
2406
+ - - "~>"
2402
2407
  - !ruby/object:Gem::Version
2403
2408
  version: '2.7'
2404
2409
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -2407,7 +2412,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2407
2412
  - !ruby/object:Gem::Version
2408
2413
  version: '0'
2409
2414
  requirements: []
2410
- rubygems_version: 3.1.6
2415
+ rubygems_version: 3.0.3.1
2411
2416
  signing_key:
2412
2417
  specification_version: 4
2413
2418
  summary: Rails engine for LCMS applications