potassium 6.5.0 → 6.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +30 -1
  4. data/docs/CONTRIBUTING.md +2 -2
  5. data/lib/potassium/assets/.circleci/config.yml.erb +11 -1
  6. data/lib/potassium/assets/.eslintrc.json +15 -9
  7. data/lib/potassium/assets/.rubocop.yml +1 -0
  8. data/lib/potassium/assets/Aptfile +5 -0
  9. data/lib/potassium/assets/README.yml +30 -6
  10. data/lib/potassium/assets/active_admin/admin-component.vue +22 -30
  11. data/lib/potassium/assets/app/javascript/{app.spec.js → components/app.spec.ts} +1 -1
  12. data/lib/potassium/assets/app/javascript/components/app.vue +9 -0
  13. data/lib/potassium/assets/app/javascript/types/vue.d.ts +5 -0
  14. data/lib/potassium/assets/app/jobs/shrine_promote_job.rb +14 -0
  15. data/lib/potassium/assets/app/mailers/application_mailer.rb +1 -1
  16. data/lib/potassium/assets/app/mailers/example_mailer.rb +6 -0
  17. data/lib/potassium/assets/app/serializers/base_serializer.rb +3 -0
  18. data/lib/potassium/assets/app/serializers/concerns/image_handling_attributes.rb +20 -0
  19. data/lib/potassium/assets/app/uploaders/cover_image_uploader.rb +52 -0
  20. data/lib/potassium/assets/app/views/example_mailer/example_mail.html.mjml +7 -0
  21. data/lib/potassium/assets/app/views/layouts/default_mail.html.mjml +49 -0
  22. data/lib/potassium/assets/config/initializers/shrine/plugins/image_handling_utilities.rb +143 -0
  23. data/lib/potassium/assets/config/mailer.rb.erb +0 -2
  24. data/lib/potassium/assets/config/shrine.rb +15 -0
  25. data/lib/potassium/assets/config/webpack/rules/css.js +5 -0
  26. data/lib/potassium/assets/config/webpack/rules/index.js +11 -0
  27. data/lib/potassium/assets/config/webpack/rules/jquery.js +11 -0
  28. data/lib/potassium/assets/config/webpack/rules/typescript.js +32 -0
  29. data/lib/potassium/assets/config/webpack/rules/vue.js +19 -0
  30. data/lib/potassium/assets/config/webpack/webpack.config.js +4 -0
  31. data/lib/potassium/assets/public/mails/platanus-logo.png +0 -0
  32. data/lib/potassium/assets/tsconfig.json +31 -0
  33. data/lib/potassium/cli/commands/create.rb +3 -1
  34. data/lib/potassium/cli_options.rb +15 -3
  35. data/lib/potassium/platanus_config.rb +20 -0
  36. data/lib/potassium/recipes/admin.rb +11 -0
  37. data/lib/potassium/recipes/api.rb +6 -85
  38. data/lib/potassium/recipes/coverage.rb +31 -0
  39. data/lib/potassium/recipes/file_storage.rb +50 -0
  40. data/lib/potassium/recipes/front_end.rb +82 -110
  41. data/lib/potassium/recipes/google_tag_manager.rb +1 -1
  42. data/lib/potassium/recipes/mailer.rb +22 -10
  43. data/lib/potassium/recipes/mjml.rb +31 -0
  44. data/lib/potassium/recipes/node.rb +11 -13
  45. data/lib/potassium/recipes/style.rb +9 -2
  46. data/lib/potassium/recipes/vue_admin.rb +38 -8
  47. data/lib/potassium/templates/application.rb +1 -0
  48. data/lib/potassium/version.rb +8 -3
  49. data/spec/features/api_spec.rb +6 -1
  50. data/spec/features/coverage_spec.rb +17 -0
  51. data/spec/features/file_storage_spec.rb +102 -26
  52. data/spec/features/front_end_spec.rb +14 -48
  53. data/spec/features/mailer_spec.rb +79 -33
  54. data/spec/features/mjml_spec.rb +53 -0
  55. data/spec/features/vue_admin_spec.rb +0 -10
  56. data/spec/support/shared_examples.rb +5 -0
  57. metadata +28 -21
  58. data/lib/potassium/assets/active_admin/admin_application.js +0 -14
  59. data/lib/potassium/assets/active_admin/init_activeadmin_vue.rb +0 -10
  60. data/lib/potassium/assets/app/graphql/graphql_controller.rb +0 -55
  61. data/lib/potassium/assets/app/graphql/mutations/login_mutation.rb +0 -23
  62. data/lib/potassium/assets/app/graphql/queries/base_query.rb +0 -4
  63. data/lib/potassium/assets/app/graphql/types/base/base_argument.rb +0 -4
  64. data/lib/potassium/assets/app/graphql/types/base/base_enum.rb +0 -4
  65. data/lib/potassium/assets/app/graphql/types/base/base_field.rb +0 -5
  66. data/lib/potassium/assets/app/graphql/types/base/base_input_object.rb +0 -5
  67. data/lib/potassium/assets/app/graphql/types/base/base_interface.rb +0 -7
  68. data/lib/potassium/assets/app/graphql/types/base/base_object.rb +0 -5
  69. data/lib/potassium/assets/app/graphql/types/base/base_scalar.rb +0 -4
  70. data/lib/potassium/assets/app/graphql/types/base/base_union.rb +0 -4
  71. data/lib/potassium/assets/app/graphql/types/mutation_type.rb +0 -10
  72. data/lib/potassium/assets/app/graphql/types/query_type.rb +0 -13
  73. data/lib/potassium/assets/config/graphql_playground.rb +0 -20
  74. data/spec/features/graphql_spec.rb +0 -71
