alchemy_cms 5.0.4 → 5.0.5

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: f72f743e334595c49a1bfd3c2faf2a7751106cbbf7db00e26df9ea6f676e0d9c
4
- data.tar.gz: f370970c8934b50efc3c63b16cd7aaa8e6314334cbf7b71a76794567b69011ff
3
+ metadata.gz: 4b6aa9700f3af909d2703be38a81990ff8494d93736c88fea58a92646c33918e
4
+ data.tar.gz: c61e345cc05a57b1675216d7842a642bc7c5d055fd8208755a0b24d54fc698b9
5
5
  SHA512:
6
- metadata.gz: effc1689a9c747ab521c3d2af854e645c69050846cecef186788c908772f321fd679d0dc2372355651162b2a9837fa91d480121af3d0e4d45cf7505434626373
7
- data.tar.gz: '00192ed6cc59f60a1aecb130d2302a5fe074ece729c154167d1b7d3c094c10039032c1382662b819ea72264c2a5c9a3f77ddaf92d784e60297c56360d590f11e'
6
+ metadata.gz: 6d562e4f04a457b77d3c20288070a6f9fdf45b38c96501339f1dda723d894875843300e2df281ef5614aa31d3170dfe03e14f70882f9b33ada672ae1dba26548
7
+ data.tar.gz: d80df80b211c42cdec1909fb072e41410ed6af4e03f11faa2e690c5ae635e985a240b86dfd95ac8544552c89086f750e8caa0b77746acd4e124b2f40888e146c
@@ -12,8 +12,8 @@ jobs:
12
12
  - '5.2'
13
13
  - '6.0'
14
14
  ruby:
15
- - '2.5.x'
16
15
  - '2.6.x'
16
+ - '2.7.x'
17
17
  database:
18
18
  - mysql
19
19
  - postgresql
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.0.5 (2021-09-15)
2
+
3
+ - Backport #2115 to v5.0 [#2126](https://github.com/AlchemyCMS/alchemy_cms/pull/2126) ([dbwinger](https://github.com/dbwinger))
4
+ - Fixate Dragonfly to < 1.4 [#2122](https://github.com/AlchemyCMS/alchemy_cms/pull/2122) ([tvdeyen](https://github.com/tvdeyen))
5
+ - Backport #2114 to v5.0 [#2118](https://github.com/AlchemyCMS/alchemy_cms/pull/2118) ([afdev82](https://github.com/afdev82))
6
+
1
7
  ## 5.0.4 (2021-05-06)
2
8
 
3
9
  - Use symbols in polymorphic routes for resources [#2087](https://github.com/AlchemyCMS/alchemy_cms/pull/2087) ([tvdeyen](https://github.com/tvdeyen))
data/alchemy_cms.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
13
13
  gem.summary = 'A powerful, userfriendly and flexible CMS for Rails'
14
14
  gem.description = 'Alchemy is a powerful, userfriendly and flexible Rails CMS.'
15
15
  gem.requirements << 'ImageMagick (libmagick), v6.6 or greater.'
16
- gem.required_ruby_version = '>= 2.3.0'
16
+ gem.required_ruby_version = '~> 2.3'
17
17
  gem.license = 'BSD New'
18
18
  gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) }
19
19
  gem.require_paths = ['lib']
@@ -23,7 +23,7 @@ Gem::Specification.new do |gem|
23
23
  gem.add_runtime_dependency 'awesome_nested_set', ['~> 3.1']
24
24
  gem.add_runtime_dependency 'cancancan', ['>= 2.1', '< 4.0']
25
25
  gem.add_runtime_dependency 'coffee-rails', ['~> 4.0', '< 5.0']
26
- gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7']
26
+ gem.add_runtime_dependency 'dragonfly', ['~> 1.0', '>= 1.0.7', '< 1.4.0']
27
27
  gem.add_runtime_dependency 'dragonfly_svg', ['~> 0.0.4']
28
28
  gem.add_runtime_dependency 'gutentag', ['~> 2.2', '>= 2.2.1']
29
29
  gem.add_runtime_dependency 'handlebars_assets', ['~> 0.23']
@@ -1,6 +1,6 @@
1
1
  <% content = local_assigns[:content] || local_assigns[:essence_picture_view] %>
