rsg 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +44 -3
  3. data/Gemfile.lock +5 -4
  4. data/README.md +13 -6
  5. data/exe/rsg +1 -1
  6. data/lib/rsg/generators/actions.rb +39 -5
  7. data/lib/rsg/generators/app/app_builder.rb +23 -36
  8. data/lib/rsg/generators/app/app_generator.rb +62 -67
  9. data/lib/rsg/generators/base.rb +2 -0
  10. data/lib/rsg/generators/dotenv/install_generator.rb +14 -20
  11. data/lib/rsg/generators/logging/common_generator.rb +17 -23
  12. data/lib/rsg/generators/logging/lograge_generator.rb +14 -24
  13. data/lib/rsg/generators/logging/templates/{initializer_lograge.rb → initializer_lograge.rb.tt} +0 -0
  14. data/lib/rsg/generators/misc/misc_generator.rb +47 -38
  15. data/lib/rsg/generators/misc/templates/{puma.rb → puma.rb.tt} +0 -0
  16. data/lib/rsg/generators/orm/active_record_generator.rb +38 -32
  17. data/lib/rsg/generators/orm/templates/{db.rake → db.rake.tt} +0 -0
  18. data/lib/rsg/generators/orm/templates/{samples.rb → samples.rb.tt} +0 -0
  19. data/lib/rsg/generators/orm/templates/{seeds.rb → seeds.rb.tt} +0 -0
  20. data/lib/rsg/generators/testing/rspec_generator.rb +19 -25
  21. data/lib/rsg/generators/webpacker/bootstrap_generator.rb +27 -0
  22. data/lib/rsg/generators/webpacker/install_generator.rb +37 -47
  23. data/lib/rsg/generators/webpacker/templates/bootstrap/application.sass +40 -0
  24. data/lib/rsg/generators/webpacker/templates/bootstrap/landing.html.erb +18 -0
  25. data/lib/rsg/generators/webpacker/templates/bootstrap/layout.html.erb +35 -0
  26. data/lib/rsg/generators/webpacker/templates/landing_controller.rb.erb +1 -1
  27. data/lib/rsg/version.rb +1 -1
  28. data/lib/rsg.rb +6 -15
  29. data/rsg.gemspec +4 -0
  30. data/templates/rsg-bootstrap.rb +7 -0
  31. data/templates/rsg-default.rb +10 -3
  32. metadata +26 -12
  33. data/lib/rsg/generators/gemfile/cleanup_generator.rb +0 -28
  34. data/lib/rsg/generators/install/install_generator.rb +0 -13
  35. data/lib/rsg/generators/orm/templates/active_record/mysql.yml +0 -59
  36. data/lib/rsg/generators/orm/templates/active_record/postgresql.yml +0 -86
  37. data/lib/rsg/generators/orm/templates/active_record/sqlite3.yml +0 -25
