rails-interactive 0.1.9 → 1.0.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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/main.yml +57 -57
  3. data/lib/rails_interactive/message.rb +7 -5
  4. data/lib/rails_interactive/version.rb +1 -1
  5. data/lib/rails_interactive.rb +9 -79
  6. metadata +2 -23
  7. data/lib/rails_interactive/templates/setup_avo.rb +0 -10
  8. data/lib/rails_interactive/templates/setup_awesome_print.rb +0 -4
  9. data/lib/rails_interactive/templates/setup_better_errors.rb +0 -8
  10. data/lib/rails_interactive/templates/setup_brakeman.rb +0 -6
  11. data/lib/rails_interactive/templates/setup_bullet.rb +0 -7
  12. data/lib/rails_interactive/templates/setup_cancancan.rb +0 -7
  13. data/lib/rails_interactive/templates/setup_devise.rb +0 -10
  14. data/lib/rails_interactive/templates/setup_faker.rb +0 -5
  15. data/lib/rails_interactive/templates/setup_friendly_id.rb +0 -26
  16. data/lib/rails_interactive/templates/setup_graphql.rb +0 -10
  17. data/lib/rails_interactive/templates/setup_haml.rb +0 -18
  18. data/lib/rails_interactive/templates/setup_kaminari.rb +0 -7
  19. data/lib/rails_interactive/templates/setup_letter_opener.rb +0 -15
  20. data/lib/rails_interactive/templates/setup_omniauth.rb +0 -61
  21. data/lib/rails_interactive/templates/setup_pundit.rb +0 -15
  22. data/lib/rails_interactive/templates/setup_rails_admin.rb +0 -10
  23. data/lib/rails_interactive/templates/setup_rspec.rb +0 -13
  24. data/lib/rails_interactive/templates/setup_rubocop.rb +0 -10
  25. data/lib/rails_interactive/templates/setup_sidekiq.rb +0 -32
  26. data/lib/rails_interactive/templates/setup_slim.rb +0 -19
  27. data/lib/rails_interactive/templates/setup_standardrb.rb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75d2314dfc92d4b4b435a0d460ead1cdd929c4a38a4b1e7d61ac4c6348153865
4
- data.tar.gz: caa1efa0259cbdb5390235f10e13d280b126e3b179b2063fab5754a52949b7b7
3
+ metadata.gz: 0ed0537b6d53cb2eb3f395bbde2c35b9b798c9b74361a28fd26420ff450f5088
4
+ data.tar.gz: 1d41ee1c12f1979dcb372a36d340bf670ef03b2146c3b8bec781456a9284a9c4
5
5
  SHA512:
6
- metadata.gz: 60eed5fe9853045e1b5b56ab5345ca5d4ab56709eed27a11473de6d9661e95e70a4ab42aeca75ca0df2bc13378291458a23449a1b5afbe7acf384f9ed35436cd
7
- data.tar.gz: af53d57979c6a78ac62dbc1e7571d0db39e491a6c3c6582c2c048e5287a6db96a20725b464aa596f58848b681592e7f02632b53e22f76e049e7b312e8968adce
6
+ metadata.gz: 483c4f42d0c78380e98722b8c5f84dc4e6bdc66e041eca02b6a82ed036e138eca618cd97d43a79089c785ed969e3ec4f7b8094a910cb38c8a4a66e724a034f9b
7
+ data.tar.gz: 4f847ee3dcfcaba3091121a1672c922e74e2bae30b8f5231811a24ca8b6151229b29950c287e5f7e7a91005fe84e6cbe8a2eca728bc678e3c76d7f6a632b513c
@@ -1,57 +1,57 @@
1
- name: Release and Publish
2
- on:
3
- push:
4
- branches:
5
- - main
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Wait for tests to succeed
11
- uses: lewagon/wait-on-check-action@v1.0.0
12
- with:
13
- ref: ${{ github.ref }}
14
- check-name: 'Run tests'
15
- repo-token: ${{ secrets.GITHUB_TOKEN }}
16
- wait-interval: 10
17
- - uses: GoogleCloudPlatform/release-please-action@v2
18
- id: release
19
- with:
20
- release-type: ruby
21
- package-name: rails-interactive
22
- version-file: 'lib/rails_interactive/version.rb'
23
- - uses: actions/checkout@v2
24
- if: ${{ steps.release.outputs.release_created }}
25
- - name: Set up Ruby
26
- uses: ruby/setup-ruby@v1
27
- if: ${{ steps.release.outputs.release_created }}
28
- with:
29
- ruby-version: 3.0.2
30
- bundler-cache: true
31
- - name: Bundle Install
32
- run: bundle install
33
- if: ${{ steps.release.outputs.release_created }}
34
- - name: Set Credentials
35
- run: |
36
- mkdir -p $HOME/.gem
37
- touch $HOME/.gem/credentials
38
- chmod 0600 $HOME/.gem/credentials
39
- printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
40
- printf -- "---\n:rubygems_api_key: ${RUBYGEMS_TOKEN}\n" > $HOME/.gem/credentials
41
- if: ${{ steps.release.outputs.release_created }}
42
- env:
43
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
44
- RUBYGEMS_TOKEN: '${{secrets.RUBYGEMS_TOKEN}}'
45
- - name: Publish to GitHub Packages
46
- run: |
47
- export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
48
- gem build *.gemspec
49
- gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
50
- gem push *.gem
51
- if: ${{ steps.release.outputs.release_created }}
52
- - name: Publish to RubyGems
53
- run: |
54
- gem build *.gemspec
55
- gem push --host https://rubygems.pkg.github.com/${OWNER} *.gem
56
- gem push *.gem
57
- if: ${{ steps.release.outputs.release_created }}
1
+ # name: Release and Publish
2
+ # on:
3
+ # push:
4
+ # branches:
5
+ # - main
6
+ # jobs:
7
+ # build:
8
+ # runs-on: ubuntu-latest
9
+ # steps:
10
+ # - name: Wait for tests to succeed
11
+ # uses: lewagon/wait-on-check-action@v1.0.0
12
+ # with:
13
+ # ref: ${{ github.ref }}
14
+ # check-name: 'Run tests'
15
+ # repo-token: ${{ secrets.GITHUB_TOKEN }}
16
+ # wait-interval: 10
17
+ # - uses: GoogleCloudPlatform/release-please-action@v2
18
+ # id: release
19
+ # with:
20
+ # release-type: ruby
21
+ # package-name: rails-interactive
22
+ # version-file: 'lib/rails_interactive/version.rb'
23
+ # - uses: actions/checkout@v2
24
+ # if: ${{ steps.release.outputs.release_created }}
25
+ # - name: Set up Ruby
26
+ # uses: ruby/setup-ruby@v1
27
+ # if: ${{ steps.release.outputs.release_created }}
28
+ # with:
29
+ # ruby-version: 3.0.2
30
+ # bundler-cache: true
31
+ # - name: Bundle Install
32
+ # run: bundle install
33
+ # if: ${{ steps.release.outputs.release_created }}
34
+ # - name: Set Credentials
35
+ # run: |
36
+ # mkdir -p $HOME/.gem
37
+ # touch $HOME/.gem/credentials
38
+ # chmod 0600 $HOME/.gem/credentials
39
+ # printf -- "---\n:github: Bearer ${GITHUB_TOKEN}\n" > $HOME/.gem/credentials
40
+ # printf -- "---\n:rubygems_api_key: ${RUBYGEMS_TOKEN}\n" > $HOME/.gem/credentials
41
+ # if: ${{ steps.release.outputs.release_created }}
42
+ # env:
43
+ # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
44
+ # RUBYGEMS_TOKEN: '${{secrets.RUBYGEMS_TOKEN}}'
45
+ # - name: Publish to GitHub Packages
46
+ # run: |
47
+ # export OWNER=$( echo ${{ github.repository }} | cut -d "/" -f 1 )
48
+ # gem build *.gemspec
49
+ # gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
50
+ # gem push *.gem
51
+ # if: ${{ steps.release.outputs.release_created }}
52
+ # - name: Publish to RubyGems
53
+ # run: |
54
+ # gem build *.gemspec
55
+ # gem push --host https://rubygems.pkg.github.com/${OWNER} *.gem
56
+ # gem push *.gem
57
+ # if: ${{ steps.release.outputs.release_created }}
@@ -19,11 +19,13 @@ module RailsInteractive
19
19
  def self.render_ascii
20
20
  # rubocop:disable Naming/HeredocDelimiterNaming
