rails_app 0.8.0 → 0.8.1
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/CHANGELOG.md +13 -0
- data/README.md +18 -14
- data/lib/rails_app/cli.rb +32 -27
- data/lib/rails_app/command.rb +4 -3
- data/lib/rails_app/options_data.rb +0 -5
- data/lib/rails_app/template/template.rb +1 -1
- data/lib/rails_app/version.rb +1 -1
- metadata +2 -3
- data/assets/screenshot_cli_useconfig.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa0c7e932155134e3302a6ac298bf0042427dcbf1c43ee9ae91f44b4156718cb
|
4
|
+
data.tar.gz: 2870a89982c68aa08b3a8ee772d88a781174630967097a2dec87dd91cde662b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2febb710ca10bbadc35bf436bf3aab125068ee2ae3c9b5415d3820217e12163a6ede6648afdfd660a89ca44ffa0a283426244c45b2be0984e12d56e2d595ccb1
|
7
|
+
data.tar.gz: 4abdce09c8d37c63f164c1bf70678852491dd816dd9f90e2acd2666b40271e8c210ec5d48e045ca0e11b06e817c310af474249155f5adfc0ab2ec4738fc0a72e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.8.1](https://github.com/eclectic-coding/rails_app/tree/0.8.1) (2024-04-08)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.8.0...0.8.1)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- Read users existing .railsrc for preferences [\#1](https://github.com/eclectic-coding/rails_app/issues/1)
|
10
|
+
|
11
|
+
**Fixed bugs:**
|
12
|
+
|
13
|
+
- CLI Menu should be bypassed when using saved configuration [\#28](https://github.com/eclectic-coding/rails_app/issues/28)
|
14
|
+
- CLI menu should be bypassed when using saved configuration [\#29](https://github.com/eclectic-coding/rails_app/pull/29) ([eclectic-coding](https://github.com/eclectic-coding))
|
15
|
+
|
3
16
|
## [0.8.0](https://github.com/eclectic-coding/rails_app/tree/0.8.0) (2024-04-05)
|
4
17
|
|
5
18
|
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.7.0...0.8.0)
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ There is an additional syntax, available starting with release `v. 0.7.0`, which
|
|
38
38
|
|
39
39
|
|
40
40
|
```bash
|
41
|
-
rails_app
|
41
|
+
rails_app my_app -a propshaft --css bootstrap -d postgresql
|
42
42
|
```
|
43
43
|
I few things to note:
|
44
44
|
- the `app_name` must be first, just like with `rails new`
|
@@ -60,18 +60,14 @@ If a file has been previously saved, you will be prompted if you want to use:
|
|
60
60
|

|
61
61
|
|
62
62
|
|
63
|
-
|
64
|
-

|
63
|
+
The CLI menu will then be bypassed and the application with be created with your presets.
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
- Webmock
|
71
|
-
- VCR
|
72
|
-
- Simplecov
|
65
|
+
# Features
|
66
|
+
|
67
|
+
## Authentication
|
68
|
+
documentation coming soon
|
73
69
|
|
74
|
-
|
70
|
+
## Code Quality Tools
|
75
71
|
The template includes the following code quality tools:
|
76
72
|
- Rubocop using the `rubocop-rails-omakase` gem with a few custom settings in a provided `.rubocop.yml`
|
77
73
|
- Brakeman for security scanning
|
@@ -80,10 +76,18 @@ The template includes the following code quality tools:
|
|
80
76
|
All of this tools can be run using the following command, which also will run the test suite: `bin/ci`
|
81
77
|
|
82
78
|
In addition, the template includes:
|
83
|
-
- the `annotate` gem to annotate models and
|
84
|
-
- the `bullet` gem to help identify and
|
79
|
+
- the `annotate` gem to annotate models and factories with schema information
|
80
|
+
- the `bullet` gem to help identify and diagnose N+1 queries
|
81
|
+
|
82
|
+
## Testing
|
83
|
+
The template includes RSpec for testing, which includes pre configured:
|
84
|
+
- FactoryBot
|
85
|
+
- Faker
|
86
|
+
- Webmock
|
87
|
+
- VCR
|
88
|
+
- Simplecov
|
85
89
|
|
86
|
-
|
90
|
+
# Development
|
87
91
|
|
88
92
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
89
93
|
|
data/lib/rails_app/cli.rb
CHANGED
@@ -5,45 +5,50 @@ require "tty-prompt"
|
|
5
5
|
module RailsApp
|
6
6
|
class CLI
|
7
7
|
def self.start(args)
|
8
|
+
puts "args: #{args}"
|
8
9
|
prompt = TTY::Prompt.new
|
9
|
-
|
10
10
|
options_data = OptionsData.new(args)
|
11
11
|
config_file = ConfigFile.new
|
12
12
|
|
13
13
|
app_name = options_data.app_name || prompt.ask("What is the name of your application?", required: true)
|
14
14
|
|
15
|
-
# Read
|
15
|
+
# Read from existing configuration and ask the user if they want to use it
|
16
16
|
config_options = config_file.read
|
17
|
+
|
17
18
|
if config_options && prompt.yes?("Do you want to use this configuration? #{config_options}")
|
18
|
-
options_data = OptionsData.from_config(config_options)
|
19
|
-
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
# Ask the user if they wish to save their configuration
|
36
|
-
if prompt.yes?("Do you wish to save your configuration?")
|
37
|
-
# Iterate over the hash and set the configuration
|
38
|
-
config_options.each do |key, value|
|
39
|
-
next if key == :app_name
|
40
|
-
config_file.set(key, value)
|
20
|
+
create_app(app_name, config_options) # standard:disable Style/IdenticalConditionalBranches
|
21
|
+
else
|
22
|
+
# not using config display menu to user
|
23
|
+
config_options = menu(app_name, prompt)
|
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}"
|
41
34
|
end
|
42
|
-
|
43
|
-
puts "
|
35
|
+
|
36
|
+
puts "config_options: #{config_options}"
|
37
|
+
create_app(app_name, config_options) # standard:disable Style/IdenticalConditionalBranches
|
44
38
|
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.menu(app_name, prompt)
|
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
|
+
%w[postgresql sqlite3 mysql trilogy oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc])
|
46
|
+
|
47
|
+
{app_name: app_name, assets: assets, styling: styling, database: database}
|
48
|
+
end
|
45
49
|
|
46
|
-
|
50
|
+
def self.create_app(app_name, args)
|
51
|
+
Command.new(app_name, args).run
|
47
52
|
end
|
48
53
|
end
|
49
54
|
end
|
data/lib/rails_app/command.rb
CHANGED
@@ -2,11 +2,12 @@ module RailsApp
|
|
2
2
|
class Command
|
3
3
|
attr_reader :app_name, :assets, :styling, :database
|
4
4
|
|
5
|
-
def initialize(args)
|
6
|
-
@app_name =
|
5
|
+
def initialize(app_name, args)
|
6
|
+
@app_name = app_name
|
7
7
|
@assets = args[:assets]
|
8
8
|
@styling = args[:styling]
|
9
9
|
@database = args[:database]
|
10
|
+
puts "Command: #{@app_name} #{args[:app_name]}"
|
10
11
|
end
|
11
12
|
|
12
13
|
def template
|
@@ -16,7 +17,7 @@ module RailsApp
|
|
16
17
|
def run
|
17
18
|
command = "rails new #{@app_name} --no-rc #{skip_spring} #{database_adapter} #{asset_management} #{javascript_bundling} #{styling_framework} #{testing_framework} -m #{template}"
|
18
19
|
command.squeeze!(" ")
|
19
|
-
puts command
|
20
|
+
# puts command
|
20
21
|
system(command)
|
21
22
|
end
|
22
23
|
|
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.8.
|
4
|
+
version: 0.8.1
|
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-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|
@@ -97,7 +97,6 @@ files:
|
|
97
97
|
- assets/screenshot_cli.png
|
98
98
|
- assets/screenshot_cli_db.png
|
99
99
|
- assets/screenshot_cli_readconfig.png
|
100
|
-
- assets/screenshot_cli_useconfig.png
|
101
100
|
- bin/rails_app
|
102
101
|
- lib/rails_app.rb
|
103
102
|
- lib/rails_app/cli.rb
|
Binary file
|