potassium 6.3.0 → 6.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +1 -1
  3. data/.node-version +1 -1
  4. data/CHANGELOG.md +45 -0
  5. data/README.md +30 -3
  6. data/docs/CONTRIBUTING.md +2 -2
  7. data/lib/potassium/assets/.circleci/config.yml.erb +40 -12
  8. data/lib/potassium/assets/.eslintrc.json +15 -9
  9. data/lib/potassium/assets/.pryrc +0 -6
  10. data/lib/potassium/assets/.rubocop.yml +1 -0
  11. data/lib/potassium/assets/Aptfile +5 -0
  12. data/lib/potassium/assets/README.yml +74 -7
  13. data/lib/potassium/assets/active_admin/admin-component.vue +22 -30
  14. data/lib/potassium/assets/active_admin/policies/admin_user_policy.rb +2 -0
  15. data/lib/potassium/assets/active_admin/policies/comment_policy.rb +2 -0
  16. data/lib/potassium/assets/active_admin/policies/default_policy.rb +49 -0
  17. data/lib/potassium/assets/active_admin/policies/page_policy.rb +2 -0
  18. data/lib/potassium/assets/app/javascript/{app.spec.js → components/app.spec.ts} +2 -2
  19. data/lib/potassium/assets/app/javascript/components/app.vue +9 -0
  20. data/lib/potassium/assets/app/javascript/types/vue.d.ts +5 -0
  21. data/lib/potassium/assets/app/jobs/shrine_promote_job.rb +14 -0
  22. data/lib/potassium/assets/app/mailers/application_mailer.rb +1 -1
  23. data/lib/potassium/assets/app/mailers/example_mailer.rb +6 -0
  24. data/lib/potassium/assets/app/serializers/base_serializer.rb +3 -0
  25. data/lib/potassium/assets/app/serializers/concerns/image_handling_attributes.rb +20 -0
  26. data/lib/potassium/assets/app/uploaders/cover_image_uploader.rb +52 -0
  27. data/lib/potassium/assets/app/views/example_mailer/example_mail.html.mjml +7 -0
  28. data/lib/potassium/assets/app/views/layouts/default_mail.html.mjml +49 -0
  29. data/lib/potassium/assets/config/initializers/shrine/plugins/image_handling_utilities.rb +143 -0
  30. data/lib/potassium/assets/config/mailer.rb.erb +0 -2
  31. data/lib/potassium/assets/config/shrine.rb +15 -0
  32. data/lib/potassium/assets/config/webpack/rules/css.js +5 -0
  33. data/lib/potassium/assets/config/webpack/rules/index.js +11 -0
  34. data/lib/potassium/assets/config/webpack/rules/jquery.js +11 -0
  35. data/lib/potassium/assets/config/webpack/rules/typescript.js +32 -0
  36. data/lib/potassium/assets/config/webpack/rules/vue.js +19 -0
  37. data/lib/potassium/assets/config/webpack/webpack.config.js +4 -0
  38. data/lib/potassium/assets/public/mails/platanus-logo.png +0 -0
  39. data/lib/potassium/assets/testing/.rspec +1 -0
  40. data/lib/potassium/assets/testing/devise_config.rb +6 -0
  41. data/lib/potassium/assets/testing/factory_bot_config.rb +3 -0
  42. data/lib/potassium/assets/testing/faker_config.rb +1 -0
  43. data/lib/potassium/assets/testing/power_types_config.rb +1 -0
  44. data/lib/potassium/assets/testing/rails_helper.rb +130 -49
  45. data/lib/potassium/assets/testing/shoulda_matchers_config.rb +8 -0
  46. data/lib/potassium/assets/testing/simplecov_config.rb +64 -0
  47. data/lib/potassium/assets/testing/system_tests_config.rb +6 -0
  48. data/lib/potassium/assets/tsconfig.json +31 -0
  49. data/lib/potassium/cli/commands/create.rb +3 -1
  50. data/lib/potassium/cli_options.rb +23 -3
  51. data/lib/potassium/platanus_config.rb +20 -0
  52. data/lib/potassium/recipes/admin.rb +37 -16
  53. data/lib/potassium/recipes/api.rb +8 -85
  54. data/lib/potassium/recipes/coverage.rb +66 -0
  55. data/lib/potassium/recipes/file_storage.rb +50 -0
  56. data/lib/potassium/recipes/front_end.rb +87 -108
  57. data/lib/potassium/recipes/google_tag_manager.rb +20 -16
  58. data/lib/potassium/recipes/heroku.rb +1 -2
  59. data/lib/potassium/recipes/mailer.rb +22 -10
  60. data/lib/potassium/recipes/mjml.rb +31 -0
  61. data/lib/potassium/recipes/node.rb +11 -13
  62. data/lib/potassium/recipes/pundit.rb +29 -10
  63. data/lib/potassium/recipes/rails.rb +0 -4
  64. data/lib/potassium/recipes/spring.rb +9 -0
  65. data/lib/potassium/recipes/style.rb +9 -2
  66. data/lib/potassium/recipes/testing.rb +75 -18
  67. data/lib/potassium/recipes/vue_admin.rb +38 -8
  68. data/lib/potassium/templates/application.rb +5 -2
  69. data/lib/potassium/version.rb +10 -4
  70. data/spec/features/api_spec.rb +6 -1
  71. data/spec/features/ci_spec.rb +1 -1
  72. data/spec/features/coverage_spec.rb +43 -0
  73. data/spec/features/file_storage_spec.rb +102 -26
  74. data/spec/features/front_end_spec.rb +16 -47
  75. data/spec/features/google_tag_manager_spec.rb +1 -24
  76. data/spec/features/heroku_spec.rb +0 -4
  77. data/spec/features/mailer_spec.rb +79 -33
  78. data/spec/features/mjml_spec.rb +53 -0
  79. data/spec/features/node_spec.rb +1 -1
  80. data/spec/features/pundit_spec.rb +34 -0
  81. data/spec/features/testing_spec.rb +56 -0
  82. data/spec/features/vue_admin_spec.rb +0 -10
  83. data/spec/support/potassium_test_helpers.rb +2 -2
  84. data/spec/support/shared_examples.rb +5 -0
  85. metadata +50 -27
  86. data/lib/potassium/assets/active_admin/admin_application.js +0 -14
  87. data/lib/potassium/assets/active_admin/admin_user_policy.rb +0 -2
  88. data/lib/potassium/assets/active_admin/comment_policy.rb +0 -2
  89. data/lib/potassium/assets/active_admin/init_activeadmin_vue.rb +0 -10
  90. data/lib/potassium/assets/active_admin/pundit_page_policy.rb +0 -5
  91. data/lib/potassium/assets/app/graphql/graphql_controller.rb +0 -55
  92. data/lib/potassium/assets/app/graphql/mutations/login_mutation.rb +0 -23
  93. data/lib/potassium/assets/app/graphql/queries/base_query.rb +0 -4
  94. data/lib/potassium/assets/app/graphql/types/base/base_argument.rb +0 -4
  95. data/lib/potassium/assets/app/graphql/types/base/base_enum.rb +0 -4
  96. data/lib/potassium/assets/app/graphql/types/base/base_field.rb +0 -5
  97. data/lib/potassium/assets/app/graphql/types/base/base_input_object.rb +0 -5
  98. data/lib/potassium/assets/app/graphql/types/base/base_interface.rb +0 -7
  99. data/lib/potassium/assets/app/graphql/types/base/base_object.rb +0 -5
  100. data/lib/potassium/assets/app/graphql/types/base/base_scalar.rb +0 -4
  101. data/lib/potassium/assets/app/graphql/types/base/base_union.rb +0 -4
  102. data/lib/potassium/assets/app/graphql/types/mutation_type.rb +0 -10
  103. data/lib/potassium/assets/app/graphql/types/query_type.rb +0 -13
  104. data/lib/potassium/assets/config/graphql_playground.rb +0 -20
  105. data/spec/features/graphql_spec.rb +0 -71
