boring_generators 0.10.0 → 0.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0270bea161b8e7aa0cce68a2f79bd8456865f7f0ee00c3fef81b0ecddbfba1e1
4
- data.tar.gz: 19e58c07ef090636ca05c1e7c620e750994c72e052ae3dc51e6b1887783582cb
3
+ metadata.gz: ee57d89d7ab8e0ffa351d54ae30a52a5d8adeb1a2fdfd7c99910be78599c104e
4
+ data.tar.gz: 759e5b5f00ec406743075950bdb5637274c1364d9f74674b92408dc49aa7c193
5
5
  SHA512:
6
- metadata.gz: 1dd9d49410e16f73b13116f490fca9407313bf845f21ce45e403b5e4ced43e7647e0ed52b020f175cae2571ad6b6a5ff16b2ade2d271a338905837c93b58317a
7
- data.tar.gz: '092146185b12c44adad625d7c67a19253759a4d7b7a8a520ec4b541bf066f49aa98dba50787dc46ad535ad2318c79e31fb6e2fc60d7e14733872948f738ee83a'
6
+ metadata.gz: db02ff1b7c2503b3cbc61a525d8c22557ea703c50821a7c62de5a807d0d9778aaaca9bfc816884576c593d076a681c7d14aa4f185034c740da41596be5f61df7
7
+ data.tar.gz: 935f71b5e4ed6ba413698addf56884b473458966a4350fbb071fa2667d4c99240d9ead01936236a585b2e70bace03cdab94b85212bdeb3e0e95d9e70e8b75602
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## master (unreleased)
4
4
 
5
+ ## 0.11.0 (June 23rd, 2021)
6
+ * Adds Stimulus generator. ([@abhaynikam][])
7
+ * Adds Rails Admin generator. ([@abhaynikam][])
8
+ * Adds Paper Trail generator. ([@abhaynikam][])
9
+ * Update default node-version for GitHub Action generator and fixes PG setup issues. ([@abhaynikam][])
10
+
5
11
  ## 0.10.0 (May 26th, 2021)
6
12
  * Updates Stripe payment generator. ([@abhaynikam][])
7
13
  * Fixes many generators which install ruby gems to not hardcode gem version. ([@abhaynikam][])
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- boring_generators (0.9.0)
4
+ boring_generators (0.10.0)
5
5
  railties
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -67,6 +67,9 @@ The boring generator introduces following generators:
67
67
  - Install Twilio: `rails generate boring:twilio:install`
68
68
  - Install Ahoy: `rails generate boring:ahoy:install`
69
69
  - Install Stripe: `rails generate boring:payments:stripe:install`
70
+ - Install Stimulus: `rails generate boring:stimulus:install`
71
+ - Install Rails Admin: `rails generate boring:rails_admin:install`
72
+ - Install Paper Trail: `rails generate boring:paper_trail:install`
70
73
 
71
74
  ## Screencasts
72
75
 
@@ -1,3 +1,3 @@
1
1
  module BoringGenerators
2
- VERSION = "0.10.0"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -10,7 +10,7 @@ module Boring
10
10
  RUBY_VERSION_FILE = ".ruby-version"
11
11
 
12
12
  DEFAULT_RUBY_VERSION = ".ruby-version"
13
- DEFAULT_NODE_VERSION = "10.13.0"
13
+ DEFAULT_NODE_VERSION = "14"
14
14
  DEFAULT_REPOSITORY_NAME = "boring_generators"
15
15
 
16
16
  class_option :ruby_version, type: :string, aliases: "-v",
@@ -1,5 +1,9 @@
1
1
  name: CI
2
- on: [push]
2
+ on:
3
+ push:
4
+ branches: [ main ]
5
+ pull_request:
6
+ branches: [ main ]
3
7
  jobs:
4
8
  test:
5
9
  name: Tests
@@ -10,8 +14,9 @@ jobs:
10
14
  env:
11
15
  POSTGRES_USER: <%= @repository_name %>
12
16
  POSTGRES_DB: <%= "#{@repository_name}_test" %>
13
- POSTGRES_PASSWORD: ""
17
+ POSTGRES_PASSWORD: postgres
14
18
  ports: ["5432:5432"]
19
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
15
20
 
16
21
  steps:
17
22
  - name: Checkout code
@@ -25,6 +30,8 @@ jobs:
25
30
  uses: actions/setup-node@v1
26
31
  with:
27
32
  node-version: <%= @node_version %>
33
+ - name: Install library for postgres
34
+ run: sudo apt-get install libpq-dev
28
35
  - name: Find yarn cache location
29
36
  id: yarn-cache
30
37
  run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -43,7 +50,13 @@ jobs:
43
50
  RAILS_ENV: test
44
51
  PGHOST: localhost
45
52
  PGUSER: <%= @repository_name %>
53
+ PGPASSWORD: postgres
46
54
  run: |
47
55
  bin/rails db:setup
48
56
  - name: Run tests
