rails_app 0.6.0 → 0.7.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +22 -1
- data/bin/rails_app +1 -1
- data/lib/rails_app/cli.rb +13 -5
- data/lib/rails_app/options_data.rb +57 -0
- data/lib/rails_app/rails_app.rb +2 -2
- data/lib/rails_app/version.rb +1 -1
- data/lib/rails_app.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 534816163e2b9fc2c353d1a2afb4568c8bd9b3355b46fcbe1b132b83cb89acad
|
4
|
+
data.tar.gz: e2e50fd1ebe97b1981da6713e49cc7595c8f11c58bb600b67e7b99088a745252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5242d9c1382772a58599ab08658745d6eac76a12c78ef2b83395af317a777abd022885028c5f664087882a4b6fed1331b831a0cc5dec9bd760746b5268ceb05
|
7
|
+
data.tar.gz: b3dcfc4ecbe21b2c96435606cb44bd7867f1de8d8da66075d50b9852db7d294580639434fdbef7f2fe4e81f72dcad879a5c336eeb5cf5a7ba1ea3b513a8fde16
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.7.0](https://github.com/eclectic-coding/rails_app/tree/0.7.0) (2024-04-04)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.6.0...0.7.0)
|
6
|
+
|
7
|
+
**Implemented enhancements:**
|
8
|
+
|
9
|
+
- handle optional CLI ARGV [\#21](https://github.com/eclectic-coding/rails_app/issues/21)
|
10
|
+
- Add user option to select other styling systems [\#2](https://github.com/eclectic-coding/rails_app/issues/2)
|
11
|
+
- Handle optional cli argv [\#22](https://github.com/eclectic-coding/rails_app/pull/22) ([eclectic-coding](https://github.com/eclectic-coding))
|
12
|
+
|
3
13
|
## [0.6.0](https://github.com/eclectic-coding/rails_app/tree/0.6.0) (2024-04-04)
|
4
14
|
|
5
15
|
[Full Changelog](https://github.com/eclectic-coding/rails_app/compare/0.5.0...0.6.0)
|
data/README.md
CHANGED
@@ -31,7 +31,28 @@ Also, you can select your database of choice:
|
|
31
31
|
|
32
32
|
The template will then create a new Rails application with the selected options.
|
33
33
|
|
34
|
-
###
|
34
|
+
### Optional CLI Syntax
|
35
|
+
|
36
|
+
There is an additional syntax, available starting with release `v. 0.7.0`, which allows you to use `rails_app` very similarly to the `rails new` command:
|
37
|
+
|
38
|
+
```bash
|
39
|
+
rails_app new my_app -a propshaft --css bootstrap -d postgresql
|
40
|
+
```
|
41
|
+
I few things to note:
|
42
|
+
- the `app_name` must be first, just like with `rails new`
|
43
|
+
- the following arguments and flags must be separated by a space `-a propshaft`. Since, the parser ignores the flag and checks for the specific keywords only, you technically can use the follow: `rails_app my_app propshaft bootstrap postgresql`.
|
44
|
+
|
45
|
+
If you use this syntax, the template will not prompt you the application name, and subsequent options will be preselected for you.
|
46
|
+
|
47
|
+
Right not this syntax only supports the following options:
|
48
|
+
- app name
|
49
|
+
- assets pipeline
|
50
|
+
- styling
|
51
|
+
- database
|
52
|
+
|
53
|
+
More options will be added in future releases.
|
54
|
+
|
55
|
+
## Testing
|
35
56
|
The template includes RSpec for testing, which includes pre configured:
|
36
57
|
- FactoryBot
|
37
58
|
- Faker
|
data/bin/rails_app
CHANGED
data/lib/rails_app/cli.rb
CHANGED
@@ -4,11 +4,14 @@ require "tty-prompt"
|
|
4
4
|
|
5
5
|
module RailsApp
|
6
6
|
class CLI
|
7
|
-
def self.start
|
7
|
+
def self.start(args)
|
8
8
|
prompt = TTY::Prompt.new
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
options_data = OptionsData.new(args)
|
11
|
+
|
12
|
+
app_name = options_data.app_name || prompt.ask("What is the name of your application?", required: true)
|
13
|
+
|
14
|
+
assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets], default: options_data.default_assets)
|
12
15
|
styling_choices = [
|
13
16
|
{name: "Bootstrap", value: "bootstrap"},
|
14
17
|
{name: "Tailwind CSS", value: "tailwind"},
|
@@ -16,8 +19,13 @@ module RailsApp
|
|
16
19
|
{name: "PostCSS", value: "postcss"},
|
17
20
|
{name: "SASS", value: "sass"}
|
18
21
|
]
|
19
|
-
styling = prompt.select("How would you like to manage styling?", styling_choices)
|
20
|
-
|
22
|
+
styling = prompt.select("How would you like to manage styling?", styling_choices, default: options_data.default_styling)
|
23
|
+
|
24
|
+
database = prompt.select("Which database would you like to use?",
|
25
|
+
%w[postgresql sqlite3 mysql trilogy oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc],
|
26
|
+
default: options_data.default_database)
|
27
|
+
|
28
|
+
# save configuration
|
21
29
|
|
22
30
|
Command.new(app_name: app_name, assets: assets, styling: styling, database: database).run
|
23
31
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsApp
|
4
|
+
class OptionsData
|
5
|
+
attr_reader :options
|
6
|
+
|
7
|
+
def initialize(args)
|
8
|
+
@options = args.flat_map { |arg| arg.split(" ") }
|
9
|
+
end
|
10
|
+
|
11
|
+
def app_name
|
12
|
+
@options[0]
|
13
|
+
end
|
14
|
+
|
15
|
+
def default_assets
|
16
|
+
@options.include?("sprockets") ? "sprockets" : "propshaft"
|
17
|
+
end
|
18
|
+
|
19
|
+
def default_styling
|
20
|
+
if @options.include?("tailwind")
|
21
|
+
"tailwind"
|
22
|
+
elsif @options.include?("bulma")
|
23
|
+
"bulma"
|
24
|
+
elsif @options.include?("postcss")
|
25
|
+
"postcss"
|
26
|
+
elsif @options.include?("sass")
|
27
|
+
"sass"
|
28
|
+
elsif @options.include?("bootstrap")
|
29
|
+
"bootstrap"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_database
|
34
|
+
if @options.include?("postgresql")
|
35
|
+
"postgresql"
|
36
|
+
elsif @options.include?("mysql")
|
37
|
+
"mysql"
|
38
|
+
elsif @options.include?("trilogy")
|
39
|
+
"trilogy"
|
40
|
+
elsif @options.include?("oracle")
|
41
|
+
"oracle"
|
42
|
+
elsif @options.include?("sqlserver")
|
43
|
+
"sqlserver"
|
44
|
+
elsif @options.include?("jdbcmysql")
|
45
|
+
"jdbcmysql"
|
46
|
+
elsif @options.include?("jdbcsqlite3")
|
47
|
+
"jdbcsqlite3"
|
48
|
+
elsif @options.include?("jdbcpostgresql")
|
49
|
+
"jdbcpostgresql"
|
50
|
+
elsif @options.include?("jdbc")
|
51
|
+
"jdbc"
|
52
|
+
else
|
53
|
+
"sqlite3"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/rails_app/rails_app.rb
CHANGED
data/lib/rails_app/version.rb
CHANGED
data/lib/rails_app.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuck Smith
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/rails_app/cli.rb
|
86
86
|
- lib/rails_app/command.rb
|
87
87
|
- lib/rails_app/error.rb
|
88
|
+
- lib/rails_app/options_data.rb
|
88
89
|
- lib/rails_app/rails_app.rb
|
89
90
|
- lib/rails_app/template/.rspec
|
90
91
|
- lib/rails_app/template/.rubocop.yml
|