@@ -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
@@ -1,7 +1,7 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe "Node" do
4
- let(:version) { "12" }
4
+ let(:version) { "14" }
5
5
 
6
6
  before(:all) do
7
7
  drop_dummy_database
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Pundit" do
4
+ before :all do
5
+ drop_dummy_database
6
+ remove_project_directory
7
+ create_dummy_project("pundit" => true, "devise" => true, "admin" => true)
8
+ end
9
+
10
+ it "adds the Pundit gem to Gemfile" do
11
+ content = IO.read("#{project_path}/Gemfile")
12
+
13
+ expect(content).to include("gem 'pundit'")
14
+ end
15
+
16
+ it "setup active admin" do
17
+ content = IO.read("#{project_path}/config/initializers/active_admin.rb")
18
+
19
+ expect(content).to include("config.authorization_adapter = ActiveAdmin::PunditAdapter")
20
+ expect(content).to include("config.pundit_default_policy = 'BackOffice::DefaultPolicy'")
21
+ expect(content).to include("config.pundit_policy_namespace = :back_office")
22
+ end
23
+
24
+ it "creates default policy" do
25
+ content = IO.read("#{project_path}/app/policies/back_office/default_policy.rb")
26
+
27
+ expect(content).to include("class BackOffice::DefaultPolicy")
28
+ end
29
+
30
+ it "modifies the README file" do
31
+ readme = IO.read("#{project_path}/README.md")
32
+ expect(readme).to include("from `BackOffice::DefaultPolicy`")
33
+ end
34
+ end
@@ -0,0 +1,56 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Testing" do
4
+ let(:gemfile_content) { IO.read("#{project_path}/Gemfile") }
5
+ let(:rails_helper_content) { IO.read("#{project_path}/spec/rails_helper.rb") }
6
+ let(:rspec_content) { IO.read("#{project_path}/.rspec") }
7
+
8
+ let(:support_directories) do
9
+ %w{
10
+ custom_matchers
11
+ shared_examples
12
+ configurations
13
+ helpers
14
+ }
15
+ end
16
+
17
+ let(:conf_files) do
18
+ %w{
19
+ factory_bot_config.rb
20
+ power_types_config.rb
21
+ shoulda_matchers_config.rb
22
+ devise_config.rb
23
+ system_tests_config.rb
24
+ faker_config.rb
25
+ }
26
+ end
27
+
28
+ before(:all) do
29
+ drop_dummy_database
30
+ remove_project_directory
31
+ create_dummy_project(devise: true)
32
+ end
33
+
34
+ it { expect(gemfile_content).to include("gem 'rspec-rails'") }
35
+ it { expect(gemfile_content).to include('rspec-rails') }
36
+ it { expect(gemfile_content).to include('factory_bot_rails') }
37
+ it { expect(gemfile_content).to include('faker') }
38
+ it { expect(gemfile_content).to include('guard-rspec') }
39
+ it { expect(gemfile_content).to include('rspec-nc') }
40
+ it { expect(gemfile_content).to include('shoulda-matchers') }
41
+ it { expect(gemfile_content).to include('capybara') }
42
+ it { expect(gemfile_content).to include('webdrivers') }
43
+
44
+ it { expect(rails_helper_content).to include("require 'spec_helper'") }
45
+ it { expect(rails_helper_content).to include("config.filter_run_when_matching :focus") }
46
+
47
+ it { expect(rspec_content).to include("--require rails_helper") }
48
+ it { expect(Dir.entries("#{project_path}/spec/support")).to include(*support_directories) }
49
+ it { expect(Dir.entries("#{project_path}/spec/support/configurations")).to include(*conf_files) }
50
+
51
+ it { expect(IO.read("#{project_path}/bin/rspec")).to include('path("rspec-core", "rspec")') }
52
+ it { expect(IO.read("#{project_path}/Guardfile")).to include(':rspec, cmd: "bin/rspec"') }
53
+ it { expect(IO.read("#{project_path}/bin/guard")).to include('path("guard", "guard")') }
54
+
55
+ it { expect(IO.read("#{project_path}/README.md")).to include("To run unit test") }
56
+ 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)
@@ -17,7 +17,7 @@ module PotassiumTestHelpers
17
17
 
