potassium 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +80 -38
- data/.gitignore +2 -1
- data/.rubocop.yml +530 -0
- data/CHANGELOG.md +12 -0
- data/README.md +1 -1
- data/lib/potassium/assets/.rubocop.yml +13 -0
- data/lib/potassium/assets/README.yml +0 -3
- data/lib/potassium/assets/app/views/shared/_gtm_body.html.erb +4 -0
- data/lib/potassium/assets/app/views/shared/_gtm_head.html.erb +7 -0
- data/lib/potassium/cli_options.rb +11 -3
- data/lib/potassium/recipes/background_processor.rb +43 -32
- data/lib/potassium/recipes/google_tag_manager.rb +90 -0
- data/lib/potassium/recipes/heroku.rb +42 -29
- data/lib/potassium/recipes/mailer.rb +18 -5
- data/lib/potassium/recipes/schedule.rb +16 -1
- data/lib/potassium/recipes/style.rb +2 -2
- data/lib/potassium/templates/application.rb +2 -0
- data/lib/potassium/version.rb +3 -2
- data/potassium.gemspec +3 -1
- data/spec/features/background_processor_spec.rb +7 -5
- data/spec/features/google_tag_manager_spec.rb +59 -0
- data/spec/features/mailer_spec.rb +16 -0
- data/spec/features/schedule_spec.rb +11 -4
- data/spec/support/potassium_test_helpers.rb +0 -1
- data/tmp/.keep +0 -0
- metadata +43 -9
- data/lib/potassium/assets/sidekiq_scheduler.yml +0 -9
@@ -10,8 +10,8 @@ class Recipes::Schedule < Rails::AppBuilder
|
|
10
10
|
if selected?(:schedule)
|
11
11
|
gather_gem 'sidekiq-scheduler', '>= 3.0.1'
|
12
12
|
add_readme_section :internal_dependencies, :sidekiq_scheduler
|
13
|
+
append_schedule_section_to_yml
|
13
14
|
end
|
14
|
-
template '../assets/sidekiq_scheduler.yml', 'config/sidekiq.yml', force: true
|
15
15
|
end
|
16
16
|
|
17
17
|
def install
|
@@ -22,4 +22,19 @@ class Recipes::Schedule < Rails::AppBuilder
|
|
22
22
|
def installed?
|
23
23
|
gem_exists?(/sidekiq-scheduler/) && file_exist?('config/sidekiq.yml')
|
24
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def append_schedule_section_to_yml
|
29
|
+
append_to_file(
|
30
|
+
'config/sidekiq.yml',
|
31
|
+
<<-HERE.gsub(/^ {8}/, '')
|
32
|
+
# :schedule:
|
33
|
+
# an_scheduled_task:
|
34
|
+
# cron: '0 * * * * *' # Runs once per minute
|
35
|
+
# class: ExampleJob
|
36
|
+
# args: ['a', 'b']
|
37
|
+
HERE
|
38
|
+
)
|
39
|
+
end
|
25
40
|
end
|
@@ -13,10 +13,10 @@ class Recipes::Style < Rails::AppBuilder
|
|
13
13
|
|
14
14
|
def add_linters
|
15
15
|
gather_gems(:development, :test) do
|
16
|
-
gather_gem 'rubocop',
|
16
|
+
gather_gem 'rubocop', Potassium::RUBOCOP_VERSION
|
17
17
|
gather_gem 'rubocop-performance'
|
18
18
|
gather_gem 'rubocop-rails'
|
19
|
-
gather_gem 'rubocop-rspec'
|
19
|
+
gather_gem 'rubocop-rspec', Potassium::RUBOCOP_RSPEC_VERSION
|
20
20
|
end
|
21
21
|
run 'bin/yarn add --dev stylelint eslint eslint-plugin-import'
|
22
22
|
run 'bin/yarn add --dev eslint-plugin-vue' if selected?(:front_end, :vue)
|
@@ -20,6 +20,7 @@ run_action(:asking) do
|
|
20
20
|
ask :database
|
21
21
|
ask :devise
|
22
22
|
ask :admin
|
23
|
+
ask :google_tag_manager
|
23
24
|
ask :front_end
|
24
25
|
ask :vue_admin
|
25
26
|
ask :mailer
|
@@ -76,6 +77,7 @@ run_action(:recipe_loading) do
|
|
76
77
|
create :github
|
77
78
|
create :cleanup
|
78
79
|
create :front_end
|
80
|
+
create :google_tag_manager
|
79
81
|
end
|
80
82
|
|
81
83
|
info "Gathered enough information. Applying the template. Wait a minute."
|
data/lib/potassium/version.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Potassium
|
2
|
-
VERSION = "6.
|
2
|
+
VERSION = "6.2.0"
|
3
3
|
RUBY_VERSION = "2.7.0"
|
4
4
|
RAILS_VERSION = "~> 6.0.2"
|
5
|
-
RUBOCOP_VERSION = "~>
|
5
|
+
RUBOCOP_VERSION = "~> 1.9"
|
6
|
+
RUBOCOP_RSPEC_VERSION = "~> 2.2"
|
6
7
|
POSTGRES_VERSION = "11.3"
|
7
8
|
MYSQL_VERSION = "5.7"
|
8
9
|
NODE_VERSION = "12"
|
data/potassium.gemspec
CHANGED
@@ -24,7 +24,9 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.4.0"
|
25
25
|
spec.add_development_dependency "rspec_junit_formatter"
|
26
26
|
spec.add_development_dependency "rubocop", Potassium::RUBOCOP_VERSION
|
27
|
-
spec.add_development_dependency "rubocop-
|
27
|
+
spec.add_development_dependency "rubocop-performance"
|
28
|
+
spec.add_development_dependency "rubocop-rails"
|
29
|
+
spec.add_development_dependency "rubocop-rspec", Potassium::RUBOCOP_RSPEC_VERSION
|
28
30
|
spec.add_runtime_dependency "gems", "~> 0.8"
|
29
31
|
spec.add_runtime_dependency "gli", "~> 2.12.2"
|
30
32
|
spec.add_runtime_dependency "inquirer", "~> 0.2"
|
@@ -2,11 +2,11 @@ require "spec_helper"
|
|
2
2
|
require 'yaml'
|
3
3
|
|
4
4
|
RSpec.describe "BackgroundProcessor" do
|
5
|
-
context "working with sidekiq" do
|
5
|
+
context "when working with sidekiq and no mailer" do
|
6
6
|
before :all do
|
7
7
|
drop_dummy_database
|
8
8
|
remove_project_directory
|
9
|
-
create_dummy_project("background_processor" =>
|
9
|
+
create_dummy_project("background_processor" => true, "heroku" => true)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "adds sidekiq gem to Gemfile" do
|
@@ -52,9 +52,11 @@ RSpec.describe "BackgroundProcessor" do
|
|
52
52
|
expect(content).to include("require 'sidekiq'")
|
53
53
|
end
|
54
54
|
|
55
|
-
it "adds sidekiq.yml file" do
|
56
|
-
|
57
|
-
|
55
|
+
it "adds sidekiq.yml file with no mailer queue" do
|
56
|
+
yml_path = "#{project_path}/config/sidekiq.yml"
|
57
|
+
content = IO.read(yml_path)
|
58
|
+
expect(File.exist?(yml_path)).to be true
|
59
|
+
expect(content).not_to include("- mailers")
|
58
60
|
end
|
59
61
|
|
60
62
|
it "adds redis.yml file" do
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
RSpec.describe "Google Tag Manager" do
|
4
|
+
before :all do
|
5
|
+
remove_project_directory
|
6
|
+
create_dummy_project('google_tag_manager' => true)
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:gtm_head_file_path) do
|
10
|
+
"#{project_path}/app/views/shared/_gtm_head.html.erb"
|
11
|
+
end
|
12
|
+
let(:gtm_body_file_path) do
|
13
|
+
"#{project_path}/app/views/shared/_gtm_body.html.erb"
|
14
|
+
end
|
15
|
+
let(:content_security_policy_file_path) do
|
16
|
+
"#{project_path}/config/initializers/content_security_policy.rb"
|
17
|
+
end
|
18
|
+
let(:application_layout_file) do
|
19
|
+
IO.read("#{project_path}/app/views/layouts/application.html.erb")
|
20
|
+
end
|
21
|
+
let(:content_security_policy_file) do
|
22
|
+
IO.read(content_security_policy_file_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'adds google tag manager script' do
|
26
|
+
expect(File).to be_file(gtm_head_file_path)
|
27
|
+
expect(File).to be_file(gtm_body_file_path)
|
28
|
+
expect(application_layout_file).to include('shared/gtm_head')
|
29
|
+
expect(application_layout_file).to include('shared/gtm_body')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'add content security policy' do
|
33
|
+
expect(content_security_policy_file)
|
34
|
+
.to include(content_security_policy_code)
|
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
|
58
|
+
end
|
59
|
+
end
|
@@ -4,6 +4,7 @@ RSpec.describe "Mailer" do
|
|
4
4
|
let(:gemfile) { IO.read("#{project_path}/Gemfile") }
|
5
5
|
let(:mailer_config) { IO.read("#{project_path}/config/mailer.rb") }
|
6
6
|
let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
|
7
|
+
let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
|
7
8
|
|
8
9
|
before(:all) { drop_dummy_database }
|
9
10
|
|
@@ -26,6 +27,8 @@ RSpec.describe "Mailer" do
|
|
26
27
|
expect(dev_config).to include("sendgrid_dev_settings = {")
|
27
28
|
expect(dev_config).to include("api_key: ENV['SENDGRID_API_KEY']")
|
28
29
|
end
|
30
|
+
|
31
|
+
it { expect(sidekiq_config).to include("- mailers") }
|
29
32
|
end
|
30
33
|
|
31
34
|
context "when selecting aws_ses as mailer" do
|
@@ -38,5 +41,18 @@ RSpec.describe "Mailer" do
|
|
38
41
|
it { expect(gemfile).to include("letter_opener") }
|
39
42
|
it { expect(mailer_config).to include("delivery_method = :aws_sdk") }
|
40
43
|
it { expect(dev_config).to include("delivery_method = :letter_opener") }
|
44
|
+
it { expect(sidekiq_config).to include("- mailers") }
|
45
|
+
end
|
46
|
+
|
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
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
it { expect(sidekiq_config).to include("- mailers") }
|
41
57
|
end
|
42
58
|
end
|
@@ -1,10 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe "schedule" do
|
4
|
+
let(:sidekiq_config) { IO.read("#{project_path}/config/sidekiq.yml") }
|
5
|
+
|
4
6
|
before :all do
|
5
7
|
drop_dummy_database
|
6
8
|
remove_project_directory
|
7
|
-
create_dummy_project(
|
9
|
+
create_dummy_project(
|
10
|
+
"schedule" => true, "background_processor" => true, "email_service" => "sendgrid"
|
11
|
+
)
|
8
12
|
end
|
9
13
|
|
10
14
|
it "adds the sidekiq-scheduler gem to Gemfile" do
|
@@ -12,9 +16,12 @@ RSpec.describe "schedule" do
|
|
12
16
|
expect(gemfile_content).to include("gem 'sidekiq-scheduler'")
|
13
17
|
end
|
14
18
|
|
15
|
-
it "
|
16
|
-
|
17
|
-
|
19
|
+
it "adds schedule section to sidekiq config" do
|
20
|
+
expect(sidekiq_config).to include(":schedule:")
|
21
|
+
end
|
22
|
+
|
23
|
+
it "doesn't remove mailers queue" do
|
24
|
+
expect(sidekiq_config).to include("- mailers")
|
18
25
|
end
|
19
26
|
|
20
27
|
it "adds scheduler ui to the sidekiq initializer" do
|
@@ -22,7 +22,6 @@ module PotassiumTestHelpers
|
|
22
22
|
add_project_bin_to_path
|
23
23
|
full_arguments = hash_to_arguments(create_arguments(true).merge(arguments))
|
24
24
|
run_command("#{potassium_bin} create #{APP_NAME} #{full_arguments}")
|
25
|
-
on_project { run_command("hound rules update ruby --local") }
|
26
25
|
end
|
27
26
|
end
|
28
27
|
end
|
data/tmp/.keep
ADDED
File without changes
|
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.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juliogarciag
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -86,16 +86,30 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '1.9'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '1.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-
|
98
|
+
name: rubocop-performance
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rails
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - ">="
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.2'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: gems
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +248,7 @@ files:
|
|
220
248
|
- ".gitignore"
|
221
249
|
- ".node-version"
|
222
250
|
- ".rspec"
|
251
|
+
- ".rubocop.yml"
|
223
252
|
- ".ruby-version"
|
224
253
|
- CHANGELOG.md
|
225
254
|
- Gemfile
|
@@ -269,6 +298,8 @@ files:
|
|
269
298
|
- lib/potassium/assets/app/mailers/application_mailer.rb
|
270
299
|
- lib/potassium/assets/app/uploaders/base_uploader.rb
|
271
300
|
- lib/potassium/assets/app/uploaders/image_uploader.rb
|
301
|
+
- lib/potassium/assets/app/views/shared/_gtm_body.html.erb
|
302
|
+
- lib/potassium/assets/app/views/shared/_gtm_head.html.erb
|
272
303
|
- lib/potassium/assets/bin/cibuild.erb
|
273
304
|
- lib/potassium/assets/bin/release
|
274
305
|
- lib/potassium/assets/bin/setup.erb
|
@@ -295,7 +326,6 @@ files:
|
|
295
326
|
- lib/potassium/assets/seeds/seeds.rb
|
296
327
|
- lib/potassium/assets/sidekiq.rb.erb
|
297
328
|
- lib/potassium/assets/sidekiq.yml
|
298
|
-
- lib/potassium/assets/sidekiq_scheduler.yml
|
299
329
|
- lib/potassium/assets/testing/.rspec
|
300
330
|
- lib/potassium/assets/testing/platanus.png
|
301
331
|
- lib/potassium/assets/testing/rails_helper.rb
|
@@ -337,6 +367,7 @@ files:
|
|
337
367
|
- lib/potassium/recipes/file_storage.rb
|
338
368
|
- lib/potassium/recipes/front_end.rb
|
339
369
|
- lib/potassium/recipes/github.rb
|
370
|
+
- lib/potassium/recipes/google_tag_manager.rb
|
340
371
|
- lib/potassium/recipes/heroku.rb
|
341
372
|
- lib/potassium/recipes/i18n.rb
|
342
373
|
- lib/potassium/recipes/listen.rb
|
@@ -379,6 +410,7 @@ files:
|
|
379
410
|
- spec/features/file_storage_spec.rb
|
380
411
|
- spec/features/front_end_spec.rb
|
381
412
|
- spec/features/github_spec.rb
|
413
|
+
- spec/features/google_tag_manager_spec.rb
|
382
414
|
- spec/features/graphql_spec.rb
|
383
415
|
- spec/features/heroku_spec.rb
|
384
416
|
- spec/features/i18n_spec.rb
|
@@ -393,11 +425,12 @@ files:
|
|
393
425
|
- spec/support/fake_heroku.rb
|
394
426
|
- spec/support/fake_octokit.rb
|
395
427
|
- spec/support/potassium_test_helpers.rb
|
428
|
+
- tmp/.keep
|
396
429
|
homepage: https://github.com/platanus/potassium
|
397
430
|
licenses:
|
398
431
|
- MIT
|
399
432
|
metadata: {}
|
400
|
-
post_install_message:
|
433
|
+
post_install_message:
|
401
434
|
rdoc_options: []
|
402
435
|
require_paths:
|
403
436
|
- lib
|
@@ -413,7 +446,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
413
446
|
version: '0'
|
414
447
|
requirements: []
|
415
448
|
rubygems_version: 3.1.2
|
416
|
-
signing_key:
|
449
|
+
signing_key:
|
417
450
|
specification_version: 4
|
418
451
|
summary: An application generator from Platanus
|
419
452
|
test_files:
|
@@ -430,6 +463,7 @@ test_files:
|
|
430
463
|
- spec/features/file_storage_spec.rb
|
431
464
|
- spec/features/front_end_spec.rb
|
432
465
|
- spec/features/github_spec.rb
|
466
|
+
- spec/features/google_tag_manager_spec.rb
|
433
467
|
- spec/features/graphql_spec.rb
|
434
468
|
- spec/features/heroku_spec.rb
|
435
469
|
- spec/features/i18n_spec.rb
|