potassium 6.3.0 → 6.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/lib/potassium/assets/app/javascript/app.spec.js +1 -1
- data/lib/potassium/recipes/admin.rb +26 -16
- data/lib/potassium/recipes/api.rb +1 -0
- data/lib/potassium/recipes/front_end.rb +18 -11
- data/lib/potassium/recipes/google_tag_manager.rb +20 -16
- data/lib/potassium/templates/application.rb +2 -2
- data/lib/potassium/version.rb +2 -1
- data/spec/features/front_end_spec.rb +4 -1
- data/spec/features/google_tag_manager_spec.rb +1 -24
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e14355a0a57fd6a46a1cd70c835959c2bad07eb67ddf46406fab5d6d3b5ad1d7
|
4
|
+
data.tar.gz: 6c9d2885e8723911bfa0084feb4ab3a6697442314400ba4d3fc56c4117125cb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 136691a7fc128bb7365594deee8187e1c6e72bebb098d59157cfdc7e82134c7d790a67e5ca49edc4c445472a28b57ead05752bf89a127825c0b1c3c68f245706
|
7
|
+
data.tar.gz: 33685ddf7b75156fa20dda246ad7b848a9f4dd247f877445596c347daf58e6b8ac8f61333e1315c526f85c7ed298ed01d1cf9ed4909a218006bd84dac972fc81
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,20 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 6.4.0
|
6
|
+
|
7
|
+
Features
|
8
|
+
- Include `run_test` as a valid example group [#379](https://github.com/platanus/potassium/pull/379)
|
9
|
+
- Updates ActiveAdmin installation to use webpacker [#350](https://github.com/platanus/potassium/pull/350)
|
10
|
+
- Replaces Active Skin with Arctic Admin [#350](https://github.com/platanus/potassium/pull/350)
|
11
|
+
|
12
|
+
Fixes
|
13
|
+
- Forces `vue-loader` version to 15, as 16 requires `@vue/compiler-sfc`, which is a part of Vue 3 [#375](https://github.com/platanus/potassium/pull/375)
|
14
|
+
- Changes Content Security Policy added by GTM recipe to: [#375](https://github.com/platanus/potassium/pull/375)
|
15
|
+
- Include the same config regardless of environment
|
16
|
+
- Include `unsafe_eval` in `script_src`, as it is required for Vue's compiler build
|
17
|
+
- Changes the front-end test to avoid using the deprecated method `isVueInstance` [#376](https://github.com/platanus/potassium/pull/376)
|
18
|
+
|
5
19
|
## 6.3.0
|
6
20
|
|
7
21
|
Features:
|
@@ -34,10 +34,9 @@ class Recipes::Admin < Rails::AppBuilder
|
|
34
34
|
def add_active_admin
|
35
35
|
gather_gem 'activeadmin', '~> 2.6'
|
36
36
|
gather_gem 'activeadmin_addons'
|
37
|
-
gather_gem 'active_skin', github: 'SoftwareBrothers/active_skin'
|
38
37
|
add_readme_section :internal_dependencies, :active_admin
|
39
38
|
after(:gem_install, wrap_in_action: :admin_install) do
|
40
|
-
generate "active_admin:install"
|
39
|
+
generate "active_admin:install --use_webpacker"
|
41
40
|
line = "ActiveAdmin.setup do |config|"
|
42
41
|
initializer = "config/initializers/active_admin.rb"
|
43
42
|
gsub_file initializer, /(#{Regexp.escape(line)})/mi do |_match|
|
@@ -50,26 +49,37 @@ class Recipes::Admin < Rails::AppBuilder
|
|
50
49
|
end\n
|
51
50
|
ActiveAdmin.setup do |config|
|
52
51
|
config.view_factory.footer = CustomFooter
|
52
|
+
meta_tags_options = { viewport: 'width=device-width, initial-scale=1' }
|
53
|
+
config.meta_tags = meta_tags_options
|
54
|
+
config.meta_tags_for_logged_out_pages = meta_tags_options
|
53
55
|
HERE
|
54
56
|
end
|
55
57
|
|
56
|
-
|
57
|
-
style = "app/assets/stylesheets/active_admin.css.scss"
|
58
|
-
style = File.exist?(style) ? style : "app/assets/stylesheets/active_admin.scss"
|
58
|
+
generate "activeadmin_addons:install"
|
59
59
|
|
60
|
-
|
61
|
-
<<~HERE
|
62
|
-
#{line}
|
63
|
-
$skinActiveColor: #001CEE;
|
64
|
-
$skinHeaderBck: #002744;
|
65
|
-
$panelHeaderBck: #002744;
|
66
|
-
//$skinLogo: $skinHeaderBck image-url("logo_admin.png") no-repeat center center;
|
60
|
+
run "bin/yarn add arctic_admin @fortawesome/fontawesome-free"
|
67
61
|
|
68
|
-
|
69
|
-
HERE
|
70
|
-
end
|
62
|
+
aa_style = "app/javascript/stylesheets/active_admin.scss"
|
71
63
|
|
72
|
-
|
64
|
+
gsub_file(
|
65
|
+
aa_style,
|
66
|
+
"@import \"~@activeadmin/activeadmin/src/scss/mixins\";\n" +
|
67
|
+
"@import \"~@activeadmin/activeadmin/src/scss/base\";",
|
68
|
+
"@import '~arctic_admin/src/scss/main'; \n"
|
69
|
+
)
|
70
|
+
|
71
|
+
aa_js = "app/javascript/packs/active_admin.js"
|
72
|
+
js_line = "import \"@activeadmin/activeadmin\";\n"
|
73
|
+
|
74
|
+
gsub_file(
|
75
|
+
aa_js,
|
76
|
+
js_line,
|
77
|
+
<<~HERE
|
78
|
+
#{js_line}
|
79
|
+
import '@fortawesome/fontawesome-free/css/all.css';
|
80
|
+
import 'arctic_admin';
|
81
|
+
HERE
|
82
|
+
)
|
73
83
|
end
|
74
84
|
end
|
75
85
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
class Recipes::FrontEnd < Rails::AppBuilder
|
2
|
+
VUE_LOADER_VERSION = Potassium::VUE_LOADER_VERSION
|
3
|
+
|
2
4
|
def ask
|
3
5
|
frameworks = {
|
4
6
|
vue: "Vue",
|
@@ -15,21 +17,13 @@ class Recipes::FrontEnd < Rails::AppBuilder
|
|
15
17
|
end
|
16
18
|
|
17
19
|
def create
|
18
|
-
return if [:none, :None].include? get(:front_end).to_sym
|
19
|
-
|
20
20
|
recipe = self
|
21
21
|
after(:gem_install) do
|
22
22
|
value = get(:front_end)
|
23
23
|
run "rails webpacker:install"
|
24
|
-
run "rails webpacker:install:#{value}"
|
25
|
-
|
26
|
-
if value == :vue
|
27
|
-
recipe.setup_vue_with_compiler_build
|
28
|
-
recipe.setup_jest
|
29
|
-
if get(:api) == :graphql
|
30
|
-
recipe.setup_apollo
|
31
|
-
end
|
32
|
-
end
|
24
|
+
run "rails webpacker:install:#{value}" unless [:none, :None].include? value.to_sym
|
25
|
+
|
26
|
+
recipe.setup_vue if value == :vue
|
33
27
|
recipe.add_responsive_meta_tag
|
34
28
|
recipe.setup_tailwind
|
35
29
|
add_readme_header :webpack
|
@@ -108,6 +102,19 @@ class Recipes::FrontEnd < Rails::AppBuilder
|
|
108
102
|
)
|
109
103
|
end
|
110
104
|
|
105
|
+
def foce_vue_loader_version
|
106
|
+
run "bin/yarn add vue-loader@#{VUE_LOADER_VERSION}"
|
107
|
+
end
|
108
|
+
|
109
|
+
def setup_vue
|
110
|
+
foce_vue_loader_version
|
111
|
+
setup_vue_with_compiler_build
|
112
|
+
setup_jest
|
113
|
+
if get(:api) == :graphql
|
114
|
+
setup_apollo
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
111
118
|
private
|
112
119
|
|
113
120
|
def frameworks(framework)
|
@@ -68,22 +68,26 @@ class Recipes::GoogleTagManager < Rails::AppBuilder
|
|
68
68
|
def content_security_policy_code
|
69
69
|
<<~HERE
|
70
70
|
Rails.application.config.content_security_policy do |policy|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
71
|
+
policy.connect_src(
|
72
|
+
:self,
|
73
|
+
:https,
|
74
|
+
'http://localhost:3035',
|
75
|
+
'ws://localhost:3035',
|
76
|
+
'https://www.google-analytics.com'
|
77
|
+
)
|
78
|
+
# google tag manager requires to enable unsafe inline and vue unsave eval:
|
79
|
+
# https://developers.google.com/tag-manager/web/csp
|
80
|
+
# https://vuejs.org/v2/guide/installation.html#CSP-environments
|
81
|
+
policy.script_src(
|
82
|
+
:self,
|
83
|
+
:https,
|
84
|
+
:unsafe_inline,
|
85
|
+
:unsafe_eval,
|
86
|
+
'https://www.googletagmanager.com',
|
87
|
+
'https://www.google-analytics.com',
|
88
|
+
'https://ssl.google-analytics.com'
|
89
|
+
)
|
90
|
+
policy.img_src :self, :https, 'https://www.googletagmanager.com', 'https://www.google-analytics.com'
|
87
91
|
end
|
88
92
|
HERE
|
89
93
|
end
|
@@ -61,8 +61,6 @@ run_action(:recipe_loading) do
|
|
61
61
|
create :better_errors
|
62
62
|
create :monitoring
|
63
63
|
create :devise
|
64
|
-
create :admin
|
65
|
-
create :vue_admin
|
66
64
|
create :seeds
|
67
65
|
create :error_reporting
|
68
66
|
create :pundit
|
@@ -78,6 +76,8 @@ run_action(:recipe_loading) do
|
|
78
76
|
create :github
|
79
77
|
create :cleanup
|
80
78
|
create :front_end
|
79
|
+
create :admin
|
80
|
+
create :vue_admin
|
81
81
|
create :google_tag_manager
|
82
82
|
end
|
83
83
|
|
data/lib/potassium/version.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Potassium
|
2
|
-
VERSION = "6.
|
2
|
+
VERSION = "6.4.0"
|
3
3
|
RUBY_VERSION = "2.7.0"
|
4
4
|
RAILS_VERSION = "~> 6.0.2"
|
5
5
|
RUBOCOP_VERSION = "~> 1.9"
|
@@ -8,4 +8,5 @@ module Potassium
|
|
8
8
|
MYSQL_VERSION = "5.7"
|
9
9
|
NODE_VERSION = "12"
|
10
10
|
TAILWINDCSS = "npm:@tailwindcss/postcss7-compat"
|
11
|
+
VUE_LOADER_VERSION = "^15.9.7"
|
11
12
|
end
|
@@ -19,7 +19,6 @@ RSpec.describe "Front end" do
|
|
19
19
|
remove_project_directory
|
20
20
|
create_dummy_project("front_end" => "None")
|
21
21
|
expect(gemfile).to include('webpacker')
|
22
|
-
expect(File).not_to exist(application_css_path)
|
23
22
|
end
|
24
23
|
|
25
24
|
def expect_to_have_tailwind_compatibility_build
|
@@ -65,6 +64,10 @@ RSpec.describe "Front end" do
|
|
65
64
|
expect_to_have_tailwind_compatibility_build
|
66
65
|
end
|
67
66
|
|
67
|
+
it 'includes correct version of vue-loader in package' do
|
68
|
+
expect(node_modules_file).to include("\"vue-loader\": \"#{Potassium::VUE_LOADER_VERSION}\"")
|
69
|
+
end
|
70
|
+
|
68
71
|
context "with graphql" do
|
69
72
|
before(:all) do
|
70
73
|
remove_project_directory
|
@@ -31,29 +31,6 @@ RSpec.describe "Google Tag Manager" do
|
|
31
31
|
|
32
32
|
it 'add content security policy' do
|
33
33
|
expect(content_security_policy_file)
|
34
|
-
.to include(
|
35
|
-
end
|
36
|
-
|
37
|
-
def content_security_policy_code
|
38
|
-
<<~HERE
|
39
|
-
Rails.application.config.content_security_policy do |policy|
|
40
|
-
if Rails.env.development?
|
41
|
-
policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035'
|
42
|
-
policy.script_src :self, :https, :unsafe_eval
|
43
|
-
else
|
44
|
-
policy.script_src :self, :https
|
45
|
-
# google tag manager requires to enable unsafe inline:
|
46
|
-
# https://developers.google.com/tag-manager/web/csp
|
47
|
-
policy.connect_src :self, :https, 'https://www.google-analytics.com'
|
48
|
-
policy.script_src :self,
|
49
|
-
:https,
|
50
|
-
:unsafe_inline,
|
51
|
-
'https://www.googletagmanager.com',
|
52
|
-
'https://www.google-analytics.com',
|
53
|
-
'https://ssl.google-analytics.com'
|
54
|
-
policy.img_src :self, :https, 'https://www.googletagmanager.com', 'https://www.google-analytics.com'
|
55
|
-
end
|
56
|
-
end
|
57
|
-
HERE
|
34
|
+
.to include("\nRails.application.config.content_security_policy do |policy|")
|
58
35
|
end
|
59
36
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: potassium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juliogarciag
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|