18
18
  def create_dummy_project(arguments = {})
19
19
  Dir.chdir(tmp_path) do
20
- Bundler.with_clean_env do
20
+ Bundler.with_unbundled_env do
21
21
  add_fakes_to_path
22
22
  add_project_bin_to_path
23
23
  full_arguments = hash_to_arguments(create_arguments(true).merge(arguments))
@@ -46,7 +46,7 @@ module PotassiumTestHelpers
46
46
 
47
47
  def on_project(&block)
48
48
  Dir.chdir(project_path) do
49
- Bundler.with_clean_env do
49
+ Bundler.with_unbundled_env do
50
50
  block.call
51
51
  end
52
52
  end
@@ -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.3.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: 2021-06-18 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
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 6.0.2
215
+ version: 6.1.4.4
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 6.0.2
222
+ version: 6.1.4.4
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: semantic
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -271,33 +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/admin_user_policy.rb
281
- - lib/potassium/assets/active_admin/comment_policy.rb
282
- - lib/potassium/assets/active_admin/init_activeadmin_vue.rb
283
- - lib/potassium/assets/active_admin/pundit_page_policy.rb
284
- - lib/potassium/assets/app/graphql/graphql_controller.rb
285
- - lib/potassium/assets/app/graphql/mutations/login_mutation.rb
286
- - lib/potassium/assets/app/graphql/queries/base_query.rb
287
- - lib/potassium/assets/app/graphql/types/base/base_argument.rb
288
- - lib/potassium/assets/app/graphql/types/base/base_enum.rb
289
- - lib/potassium/assets/app/graphql/types/base/base_field.rb
290
- - lib/potassium/assets/app/graphql/types/base/base_input_object.rb
291
- - lib/potassium/assets/app/graphql/types/base/base_interface.rb
292
- - lib/potassium/assets/app/graphql/types/base/base_object.rb
293
- - lib/potassium/assets/app/graphql/types/base/base_scalar.rb
294
- - lib/potassium/assets/app/graphql/types/base/base_union.rb
295
- - lib/potassium/assets/app/graphql/types/mutation_type.rb
296
- - lib/potassium/assets/app/graphql/types/query_type.rb
297
- - lib/potassium/assets/app/javascript/app.spec.js
280
+ - lib/potassium/assets/active_admin/policies/admin_user_policy.rb
281
+ - lib/potassium/assets/active_admin/policies/comment_policy.rb
282
+ - lib/potassium/assets/active_admin/policies/default_policy.rb
283
+ - lib/potassium/assets/active_admin/policies/page_policy.rb
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
298
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
299
292
  - lib/potassium/assets/app/uploaders/base_uploader.rb