57
+ env:
58
+ RAILS_ENV: test
59
+ PGHOST: localhost
60
+ PGUSER: <%= @repository_name %>
61
+ PGPASSWORD: postgres
49
62
  run: bundle exec rails test # TODO: Update the test runner command as per your requirement.
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boring
4
+ module PaperTrail
5
+ class InstallGenerator < Rails::Generators::Base
6
+ desc "Adds paper trail to the application"
7
+ source_root File.expand_path("templates", __dir__)
8
+
9
+ class_option :skip_generator, type: :boolean, aliases: "-sg",
10
+ desc: "Skip running paper_trail install generator"
11
+ class_option :skip_user_track_config, type: :boolean, aliases: "-sutc",
12
+ desc: "Skip adding config for tracking devise user in paper_trail"
13
+
14
+ def add_bullet_gem
15
+ say "Adding paper trail gems", :green
16
+ Bundler.with_unbundled_env do
17
+ run "bundle add paper_trail"
18
+ end
19
+ end
20
+
21
+ def run_paper_trail_generator
22
+ return if options[:skip_generator]
23
+
24
+ say "Running rails_admin generator", :green
25
+ Bundler.with_unbundled_env do
26
+ run "DISABLE_SPRING=1 bundle exec rails generate paper_trail:install --with-changes"
27
+ end
28
+ end
29
+
30
+ def set_configuration_to_track_whodunnit
31
+ return if options[:skip_user_track_config]
32
+
33
+ say "Setting configuration to track devise current_user", :green
34
+ insert_into_file "app/controllers/application_controller.rb", <<~RUBY, after: /class ApplicationController < ActionController::Base/
35
+ \tbefore_action :set_paper_trail_whodunnit
36
+ RUBY
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boring
4
+ module RailsAdmin
5
+ class InstallGenerator < Rails::Generators::Base
6
+ desc "Adds rails_admin to the application"
7
+ source_root File.expand_path("templates", __dir__)
8
+
9
+ class_option :skip_generator, type: :boolean, aliases: "-sg",
10
+ desc: "Skip running rails_admin install generator"
11
+ class_option :route_name, type: :string, aliases: "-r",
12
+ desc: "Mount the rails_admin engine on route"
13
+
14
+ def add_rails_admin_ruby_gem
15
+ say "Adding rails_admin gem", :green
16
+ Bundler.with_unbundled_env do
17
+ run "bundle add rails_admin"
18
+ end
19
+ end
20
+
21
+ def run_rails_admin_generator
22
+ return if options[:skip_generator]
23
+ if options[:route_name].present?
24
+ say "Running rails_admin generator", :green
25
+ Bundler.with_unbundled_env do
26
+ run "DISABLE_SPRING=1 bundle exec rails generate rails_admin:install #{options[:route_name]}"
27
+ end
28
+ else
29
+ say <<~WARNING, :red
30
+ ERROR: Please specify the --route_name=<name> where you want to mount the rails_admin engine
31
+ WARNING
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Boring
4
+ module Stimulus
5
+ class InstallGenerator < Rails::Generators::Base
6
+ desc "Adds Stimulus to the application"
7
+ source_root File.expand_path("templates", __dir__)
8
+
9
+ def add_stimulus_ruby_gem
10
+ say "Adding Stimulus gem", :green
11
+ Bundler.with_unbundled_env do
12
+ run "bundle add stimulus-rails"
13
+ end
14
+ end
15
+
16
+ def generating_devise_defaults
17
+ say "Generating stimulus defaults", :green
18
+ Bundler.with_unbundled_env do
19
+ run "DISABLE_SPRING=1 bundle exec rails stimulus:install"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boring_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abhay Nikam
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2021-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -95,6 +95,7 @@ files:
95
95
  - lib/generators/boring/oauth/twitter/install/install_generator.rb
96
96
  - lib/generators/boring/oauth/twitter/install/templates/README
97
97
  - lib/generators/boring/oauth/twitter/install/templates/omniauth_callbacks_controller.rb
98
+ - lib/generators/boring/paper_trail/install/install_generator.rb
98
99
  - lib/generators/boring/payments/stripe/install/install_generator.rb
99
100
  - lib/generators/boring/payments/stripe/install/templates/README
100
101
  - lib/generators/boring/payments/stripe/install/templates/controllers/stripe/checkouts_controller.rb
@@ -104,9 +105,11 @@ files:
104
105
  - lib/generators/boring/pry/install/install_generator.rb
105
106
  - lib/generators/boring/pry/install/templates/pryrc
106
107
  - lib/generators/boring/pundit/install/install_generator.rb
108
+ - lib/generators/boring/rails_admin/install/install_generator.rb
107
109
  - lib/generators/boring/rubocop/install/install_generator.rb
108
110
  - lib/generators/boring/rubocop/install/templates/.rubocop.yml.tt
109
111
  - lib/generators/boring/simple_form/install/install_generator.rb
112
+ - lib/generators/boring/stimulus/install/install_generator.rb
110
113
  - lib/generators/boring/tailwind/install/install_generator.rb
111
114
  - lib/generators/boring/tailwind/install/templates/README
112
115
  - lib/generators/boring/tailwind/install/templates/application.scss