@@ -32,44 +32,120 @@ RSpec.describe "File Storage" do
32
32
  content = IO.read("#{project_path}/.env.development")
33
33
  expect(content).to include("S3_BUCKET=")
34
34
  end
35
+
36
+ it "does not add vips install step to ci config" do
37
+ content = IO.read("#{project_path}/.circleci/config.yml")
38
+ expect(content).not_to include("Install apt and vips buildpack dependencies")
39
+ end
35
40
  end
36
41
 
37
42
  context "when selecting shrine" do
38
- before :all do
39
- drop_dummy_database
40
- remove_project_directory
41
- create_dummy_project(storage: :shrine)
42
- end
43
+ shared_examples 'common shrine setup' do
44
+ it "adds the aws-sdk-s3, shrine and marcel gems to Gemfile" do
45
+ gemfile_content = IO.read("#{project_path}/Gemfile")
46
+ expect(gemfile_content).to include("gem 'aws-sdk-s3'")
47
+ expect(gemfile_content).to include("gem 'shrine'")
48
+ expect(gemfile_content).to include("gem 'marcel'")
49
+ end
43
50
 
44
- it "adds the aws-sdk-s3, shrine and marcel gems to Gemfile" do
45
- gemfile_content = IO.read("#{project_path}/Gemfile")
46
- expect(gemfile_content).to include("gem 'aws-sdk-s3'")
47
- expect(gemfile_content).to include("gem 'shrine'")
48
- expect(gemfile_content).to include("gem 'marcel'")
49
- end
51
+ it "adds brief to README file" do
52
+ content = IO.read("#{project_path}/README.md")
53
+ expect(content).to include("Shrine")
54
+ end
50
55
 
51
- it "adds brief to README file" do
52
- content = IO.read("#{project_path}/README.md")
53
- expect(content).to include("Shrine")
54
- end
56
+ it "adds shrine initializer" do
57
+ expect(File.exist?("#{project_path}/config/initializers/shrine.rb")).to be true
58
+ end
59
+
60
+ it "adds base_uploader and image_uploader" do
61
+ expect(File.exist?("#{project_path}/app/uploaders/base_uploader.rb")).to be true
62
+ expect(File.exist?("#{project_path}/app/uploaders/image_uploader.rb")).to be true
63
+ end
64
+
65
+ it "adds S3 bucket ENV vars" do
66
+ content = IO.read("#{project_path}/.env.development")
67
+ expect(content).to include("S3_BUCKET=")
68
+ end
69
+
70
+ it "adds filestorage path to gitignore" do
71
+ content = IO.read("#{project_path}/.gitignore")
72
+ expect(content).to include("/public/uploads")
73
+ end
55
74
 
56
- it "adds shrine initializer" do
57
- expect(File.exist?("#{project_path}/config/initializers/shrine.rb")).to be true
75
+ it "adds vips install step to ci config" do
76
+ content = IO.read("#{project_path}/.circleci/config.yml")
77
+ expect(content).to include("Install apt and vips buildpack dependencies")
78
+ end
58
79
  end
59
80
 