293
+ - lib/potassium/assets/app/uploaders/cover_image_uploader.rb
300
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
301
297
  - lib/potassium/assets/app/views/shared/_gtm_body.html.erb
302
298
  - lib/potassium/assets/app/views/shared/_gtm_head.html.erb
303
299
  - lib/potassium/assets/bin/release
@@ -306,17 +302,24 @@ files:
306
302
  - lib/potassium/assets/bin/update.erb
307
303
  - lib/potassium/assets/config/database_mysql.yml.erb
308
304
  - lib/potassium/assets/config/database_postgresql.yml.erb
309
- - lib/potassium/assets/config/graphql_playground.rb
305
+ - lib/potassium/assets/config/initializers/shrine/plugins/image_handling_utilities.rb
310
306
  - lib/potassium/assets/config/mailer.rb.erb
311
307
  - lib/potassium/assets/config/puma.rb
312
308
  - lib/potassium/assets/config/secrets.yml.erb
313
309
  - lib/potassium/assets/config/sentry.rb.erb
314
310
  - lib/potassium/assets/config/shrine.rb
315
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
316
318
  - lib/potassium/assets/docker-compose.yml
317
319
  - lib/potassium/assets/es-CL.yml
318
320
  - lib/potassium/assets/lib/tasks/auto_annotate_models.rake
319
321
  - lib/potassium/assets/package.json
322
+ - lib/potassium/assets/public/mails/platanus-logo.png
320
323
  - lib/potassium/assets/redis.yml
321
324
  - lib/potassium/assets/seeds/admin_data_loader.rb
322
325
  - lib/potassium/assets/seeds/fake_data_loader.rake
@@ -325,8 +328,16 @@ files:
325
328
  - lib/potassium/assets/sidekiq.rb.erb
326
329
  - lib/potassium/assets/sidekiq.yml
327
330
  - lib/potassium/assets/testing/.rspec
