potassium 6.1.0 → 6.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +103 -38
  3. data/.circleci/setup-rubygems.sh +3 -0
  4. data/.gitignore +2 -1
  5. data/.node-version +1 -1
  6. data/.rubocop.yml +530 -0
  7. data/CHANGELOG.md +50 -1
  8. data/README.md +11 -3
  9. data/lib/potassium/assets/.circleci/config.yml.erb +107 -40
  10. data/lib/potassium/assets/.pryrc +0 -6
  11. data/lib/potassium/assets/.rubocop.yml +13 -0
  12. data/lib/potassium/assets/README.yml +45 -8
  13. data/lib/potassium/assets/active_admin/policies/admin_user_policy.rb +2 -0
  14. data/lib/potassium/assets/active_admin/policies/comment_policy.rb +2 -0
  15. data/lib/potassium/assets/active_admin/policies/default_policy.rb +49 -0
  16. data/lib/potassium/assets/active_admin/policies/page_policy.rb +2 -0
  17. data/lib/potassium/assets/app/javascript/app.spec.js +1 -1
  18. data/lib/potassium/assets/app/views/shared/_gtm_body.html.erb +4 -0
  19. data/lib/potassium/assets/app/views/shared/_gtm_head.html.erb +7 -0
  20. data/lib/potassium/assets/testing/.rspec +1 -0
  21. data/lib/potassium/assets/testing/devise_config.rb +6 -0
  22. data/lib/potassium/assets/testing/factory_bot_config.rb +3 -0
  23. data/lib/potassium/assets/testing/faker_config.rb +1 -0
  24. data/lib/potassium/assets/testing/power_types_config.rb +1 -0
  25. data/lib/potassium/assets/testing/rails_helper.rb +130 -49
  26. data/lib/potassium/assets/testing/shoulda_matchers_config.rb +8 -0
  27. data/lib/potassium/assets/testing/simplecov_config.rb +64 -0
  28. data/lib/potassium/assets/testing/system_tests_config.rb +6 -0
  29. data/lib/potassium/cli_options.rb +19 -3
  30. data/lib/potassium/helpers/template-helpers.rb +4 -0
  31. data/lib/potassium/recipes/admin.rb +27 -17
  32. data/lib/potassium/recipes/api.rb +2 -0
  33. data/lib/potassium/recipes/background_processor.rb +43 -32
  34. data/lib/potassium/recipes/ci.rb +9 -39
  35. data/lib/potassium/recipes/coverage.rb +35 -0
  36. data/lib/potassium/recipes/file_storage.rb +1 -1
  37. data/lib/potassium/recipes/front_end.rb +26 -13
  38. data/lib/potassium/recipes/google_tag_manager.rb +94 -0
  39. data/lib/potassium/recipes/heroku.rb +43 -31
  40. data/lib/potassium/recipes/mailer.rb +18 -5
  41. data/lib/potassium/recipes/monitoring.rb +5 -0
  42. data/lib/potassium/recipes/pundit.rb +29 -10
  43. data/lib/potassium/recipes/rails.rb +0 -4
  44. data/lib/potassium/recipes/schedule.rb +16 -1
  45. data/lib/potassium/recipes/spring.rb +9 -0
  46. data/lib/potassium/recipes/style.rb +2 -2
  47. data/lib/potassium/recipes/testing.rb +75 -18
  48. data/lib/potassium/templates/application.rb +7 -2
  49. data/lib/potassium/version.rb +7 -4
  50. data/potassium.gemspec +3 -1
  51. data/spec/features/background_processor_spec.rb +7 -5
  52. data/spec/features/ci_spec.rb +7 -4
  53. data/spec/features/coverage_spec.rb +26 -0
  54. data/spec/features/front_end_spec.rb +18 -1
  55. data/spec/features/google_tag_manager_spec.rb +36 -0
  56. data/spec/features/heroku_spec.rb +0 -4
  57. data/spec/features/mailer_spec.rb +16 -0
  58. data/spec/features/node_spec.rb +1 -1
  59. data/spec/features/pundit_spec.rb +34 -0
  60. data/spec/features/schedule_spec.rb +11 -4
  61. data/spec/features/testing_spec.rb +56 -0
  62. data/spec/support/potassium_test_helpers.rb +2 -3
  63. data/tmp/.keep +0 -0
  64. metadata +64 -15
  65. data/lib/potassium/assets/Dockerfile.ci +0 -6
  66. data/lib/potassium/assets/active_admin/admin_user_policy.rb +0 -2
  67. data/lib/potassium/assets/active_admin/comment_policy.rb +0 -2
  68. data/lib/potassium/assets/active_admin/pundit_page_policy.rb +0 -5
  69. data/lib/potassium/assets/bin/cibuild.erb +0 -117
  70. data/lib/potassium/assets/docker-compose.ci.yml +0 -12
  71. data/lib/potassium/assets/sidekiq_scheduler.yml +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0a1ede8a865324db5e181ed3cfbf3c9e1f96484caadc5c029b6c5175efc7e6b