60
- it "adds base_uploader and image_uploader" do
61
- expect(File.exist?("#{project_path}/app/uploaders/base_uploader.rb")).to be true
62
- expect(File.exist?("#{project_path}/app/uploaders/image_uploader.rb")).to be true
81
+ context 'with no heroku or api' do
82
+ before :all do
83
+ drop_dummy_database
84
+ remove_project_directory
85
+ create_dummy_project(storage: :shrine)
86
+ end
87
+
88
+ it_behaves_like 'common shrine setup'
89
+
90
+ it 'does not add buildpacks to missing .buildpacks' do
91
+ expect { IO.read("#{project_path}/.buildpacks") }.to raise_error(Errno::ENOENT)
92
+ end
93
+
94
+ it 'does not add Aptfile' do
95
+ expect { IO.read("#{project_path}/Aptfile") }.to raise_error(Errno::ENOENT)
96
+ end
97
+
98
+ it 'does not image_handling_attributes serializer concern' do
99
+ expect do
100
+ IO.read("#{project_path}/app/serializers/concerns/image_handling_attributes.rb")
101
+ end.to raise_error(Errno::ENOENT)
102
+ end
103
+
104
+ it 'does not add base serializer' do
105
+ expect do
106
+ IO.read("#{project_path}/app/serializers/base_serializer.rb")
107
+ end.to raise_error(Errno::ENOENT)
108
+ end
63
109
  end
64
110
 
65
- it "adds S3 bucket ENV vars" do
66
- content = IO.read("#{project_path}/.env.development")
67
- expect(content).to include("S3_BUCKET=")
111
+ context 'with heroku' do
112
+ before :all do
113
+ drop_dummy_database
114
+ remove_project_directory
115
+ create_dummy_project(storage: :shrine, heroku: true)
116
+ end
117
+
118
+ it_behaves_like 'common shrine setup'
119
+
120
+ it 'adds buildpacks .buildpacks' do
121
+ content = IO.read("#{project_path}/.buildpacks")
122
+ expect(content).to include("heroku-buildpack-apt")
123
+ expect(content).to include("heroku-buildpack-vips")
124
+ end
125
+
126
+ it 'adds Aptfile' do
127
+ expect(File.exist?("#{project_path}/Aptfile")).to be(true)
128
+ end
68
129
  end
69
130
 
70
- it "adds filestorage path to gitignore" do
71
- content = IO.read("#{project_path}/.gitignore")
72
- expect(content).to include("/public/uploads")
131
+ context 'with api' do
132
+ before :all do
133
+ drop_dummy_database
134
+ remove_project_directory
135
+ create_dummy_project(storage: :shrine, api: true)
136
+ end
137
+
138
+ it_behaves_like 'common shrine setup'
139
+
140
+ it 'adds image_handling_attributes serializer concern' do
141
+ expect(
142
+ File.exist?("#{project_path}/app/serializers/concerns/image_handling_attributes.rb")
143
+ ).to be(true)
144
+ end
145
+
146
+ it 'adds base serializer' do
147
+ expect(File.exist?("#{project_path}/app/serializers/base_serializer.rb")).to be(true)
148
+ end
73
149
  end
74
150
  end
75
151
  end
@@ -9,7 +9,7 @@ RSpec.describe "Front end" do
9
9
  let(:application_css_path) { "#{project_path}/app/javascript/css/application.css" }
10
10
  let(:gemfile) { IO.read("#{project_path}/Gemfile") }
11
11
  let(:node_modules_file) { IO.read("#{project_path}/package.json") }
12
- let(:application_js_file) { IO.read("#{project_path}/app/javascript/packs/application.js") }
12
+ let(:application_js_file) { IO.read("#{project_path}/app/javascript/application.js") }
13
13
  let(:layout_file) { IO.read("#{project_path}/app/views/layouts/application.html.erb") }
14
14
  let(:application_css_file) { IO.read(application_css_path) }
15
15
  let(:tailwind_config_file) { IO.read("#{project_path}/tailwind.config.js") }
@@ -18,13 +18,13 @@ RSpec.describe "Front end" do
18
18
  it "creates a project without a front end framework" do
19
19
  remove_project_directory
20
20
  create_dummy_project("front_end" => "None")
21
- expect(gemfile).to include('webpacker')
21
+ expect(gemfile).to include('shakapacker')
22
22
  end
23
23
 
24
- def expect_to_have_tailwind_compatibility_build
25
- expect(node_modules_file).to include("\"tailwindcss\": \"npm:@tailwindcss/postcss7-compat\"")
26
- expect(node_modules_file).to include("\"autoprefixer\": \"^9\"")
27
- expect(node_modules_file).to include("\"postcss\": \"^7\"")
24
+ def expect_to_have_tailwind_package_versions
25
+ expect(node_modules_file).to include("\"tailwindcss\": \"^3\"")
26
+ expect(node_modules_file).to include("\"autoprefixer\": \"^10\"")
27
+ expect(node_modules_file).to include("\"postcss\": \"^8\"")
28
28
  end