331
+ - lib/potassium/assets/testing/devise_config.rb
332
+ - lib/potassium/assets/testing/factory_bot_config.rb
333
+ - lib/potassium/assets/testing/faker_config.rb
328
334
  - lib/potassium/assets/testing/platanus.png
335
+ - lib/potassium/assets/testing/power_types_config.rb
329
336
  - lib/potassium/assets/testing/rails_helper.rb
337
+ - lib/potassium/assets/testing/shoulda_matchers_config.rb
338
+ - lib/potassium/assets/testing/simplecov_config.rb
339
+ - lib/potassium/assets/testing/system_tests_config.rb
340
+ - lib/potassium/assets/tsconfig.json
330
341
  - lib/potassium/cli.rb
331
342
  - lib/potassium/cli/commands/create.rb
332
343
  - lib/potassium/cli/commands/install.rb
@@ -346,6 +357,7 @@ files:
346
357
  - lib/potassium/helpers/variable-helpers.rb
347
358
  - lib/potassium/newest_version_ensurer.rb
348
359
  - lib/potassium/node_version_ensurer.rb
360
+ - lib/potassium/platanus_config.rb
349
361
  - lib/potassium/recipe.rb
350
362
  - lib/potassium/recipes/admin.rb
351
363
  - lib/potassium/recipes/annotate.rb
@@ -354,6 +366,7 @@ files:
354
366
  - lib/potassium/recipes/better_errors.rb
355
367
  - lib/potassium/recipes/ci.rb
356
368
  - lib/potassium/recipes/cleanup.rb
369
+ - lib/potassium/recipes/coverage.rb
357
370
  - lib/potassium/recipes/data_migrate.rb
358
371
  - lib/potassium/recipes/database.rb
359
372
  - lib/potassium/recipes/database_container.rb
@@ -370,6 +383,7 @@ files:
370
383
  - lib/potassium/recipes/i18n.rb
371
384
  - lib/potassium/recipes/listen.rb
372
385
  - lib/potassium/recipes/mailer.rb
386
+ - lib/potassium/recipes/mjml.rb
373
387
  - lib/potassium/recipes/monitoring.rb
374
388
  - lib/potassium/recipes/node.rb
375
389
  - lib/potassium/recipes/power_types.rb
@@ -384,6 +398,7 @@ files:
384
398
  - lib/potassium/recipes/script.rb
385
399
  - lib/potassium/recipes/secrets.rb
386
400
  - lib/potassium/recipes/seeds.rb
401
+ - lib/potassium/recipes/spring.rb
387
402
  - lib/potassium/recipes/style.rb
388
403
  - lib/potassium/recipes/testing.rb
389
404
  - lib/potassium/recipes/tzinfo.rb
@@ -401,6 +416,7 @@ files:
401
416
  - spec/features/api_spec.rb
402
417
  - spec/features/background_processor_spec.rb
403
418
  - spec/features/ci_spec.rb
419
+ - spec/features/coverage_spec.rb
404
420
  - spec/features/data_migrate_spec.rb
405
421
  - spec/features/database_container_spec.rb
406
422
  - spec/features/database_spec.rb
@@ -410,20 +426,23 @@ files:
410
426
  - spec/features/front_end_spec.rb
411
427
  - spec/features/github_spec.rb
412
428
  - spec/features/google_tag_manager_spec.rb
413
- - spec/features/graphql_spec.rb
414
429
  - spec/features/heroku_spec.rb
415
430
  - spec/features/i18n_spec.rb
416
431
  - spec/features/mailer_spec.rb
432
+ - spec/features/mjml_spec.rb
417
433
  - spec/features/new_project_spec.rb
418
434
  - spec/features/node_spec.rb
419
435
  - spec/features/power_types_spec.rb
436
+ - spec/features/pundit_spec.rb
420
437
  - spec/features/schedule_spec.rb
438
+ - spec/features/testing_spec.rb
421
439
  - spec/features/vue_admin_spec.rb
422
440
  - spec/spec_helper.rb
423
441
  - spec/support/fake_github.rb
424
442
  - spec/support/fake_heroku.rb
425
443
  - spec/support/fake_octokit.rb
426
444
  - spec/support/potassium_test_helpers.rb
445
+ - spec/support/shared_examples.rb
427
446
  - tmp/.keep
