rails_app 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58716cd225034bd8c2deecc05e99d82b58d05ffbbdeadc3b721a526d249a4b1e
4
- data.tar.gz: 531c6ecd9e5a5910d0170a53a2cf50e31f294037ae2deeb21908eb2de626f45b
3
+ metadata.gz: fa0c7e932155134e3302a6ac298bf0042427dcbf1c43ee9ae91f44b4156718cb
4
+ data.tar.gz: 2870a89982c68aa08b3a8ee772d88a781174630967097a2dec87dd91cde662b4
5
5
  SHA512:
6
- metadata.gz: 0be667225b33a863c11cd13a0a9f1fa5cf52b70983d6cd3c549c89f3e1012942a0bb44dd1de6f695db48dca5275e23512a5e053541439bfa73480ba73b6ccc68
7
- data.tar.gz: 420dc812fc3fb540a55b072c4a4ec18635862efbdb2bdf751de64890dc279b33b76cbbb4840a81cc296bf06d1ba72d068439311e1a5e57d13d361b126e09461f
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 new my_app -a propshaft --css bootstrap -d postgresql
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
  ![](assets/screenshot_cli_readconfig.png)
61
61
 
62
62
 
63
- Then your options will be pre-selected:
64
- ![](assets/screenshot_cli_useconfig.png)
63
+ The CLI menu will then be bypassed and the application with be created with your presets.
65
64
 
66
- ## Testing
67
- The template includes RSpec for testing, which includes pre configured:
68
- - FactoryBot
69
- - Faker
70
- - Webmock
71
- - VCR
72
- - Simplecov
65
+ # Features
66
+
67
+ ## Authentication
68
+ documentation coming soon
73
69
 
74
- ### Code Quality Tools
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 and factories with schema information
84
- - the `bullet` gem to help identify and remove N+1 queries
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
- ## Development
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 the configuration and ask the user if they want to use it
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
- assets = prompt.select("How would you like to manage assets?", %w[propshaft sprockets], default: options_data.default_assets)
22
- styling = prompt.select("How would you like to manage styling?", %w[bootstrap tailwind bulma postcss sass], default: options_data.default_styling)
23
- database = prompt.select("Which database would you like to use?",
24
- %w[postgresql sqlite3 mysql trilogy oracle sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc],
25
- default: options_data.default_database)
26
-
27
- # Collect all configuration options into a hash
28
- config_options = {
29
- app_name: app_name,
30
- assets: assets,
31
- styling: styling,
32
- database: database
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
- config_file.write(force: true)
43
- puts "Configuration saved successfully @ #{config_file.full_path}"
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
- Command.new(config_options).run
50
+ def self.create_app(app_name, args)
51
+ Command.new(app_name, args).run
47
52
  end
48
53
  end
49
54
  end
@@ -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 = args[: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
 
@@ -8,11 +8,6 @@ module RailsApp
8
8
  @options = args
9
9
  end
10
10
 
11
- def self.from_config(config_hash)
12
- new_args = config_hash.map { |key, value| value.to_s }
13
- new(new_args)
14
- end
15
-
16
11
  def app_name
17
12
  @options[0]
18
13
  end
@@ -3,7 +3,7 @@
3
3
  require "fileutils"
4
4
  require "shellwords"
5
5
 
6
- puts "options: #{options}"
6
+ # puts "options: #{options}"
7
7
 
8
8
  def add_template_to_source_path
9
9
  source_paths.unshift(File.expand_path(File.join(__dir__)))
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsApp
4
- VERSION = "0.8.0"
4
+ VERSION = "0.8.1"
5
5
  end
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.0
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-05 00:00:00.000000000 Z
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