29
29
 
30
30
  context "with vue" do
@@ -33,11 +33,11 @@ RSpec.describe "Front end" do
33
33
  create_dummy_project("front_end" => "vue")
34
34
  end
35
35
 
36
- it "creates a project with vue in compiler mode as frontend framework" do
37
- expect(gemfile).to include('webpacker')
36
+ it "creates a project with vue as frontend framework" do
37
+ expect(gemfile).to include('shakapacker')
38
38
  expect(node_modules_file).to include("\"vue\"")
39
- expect(application_js_file).to include('vue/dist/vue.esm')
40
- expect(application_js_file).to include("el: '#vue-app'")
39
+ expect(application_js_file).to include('vue')
40
+ expect(application_js_file).to include("app.mount('#vue-app')")
41
41
  expect(layout_file).to include('id="vue-app"')
42
42
  end
43
43
 
@@ -46,7 +46,7 @@ RSpec.describe "Front end" do
46
46
  end
47
47
 
48
48
  it "creates a vue project with client css" do
49
- expect(application_js_file).to include("import '../css/application.css';")
49
+ expect(application_js_file).to include("import './css/application.css';")
50
50
  expect(layout_file).to include("<%= stylesheet_pack_tag 'application' %>")
51
51
  expect(rails_css_file).not_to include('*= require_tree', '*= require_self')
52
52
  end
@@ -54,52 +54,18 @@ RSpec.describe "Front end" do
54
54
  it "creates a vue project with tailwindcss" do
55
55
  expect(node_modules_file).to include("\"tailwindcss\"")
56
56
  expect(application_css_file).to include(
57
- "@import 'tailwindcss/base';",
58
- "@import 'tailwindcss/components';"
57
+ "@tailwind base;",
58
+ "@tailwind components;"
59
59
  )
60
60
  expect(tailwind_config_file).to include('module.exports')
61
61
  end
62
62
 
63
63
  it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
64
- expect_to_have_tailwind_compatibility_build
64
+ expect_to_have_tailwind_package_versions
65
65
  end
66
66
 
67
67
  it 'includes correct version of vue-loader in package' do
68
68
  expect(node_modules_file).to include("\"vue-loader\": \"#{Potassium::VUE_LOADER_VERSION}\"")
69
69
  end
70
-
71
- context "with graphql" do
72
- before(:all) do
73
- remove_project_directory
74
- create_dummy_project("front_end" => "vue", "api" => "graphql")
75
- end
76
-
77
- it "creates a vue project with apollo" do
78
- expect(node_modules_file).to include("\"vue-apollo\"")
79
- expect(application_js_file).to include("import { ApolloClient } from 'apollo-client';")
80
- expect(application_js_file).to include("Vue.use(VueApollo)")
81
- expect(application_js_file).to include("apolloProvider,")
82
- end
83
- end
84
- end
85
-
86
- context "with angular" do
87
- before(:all) do
88
- remove_project_directory
89
- create_dummy_project("front_end" => "angular")
90
- end
91
-
92
- it "creates a project without vue as front end framework" do
93
- expect(gemfile).to include('webpacker')
94
- expect(node_modules_file).to include("\"@angular/core\"")
95
- end
96
-
97
- it "creates application_js_file for tailwind without vue" do
98
- expect(application_js_file).to include("import '../css/application.css';")
99
- end
100
-
101
- it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
102
- expect_to_have_tailwind_compatibility_build
103
- end
104
70
  end
105
71
  end
@@ -1,58 +1,104 @@
1
+ # rubocop:disable Rspec/MultipleMemoizedHelpers
1
2
  require "spec_helper"
2
3
 
3
4
  RSpec.describe "Mailer" do
4
5
  let(:gemfile) { IO.read("#{project_path}/Gemfile") }
5
- let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
6
+ let(:env) { IO.read("#{project_path}/.env.development") }
6
7
  let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
7
- let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
8
+ let(:prod_config) { IO.read("#{project_path}/config/environments/production.rb") }
9
+ let(:asset_host_dev) do
10
+ <<~RUBY
11
+ config.action_mailer.asset_host = "http://\#{ENV.fetch('APPLICATION_HOST')}"
12
+ RUBY
13
+ end
14
+ let(:asset_host_prod) do
15
+ <<~RUBY
16
+ config.action_mailer.asset_host = "https://\#{ENV.fetch('APPLICATION_HOST')}"
17
+ RUBY
18
+ end
19
+ let(:mailer_config_text) do
20
+ <<~RUBY
21
+ require Rails.root.join("config", "mailer")
22
+ RUBY
23
+ end
8
24
 
