lcms-engine 0.4.0 → 0.4.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: 88efc618857b500fa9f4b31269da6e6ea6a0a145a226d2e7a49a27b7c55d110c
4
- data.tar.gz: 415213ff1df9648d44a20769e4b71dae28fc5ad4bd9d351d0ca7e04f1ee5788e
3
+ metadata.gz: 5c37201e439f0704a64bb50c1b520eda59af5407d1e76389ec579532142ce08a
4
+ data.tar.gz: 03d52081094d087b2b3fe1090a86a9e153fdcd6fab33510e19ea1809ff4d7a29
5
5
  SHA512:
6
- metadata.gz: 13e737a28539e68498435df2c79c9b8e4b3e088cdd50e24172365fe3835923664381c7a16dc076fb4b5983e6797e2ae940399d362bd11f8e557b8579d4d9e3fd
7
- data.tar.gz: 184b331a41a3836775f235288015d4a2b1aa9d5d9053bb0bfb1eef04fa963005c89044082b44afc5ba3b874f73cb1c5eeb69a6afe755a8fd8a040b5d0446310d
6
+ metadata.gz: 5572bde25038a2a11c02380993d600a8ba864d1a4d0f2ca4f4369c9f487e2ccc230c742d3d4ede4eae7a9765b1dda1ca6117ac78528802eabbf64dc3d8ac8b27
7
+ data.tar.gz: 1310db2346532587a79938b12711e3e7bc844790efe0675ad5aed13c0b8357d441ba37b9b6befe18357f1f4cbfd8fd5ea77702f51466c1b43364b8764b712527
data/CHANGELOG.md CHANGED
@@ -4,9 +4,15 @@ 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.1...HEAD)
8
8
 
9
- ## [Unreleased](https://github.com/learningtapestry/lcms-engine/compare/v0.3.1...v0.4.0)
9
+ ## [0.4.1](https://github.com/learningtapestry/lcms-engine/compare/v0.4.0...v0.4.1) - 2022.10.13
10
+
11
+ ### Changed
12
+
13
+ - `Lcms::Engine::AdminMaterialsQuery` now filters by metadata in case-insensitive way - [@paranoicsan](https://github.com/paranoicsan)
14
+
15
+ ## [0.4.0](https://github.com/learningtapestry/lcms-engine/compare/v0.3.1...v0.4.0) - 2022.09.28
10
16
 
11
17
  ### Added
12
18
 
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.1)
14
14
  active_model_serializers (~> 0.10.10)
15
15
  activejob-retry (~> 0.6.3)
16
16
  acts-as-taggable-on (~> 7.0)
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
 
@@ -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
@@ -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.1'
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.1
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-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activejob-retry
@@ -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