2
2
  <%= Alchemy::EssencePictureView.new(
3
3
  content,
4
- local_assigns[:options],
5
- local_assigns[:html_options]
6
- ).render %>
4
+ local_assigns[:options] || {},
5
+ local_assigns[:html_options] || {}
6
+ ).render %>
@@ -1,9 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "tasks/harden_gutentag_migrations"
4
+ require "rails/generators"
5
+ require "thor"
6
+ require "alchemy/install/tasks"
4
7
 
5
8
  module Alchemy
6
9
  class Upgrader::FivePointZero < Upgrader
10
+ include Rails::Generators::Actions
11
+ include Thor::Base
12
+ include Thor::Actions
13
+
14
+ source_root File.expand_path("../../generators/alchemy/install/files", __dir__)
15
+
7
16
  class << self
8
17
  def install_gutentag_migrations
9
18
  desc "Install Gutentag migrations"
@@ -36,6 +45,28 @@ module Alchemy
36
45
  log "Root page not found.", :skip
37
46
  end
38
47
  end
48
+
49
+ def run_webpacker_installer
50
+ # Webpacker does not create a package.json, but we need one
51
+ unless File.exist? app_root.join("package.json")
52
+ in_root { run "echo '{}' > package.json" }
53
+ end
54
+ new.rake("webpacker:install", abort_on_failure: true)
55
+ end
56
+
57
+ def add_npm_package
58
+ new.run "yarn add @alchemy_cms/admin"
59
+ end
60
+
61
+ def copy_alchemy_entry_point
62
+ webpack_config = YAML.load_file(app_root.join("config", "webpacker.yml"))[Rails.env]
63
+ new.copy_file "alchemy_admin.js",
64
+ app_root.join(webpack_config["source_path"], webpack_config["source_entry_path"], "alchemy/admin.js")
65
+ end
66
+
67
+ def app_root
68
+ @_app_root ||= Rails.root
69
+ end
39
70
  end
40
71
  end
41
72
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Alchemy
4
- VERSION = "5.0.4"
4
+ VERSION = "5.0.5"
5
5
 
6
6
  def self.version
7
7
  VERSION
@@ -42,6 +42,9 @@ namespace :alchemy do
42
42
  "alchemy:upgrade:5.0:install_gutentag_migrations",
43
43
  "alchemy:upgrade:5.0:remove_layout_roots",
44
44
  "alchemy:upgrade:5.0:remove_root_page",
45
+ "alchemy:upgrade:5.0:run_webpacker_installer",
46
+ "alchemy:upgrade:5.0:add_npm_package",
47
+ "alchemy:upgrade:5.0:copy_alchemy_entry_point",
45
48
  ]
46
49
 
47
50
  desc "Install Gutentag migrations"
@@ -58,6 +61,23 @@ namespace :alchemy do
58
61
  task remove_root_page: [:environment] do
59
62
  Alchemy::Upgrader::FivePointZero.remove_root_page
60
63
  end
64
+
65
+ desc "Run webpacker installer"
66
+ task run_webpacker_installer: [:environment] do
67
+ Alchemy::Upgrader::FivePointZero.run_webpacker_installer
68
+ end
69
+
70
+ desc "Add NPM package"
71
+ task add_npm_package: [:environment] do
72
+ puts "adding npm_package..."
73
+ Alchemy::Upgrader::FivePointZero.add_npm_package
74
+ end
75
+
76
+ desc "Copy alchemy entry point"
77
+ task copy_alchemy_entry_point: [:environment] do
78
+ puts "copying alchemy entry point"
79
+ Alchemy::Upgrader::FivePointZero.copy_alchemy_entry_point
80
+ end
61
81
  end
62
82
  end
63
83
  end
data/package/admin.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import translate from "./src/i18n"
2
+ import translationData from "./src/translations"
2
3
  import NodeTree from "./src/node_tree"
3
4
 
4
5
  // Global Alchemy object