9
25
  before(:all) { drop_dummy_database }
10
26
 
11
- context "when selecting sendgrid as mailer" do
12
- before(:all) do
13
- remove_project_directory
14
- create_dummy_project("email_service" => "sendgrid")
15
- end
27
+ describe 'with mailer' do
28
+ let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
29
+ let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
30
+
31
+ context "when selecting sendgrid as mailer" do
32
+ before(:all) do
33
+ remove_project_directory
34
+ create_dummy_project("email_service" => "sendgrid")
35
+ end
36
+
37
+ it_behaves_like "name"
38
+ it { expect(gemfile).to include("send_grid_mailer") }
16
39
 
17
- it { expect(gemfile).to include("send_grid_mailer") }
40
+ it "adds configuration to mailer.rb" do
41
+ expect(mailer_config).to include("delivery_method = :sendgrid")
42
+ expect(mailer_config).to include("sendgrid_settings = {")
43
+ expect(mailer_config).to include("api_key: ENV['SENDGRID_API_KEY']")
44
+ end
18
45
 
19
- it "adds configuration to mailer.rb" do
20
- expect(mailer_config).to include("delivery_method = :sendgrid")
21
- expect(mailer_config).to include("sendgrid_settings = {")
22
- expect(mailer_config).to include("api_key: ENV['SENDGRID_API_KEY']")
46
+ it "adds configuration to development.rb" do
47
+ expect(dev_config).to include("delivery_method = :sendgrid_dev")
48
+ expect(dev_config).to include("sendgrid_dev_settings = {")
49
+ expect(dev_config).to include("api_key: ENV['SENDGRID_API_KEY']")
50
+ end
51
+
52
+ it "adds configuration to production" do
53
+ expect(prod_config).to include(mailer_config_text)
54
+ expect(prod_config).to include(asset_host_prod)
55
+ end
23
56
  end
24
57
 
25
- it "adds configuration to development.rb" do
26
- expect(dev_config).to include("delivery_method = :sendgrid_dev")
27
- expect(dev_config).to include("sendgrid_dev_settings = {")
28
- expect(dev_config).to include("api_key: ENV['SENDGRID_API_KEY']")
58
+ context "when selecting aws_ses as mailer" do
59
+ before(:all) do
60
+ remove_project_directory
61
+ create_dummy_project("email_service" => "aws_ses")
62
+ end
63
+
64
+ it_behaves_like "name"
65
+ it { expect(gemfile).to include("aws-sdk-rails") }
66
+ it { expect(gemfile).to include("letter_opener") }
67
+ it { expect(mailer_config).to include("delivery_method = :aws_sdk") }
68
+ it { expect(dev_config).to include("delivery_method = :letter_opener") }
29
69
  end
30
70
 
31
- it { expect(sidekiq_config).to include("- mailers") }
71
+ context "when selecting a mailer and sidekiq" do
72
+ before :all do
73
+ drop_dummy_database
74
+ remove_project_directory
75
+ create_dummy_project(
76
+ "background_processor" => true, "email_service" => 'sendgrid'
77
+ )
78
+ end
79
+
80
+ it { expect(sidekiq_config).to include("- mailers") }
81
+ end
32
82
  end
33
83
 
34
- context "when selecting aws_ses as mailer" do
84
+ context "when there is no mailer" do
35
85
  before(:all) do
36
86
  remove_project_directory
37
- create_dummy_project("email_service" => "aws_ses")
87
+ create_dummy_project
38
88
  end
39
89
 
40
- it { expect(gemfile).to include("aws-sdk-rails") }
41
- it { expect(gemfile).to include("letter_opener") }
42
- it { expect(mailer_config).to include("delivery_method = :aws_sdk") }
43
- it { expect(dev_config).to include("delivery_method = :letter_opener") }
44
- it { expect(sidekiq_config).to include("- mailers") }
45
- end
90
+ it { expect(gemfile).not_to include("letter_opener") }
91
+ it { expect(File.exists?("#{project_path}/config/mailer.rb")).to eq(false) }
92
+ it { expect(env).not_to include("EMAIL_RECIPIENTS") }
46
93
 
47
- context "when selecting a mailer and sidekiq" do
48
- before :all do
49
- drop_dummy_database
50
- remove_project_directory
51
- create_dummy_project(
52
- "background_processor" => true, "email_service" => 'sendgrid'
53
- )
94
+ it "adds configuration to development" do
95
+ expect(dev_config).not_to include(asset_host_dev)
96
+ expect(dev_config).not_to include("delivery_method")
54
97
  end