4
- data.tar.gz: 8639acb5ea81cfdc85d98d14db0a01be36eaca1af890091784e04b29f6680a9f
3
+ metadata.gz: bf3d3969e70d29a2f2c15992c48f609ad389a486560fd6a16ea3a74871328a19
4
+ data.tar.gz: c1617bc3cba761408d2cba7419fbe4c68cb265a7438ea07b8c9b637944e3271d
5
5
  SHA512:
6
- metadata.gz: 239fc6414dc246862c5cfedfa12a5a182e11b79897b8309e7d0f12c0cb500ef06e919b5dadf6c2f78eaf30f53de14eef923ba2992ee23f6765b055dd667d9136
7
- data.tar.gz: 4d25beae0b7803c49cda4d35c573922c310f9a48003044fece122a87b020c75cbfc89efd8b4861bac90d7a8a8ff42496322155e1ead2c9b6214d49700e0eb994
6
+ metadata.gz: 61cbdbbced51469867a32a83a97628f8ea4ccfb3290cc2b2e6e8a34f86e53a6e0478609326264b59324266b8db184cd449d921a9f17cc3f5a58be01eddb00e3b
7
+ data.tar.gz: '00900211ab3d5dcb75e4f45889778c752cda9f61a7e8d8cd0e264bb1ba678c50f8b9593f8bb98c3afd8b2fa554458cb639bfba202428a978976872cf45d291a5'
data/.circleci/config.yml CHANGED
@@ -1,42 +1,107 @@
1
- version: 2
2
- jobs:
3
- build:
4
- working_directory: ~/app
5
- parallelism: 4
6
- shell: /bin/bash --login
1
+ version: 2.1
2
+
3
+ ruby-image: &ruby-image cimg/ruby:2.7.4-node
4
+ env-vars: &env-vars
5
+ BUNDLE_JOBS: 4
6
+ RAILS_ENV: test
7
+ RAKE_ENV: test
8
+ BUNDLE_PATH: /home/circleci/project/vendor/bundle
9
+ GEM_PATH: /home/circleci/project/vendor/bundle/ruby/2.7.0
7
10
 
11
+ executors:
12
+ ruby-executor:
8
13
  docker:
9
- - image: circleci/ruby:2.7.0-node
10
- environment:
11
- GEM_HOME: /home/circleci/app/vendor/bundle
12
- BUNDLE_JOBS: 4
13
- BUNDLE_RETRY: 3
14
- BUNDLE_PATH: /home/circleci/app/vendor/bundle
14
+ - image: *ruby-image
15
+ environment: *env-vars
16
+
17
+ commands:
18
+ setup:
19
+ description: checkout code, restore cache, install dependencies, save cache
20
+ steps:
21
+ - checkout
22
+
23
+ - restore_cache:
24
+ keys:
25
+ - potassium-vendor-bundle-{{ .Branch }}
26
+ - potassium-vendor-bundle-master
27
+ - potassium-vendor-bundle
28
+
29
+ - run:
30
+ name: Install bundle dependencies
31
+ command: |
32
+ gem install bundler:2.1.4
33
+ bundle _2.1.4_ install
34
+
35
+ - save_cache:
36
+ key: potassium-vendor-bundle-{{ .Branch }}
37
+ paths:
38
+ - vendor/bundle
39
+
40
+ jobs:
41
+ test:
42
+ parallelism: 6
43
+ executor: ruby-executor
44
+ steps:
45
+ - setup
15
46
 