@@ -1,28 +0,0 @@
1
- require_relative "../base"
2
-
3
- module Rsg
4
- module Gemfile
5
- class CleanupGenerator < Rsg::Generators::Base
6
- def banner
7
- say "Cleaning up Gemfile"
8
- end
9
-
10
- def remove_comments
11
- gsub_file "Gemfile", /^ *#\s*[^#\n]+\n/, ""
12
- end
13
-
14
- def remove_tzinfo
15
- # Remove tzinfo-data since we don't have a need for it in dev / prod env
16
- gsub_file "Gemfile", /\ngem 'tzinfo-data'[^\n]+\n/, ""
17
- end
18
-
19
- def remove_extra_whitespace
20
- gsub_file "Gemfile", /^( *gem[^\n]+)\n\n\n/, "\\1\n\n"
21
- end
22
-
23
- def isolate_rails_gem
24
- gsub_file "Gemfile", /^( *)(gem ["']rails["'][^\n]+)\n(?: *)(gem ['"]puma['"][^\n]+)\n$/, "\\1\\2\n\n\\3"
25
- end
26
- end
27
- end
28
- end
@@ -1,13 +0,0 @@
1
- require_relative "../base"
2
-
3
- module Rsg
4
- module Install
5
- class InstallGenerator < Rsg::Generators::Base
6
- class_option :path, type: :string, default: nil, desc: "Path to the RSG gem"
7
-
8
- def add_rsg
9
- install_rsg
10
- end
11
- end
12
- end
13
- end
@@ -1,59 +0,0 @@
1
- # MySQL. Versions 5.5.8 and up are supported.
2
- #
3
- # Install the MySQL driver
4
- # gem install mysql2
5
- #
6
- # Ensure the MySQL gem is defined in your Gemfile
7
- # gem 'mysql2'
8
- #
9
- # And be sure to use new-style password hashing:
10
- # https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
11
- #
12
- default: &default
13
- adapter: mysql2
14
- encoding: utf8mb4
15
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
16
- username: root
17
- password:
18
- <% if mysql_socket -%>
19
- socket: <%= mysql_socket %>
20
- <% else -%>
21
- host: localhost
22
- <% end -%>
23
-
24
- development:
25
- <<: *default
26
- database: <%= app_name %>_development
27
-
28
- # Warning: The database defined as "test" will be erased and
29
- # re-generated from your development database when you run "rake".
30
- # Do not set this db to the same as development or production.
31
- test:
32
- <<: *default
33
- database: <%= app_name %>_test
34
-
35
- # As with config/credentials.yml, you never want to store sensitive information,
36
- # like your database password, in your source code. If your source code is
37
- # ever seen by anyone, they now have access to your database.
38
- #
39
- # Instead, provide the password or a full connection URL as an environment
40
- # variable when you boot the app. For example:
41
- #
42
- # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
43
- #
44
- # If the connection URL is provided in the special DATABASE_URL environment
45
- # variable, Rails will automatically merge its configuration values on top of
46
- # the values provided in this file. Alternatively, you can specify a connection
47
- # URL environment variable explicitly:
48
- #
49
- # production:
50
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
51
- #
52
- # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
53
- # for a full overview on how database connection configuration can be specified.
54
- #
55
- production:
56
- <<: *default
57
- database: <%= app_name %>_production
58
- username: <%= app_name %>
59
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
@@ -1,86 +0,0 @@
1
- # PostgreSQL. Versions 9.3 and up are supported.
2
- #
3
- # Install the pg driver:
4
- # gem install pg
5
- # On macOS with Homebrew:
6
- # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
- # On macOS with MacPorts:
8
- # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
- # On Windows:
10
- # gem install pg
11
- # Choose the win32 build.
12
- # Install PostgreSQL and put its /bin directory on your path.
13
- #
14
- # Configure Using Gemfile
15
- # gem 'pg'
16
- #
17
- default: &default
18
- adapter: postgresql
19
- encoding: unicode
20
- # For details on connection pooling, see Rails configuration guide
21
- # https://guides.rubyonrails.org/configuring.html#database-pooling
22
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23
-
24
- development:
25
- <<: *default
26
- database: <%= app_name %>_development
27
-
28
- # The specified database role being used to connect to postgres.
29
- # To create additional roles in postgres see `$ createuser --help`.
30
- # When left blank, postgres will use the default role. This is
31
- # the same name as the operating system user running Rails.
32
- #username: <%= app_name %>
33
-
34
- # The password associated with the postgres role (username).
35
- #password:
36
-
37
- # Connect on a TCP socket. Omitted by default since the client uses a
38
- # domain socket that doesn't need configuration. Windows does not have
39
- # domain sockets, so uncomment these lines.
40
- #host: localhost
41
-
42
- # The TCP port the server listens on. Defaults to 5432.
43
- # If your server runs on a different port number, change accordingly.
44
- #port: 5432
45
-
46
- # Schema search path. The server defaults to $user,public
47
- #schema_search_path: myapp,sharedapp,public
48
-
49
- # Minimum log levels, in increasing order:
50
- # debug5, debug4, debug3, debug2, debug1,
51
- # log, notice, warning, error, fatal, and panic
52
- # Defaults to warning.
53
- #min_messages: notice
54
-
55
- # Warning: The database defined as "test" will be erased and
56
- # re-generated from your development database when you run "rake".
57
- # Do not set this db to the same as development or production.
58
- test:
59
- <<: *default
60
- database: <%= app_name %>_test
61
-
62
- # As with config/credentials.yml, you never want to store sensitive information,
63
- # like your database password, in your source code. If your source code is
64
- # ever seen by anyone, they now have access to your database.
65
- #
66
- # Instead, provide the password or a full connection URL as an environment
67
- # variable when you boot the app. For example:
68
- #
69
- # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
70
- #
71
- # If the connection URL is provided in the special DATABASE_URL environment
72
- # variable, Rails will automatically merge its configuration values on top of
73
- # the values provided in this file. Alternatively, you can specify a connection
74
- # URL environment variable explicitly:
75
- #
76
- # production:
77
- # url: <%%= ENV['MY_APP_DATABASE_URL'] %>
78
- #
79
- # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
80
- # for a full overview on how database connection configuration can be specified.
81
- #
82
- production:
83
- <<: *default
84
- database: <%= app_name %>_production
85
- username: <%= app_name %>
86
- password: <%%= ENV['<%= app_name.upcase %>_DATABASE_PASSWORD'] %>
@@ -1,25 +0,0 @@
1
- # SQLite. Versions 3.8.0 and up are supported.
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- #
7
- default: &default
8
- adapter: sqlite3
9
- pool: <%%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
- timeout: 5000
11
-
12
- development:
13
- <<: *default
14
- database: db/development.sqlite3
15
-
16
- # Warning: The database defined as "test" will be erased and
17
- # re-generated from your development database when you run "rake".
18
- # Do not set this db to the same as development or production.
19
- test:
20
- <<: *default
21
- database: db/test.sqlite3
22
-
23
- production:
24
- <<: *default
25
- database: db/production.sqlite3