55
98
 
56
- it { expect(sidekiq_config).to include("- mailers") }
99
+ it "adds configuration to production" do
100
+ expect(prod_config).not_to include(mailer_config_text)
101
+ expect(prod_config).not_to include(asset_host_prod)
102
+ end
57
103
  end
58
104
  end
@@ -0,0 +1,53 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Mjml" do
4
+ let(:gemfile) { IO.read("#{project_path}/Gemfile") }
5
+ let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
6
+ let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
7
+ let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
8
+ let(:yarn_lock) { IO.read("#{project_path}/yarn.lock") }
9
+
10
+ before(:all) { drop_dummy_database }
11
+
12
+ context "when selecting a mailer" do
13
+ before(:all) do
14
+ remove_project_directory
15
+ create_dummy_project("email_service" => "sendgrid")
16
+ end
17
+
18
+ it 'adds gems and packages' do
19
+ expect(yarn_lock).to include("mjml")
20
+ expect(gemfile).to include("mjml-rails")
21
+ end
22
+
23
+ it 'creates example mailer' do
24
+ expect(File.exists?("#{project_path}/app/views/layouts/default_mail.html.mjml")).to eq(true)
25
+ expect(File.exists?("#{project_path}/app/mailers/example_mailer.rb")).to eq(true)
26
+ expect(File.exists?("#{project_path}/app/views/example_mailer/example_mail.html.mjml"))
27
+ .to eq(true)
28
+ expect(File.exists?("#{project_path}/public/mails/platanus-logo.png")).to eq(true)
29
+ end
30
+ end
31
+
32
+ context "when there is no mailer selected" do
33
+ before(:all) do
34
+ remove_project_directory
35
+ create_dummy_project
36
+ end
37
+
38
+ it 'adds gems and packages' do
39
+ expect(yarn_lock).not_to include("mjml")
40
+ expect(gemfile).not_to include("mjml-rails")
41
+ end
42
+
43
+ it 'creates example mailer' do
44
+ expect(File.exists?("#{project_path}/app/views/layouts/default_mail.html.mjml"))
45
+ .not_to eq(true)
46
+ expect(File.exists?("#{project_path}/app/mailers/example_mailer.rb"))
47
+ .not_to eq(true)
48
+ expect(File.exists?("#{project_path}/app/views/example_mailer/example_mail.html.mjml"))
49
+ .not_to eq(true)
50
+ expect(File.exists?("#{project_path}/public/mails/platanus-logo.png")).not_to eq(true)
51
+ end
52
+ end
53
+ end
@@ -14,11 +14,6 @@ RSpec.describe "VueAdmin" do
14
14
  expect(initializer_file).to include("AUTO_BUILD_ELEMENTS")
15
15
  end
16
16
 
17
- it "adds layout tags to active admin layout initializer" do
18
- initializer_path = "#{project_path}/config/initializers/init_activeadmin_vue.rb"
19
- expect(File).to be_file(initializer_path)
20
- end
21
-
22
17
  it "adds vue_component to library" do
23
18
  vue_component_lib_path = "#{project_path}/lib/vue_component.rb"
24
19
  expect(File).to be_file(vue_component_lib_path)
@@ -26,11 +21,6 @@ RSpec.describe "VueAdmin" do
26
21
  expect(vue_component_lib).to include("VueComponent")
27
22
  end
28
23
 
29
- it "adds admin_application pack to packs" do
30
- application_pack_path = "#{project_path}/app/javascript/packs/admin_application.js"
31
- expect(File).to be_file(application_pack_path)
32
- end
33
-
34
24
  it "adds admin_component to vue components" do
35
25
  application_pack_path = "#{project_path}/app/javascript/components/admin-component.vue"
36
26
  expect(File).to be_file(application_pack_path)
@@ -0,0 +1,5 @@
1
+ RSpec.shared_examples "name" do
2
+ it { expect(sidekiq_config).to include("- mailers") }
3
+ it { expect(env).to include("EMAIL_RECIPIENTS") }
4
+ it { expect(dev_config).to include(asset_host_dev) }
5
+ 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.5.0
4
+ version: 6.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-28 00:00:00.000000000 Z
11
+ date: 2022-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -271,34 +271,29 @@ files:
271
271
  - lib/potassium/assets/.pryrc
272
272
  - lib/potassium/assets/.rubocop.yml
273
273
  - lib/potassium/assets/.stylelintrc.json