47
+ - run:
48
+ name: Run rspec
49
+ command: |
50
+ RSPEC_JUNIT_ARGS="-r rspec_junit_formatter -f RspecJunitFormatter -o test_results/rspec.xml"
51
+ RSPEC_GENERAL_ARGS="-f progress --no-color -p 10"
52
+ SPLIT_ARGS="$(circleci tests glob spec/**/*_spec.rb | circleci tests split --split-by=timings)"
53
+ bundle exec rspec $RSPEC_GENERAL_ARGS $RSPEC_JUNIT_ARGS $SPLIT_ARGS
54
+
55
+ - store_test_results:
56
+ path: test_results
57
+
58
+ lint:
59
+ executor: ruby-executor
60
+ steps:
61
+ - setup
62
+
63
+ - run:
64
+ name: Install reviewdog
65
+ command: |
66
+ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b ./bin
67
+
68
+ - run:
69
+ name: Get files to lint
70
+ command: git diff origin/master --name-only --diff-filter=d > tmp/files_to_lint
71
+
72
+ - run:
73
+ name: Run rubocop
74
+ shell: /bin/bash
75
+ command: |
76
+ cat tmp/files_to_lint | grep -E '.+\.(rb)$' | xargs bundle exec rubocop --force-exclusion \
77
+ | ./bin/reviewdog -reporter=github-pr-review -f=rubocop
78
+
79
+ deploy:
80
+ executor: ruby-executor
16
81
  steps:
17
- - checkout
18
- - setup_remote_docker
19
-
20
- - restore_cache:
21
- keys:
22
- - potassium-bundle-{{ .Branch }}-
23
- - potassium-bundle-master-
24
- - potassium-bundle-
25
- - run: gem install bundler:2.0.2
26
- - run: bundle _2.0.2_ install
27
- - run: gem install hound-cli
28
- - run:
29
- command: |
30
- bundle exec rspec --color --require spec_helper --profile 10 \
31
- --format progress --format documentation \
32
- --format RspecJunitFormatter --out test_results/rspec.xml \
33
- $(circleci tests glob spec/**/*_spec.rb | circleci tests split --split-by=timings)
34
- environment:
35
- RAILS_ENV: test
36
- RACK_ENV: test
37
- - save_cache:
38
- key: potassium-bundle-{{ .Branch }}-{{ epoch }}
39
- paths:
40
- - vendor/bundle
41
- - store_test_results:
42
- path: test_results
82
+ - setup
83
+
84
+ - run:
85
+ name: Setup rubygems
86
+ command: bash .circleci/setup-rubygems.sh
87
+
88
+ - run:
89
+ name: Publish to rubygems
90
+ command: |
91
+ gem build potassium.gemspec
92
+ version_tag=$(git describe --tags)
93
+ gem push potassium-${version_tag#v}.gem
94
+
95
+ workflows:
96
+ test_and_lint:
97
+ jobs:
98
+ - test
99
+ - lint:
100
+ context: org-global
101
+ - deploy:
102
+ context: org-global
103
+ filters:
104
+ tags:
105
+ only: /.*/
106
+ branches:
107
+ ignore: /.*/
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
data/.gitignore CHANGED
@@ -6,7 +6,8 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
- /tmp/
9
+ /tmp/*
10
+ !/tmp/.keep
10
11
  *.bundle
11
12
  *.so
12
13
  *.o
data/.node-version CHANGED
@@ -1 +1 @@
1
- 12
1
+ 14