alchemy_cms 6.0.11 → 6.0.13

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.

Potentially problematic release.


This version of alchemy_cms might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc9b537e2e01fab999228f1a8813bbd0c905d521639eeeb1413021c70e5add7e
4
- data.tar.gz: 6d93f0bb79d91d05a6cda0d9a1f6697fada5cd2de30bc11b7e5c879f98ebd1a4
3
+ metadata.gz: d401fd3a44495f1a096fc4115eec8d32be8862305cc95c35715548147ec7688a
4
+ data.tar.gz: 8f9a98f79c64acafaad1eaef6358a1ca468ed00cb18e5dff15627f47db028bde
5
5
  SHA512:
6
- metadata.gz: 9640f98ba68fb3b85dcdf7edb966911eb148448838259981576f0f5da1e8a6511b2adf6c72753c5396b13ae7d3d42776ac160db9e5793b6b34f4cb5296e28910
7
- data.tar.gz: 59ab7f7c6097b79df1971212cae17cc587aadb93338b8e7a8131dfdea73756bb3e0ec0b5fd68726769b829e326b346bd0ce9832764bd613af131a4b21dfb8a76
6
+ metadata.gz: 7982344f2c8376017f665f70985da9f1263551a9424481646081a7cfa65a6cd65f7e87ee615cbd64ace815b9e6f4450c45625fea87330db7690233cb2b042d63
7
+ data.tar.gz: 4b148956360c26b3acb5495a341de5a14f809272fb709c856ff878882367af59b7b7a1133731c02e68fad2cf5404e00e5db8730b1b1b91d6a7a2e8511b5872b0
@@ -5,42 +5,42 @@ name: Brakeman Scan
5
5
 
6
6
  on:
7
7
  push:
8
- branches: [ main ]
8
+ branches: [main]
9
9
  pull_request:
10
10
  # The branches below must be a subset of the branches above
11
- branches: [ main ]
11
+ branches: [main]
12
12
  schedule:
13
- - cron: '40 4 * * 2'
13
+ - cron: "40 4 * * 2"
14
14
 
15
15
  jobs:
16
16
  brakeman-scan:
17
17
  name: Brakeman Scan
18
18
  runs-on: ubuntu-latest
19
19
  steps:
20
- # Checkout the repository to the GitHub Actions runner
21
- - name: Checkout
22
- uses: actions/checkout@v2
20
+ # Checkout the repository to the GitHub Actions runner
21
+ - name: Checkout
22
+ uses: actions/checkout@v2
23
23
 
24
- # Customize the ruby version depending on your needs
25
- - name: Setup Ruby
26
- uses: actions/setup-ruby@v1
27
- with:
28
- ruby-version: '2.7'
24
+ # Customize the ruby version depending on your needs
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: "3.0"
29
29
 
30
- - name: Setup Brakeman
31
- env:
32
- BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
33
- run: |
34
- gem install brakeman --version $BRAKEMAN_VERSION
30
+ - name: Setup Brakeman
31
+ env:
32
+ BRAKEMAN_VERSION: "5.4" # SARIF support is provided in Brakeman version 4.10+
33
+ run: |
34
+ gem install brakeman --version $BRAKEMAN_VERSION
35
35
 
36
- # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
37
- - name: Scan
38
- continue-on-error: true
39
- run: |
40
- brakeman -f sarif -o output.sarif.json .
36
+ # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
37
+ - name: Scan
38
+ continue-on-error: true
39
+ run: |
40
+ brakeman -f sarif -o output.sarif.json .
41
41
 