274
+ - lib/potassium/assets/Aptfile
274
275
  - lib/potassium/assets/Makefile.erb
275
276
  - lib/potassium/assets/Procfile
276
277
  - lib/potassium/assets/README.md.erb
277
278
  - lib/potassium/assets/README.yml
278
279
  - lib/potassium/assets/active_admin/admin-component.vue
279
- - lib/potassium/assets/active_admin/admin_application.js
280
- - lib/potassium/assets/active_admin/init_activeadmin_vue.rb
281
280
  - lib/potassium/assets/active_admin/policies/admin_user_policy.rb
282
281
  - lib/potassium/assets/active_admin/policies/comment_policy.rb
283
282
  - lib/potassium/assets/active_admin/policies/default_policy.rb
284
283
  - lib/potassium/assets/active_admin/policies/page_policy.rb
285
- - lib/potassium/assets/app/graphql/graphql_controller.rb
286
- - lib/potassium/assets/app/graphql/mutations/login_mutation.rb
287
- - lib/potassium/assets/app/graphql/queries/base_query.rb
288
- - lib/potassium/assets/app/graphql/types/base/base_argument.rb
289
- - lib/potassium/assets/app/graphql/types/base/base_enum.rb
290
- - lib/potassium/assets/app/graphql/types/base/base_field.rb
291
- - lib/potassium/assets/app/graphql/types/base/base_input_object.rb
292
- - lib/potassium/assets/app/graphql/types/base/base_interface.rb
293
- - lib/potassium/assets/app/graphql/types/base/base_object.rb
294
- - lib/potassium/assets/app/graphql/types/base/base_scalar.rb
295
- - lib/potassium/assets/app/graphql/types/base/base_union.rb
296
- - lib/potassium/assets/app/graphql/types/mutation_type.rb
297
- - lib/potassium/assets/app/graphql/types/query_type.rb
298
- - lib/potassium/assets/app/javascript/app.spec.js
284
+ - lib/potassium/assets/app/javascript/components/app.spec.ts
285
+ - lib/potassium/assets/app/javascript/components/app.vue
286
+ - lib/potassium/assets/app/javascript/types/vue.d.ts
287
+ - lib/potassium/assets/app/jobs/shrine_promote_job.rb
299
288
  - lib/potassium/assets/app/mailers/application_mailer.rb
289
+ - lib/potassium/assets/app/mailers/example_mailer.rb
290
+ - lib/potassium/assets/app/serializers/base_serializer.rb
291
+ - lib/potassium/assets/app/serializers/concerns/image_handling_attributes.rb
300
292
  - lib/potassium/assets/app/uploaders/base_uploader.rb
293
+ - lib/potassium/assets/app/uploaders/cover_image_uploader.rb
301
294
  - lib/potassium/assets/app/uploaders/image_uploader.rb
295
+ - lib/potassium/assets/app/views/example_mailer/example_mail.html.mjml
296
+ - lib/potassium/assets/app/views/layouts/default_mail.html.mjml
302
297
  - lib/potassium/assets/app/views/shared/_gtm_body.html.erb
303
298
  - lib/potassium/assets/app/views/shared/_gtm_head.html.erb
304
299
  - lib/potassium/assets/bin/release
@@ -307,17 +302,24 @@ files:
307
302
  - lib/potassium/assets/bin/update.erb
308
303
  - lib/potassium/assets/config/database_mysql.yml.erb
309
304
  - lib/potassium/assets/config/database_postgresql.yml.erb
310
- - lib/potassium/assets/config/graphql_playground.rb
305
+ - lib/potassium/assets/config/initializers/shrine/plugins/image_handling_utilities.rb
311
306
  - lib/potassium/assets/config/mailer.rb.erb
312
307
  - lib/potassium/assets/config/puma.rb
313
308
  - lib/potassium/assets/config/secrets.yml.erb
314
309
  - lib/potassium/assets/config/sentry.rb.erb
315
310
  - lib/potassium/assets/config/shrine.rb
316
311
  - lib/potassium/assets/config/storage.yml
312
+ - lib/potassium/assets/config/webpack/rules/css.js
313
+ - lib/potassium/assets/config/webpack/rules/index.js
314
+ - lib/potassium/assets/config/webpack/rules/jquery.js
315
+ - lib/potassium/assets/config/webpack/rules/typescript.js
316
+ - lib/potassium/assets/config/webpack/rules/vue.js
317
+ - lib/potassium/assets/config/webpack/webpack.config.js
317
318
  - lib/potassium/assets/docker-compose.yml
318
319
  - lib/potassium/assets/es-CL.yml