21
21
  puts <<-'EOF'
22
- ___ _ _ _ ____ _ _
23
- |_ _|_ __ | |_ ___ _ __ __ _ ___| |_(_)_ _____| _ \ __ _(_) |___
24
- | || '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \ |_) / _` | | / __|
25
- | || | | | || __/ | | (_| | (__| |_| |\ V / __/ _ < (_| | | \__ \
26
- |___|_| |_|\__\___|_| \__,_|\___|\__|_| \_/ \___|_| \_\__,_|_|_|___/
22
+ _____ _ _ _____ _ _ _
23
+ | __ \ (_) | |_ _| | | | | (_)
24
+ | |__) |__ _ _| |___ | | _ __ | |_ ___ _ __ __ _ ___| |_ ___ _____
25
+ | _ // _` | | / __| | | | '_ \| __/ _ \ '__/ _` |/ __| __| \ \ / / _ \
26
+ | | \ \ (_| | | \__ \_| |_| | | | || __/ | | (_| | (__| |_| |\ V / __/
27
+ |_| \_\__,_|_|_|___/_____|_| |_|\__\___|_| \__,_|\___|\__|_| \_/ \___|
28
+
27
29
 
28
30
  EOF
29
31
  # rubocop:enable Naming/HeredocDelimiterNaming
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsInteractive
4
- VERSION = "0.1.9"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -27,73 +27,37 @@ module RailsInteractive
27
27
  name
28
28
  type
29
29
  database
30
- features
31
- code_quality_tool
32
- template_engines
33
- admin_panel
34
- testing_tools
35
- development_tools
30
+ css_frameworks
36
31
 
37
32
  create
38
33
  end
39
34
 
40
- # rubocop:disable Metrics/MethodLength
41
35
  def create
42
36
  # Install gems
43
37
  system("bin/setup")
38
+
44
39
  # Create project
45
40
  system(setup)
46
41
 
47
- copy_templates_to_project
48
-
49
- # Move to project folder and install gems
42
+ # Prepare project requirements and give instructions
50
43
  Dir.chdir "./#{@inputs[:name]}"
44
+ system("rails db:create")
51
45
 
52
- # Features Templates
53
- handle_multi_options(key: :features)
54
-
55
- # Code Quality Template
56
- system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:code_quality_tool]}.rb")
57
-
58
- # HTML Template Engines
59
- system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:template_engine]}.rb")
60
-
61
- # Admin Panel Template
62
- system("bin/rails app:template LOCATION=templates/setup_#{@inputs[:admin_panel]}.rb")
63
-
64
- # Testing tools Template
65
- handle_multi_options(key: :testing_tools)
66
-
67
- # Development tools Template
68
- handle_multi_options(key: :development_tools)
69
-
70
- # Prepare project requirements and give instructions
71
46
  sign_project
72
47
  Message.prepare
73
48
  end
74
- # rubocop:enable Metrics/MethodLength
75
49
 
76
50
  def setup
77
51
  base = "rails new"
78
52
  cmd = ""
79
53
 
80
- @inputs.first(3).each { |_key, value| cmd += "#{value} " }
54
+ @inputs.each { |_key, value| cmd += "#{value} " }
81
55
 
82
56
  "#{base} #{cmd}".strip!
83
57
  end
84
58
 
85
- def copy_templates_to_project
86
- FileUtils.cp_r "#{__dir__}/rails_interactive/templates", "./#{@inputs[:name]}"
87
- end
88
-
89
59
  private
90
60
 
91
- def handle_multi_options(key:)
92
- @inputs[key].each do |value|
93
- system("bin/rails app:template LOCATION=templates/setup_#{value}.rb")
94
- end
95
- end
96
-
97
61
  def name
98
62
  @inputs[:name] = Prompt.new("Enter the name of the project: ", "ask", required: true).perform
99
63
  end
@@ -109,45 +73,11 @@ module RailsInteractive
109
73
  @inputs[:database] = Prompt.new("Choose project's database: ", "select", database_types, required: true).perform
110
74
  end
111
75
 
112
- def features
113
- features = %w[devise cancancan omniauth pundit brakeman sidekiq graphql kaminari]
114
-
115
- @inputs[:features] = Prompt.new("Choose project features: ", "multi_select", features).perform
116
- end
117
-
118
- def code_quality_tool
119
- code_quality_tool = { "Rubocop" => "rubocop", "StandardRB" => "standardrb" }
120
-
121
- @inputs[:code_quality_tool] =
122
- Prompt.new("Choose project code quality tool: ", "select", code_quality_tool).perform
123
- end
124
-
125
- def admin_panel
126
- admin_panel = { "RailsAdmin" => "rails_admin", "Avo" => "avo" }
127
-
128
- @inputs[:admin_panel] =
129
- Prompt.new("Choose project's admin panel: ", "select", admin_panel).perform
130
- end
131
-
132
- def testing_tools
133
- testing_tools = %w[rspec]
134
-
135
- @inputs[:testing_tools] =
136
- Prompt.new("Choose project's testing tools: ", "multi_select", testing_tools).perform
137
- end
138
-
139
- def template_engines
140
- template_engines = { "HAML" => "haml", "SLIM" => "slim" }
141
-
142
- @inputs[:template_engine] =
143
- Prompt.new("Choose project's template engine: ", "select", template_engines).perform
144
- end
145
-
146
- def development_tools
147
- development_tools = %w[bullet faker friendly_id better_errors letter_opener awesome_print]
76
+ def css_frameworks
77
+ css_frameworks = { "None" => "", "Bootstrap" => "--css=bootstrap", "Tailwind" => "--css=tailwind" }
148
78
 
149
- @inputs[:development_tools] =
150
- Prompt.new("Choose project's development tools: ", "multi_select", development_tools).perform
79
+ @inputs[:css_framework] =
80
+ Prompt.new("Choose project's CSS framework: ", "select", css_frameworks, required: true).perform
151
81
  end
152
82
 
153
83
  def sign_project
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-interactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oguzhan Ince
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-24 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,27 +138,6 @@ files:
138
138
  - lib/rails_interactive.rb
139
139
  - lib/rails_interactive/message.rb
140
140
  - lib/rails_interactive/prompt.rb
141
- - lib/rails_interactive/templates/setup_avo.rb
142
- - lib/rails_interactive/templates/setup_awesome_print.rb
143
- - lib/rails_interactive/templates/setup_better_errors.rb
144
- - lib/rails_interactive/templates/setup_brakeman.rb
145
- - lib/rails_interactive/templates/setup_bullet.rb
146
- - lib/rails_interactive/templates/setup_cancancan.rb
147
- - lib/rails_interactive/templates/setup_devise.rb
148
- - lib/rails_interactive/templates/setup_faker.rb
149
- - lib/rails_interactive/templates/setup_friendly_id.rb
150
- - lib/rails_interactive/templates/setup_graphql.rb
151
- - lib/rails_interactive/templates/setup_haml.rb
152
- - lib/rails_interactive/templates/setup_kaminari.rb
153
- - lib/rails_interactive/templates/setup_letter_opener.rb
154
- - lib/rails_interactive/templates/setup_omniauth.rb
155
- - lib/rails_interactive/templates/setup_pundit.rb
156
- - lib/rails_interactive/templates/setup_rails_admin.rb
157
- - lib/rails_interactive/templates/setup_rspec.rb
158
- - lib/rails_interactive/templates/setup_rubocop.rb
159
- - lib/rails_interactive/templates/setup_sidekiq.rb
160
- - lib/rails_interactive/templates/setup_slim.rb
161
- - lib/rails_interactive/templates/setup_standardrb.rb
162
141
  - lib/rails_interactive/version.rb
163
142
  - rails-interactive.gemspec
164
143
  homepage: https://github.com/oguzsh/rails-interactive
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "rails db:prepare"
4
- run "bundle add avo"
5
-
6
- Bundler.with_unbundled_env { run "bundle install" }
7
-
8
- rails_command("generate avo:install")
9
-
10
- puts "Avo is installed! You can go to http://localhost:3000/avo for next steps"
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run 'bundle add awesome_print --group "development"'
4
- Bundler.with_unbundled_env { run "bundle install" }
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- gem_group :development do
4
- gem "better_errors"
5
- gem "binding_of_caller"
6
- end
7
-
8
- Bundler.with_unbundled_env { run "bundle install" }
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run 'bundle add brakeman --group "development"'
4
- Bundler.with_unbundled_env { run "bundle install" }
5
- run "bundle binstubs brakeman"
6
- run "bin/brakeman"
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add bullet --group 'development'"
4
-
5
- Bundler.with_unbundled_env { run "bundle install" }
6
-
7
- run "bundle exec rails g bullet:install"
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add cancancan"
4
-
5
- Bundler.with_unbundled_env { run "bundle install" }
6
-
7
- rails_command "generate cancan:ability"
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add devise"
4
- Bundler.with_unbundled_env { run "bundle install" }
5
-
6
- rails_command "generate devise:install"
7
-
8
- run "rails generate devise User"
9
- run "rails db:create"
10
- run "rails db:migrate"
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add faker --group 'development' 'test'"
4
-
5
- Bundler.with_unbundled_env { run "bundle install" }
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def ask_with_default(prompt, default)
4
- value = ask("#{prompt} (default: #{default})")
5
- value.present? ? value : default
6
- end
7
-
8
- run "bundle add 'friendly_id'"
9
-
10
- rails_command "generate friendly_id"
11
-
12
- while yes?("Do you want to use Friendly ID with an existing model? (y/n)")
13
- model_name = ask_with_default("Model Name:", "Postr")
14
- attribute = ask_with_default("Attribute:", "name")
15
- next unless model_name && attribute
16
-
17
- # We generate a migration to add the friendly id slug column.
18
- generate(:migration, "AddSlugTo#{model_name.titleize.pluralize}", "slug:uniq")
19
- string = <<~RUBY
20
- extend FriendlyId
21
- friendly_id :#{attribute}, use: :slugged
22
- RUBY
23
- # Inject the friendly id methods into the class.
24
- inject_into_file "app/models/#{model_name.downcase}.rb", string,
25
- after: "class #{model_name.titleize} < ApplicationRecord\n"
26
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "rails db:prepare"
4
- run "bundle add graphql"
5
-
6
- Bundler.with_unbundled_env { run "bundle install" }
7
-
8
- rails_command("generate graphql:install")
9
-
10
- puts "GraphQL is installed!"
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def bundle_install
4
- Bundler.with_unbundled_env { run "bundle install" }
5
- end
6
-
7
- run "bundle add haml"
8
- bundle_install
9
-
10
- if yes?("Would you like to convert your existing *.erb files to *.haml files? [y/n]")
11
- run "bundle add erb2haml --group 'development'"
12
- bundle_install
13
- if yes?("Would you like to keep the original *.erb files? [y/n]")
14
- rake "haml:convert_erbs"
15
- else
16
- rake "haml:replace_erbs"
17
- end
18
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add kaminari"
4
-
5
- Bundler.with_unbundled_env { run "bundle install" }
6
-
7
- puts "Kaminari is installed!"
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run 'bundle add letter_opener --group "development"'
4
-
5
- Bundler.with_unbundled_env { run "bundle install" }
6
-
7
- inject_into_file "config/environments/development.rb", after: "config.action_mailer.perform_caching = false\n" do
8
- <<-RUBY
9
-
10
- config.action_mailer.delivery_method = :letter_opener
11
- config.action_mailer.perform_deliveries = true
12
- RUBY
13
- end
14
-
15
- puts "Letter Opener is now installed!"
@@ -1,61 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add omniauth"
4
-
5
- run "bundle install"
6
-
7
- # rubocop:disable Layout/LineLength
8
- rails_command "generate model identity user:references provider:string:index uid:string:index token:string:index refresh_token:string:index"
9
- # rubocop:enable Layout/LineLength
10
-
11
- rails_command "generate migration AddIdentityToUsers identities_count:integer"
12
-
13
- rails_command "db:migrate"
14
-
15
- inject_into_file "config/routes.rb", after: "devise_for :users\n" do
16
- " # devise_for :users, controllers: { omniauth_callbacks: 'omniauth' }"
17
- end
18
-
19
- inject_into_file "app/models/user.rb", after: ":database_authenticatable, " do
20
- ":omniauthable, "
21
- end
22
-
23
- inject_into_file "app/models/identity.rb", after: "belongs_to :user" do
24
- ", counter_cache: true"
25
- end
26
-
27
- inject_into_file "app/models/user.rb", after: "class User < ApplicationRecord\n" do
28
- # rubocop:disable Naming/HeredocDelimiterNaming
29
- <<-EOF
30
- has_many :identities, dependent: :destroy
31
-
32
- def self.from_omniauth(auth)
33
- if auth.present? && auth.provider.present? && auth.uid.present?
34
- identity = Identity.where(provider: auth.provider, uid: auth.uid).first_or_initialize
35
- if auth.credentials.present?
36
- identity.token = auth.credentials.token
37
- identity.refresh_token = auth.credentials.refresh_token
38
- end
39
- if identity.user.nil? && auth.info.email.present?
40
- user = User.where(email: auth.info.email).first_or_initialize
41
- user.name = auth.info.name
42
- user.password = Devise.friendly_token if user.new_record?
43
- user.save!
44
- identity.user = user
45
- end
46
- identity.save!
47
- identity.user
48
- end
49
- end
50
-
51
- EOF
52
- # rubocop:enable Naming/HeredocDelimiterNaming
53
- end
54
-
55
- file "app/controllers/omniauth_controller.rb", <<~CODE
56
- class OmniauthController < Devise::OmniauthCallbacksController
57
-
58
- end
59
- CODE
60
-
61
- puts "IMPORTANT: Add devise_for :users, controllers: { omniauth_callbacks: 'omniauth' } to your routes.rb"
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "bundle add pundit"
4
-
5
- puts "Add - Pundit module to Application Controller"
6
- puts ""
7
-
8
- inject_into_file "app/controllers/application_controller.rb",
9
- after: "class ApplicationController < ActionController::Base\n" do
10
- " include Pundit\n"
11
- end
12
-
13
- puts "Run - Pundit Generator"
14
-
15
- rails_command("generate pundit:install")
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "rails db:prepare"
4
- run "bundle add rails_admin"
5
-
6
- Bundler.with_unbundled_env { run "bundle install" }
7
-
8
- rails_command("generate rails_admin:install")
9
-
10
- puts "RailsAdmin is installed! You can go to your admin panel at /admin"
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- run "spring stop"
4
-
5
- gem_group :development, :test do
6
- gem "rspec-rails"
7
- end
8
-
9
- Bundler.with_unbundled_env { run "bundle install" }
10
-
11
- rails_command "generate rspec:install"
12
-
13
- puts "RSpec is installed!"
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- gem_group :development do
4
- gem "rubocop", require: false
5
- end
6
-
7
- Bundler.with_unbundled_env { run "bundle install" }
8
-
9
- run "rubocop --auto-gen-config"
10
- run "bundle binstubs rubocop"
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def file_contains?(filename, string)
4
- File.foreach(filename).detect { |line| line.include?(string) }
5
- end
6
-
7
- run "bundle add sidekiq"
8
- run "bundle add redis" unless file_contains? "Gemfile", "Gem 'redis'"
9
-
10
- Bundler.with_unbundled_env { run "bundle install" }
11
-
12
- # rubocop:disable Naming/HeredocDelimiterNaming
13
- application do
14
- <<~EOF
15
- config.active_job.queue_adapter = :sidekiq
16
- EOF
17
- end
18
-
19
- inject_into_file "config/routes.rb" do
20
- <<~EOF
21
- require "sidekiq/web"
22
- if Rails.env.production?
23
- Sidekiq::Web.use Rack::Auth::Basic do |username, password|
24
- ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_USERNAME"])) &
25
- ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV["SIDEKIQ_PASSWORD"]))
26
- end
27
- end
28
- EOF
29
- end
30
- # rubocop:enable Naming/HeredocDelimiterNaming
31
-
32
- route 'mount Sidekiq::Web => "/sidekiq"'
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- def bundle_install
4
- Bundler.with_unbundled_env { run "bundle install" }
5
- end
6
-
7
- run "bundle add slim-rails"
8
-
9
- bundle_install
10
-
11
- if yes?("Would you like to convert your existing *.erb files to *.slim files? [y/n]")
12
- run "bundle add html2slim --group 'development'"
13
- bundle_install
14
- if yes?("Would you like to keep the original *.erb files? [y/n]")
15
- run "erb2slim app/views"
16
- else
17
- run "erb2slim app/views -d"
18
- end
19
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- gem_group :development, :test do
4
- gem "standard"
5
- end
6
-
7
- Bundler.with_unbundled_env { run "bundle install" }
8
-
9
- puts "You can then run Standard from the command line with:"
10
- puts "bundle exec standardrb"