@@ -10,5 +11,6 @@ if (typeof window.Alchemy === "undefined") {
10
11
  Object.assign(Alchemy, {
11
12
  // Global utility method for translating a given string
12
13
  t: translate,
14
+ translations: Object.assign(Alchemy.translations || {}, translationData),
13
15
  NodeTree
14
16
  })
@@ -15,12 +15,20 @@ describe("translate", () => {
15
15
  })
16
16
 
17
17
  describe("if translation is present", () => {
18
+ beforeEach(() => {
19
+ Alchemy.translations = { en: { help: "Help" } }
20
+ })
21
+
18
22
  it("Returns translated string", () => {
19
23
  expect(translate("help")).toEqual("Help")
20
24
  })
21
25
 
22
26
  describe("if key includes a period", () => {
23
27
  describe("that is translated", () => {
28
+ beforeEach(() => {
29
+ Alchemy.translations = { en: { formats: { date: "Y-m-d" } } }
30
+ })
31
+
24
32
  it("splits into group", () => {
25
33
  expect(translate("formats.date")).toEqual("Y-m-d")
26
34
  })
@@ -40,6 +48,10 @@ describe("translate", () => {
40
48
  })
41
49
 
42
50
  describe("if replacement is given", () => {
51
+ beforeEach(() => {
52
+ Alchemy.translations = { en: { allowed_chars: "of %{number} chars" } }
53
+ })
54
+
43
55
  it("replaces it", () => {
44
56
  expect(translate("allowed_chars", 5)).toEqual("of 5 chars")
45
57
  })
@@ -67,4 +79,15 @@ describe("translate", () => {
67
79
  spy.mockRestore()
68
80
  })
69
81
  })
82
+
83
+ describe("if Alchemy.translations is not set", () => {
84
+ it("Returns passed string and logs a warning", () => {
85
+ const spy = jest.spyOn(console, "warn").mockImplementation(() => {})
86
+ expect(translate("help")).toEqual("help")
87
+ expect(spy.mock.calls).toEqual([
88
+ ["Translations for locale kl not found!"]
89
+ ])
90
+ spy.mockRestore()
91
+ })
92
+ })
70
93
  })
data/package/src/i18n.js CHANGED
@@ -1,5 +1,3 @@
1
- import translationData from "./translations"
2
-
3
1
  const KEY_SEPARATOR = /\./
4
2
 
5
3
  function currentLocale() {
@@ -11,7 +9,7 @@ function currentLocale() {
11
9
 
12
10
  function getTranslations() {
13
11
  const locale = currentLocale()
14
- const translations = translationData[locale]
12
+ const translations = Alchemy.translations && Alchemy.translations[locale]
15
13
 
16
14
  if (translations) {
17
15
  return translations
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy_cms/admin",
3
- "version": "0.2.0",
3
+ "version": "5.0.5",
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: 5.0.4
4
+ version: 5.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
@@ -10,10 +10,10 @@ authors:
10
10
  - Hendrik Mans
11
11
  - Carsten Fregin
12
12
  - Martin Meyerhoff
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-05-06 00:00:00.000000000 Z
16
+ date: 2021-09-15 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: active_model_serializers
@@ -113,6 +113,9 @@ dependencies:
113
113
  - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: 1.0.7
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: 1.4.0
116
119
  type: :runtime
117
120
  prerelease: false
118
121
  version_requirements: !ruby/object:Gem::Requirement
@@ -123,6 +126,9 @@ dependencies:
123
126
  - - ">="
124
127
  - !ruby/object:Gem::Version
125
128
  version: 1.0.7
129
+ - - "<"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.4.0
126
132
  - !ruby/object:Gem::Dependency
127
133
  name: dragonfly_svg
128
134
  requirement: !ruby/object:Gem::Requirement
@@ -1258,9 +1264,9 @@ require_paths:
1258
1264
  - lib
1259
1265
  required_ruby_version: !ruby/object:Gem::Requirement
1260
1266
  requirements:
1261
- - - ">="
1267
+ - - "~>"
1262
1268
  - !ruby/object:Gem::Version
1263
- version: 2.3.0
1269
+ version: '2.3'
1264
1270
  required_rubygems_version: !ruby/object:Gem::Requirement
1265
1271
  requirements:
1266
1272
  - - ">="
@@ -1268,8 +1274,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1268
1274
  version: '0'
1269
1275
  requirements:
1270
1276
  - ImageMagick (libmagick), v6.6 or greater.
1271
- rubygems_version: 3.1.4
1272
- signing_key:
1277
+ rubygems_version: 3.2.26
1278
+ signing_key:
1273
1279
  specification_version: 4
1274
1280
  summary: A powerful, userfriendly and flexible CMS for Rails
1275
1281
  test_files: []
1282
+ ...