319
320
  - lib/potassium/assets/lib/tasks/auto_annotate_models.rake
320
321
  - lib/potassium/assets/package.json
322
+ - lib/potassium/assets/public/mails/platanus-logo.png
321
323
  - lib/potassium/assets/redis.yml
322
324
  - lib/potassium/assets/seeds/admin_data_loader.rb
323
325
  - lib/potassium/assets/seeds/fake_data_loader.rake
@@ -335,6 +337,7 @@ files:
335
337
  - lib/potassium/assets/testing/shoulda_matchers_config.rb
336
338
  - lib/potassium/assets/testing/simplecov_config.rb
337
339
  - lib/potassium/assets/testing/system_tests_config.rb
340
+ - lib/potassium/assets/tsconfig.json
338
341
  - lib/potassium/cli.rb
339
342
  - lib/potassium/cli/commands/create.rb
340
343
  - lib/potassium/cli/commands/install.rb
@@ -354,6 +357,7 @@ files:
354
357
  - lib/potassium/helpers/variable-helpers.rb
355
358
  - lib/potassium/newest_version_ensurer.rb
356
359
  - lib/potassium/node_version_ensurer.rb
360
+ - lib/potassium/platanus_config.rb
357
361
  - lib/potassium/recipe.rb
358
362
  - lib/potassium/recipes/admin.rb
359
363
  - lib/potassium/recipes/annotate.rb
@@ -379,6 +383,7 @@ files:
379
383
  - lib/potassium/recipes/i18n.rb
380
384
  - lib/potassium/recipes/listen.rb
381
385
  - lib/potassium/recipes/mailer.rb
386
+ - lib/potassium/recipes/mjml.rb
382
387
  - lib/potassium/recipes/monitoring.rb
383
388
  - lib/potassium/recipes/node.rb
384
389
  - lib/potassium/recipes/power_types.rb
@@ -421,10 +426,10 @@ files:
421
426
  - spec/features/front_end_spec.rb
422
427
  - spec/features/github_spec.rb
423
428
  - spec/features/google_tag_manager_spec.rb
424
- - spec/features/graphql_spec.rb
425
429
  - spec/features/heroku_spec.rb
426
430
  - spec/features/i18n_spec.rb
427
431
  - spec/features/mailer_spec.rb
432
+ - spec/features/mjml_spec.rb
428
433
  - spec/features/new_project_spec.rb
429
434
  - spec/features/node_spec.rb
430
435
  - spec/features/power_types_spec.rb
@@ -437,6 +442,7 @@ files:
437
442
  - spec/support/fake_heroku.rb
438
443
  - spec/support/fake_octokit.rb
439
444
  - spec/support/potassium_test_helpers.rb
445
+ - spec/support/shared_examples.rb
440
446
  - tmp/.keep
441
447
  homepage: https://github.com/platanus/potassium
442
448
  licenses:
@@ -477,10 +483,10 @@ test_files:
477
483
  - spec/features/front_end_spec.rb
478
484
  - spec/features/github_spec.rb
479
485
  - spec/features/google_tag_manager_spec.rb
480
- - spec/features/graphql_spec.rb
481
486
  - spec/features/heroku_spec.rb
482
487
  - spec/features/i18n_spec.rb
483
488
  - spec/features/mailer_spec.rb
489
+ - spec/features/mjml_spec.rb
484
490
  - spec/features/new_project_spec.rb
485
491
  - spec/features/node_spec.rb
486
492
  - spec/features/power_types_spec.rb
@@ -493,3 +499,4 @@ test_files:
493
499
  - spec/support/fake_heroku.rb
494
500
  - spec/support/fake_octokit.rb
495
501
  - spec/support/potassium_test_helpers.rb
502
+ - spec/support/shared_examples.rb
@@ -1,14 +0,0 @@
1
- import Vue from 'vue/dist/vue.esm';
2
- import AdminComponent from '../components/admin-component';
3
-
4
- Vue.component('admin_component', AdminComponent);
5
-
6
- document.addEventListener('DOMContentLoaded', () => {
7
- if (document.getElementById('wrapper') !== null) {
8
- return new Vue({
9
- el: '#wrapper',
10
- });
11
- }
12
-
13
- return null;
14
- });
@@ -1,10 +0,0 @@
1
- module AdminPageLayoutOverride
2
- def build_page(*args)
3
- within head do
4
- text_node(javascript_packs_with_chunks_tag('admin_application'))
5
- end
6
- super
7
- end
8
- end
9
-
10
- ActiveAdmin::Views::Pages::Base.send :prepend, AdminPageLayoutOverride