rails_app 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/rails_app/cli.rb +27 -24
- data/lib/rails_app/command.rb +29 -3
- data/lib/rails_app/options_data.rb +22 -0
- data/lib/rails_app/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52a552ad38f9b0cd6267841541720a9f89db6000e68131eb8a34247f1a329fdc
|
4
|
+
data.tar.gz: 87e54f8b3f3a27327d426f14871e3ede7b5d7f5377a5ef54d586b77ec6953f99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce7c421dd28e008f52caf74b520e8bb2aa57ca13e8d21f7b4dc5c0cc6ab8357d3ffad3a18dd8f65b7ae80339475664fcf23ff28d5fb8a4d838f165bbb9e0e71
|
7
|
+
data.tar.gz: 54409b3d01c1bd0a11f4ca01bcd8ba0f0d153192127ab262b2e2f9a4bfafb7046fd2f8df04b84d37ed4451d6858fdb1ee9451296a1a214628bd031499de3e42e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.9.0](https://github.com/eclectic-coding/rails_app/tree/0.9.0) (2024-04-09)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.8.1...0.9.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Add additional flags to CLI [\#26](https://github.com/eclectic-coding/rails_app/issues/26)
|
10
|
+
- Add additional flags to cli [\#30](https://github.com/eclectic-coding/rails_app/pull/30) ([eclectic-coding](https://github.com/eclectic-coding))
|
11
|
+
|
3
12
|
## [0.8.1](https://github.com/eclectic-coding/rails_app/tree/0.8.1) (2024-04-08)
|
4
13
|
|
5
14
|
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.8.0...0.8.1)
|
data/lib/rails_app/cli.rb
CHANGED
@@ -5,7 +5,7 @@ require "tty-prompt"
|
|
5
5
|
module RailsApp
|
6
6
|
class CLI
|
7
7
|
def self.start(args)
|
8
|
-
puts "args: #{args}"
|
8
|
+
# puts "args: #{args}"
|
9
9
|
prompt = TTY::Prompt.new
|
10
10
|
options_data = OptionsData.new(args)
|
11
11
|
config_file = ConfigFile.new
|
@@ -16,39 +16,42 @@ module RailsApp
|
|
16
16
|
config_options = config_file.read
|
17
17
|
|
18
18
|
if config_options && prompt.yes?("Do you want to use this configuration? #{config_options}")
|
19
|
-
|
20
19
|
create_app(app_name, config_options) # standard:disable Style/IdenticalConditionalBranches
|
21
20
|
else
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# Ask the user if they wish to save their configuration
|
26
|
-
if prompt.yes?("Do you wish to save your configuration?")
|
27
|
-
# Iterate over the hash and set the configuration
|
28
|
-
config_options.each do |key, value|
|
29
|
-
next if key == :app_name
|
30
|
-
config_file.set(key, value)
|
31
|
-
end
|
32
|
-
config_file.write(force: true)
|
33
|
-
puts "Configuration saved successfully @ #{config_file.full_path}"
|
34
|
-
end
|
35
|
-
|
36
|
-
puts "config_options: #{config_options}"
|
21
|
+
config_options = menu(prompt, options_data) # open cli menus to get user input
|
22
|
+
# puts "config_options: #{config_options}"
|
23
|
+
save_config(prompt, config_file, config_options) # save their configuration
|
37
24
|
create_app(app_name, config_options) # standard:disable Style/IdenticalConditionalBranches
|
38
25
|
end
|
39
26
|
end
|
40
27
|
|
41
|
-
def self.menu(
|
42
|
-
assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets])
|
43
|
-
styling = prompt.select("How would you like to manage styling?", %w[bootstrap tailwind bulma postcss sass])
|
44
|
-
database = prompt.select("Which database would you like to use?",
|
45
|
-
|
46
|
-
|
47
|
-
|
28
|
+
def self.menu(prompt, option_data = nil)
|
29
|
+
assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets], default: option_data&.default_assets)
|
30
|
+
styling = prompt.select("How would you like to manage styling?", %w[bootstrap tailwind bulma postcss sass], default: option_data&.default_styling)
|
31
|
+
database = prompt.select("Which database would you like to use?", %w[postgresql sqlite3 mysql trilogy oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc], default: option_data&.default_database)
|
32
|
+
skip_spring = prompt.yes?("Would you like to SKIP spring?", default: option_data&.default_action_mailer)
|
33
|
+
action_mailer = prompt.yes?("Would you like to SKIP Action Mailer?", default: option_data&.default_action_mailer)
|
34
|
+
action_mailbox = prompt.yes?("Would you like to SKIP Action Mailbox?", default: option_data&.default_action_mailbox)
|
35
|
+
action_text = prompt.yes?("Would you like to SKIP Action Text?", default: option_data&.default_action_text)
|
36
|
+
action_storage = prompt.yes?("Would you like to SKIP Active Storage?", default: option_data&.default_action_storage)
|
37
|
+
action_cable = prompt.yes?("Would you like to SKIP Active Cable?", default: option_data&.default_action_cable)
|
38
|
+
|
39
|
+
{assets: assets, styling: styling, database: database, skip_spring: skip_spring, action_mailer: action_mailer,
|
40
|
+
action_mailbox: action_mailbox, action_text: action_text, action_storage: action_storage, action_cable: action_cable}
|
48
41
|
end
|
49
42
|
|
50
43
|
def self.create_app(app_name, args)
|
51
44
|
Command.new(app_name, args).run
|
52
45
|
end
|
46
|
+
|
47
|
+
def self.save_config(prompt, config_file, config_options)
|
48
|
+
if prompt.yes?("Do you wish to save your configuration?")
|
49
|
+
config_options.each do |key, value|
|
50
|
+
config_file.set(key, value)
|
51
|
+
end
|
52
|
+
config_file.write(force: true)
|
53
|
+
puts "Configuration saved successfully @ #{config_file.full_path}"
|
54
|
+
end
|
55
|
+
end
|
53
56
|
end
|
54
57
|
end
|
data/lib/rails_app/command.rb
CHANGED
@@ -3,11 +3,17 @@ module RailsApp
|
|
3
3
|
attr_reader :app_name, :assets, :styling, :database
|
4
4
|
|
5
5
|
def initialize(app_name, args)
|
6
|
+
# puts "args: #{args}"
|
6
7
|
@app_name = app_name
|
7
8
|
@assets = args[:assets]
|
8
9
|
@styling = args[:styling]
|
9
10
|
@database = args[:database]
|
10
|
-
|
11
|
+
@skip_spring = args[:skip_spring]
|
12
|
+
@skip_action_mailer = args[:action_mailer]
|
13
|
+
@skip_action_mailbox = args[:action_mailbox]
|
14
|
+
@skip_action_text = args[:action_text]
|
15
|
+
@skip_action_storage = args[:action_storage]
|
16
|
+
@skip_action_cable = args[:action_cable]
|
11
17
|
end
|
12
18
|
|
13
19
|
def template
|
@@ -15,14 +21,34 @@ module RailsApp
|
|
15
21
|
end
|
16
22
|
|
17
23
|
def run
|
18
|
-
command = "rails new #{@app_name} --no-rc #{skip_spring} #{database_adapter} #{asset_management} #{javascript_bundling} #{styling_framework} #{testing_framework} -m #{template}"
|
24
|
+
command = "rails new #{@app_name} --no-rc #{skip_spring} #{skip_action_mailer} #{skip_action_mailbox} #{skip_action_text} #{skip_action_text} #{skip_action_cable} #{database_adapter} #{asset_management} #{javascript_bundling} #{styling_framework} #{testing_framework} -m #{template}"
|
19
25
|
command.squeeze!(" ")
|
20
26
|
# puts command
|
21
27
|
system(command)
|
22
28
|
end
|
23
29
|
|
24
30
|
def skip_spring
|
25
|
-
"--skip-spring"
|
31
|
+
"--skip-spring" if @skip_spring == true
|
32
|
+
end
|
33
|
+
|
34
|
+
def skip_action_mailer
|
35
|
+
"--skip-action-mailer" if @skip_action_mailer == true
|
36
|
+
end
|
37
|
+
|
38
|
+
def skip_action_mailbox
|
39
|
+
"--skip-action-mailbox" if @skip_action_mailbox == true
|
40
|
+
end
|
41
|
+
|
42
|
+
def skip_action_text
|
43
|
+
"--skip-action-text" if @skip_action_text == true
|
44
|
+
end
|
45
|
+
|
46
|
+
def skip_action_storage
|
47
|
+
"--skip-active-storage" if @skip_action_storage == true
|
48
|
+
end
|
49
|
+
|
50
|
+
def skip_action_cable
|
51
|
+
"--skip-action-cable" if @skip_action_cable == true
|
26
52
|
end
|
27
53
|
|
28
54
|
def database_adapter
|
@@ -13,6 +13,8 @@ module RailsApp
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def default_assets
|
16
|
+
# puts "@options: #{@options.include?("sprockets")}"
|
17
|
+
|
16
18
|
@options.include?("sprockets") ? "sprockets" : "propshaft"
|
17
19
|
end
|
18
20
|
|
@@ -55,5 +57,25 @@ module RailsApp
|
|
55
57
|
"sqlite3"
|
56
58
|
end
|
57
59
|
end
|
60
|
+
|
61
|
+
def default_action_mailer
|
62
|
+
@options.include?("skip_action_mailer")
|
63
|
+
end
|
64
|
+
|
65
|
+
def default_action_mailbox
|
66
|
+
@options.include?("skip_action_mailbox")
|
67
|
+
end
|
68
|
+
|
69
|
+
def default_action_text
|
70
|
+
@options.include?("skip_action_text")
|
71
|
+
end
|
72
|
+
|
73
|
+
def default_action_storage
|
74
|
+
@options.include?("skip_action_storage")
|
75
|
+
end
|
76
|
+
|
77
|
+
def default_action_cable
|
78
|
+
@options.include?("skip_action_cable")
|
79
|
+
end
|
58
80
|
end
|
59
81
|
end
|
data/lib/rails_app/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuck Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|