428
447
  homepage: https://github.com/platanus/potassium
429
448
  licenses:
@@ -444,7 +463,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
444
463
  - !ruby/object:Gem::Version
445
464
  version: '0'
446
465
  requirements: []
447
- rubygems_version: 3.1.2
466
+ rubygems_version: 3.2.22
448
467
  signing_key:
449
468
  specification_version: 4
450
469
  summary: An application generator from Platanus
@@ -454,6 +473,7 @@ test_files:
454
473
  - spec/features/api_spec.rb
455
474
  - spec/features/background_processor_spec.rb
456
475
  - spec/features/ci_spec.rb
476
+ - spec/features/coverage_spec.rb
457
477
  - spec/features/data_migrate_spec.rb
458
478
  - spec/features/database_container_spec.rb
459
479
  - spec/features/database_spec.rb
@@ -463,17 +483,20 @@ test_files:
463
483
  - spec/features/front_end_spec.rb
464
484
  - spec/features/github_spec.rb
465
485
  - spec/features/google_tag_manager_spec.rb
466
- - spec/features/graphql_spec.rb
467
486
  - spec/features/heroku_spec.rb
468
487
  - spec/features/i18n_spec.rb
469
488
  - spec/features/mailer_spec.rb
489
+ - spec/features/mjml_spec.rb
470
490
  - spec/features/new_project_spec.rb
471
491
  - spec/features/node_spec.rb
472
492
  - spec/features/power_types_spec.rb
493
+ - spec/features/pundit_spec.rb
473
494
  - spec/features/schedule_spec.rb
495
+ - spec/features/testing_spec.rb
474
496
  - spec/features/vue_admin_spec.rb
475
497
  - spec/spec_helper.rb
476
498
  - spec/support/fake_github.rb
477
499
  - spec/support/fake_heroku.rb
478
500
  - spec/support/fake_octokit.rb
479
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,2 +0,0 @@
1
- class AdminUserPolicy < ApplicationPolicy
2
- end
@@ -1,2 +0,0 @@
1
- class ActiveAdmin::CommentPolicy < ApplicationPolicy
2
- end
@@ -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
@@ -1,5 +0,0 @@
1
- class ActiveAdmin::PagePolicy < ApplicationPolicy
2
- def show?
3
- true
4
- end
5
- end
@@ -1,55 +0,0 @@
1
- class GraphqlController < ApplicationController
2
- # If accessing from outside this domain, nullify the session
3
- # This allows for outside API access while preventing CSRF attacks,
4
- # but you'll have to authenticate your user separately
5
- # protect_from_forgery with: :null_session
6
-
7
- def execute
8
- variables = prepare_variables(params[:variables])
9
- query = params[:query]
10
- operation_name = params[:operationName]
11
- context = { current_user: get_current_user }
12
- result = GqlSampleSchema.execute(query, variables: variables, context: context, operation_name: operation_name)
13
- render json: result
14
- rescue => e
15
- raise e unless Rails.env.development?
16
- handle_error_in_development e
17
- end
18
-
19
- private
20
-
21
- # Handle variables in form data, JSON body, or a blank value
22
- def prepare_variables(variables_param)
23
- case variables_param
24
- when String
25
- if variables_param.present?
26
- JSON.parse(variables_param) || {}
27
- else
28
- {}
29
- end
30
- when Hash
31
- variables_param
32
- when ActionController::Parameters
33
- variables_param.to_unsafe_hash # GraphQL-Ruby will validate name and type of incoming variables.
34
- when nil
35
- {}
36
- else
37
- raise ArgumentError, "Unexpected parameter: #{variables_param}"
38
- end
39
- end
40
-
41
- def handle_error_in_development(e)
42
- logger.error e.message
43
- logger.error e.backtrace.join("\n")
44
-
45
- render json: { errors: [{ message: e.message, backtrace: e.backtrace }], data: {} }, status: 500
46
- end
47
-
48
- def get_current_user
49
- if request.headers['Authorization']
50
- _, token = request.headers['Authorization'].split
51
- decoded_token = JWT.decode token, ENV['HMAC_SECRET'], true, { algorithm: 'HS256' }
52
- User.find(decoded_token.first["id"])
53
- end
54
- end
55
- end