42
- # Upload the SARIF file generated in the previous step
43
- - name: Upload SARIF
44
- uses: github/codeql-action/upload-sarif@v1
45
- with:
46
- sarif_file: output.sarif.json
42
+ # Upload the SARIF file generated in the previous step
43
+ - name: Upload SARIF
44
+ uses: github/codeql-action/upload-sarif@v1
45
+ with:
46
+ sarif_file: output.sarif.json
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ # Changelog
2
+
3
+ ## 6.0.13 (2023-03-29)
4
+
5
+ - Fix installer: Add seeds file if not exists [#2446](https://github.com/AlchemyCMS/alchemy_cms/pull/2446) ([tvdeyen](https://github.com/tvdeyen))
6
+ - Integrate non_stupid_digest_assets gem [#2430](https://github.com/AlchemyCMS/alchemy_cms/pull/2430) ([afdev82](https://github.com/afdev82))
7
+
8
+ ## 6.0.12 (2022-11-19)
9
+
10
+ - More installer options [#2385](https://github.com/AlchemyCMS/alchemy_cms/pull/2385) ([tvdeyen](https://github.com/tvdeyen))
11
+ - Fix custom module installer [#2384](https://github.com/AlchemyCMS/alchemy_cms/pull/2384) ([tvdeyen](https://github.com/tvdeyen))
12
+ - Always provide format with attachment URLs [#2383](https://github.com/AlchemyCMS/alchemy_cms/pull/2383) ([mamhoff](https://github.com/mamhoff))
13
+
1
14
  ## 6.0.11 (2022-09-22)
2
15
 
3
16
  - Do not touch pages when toggling element [#2377](https://github.com/AlchemyCMS/alchemy_cms/pull/2377) ([tvdeyen](https://github.com/tvdeyen))
data/alchemy_cms.gemspec CHANGED
@@ -45,7 +45,6 @@ Gem::Specification.new do |gem|
45
45
  gem.add_runtime_dependency "jquery-ui-rails", ["~> 6.0"]
46
46
  gem.add_runtime_dependency "kaminari", ["~> 1.1"]
47
47
  gem.add_runtime_dependency "originator", ["~> 3.1"]
48
- gem.add_runtime_dependency "non-stupid-digest-assets", ["~> 1.0.8"]
49
48
  gem.add_runtime_dependency "ransack", [">= 1.8", "< 4.0"]
50
49
  gem.add_runtime_dependency "request_store", ["~> 1.2"]
51
50
  gem.add_runtime_dependency "responders", [">= 2.0", "< 4.0"]
@@ -23,6 +23,7 @@ module Alchemy
23
23
  # @return [String]
24
24
  #
25
25
  def call(options = {})
26
+ options[:format] ||= @attachment.suffix
26
27
  if options.delete(:download)
27
28
  routes.download_attachment_path(@attachment, options)
28
29
  else
@@ -15,13 +15,25 @@ module Alchemy
15
15
  # @return [Alchemy::PictureThumb] The persisted thumbnail record
16
16
  #
17
17
  def call(variant, signature, uid)
18
- image = variant.image
19
- image.to_file(server_path(uid)).close
20
- variant.picture.thumbs.create!(
18
+ return if !variant.picture.valid?
19
+
20
+ # create the thumb before storing
21
+ # to prevent db race conditions
22
+ thumb = Alchemy::PictureThumb.create!(
21
23
  picture: variant.picture,
22
24
  signature: signature,
23
25
  uid: uid,
24
26
  )
27
+ begin
28
+ # process the image
29
+ image = variant.image
30
+ # store the processed image
31
+ image.to_file(server_path(uid)).close
32
+ rescue RuntimeError => e
33
+ Rails.logger.warn(e)
34
+ # destroy the thumb if processing or storing fails
35
+ thumb&.destroy
36
+ end
25
37
  end
26
38
 
27
39
  private
@@ -18,12 +18,10 @@ module Alchemy
18
18
  inject_into_file "./config/routes.rb", "\n mount Alchemy::Engine => '#{mountpoint}'\n", { after: sentinel, verbose: true }
19
19
  end
20
20
 
21
- def set_primary_language(auto_accept = false)
22
- code = "en"
21
+ def set_primary_language(code: "en", name: "English", auto_accept: false)
23
22
  unless auto_accept
24
23
  code = ask("- What is the language code of your site's primary language?", default: code)
25
24
  end
26
- name = "English"
27
25
  unless auto_accept
28
26
  name = ask("- What is the name of your site's primary language?", default: name)
29
27
  end
@@ -33,7 +31,13 @@ module Alchemy
33
31
  end
34
32
 
35
33
  def inject_seeder
36
- append_file "./db/seeds.rb", "Alchemy::Seeder.seed!\n"
34
+ seed_file = Rails.root.join("db", "seeds.rb")
35
+ args = [seed_file, "Alchemy::Seeder.seed!\n"]
36
+ if File.exist?(seed_file)
37
+ append_file(*args)
38
+ else
39
+ add_file(*args)
40
+ end
37
41
  end
38
42
  end
39
43
  end
@@ -32,13 +32,13 @@ module Alchemy
32
32
  defined_controllers = [definition_hash["navigation"]["controller"]]
33
33
 
34
34
  if definition_hash["navigation"]["sub_navigation"].is_a?(Array)
35
- defined_controllers.concat(definition_hash["navigation"]["sub_navigation"].map{ |x| x["controller"] })
35
+ defined_controllers.concat(definition_hash["navigation"]["sub_navigation"].map { |x| x["controller"] })
36
36
  end
37
37
 
38
38
  validate_controllers_existence(defined_controllers)
39
39
  end
40
40
 
41
- @@alchemy_modules << definition_hash
41
+ @@alchemy_modules |= [definition_hash]
42
42
  end
43
43
 
44
44
  private
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "6.0.11"
4
+ VERSION = "6.0.13"
5
5
 
6
6
  def self.version
7
7
  VERSION
data/lib/alchemy_cms.rb CHANGED
@@ -15,7 +15,7 @@ require "handlebars_assets"
15
15
  require "jquery-rails"
16
16
  require "jquery-ui-rails"
17
17
  require "kaminari"
18
- require "non-stupid-digest-assets"
18
+ require "non_stupid_digest_assets"
19
19
  require "ransack"
20
20
  require "request_store"
21
21
  require "responders"
@@ -26,7 +26,22 @@ module Alchemy
26
26
  class_option :skip_db_create,
27
27
  type: :boolean,
28
28
  default: false,
29
- desc: "Skip creting the database during install."
29
+ desc: "Skip creating the database during install."
30
+
31
+ class_option :skip_mount,
32
+ type: :boolean,
33
+ default: false,
34
+ desc: "Skip mounting into routes.rb during install."
35
+
36
+ class_option :default_language_code,
37
+ type: :string,
38
+ default: "en",
39
+ desc: "The default language code of your site."
40
+
41
+ class_option :default_language_name,
42
+ type: :string,
43
+ default: "English",
44
+ desc: "The default language name of your site."
30
45
 
31
46
  source_root File.expand_path("files", __dir__)
32
47
 
@@ -34,6 +49,11 @@ module Alchemy
34
49
  header
35
50
  say "Welcome to AlchemyCMS!"
36
51
  say "Let's begin with some questions.\n\n"
52
+ end
53
+
54
+ def mount
55
+ return if options[:skip_mount]
56
+
37
57
  install_tasks.inject_routes(options[:auto_accept])
38
58
  end
39
59
 
@@ -108,13 +128,17 @@ module Alchemy
108
128
 
109
129
  def set_primary_language
110
130
  header
111
- install_tasks.set_primary_language(options[:auto_accept])
131
+ install_tasks.set_primary_language(
132
+ code: options[:default_language_code],
133
+ name: options[:default_language_name],
134
+ auto_accept: options[:auto_accept]
135
+ )
112
136
  end
113
137
 
114
138
  def setup_database
115
139
  rake("db:create", abort_on_failure: true) unless options[:skip_db_create]
116
140
  # We can't invoke this rake task, because Rails will use wrong engine names otherwise
117
- rake("railties:install:migrations", abort_on_failure: true)
141
+ rake("alchemy:install:migrations", abort_on_failure: true)
118
142
  rake("db:migrate", abort_on_failure: true)
119
143
  install_tasks.inject_seeder
120
144
  rake("db:seed", abort_on_failure: true)
@@ -1,4 +1,4 @@
1
- class <%= @class_name %>Ability
1
+ class <%= @controller_class %>Ability
2
2
  include CanCan::Ability
3
3
 
4
4
  def initialize(user)
@@ -7,5 +7,4 @@ class <%= @class_name %>Ability
7
7
  can :manage, :admin_<%= @controller_name %>
8
8
  end
9
9
  end
10
-
11
- end
10
+ end
@@ -1,17 +1,19 @@
1
- Alchemy::Modules.register_module({
2
- name: '<%= @module_name %>',
3
- order: 1,
4
- navigation: {
5
- name: 'modules.<%= @module_name %>',
6
- controller: '/admin/<%= @module_name %>',
7
- action: 'index',
8
- image: 'alchemy/<%= @module_name %>_module.png',
9
- sub_navigation: [{
1
+ Rails.application.config.to_prepare do
2
+ Alchemy::Modules.register_module({
3
+ name: '<%= @module_name %>',
4
+ order: 1,
5
+ navigation: {
10
6
  name: 'modules.<%= @module_name %>',
11
7
  controller: '/admin/<%= @module_name %>',
12
- action: 'index'
13
- }]
14
- }
15
- })
8
+ action: 'index',
9
+ image: 'alchemy/<%= @module_name %>_module.png',
10
+ sub_navigation: [{
11
+ name: 'modules.<%= @module_name %>',
12
+ controller: '/admin/<%= @module_name %>',
13
+ action: 'index'
14
+ }]
15
+ }
16
+ })
16
17
 
17
- Alchemy.register_ability(<%= @class_name %>Ability)
18
+ Alchemy.register_ability(<%= @controller_class %>Ability)
19
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "sprockets/manifest"
4
+ require "active_support/core_ext/module/attribute_accessors"
5
+
6
+ module NonStupidDigestAssets
7
+ mattr_accessor :whitelist
8
+ @@whitelist = []
9
+
10
+ class << self
11
+ def assets(assets)
12
+ return assets if whitelist.empty?
13
+
14
+ whitelisted_assets(assets)
15
+ end
16
+
17
+ private
18
+
19
+ def whitelisted_assets(assets)
20
+ assets.select do |logical_path, _digest_path|
21
+ whitelist.any? do |item|
22
+ item =~ logical_path
23
+ end
24
+ end
25
+ end
26
+ end
27
+
28
+ module CompileWithNonDigest
29
+ def compile(*args)
30
+ paths = super
31
+ NonStupidDigestAssets.assets(assets).each do |(logical_path, digest_path)|
32
+ full_digest_path = File.join dir, digest_path
33
+ full_digest_gz_path = "#{full_digest_path}.gz"
34
+ full_non_digest_path = File.join dir, logical_path
35
+ full_non_digest_gz_path = "#{full_non_digest_path}.gz"
36
+
37
+ if File.exist? full_digest_path
38
+ logger.debug "Writing #{full_non_digest_path}"
39
+ FileUtils.copy_file full_digest_path, full_non_digest_path, :preserve_attributes
40
+ else
41
+ logger.debug "Could not find: #{full_digest_path}"
42
+ end
43
+ if File.exist? full_digest_gz_path
44
+ logger.debug "Writing #{full_non_digest_gz_path}"
45
+ FileUtils.copy_file full_digest_gz_path, full_non_digest_gz_path, :preserve_attributes
46
+ else
47
+ logger.debug "Could not find: #{full_digest_gz_path}"
48
+ end
49
+ end
50
+ paths
51
+ end
52
+ end
53
+ end
54
+
55
+ Sprockets::Manifest.prepend NonStupidDigestAssets::CompileWithNonDigest
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "6.0.11",
3
+ "version": "6.0.13",
4
4
  "description": "AlchemyCMS",
5
5
  "browser": "package/admin.js",
6
6
  "files": [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.11
4
+ version: 6.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2022-09-22 00:00:00.000000000 Z
16
+ date: 2023-03-29 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: actionmailer
@@ -387,20 +387,6 @@ dependencies:
387
387
  - - "~>"
388
388
  - !ruby/object:Gem::Version
389
389
  version: '3.1'
390
- - !ruby/object:Gem::Dependency
391
- name: non-stupid-digest-assets
392
- requirement: !ruby/object:Gem::Requirement
393
- requirements:
394
- - - "~>"
395
- - !ruby/object:Gem::Version
396
- version: 1.0.8
397
- type: :runtime
398
- prerelease: false
399
- version_requirements: !ruby/object:Gem::Requirement
400
- requirements:
401
- - - "~>"
402
- - !ruby/object:Gem::Version
403
- version: 1.0.8
404
390
  - !ruby/object:Gem::Dependency
405
391
  name: ransack
406
392
  requirement: !ruby/object:Gem::Requirement
@@ -1419,6 +1405,7 @@ files:
1419
1405
  - lib/generators/alchemy/site_layouts/templates/layout.html.haml
1420
1406
  - lib/generators/alchemy/site_layouts/templates/layout.html.slim
1421
1407
  - lib/generators/alchemy/views/views_generator.rb
1408
+ - lib/non_stupid_digest_assets.rb
1422
1409
  - lib/tasks/alchemy/db.rake
1423
1410
  - lib/tasks/alchemy/install.rake
1424
1411
  - lib/tasks/alchemy/thumbnails.rake
@@ -1524,7 +1511,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1524
1511
  version: '0'
1525
1512
  requirements:
1526
1513
  - ImageMagick (libmagick), v6.6 or greater.
1527
- rubygems_version: 3.3.7
1514
+ rubygems_version: 3.4.6
1528
1515
  signing_key:
1529
1516
  specification_version: 4
1530
1517
  summary: A powerful, userfriendly and flexible CMS for Rails