rails-interactive 0.1.8 → 0.1.9
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 +4 -4
- data/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md +9 -0
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/rails_interactive/templates/setup_awesome_print.rb +4 -0
- data/lib/rails_interactive/templates/setup_better_errors.rb +8 -0
- data/lib/rails_interactive/templates/setup_bullet.rb +7 -0
- data/lib/rails_interactive/templates/setup_faker.rb +5 -0
- data/lib/rails_interactive/templates/setup_friendly_id.rb +26 -0
- data/lib/rails_interactive/templates/setup_letter_opener.rb +15 -0
- data/lib/rails_interactive/version.rb +1 -1
- data/lib/rails_interactive.rb +20 -0
- metadata +8 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75d2314dfc92d4b4b435a0d460ead1cdd929c4a38a4b1e7d61ac4c6348153865
|
4
|
+
data.tar.gz: caa1efa0259cbdb5390235f10e13d280b126e3b179b2063fab5754a52949b7b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60eed5fe9853045e1b5b56ab5345ca5d4ab56709eed27a11473de6d9661e95e70a4ab42aeca75ca0df2bc13378291458a23449a1b5afbe7acf384f9ed35436cd
|
7
|
+
data.tar.gz: af53d57979c6a78ac62dbc1e7571d0db39e491a6c3c6582c2c048e5287a6db96a20725b464aa596f58848b681592e7f02632b53e22f76e049e7b312e8968adce
|
@@ -0,0 +1,9 @@
|
|
1
|
+
## What's up?
|
2
|
+
|
3
|
+
In this PR, Rails interactive have `gem` integration. In this way, when users select `gem` to install their rails project, CLI will install `gem` to the related project with the use of rails templates
|
4
|
+
|
5
|
+
## Issue
|
6
|
+
Related Issue: `issue_link`
|
7
|
+
|
8
|
+
## Closed Issue
|
9
|
+
Closes `issue_link`
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
### [0.1.9](https://www.github.com/oguzsh/rails-interactive/compare/v0.1.8...v0.1.9) (2022-04-24)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* file name typo ([#60](https://www.github.com/oguzsh/rails-interactive/issues/60)) ([542c76f](https://www.github.com/oguzsh/rails-interactive/commit/542c76fa57fd37cf583a7238b2a9b527aeba1778))
|
9
|
+
|
3
10
|
## [0.1.0] - 2022-03-11
|
4
11
|
|
5
12
|
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,15 @@
|
|
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!"
|
data/lib/rails_interactive.rb
CHANGED
@@ -32,10 +32,12 @@ module RailsInteractive
|
|
32
32
|
template_engines
|
33
33
|
admin_panel
|
34
34
|
testing_tools
|
35
|
+
development_tools
|
35
36
|
|
36
37
|
create
|
37
38
|
end
|
38
39
|
|
40
|
+
# rubocop:disable Metrics/MethodLength
|
39
41
|
def create
|
40
42
|
# Install gems
|
41
43
|
system("bin/setup")
|
@@ -62,9 +64,14 @@ module RailsInteractive
|
|
62
64
|
# Testing tools Template
|
63
65
|
handle_multi_options(key: :testing_tools)
|
64
66
|
|
67
|
+
# Development tools Template
|
68
|
+
handle_multi_options(key: :development_tools)
|
69
|
+
|
65
70
|
# Prepare project requirements and give instructions
|
71
|
+
sign_project
|
66
72
|
Message.prepare
|
67
73
|
end
|
74
|
+
# rubocop:enable Metrics/MethodLength
|
68
75
|
|
69
76
|
def setup
|
70
77
|
base = "rails new"
|
@@ -135,5 +142,18 @@ module RailsInteractive
|
|
135
142
|
@inputs[:template_engine] =
|
136
143
|
Prompt.new("Choose project's template engine: ", "select", template_engines).perform
|
137
144
|
end
|
145
|
+
|
146
|
+
def development_tools
|
147
|
+
development_tools = %w[bullet faker friendly_id better_errors letter_opener awesome_print]
|
148
|
+
|
149
|
+
@inputs[:development_tools] =
|
150
|
+
Prompt.new("Choose project's development tools: ", "multi_select", development_tools).perform
|
151
|
+
end
|
152
|
+
|
153
|
+
def sign_project
|
154
|
+
file = "README.md"
|
155
|
+
msg = "\n> This project was generated by [Rails Interactive CLI](https://github.com/oguzsh/rails-interactive)"
|
156
|
+
File.write(file, msg, mode: "a+")
|
157
|
+
end
|
138
158
|
end
|
139
159
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-interactive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oguzhan Ince
|
@@ -119,6 +119,7 @@ extensions: []
|
|
119
119
|
extra_rdoc_files: []
|
120
120
|
files:
|
121
121
|
- ".github/FUNDING.yml"
|
122
|
+
- ".github/PULL_REQUEST_TEMPLATE/pull_request_template.md"
|
122
123
|
- ".github/workflows/main.yml"
|
123
124
|
- ".github/workflows/rspec_rubocop.yml"
|
124
125
|
- ".gitignore"
|
@@ -138,12 +139,18 @@ files:
|
|
138
139
|
- lib/rails_interactive/message.rb
|
139
140
|
- lib/rails_interactive/prompt.rb
|
140
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
|
141
144
|
- lib/rails_interactive/templates/setup_brakeman.rb
|
145
|
+
- lib/rails_interactive/templates/setup_bullet.rb
|
142
146
|
- lib/rails_interactive/templates/setup_cancancan.rb
|
143
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
|
144
150
|
- lib/rails_interactive/templates/setup_graphql.rb
|
145
151
|
- lib/rails_interactive/templates/setup_haml.rb
|
146
152
|
- lib/rails_interactive/templates/setup_kaminari.rb
|
153
|
+
- lib/rails_interactive/templates/setup_letter_opener.rb
|
147
154
|
- lib/rails_interactive/templates/setup_omniauth.rb
|
148
155
|
- lib/rails_interactive/templates/setup_pundit.rb
|
149
156
|
- lib/rails_interactive/templates/setup_rails_admin.rb
|