rails_app_generator 0.2.42 → 0.2.43
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/after_templates/addons/scenic/_.rb +64 -0
- data/after_templates/addons/scenic/app/controllers/home_controller.rb +24 -0
- data/after_templates/addons/scenic/app/services/seed_service.rb +104 -0
- data/after_templates/addons/scenic/app/views/home/index.html.erb +3 -0
- data/after_templates/addons/scenic/app/views/home/individual_visitors_by_monument.html.erb +24 -0
- data/after_templates/addons/scenic/app/views/home/reseed.html.erb +3 -0
- data/after_templates/addons/scenic/app/views/home/visitors_by_monument.html.erb +22 -0
- data/after_templates/addons/scenic/app/views/layouts/_footer.html.erb +0 -0
- data/after_templates/addons/scenic/app/views/layouts/_navbar.html.erb +10 -0
- data/after_templates/addons/scenic/app/views/layouts/application.html.erb +29 -0
- data/after_templates/addons/scenic/db/seeds.rb +1 -0
- data/after_templates/addons/scenic/db/views/individual_visitors_by_monuments_v01.sql +9 -0
- data/after_templates/addons/scenic/db/views/visitors_by_monuments_v01.sql +8 -0
- data/docs/last_run/app_generator_data.json +13 -13
- data/docs/last_run/rails_options_data.json +14 -13
- data/lib/rails_app_generator/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/profiles/addons/scenic.json +14 -0
- data/tasks/profile.thor +1 -0
- data/templates/thor_task/profile/after_template.rb +19 -30
- data/templates/thor_task/profile/app/controllers/home_controller.rb +4 -0
- data/templates/thor_task/profile/app/services/seed_service.rb +27 -0
- data/templates/thor_task/profile/db/seeds.rb +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d9ac313ea8fc5383a7d3d37ed9495fff8509f9b7dd1ff373ed97c80ce69ae23
|
4
|
+
data.tar.gz: bb65bdcc19d95bfb69abf92458dbe0eec353a8b3085ba8e679d72955ab55f425
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f0ccd26ef5090325cbb6a76408fd201bbce81d8bbd739618e14393eebe0cc6814bb9e24eecdfec7dd7fd07664fe9e52ed1e47d92343461b45ab3378d37e22f7
|
7
|
+
data.tar.gz: 70dee6a466c8976ba4f385d532b34325d188a83599df9d4fcd4330b6805f9f0dcc580141fc4ad5e9d1b9a393c4b2084698f7a2771254b7839a18a4f98471765c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## [0.2.42](https://github.com/klueless-io/rails_app_generator/compare/v0.2.41...v0.2.42) (2022-08-30)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add scenic addon ([93a9561](https://github.com/klueless-io/rails_app_generator/commit/93a9561131658399b91075e15c6d9680f1b73ece))
|
7
|
+
* cops ([fe3e6b7](https://github.com/klueless-io/rails_app_generator/commit/fe3e6b7031a57b0f212fd91491ebc7f32928b9c1))
|
8
|
+
|
1
9
|
## [0.2.41](https://github.com/klueless-io/rails_app_generator/compare/v0.2.40...v0.2.41) (2022-08-30)
|
2
10
|
|
3
11
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Ads methods to ActiveRecord:Migration to create and manage database views in Rails
|
4
|
+
#
|
5
|
+
# exe/rag addons/scenic
|
6
|
+
|
7
|
+
self.local_template_path = File.dirname(__FILE__)
|
8
|
+
|
9
|
+
gac 'base rails 7 image created'
|
10
|
+
|
11
|
+
prepare_environment
|
12
|
+
|
13
|
+
after_bundle do
|
14
|
+
force_copy
|
15
|
+
|
16
|
+
create_db
|
17
|
+
scaffolds
|
18
|
+
setup_customizations
|
19
|
+
migrate_db
|
20
|
+
end
|
21
|
+
|
22
|
+
def scaffolds
|
23
|
+
add_scaffold('country', 'code', 'name')
|
24
|
+
add_scaffold('monument', 'name', 'description', 'country:references')
|
25
|
+
add_scaffold('visitor', 'name', 'monument:references')
|
26
|
+
|
27
|
+
generate('scenic:model visitors_by_monument')
|
28
|
+
generate('scenic:model individual_visitors_by_monument --materialized')
|
29
|
+
|
30
|
+
directory "db/views"
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup_customizations
|
34
|
+
route("root 'home#index'")
|
35
|
+
|
36
|
+
add_controller('home', 'index', 'visitors_by_monument', 'individual_visitors_by_monument', 'reseed', 'refresh_material_view')
|
37
|
+
|
38
|
+
directory "app/controllers"
|
39
|
+
directory "app/models"
|
40
|
+
directory "app/views"
|
41
|
+
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
42
|
+
directory "app/services"
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_db
|
46
|
+
gsub_file('config/database.yml', ' encoding: unicode', db_development_settings)
|
47
|
+
rails_command('db:environment:set RAILS_ENV=development')
|
48
|
+
db(drop: true, create: true)
|
49
|
+
end
|
50
|
+
|
51
|
+
def migrate_db
|
52
|
+
template 'db/seeds.rb' , 'db/seeds.rb'
|
53
|
+
|
54
|
+
db(migrate: true, seed: true)
|
55
|
+
end
|
56
|
+
|
57
|
+
def db_development_settings
|
58
|
+
<<-'RUBY'
|
59
|
+
encoding: unicode
|
60
|
+
host: <%= ENV['DATABASE_HOST'] %>
|
61
|
+
username: <%= ENV['DATABASE_USERNAME'] %>
|
62
|
+
password: <%= ENV['DATABASE_PASSWORD'] %>
|
63
|
+
RUBY
|
64
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class HomeController < ApplicationController
|
2
|
+
def index
|
3
|
+
end
|
4
|
+
|
5
|
+
def visitors_by_monument
|
6
|
+
@visitors = VisitorsByMonument.all.order(:visits)
|
7
|
+
end
|
8
|
+
|
9
|
+
def individual_visitors_by_monument
|
10
|
+
@visitors = IndividualVisitorsByMonument.all.order(:visits)
|
11
|
+
end
|
12
|
+
|
13
|
+
def reseed
|
14
|
+
SeedService.seed(variant: :refresh)
|
15
|
+
|
16
|
+
redirect_back_or_to root_path
|
17
|
+
end
|
18
|
+
|
19
|
+
def refresh_material_view
|
20
|
+
IndividualVisitorsByMonument.refresh
|
21
|
+
|
22
|
+
redirect_back_or_to root_path
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class SeedService
|
4
|
+
class << self
|
5
|
+
def seed(variant: :reset)
|
6
|
+
service = SeedService.new
|
7
|
+
service.call(variant: variant)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
NAMES = %w[
|
12
|
+
Adyson Aimee Aisha Akira Alani Albert Aleah Aleena Alena Alexus Alfred Ali Alia
|
13
|
+
Amelie Amina Amirah Amiya Anabella Anabelle Andrew Angeline Angelique Ann Annabel Aliana
|
14
|
+
Armani Arthur Aryana Ashanti Ashleigh Ashly Aspen Averie Avery Ayana Barbara
|
15
|
+
Brynlee Cailyn Cal Camilla Campbell Carina Carissa Carlee Carley Carlie Carolyn Cassie
|
16
|
+
Charlie Charlize Chaya Cherish Cierra Clair Clare Clarence Cloe Corinne Cristal
|
17
|
+
Destiney Dominique Dorsey Early Edith Edward Eileen Elaine Elisa Ellen Elmer Elsa Elsie
|
18
|
+
Fay Felicity Finley Frances Frank Fred Frederick Frida Gemma George Gia Giada Giana Gillian
|
19
|
+
Hana Harris Harry Haven Henderson Henry Herbert Hezekiah Hillary Iliana India
|
20
|
+
James Jamya Janae Janet Janiah Jaslyn Jaycee Jaylah Jaylee Jaylen Jaylene Jaylyn
|
21
|
+
John Johnie Joseph Joslyn Joyce Judith Julianne June Kaia Kaila Kailee Kaiya Kaley
|
22
|
+
Karma Kasey Katrina Kaya Kaylen Kayley Kaylyn Keely Kelsie Kendal Kenna Keyla Kierra
|
23
|
+
Leanna Lewis Leyla Libby Lilianna Lillianna Lilyana Lina Litzy Lizeth Lonzo Lorelai
|
24
|
+
Maeve Magdalena Maia Makena Maleah Maliyah Mara Mareli Mariam Marianna Mariela Marisa
|
25
|
+
Miah Micah Milagros Mina Mira Mollie Monique Monserrat Mont Moriah Mylie Natalya
|
26
|
+
Paloma Pamela Patience Paula Peter Phoenix Precious Raelynn Raina Raven Rayna Rayne Regan
|
27
|
+
Rollin Roselyn Rosemary Roy Ryann Saige Salma Sam Samuel Sanaa Sanai Sarahi Sariah Savanah
|
28
|
+
Shyann Shyanne Shyla Siena Sonia Stacy Stephany Susan Taliyah Tamara Taniya Taniyah
|
29
|
+
Tianna Tom Valery Walter Will William Willie Wilmer Xiomara Yadira Yamilet Yaritza Yasmine Yazmin
|
30
|
+
Yoselin Yuliana Zaniyah Zara Zaria Zion
|
31
|
+
%
|
32
|
+
].freeze
|
33
|
+
|
34
|
+
attr_reader :au, :us, :gb, :monuments
|
35
|
+
|
36
|
+
def call(variant: :reset)
|
37
|
+
reset if variant == :reset
|
38
|
+
refresh if variant == :refresh
|
39
|
+
create
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def reset
|
45
|
+
Visitor.delete_all
|
46
|
+
Monument.delete_all
|
47
|
+
Country.delete_all
|
48
|
+
end
|
49
|
+
|
50
|
+
def refresh
|
51
|
+
Visitor.delete_all
|
52
|
+
end
|
53
|
+
|
54
|
+
def create
|
55
|
+
upsert_countries
|
56
|
+
upsert_monuments
|
57
|
+
create_visitors
|
58
|
+
end
|
59
|
+
|
60
|
+
def upsert_countries
|
61
|
+
@au = Country.create_with(name: 'Australia').find_or_create_by(code: 'AU')
|
62
|
+
@us = Country.create_with(name: 'United States').find_or_create_by(code: 'US')
|
63
|
+
@gb = Country.create_with(name: 'United Kingdom').find_or_create_by(code: 'GB')
|
64
|
+
end
|
65
|
+
|
66
|
+
def upsert_monuments
|
67
|
+
@monuments = [
|
68
|
+
Monument.create_with(country: au,
|
69
|
+
description: 'The Sydney Opera House is a multi-venue performing arts centre in Sydney, New South Wales, Australia. It is the largest performing arts centre in Australia and the second largest in the world.')
|
70
|
+
.find_or_create_by(name: 'Sydney Opera House'),
|
71
|
+
Monument.create_with(country: au,
|
72
|
+
description: 'The Sydney Harbour Bridge is a viaduct bridge in Sydney, New South Wales, Australia. It is the longest viaduct bridge in Australia and the second longest in the world.')
|
73
|
+
.find_or_create_by(name: 'Sydney Harbour Bridge'),
|
74
|
+
Monument.create_with(country: au,
|
75
|
+
description: 'The Big Banana is a large, round, fruit-bearing tree in the Australian bushland of the Great Barrier Reef. It is the largest tree in the world.')
|
76
|
+
.find_or_create_by(name: 'The Big Banana'),
|
77
|
+
Monument.create_with(country: us,
|
78
|
+
description: 'The Statue of Liberty is a colossal neoclassical sculpture on Liberty Island in New York Harbor, New York, in the United States. The statue was a gift from the people of France to the people of the United States in 1886.')
|
79
|
+
.find_or_create_by(name: 'Statue of Liberty'),
|
80
|
+
Monument.create_with(country: us,
|
81
|
+
description: 'The Golden Gate Bridge is a suspension bridge spanning the Golden Gate, the one-mile-wide strait connecting San Francisco Bay and the Pacific Ocean. The bridge was completed in 1937.')
|
82
|
+
.find_or_create_by(name: 'Golden Gate Bridge'),
|
83
|
+
Monument.create_with(country: us,
|
84
|
+
description: 'The Empire State Building is a 102-story skyscraper in Midtown Manhattan, New York City. It is the world\'s tallest building, a structure that is the 4th-tallest building in the world.')
|
85
|
+
.find_or_create_by(name: 'Empire State Building'),
|
86
|
+
Monument.create_with(country: gb,
|
87
|
+
description: 'The Tower of London is a historic London tower on the north bank of the River Thames in central London. It is the most-visited paid monument in the world.')
|
88
|
+
.find_or_create_by(name: 'Tower of London'),
|
89
|
+
Monument.create_with(country: gb, description: 'The Big Ben is a clock tower in the north of London. It is the world\'s tallest clock tower.')
|
90
|
+
.find_or_create_by(name: 'Big Ben'),
|
91
|
+
Monument.create_with(country: gb,
|
92
|
+
description: 'The London Eye is a giant Ferris wheel situated on the South Bank of the River Thames in London, England. It is the world\'s largest Ferris wheel.')
|
93
|
+
.find_or_create_by(name: 'London Eye')
|
94
|
+
]
|
95
|
+
end
|
96
|
+
|
97
|
+
def create_visitors
|
98
|
+
NAMES.each do |name|
|
99
|
+
rand(1..10).times do # number monuments to visited (duplicates are fine)
|
100
|
+
Visitor.create(name: name, monument: monuments.sample)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<h1>Individual Visitors by Monument</h1>
|
2
|
+
|
3
|
+
<pre><code><%= File.read('db/views/individual_visitors_by_monuments_v01.sql') %></code></pre>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Person</th>
|
9
|
+
<th>Monument</th>
|
10
|
+
<th>Country</th>
|
11
|
+
<th>Visits</th>
|
12
|
+
</tr>
|
13
|
+
</thead>
|
14
|
+
<tbody>
|
15
|
+
<% @visitors.each do |visitor| %>
|
16
|
+
<tr>
|
17
|
+
<td><%= visitor.person %></td>
|
18
|
+
<td><%= visitor.monument %></td>
|
19
|
+
<td><%= visitor.country %></td>
|
20
|
+
<td><%= visitor.visits %></td>
|
21
|
+
</tr>
|
22
|
+
<% end %>
|
23
|
+
</tbody>
|
24
|
+
</table>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Visitors by Monument</h1>
|
2
|
+
|
3
|
+
<pre><code><%= File.read('db/views/visitors_by_monuments_v01.sql') %></code></pre>
|
4
|
+
|
5
|
+
<table>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th>Monument</th>
|
9
|
+
<th>Country</th>
|
10
|
+
<th>Visits</th>
|
11
|
+
</tr>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% @visitors.each do |visitor| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= visitor.monument %></td>
|
17
|
+
<td><%= visitor.country %></td>
|
18
|
+
<td><%= visitor.visits %></td>
|
19
|
+
</tr>
|
20
|
+
<% end %>
|
21
|
+
</tbody>
|
22
|
+
</table>
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= link_to 'Home', root_path %>
|
2
|
+
| <%= link_to 'Countries', countries_path %>
|
3
|
+
| <%= link_to 'Monuments', monuments_path %>
|
4
|
+
| <%= link_to 'Visitors', visitors_path %>
|
5
|
+
<br>
|
6
|
+
<%= link_to 'Visits (View)', home_visitors_by_monument_path %>
|
7
|
+
| <%= link_to 'Visits (Materialized)', home_individual_visitors_by_monument_path %>
|
8
|
+
| <%= link_to 'Re-Seed', home_reseed_path, style: 'color: blue; font-weight: 600;' %>
|
9
|
+
| <%= link_to 'Refresh Material View', home_refresh_material_view_path, style: 'color: blue; font-weight: 600;' %>
|
10
|
+
<hr />
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title><%= camelized %></title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%%= csrf_meta_tags %>
|
7
|
+
<%%= csp_meta_tag %>
|
8
|
+
|
9
|
+
<%- if options[:skip_hotwire] || options[:skip_javascript] -%>
|
10
|
+
<%%= stylesheet_link_tag "application" %>
|
11
|
+
<%- else -%>
|
12
|
+
<%%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
13
|
+
<%- end -%>
|
14
|
+
</head>
|
15
|
+
|
16
|
+
<body>
|
17
|
+
<header>
|
18
|
+
<%%= render 'layouts/navbar' %>
|
19
|
+
<hr />
|
20
|
+
</header>
|
21
|
+
<main>
|
22
|
+
<%%= yield %>
|
23
|
+
</main>
|
24
|
+
<footer>
|
25
|
+
<%%= render 'layouts/footer' %>
|
26
|
+
</footer>
|
27
|
+
</body>
|
28
|
+
</html>
|
29
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
SeedService.seed
|
@@ -0,0 +1,9 @@
|
|
1
|
+
select
|
2
|
+
visitors.name as person,
|
3
|
+
monuments.name as monument,
|
4
|
+
countries.name as country,
|
5
|
+
count(*) as visits
|
6
|
+
from visitors
|
7
|
+
join monuments on visitors.monument_id = monuments.id
|
8
|
+
join countries on monuments.country_id = countries.id
|
9
|
+
group by person, monument, country
|
@@ -4,7 +4,7 @@
|
|
4
4
|
"skip_collision_check": false,
|
5
5
|
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
6
6
|
"database": "postgresql",
|
7
|
-
"skip_git":
|
7
|
+
"skip_git": true,
|
8
8
|
"skip_keeps": false,
|
9
9
|
"skip_action_mailer": false,
|
10
10
|
"skip_action_mailbox": false,
|
@@ -32,18 +32,18 @@
|
|
32
32
|
"test": "rspec",
|
33
33
|
"add_acts_as_list": false,
|
34
34
|
"add_administrate": false,
|
35
|
-
"add_annotate":
|
36
|
-
"add_avo":
|
35
|
+
"add_annotate": false,
|
36
|
+
"add_avo": false,
|
37
37
|
"add_bcrypt": false,
|
38
|
-
"add_brakeman":
|
38
|
+
"add_brakeman": false,
|
39
39
|
"add_browser": false,
|
40
|
-
"add_bundler_audit":
|
40
|
+
"add_bundler_audit": false,
|
41
41
|
"add_chartkick": false,
|
42
|
-
"add_devise":
|
42
|
+
"add_devise": false,
|
43
43
|
"add_devise_masquerade": false,
|
44
|
-
"add_dotenv":
|
45
|
-
"add_factory_bot_rails":
|
46
|
-
"add_faker":
|
44
|
+
"add_dotenv": false,
|
45
|
+
"add_factory_bot_rails": false,
|
46
|
+
"add_faker": false,
|
47
47
|
"add_friendly_id": false,
|
48
48
|
"add_groupdate": false,
|
49
49
|
"add_hexapdf": false,
|
@@ -52,7 +52,7 @@
|
|
52
52
|
"add_image_processing": false,
|
53
53
|
"add_kaminari": false,
|
54
54
|
"add_lograge": false,
|
55
|
-
"add_minimal_css":
|
55
|
+
"add_minimal_css": true,
|
56
56
|
"minimal_css_library": "water.css",
|
57
57
|
"add_mini_magick": false,
|
58
58
|
"add_motor_admin": false,
|
@@ -60,12 +60,12 @@
|
|
60
60
|
"add_pretender": false,
|
61
61
|
"add_public_suffix": false,
|
62
62
|
"add_rails_html_sanitizer": false,
|
63
|
+
"add_scenic": true,
|
63
64
|
"add_ransack": false,
|
64
65
|
"add_redcarpet": false,
|
65
66
|
"add_rolify": false,
|
66
|
-
"add_rubocop":
|
67
|
+
"add_rubocop": false,
|
67
68
|
"add_twilio_ruby": false,
|
68
|
-
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/
|
69
|
-
"css": "tailwind"
|
69
|
+
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/scenic/_.rb"
|
70
70
|
}
|
71
71
|
}
|
@@ -7,9 +7,9 @@
|
|
7
7
|
"quiet": false,
|
8
8
|
"skip": false,
|
9
9
|
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
10
|
-
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/
|
10
|
+
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/scenic/_.rb",
|
11
11
|
"database": "postgresql",
|
12
|
-
"skip_git":
|
12
|
+
"skip_git": true,
|
13
13
|
"skip_keeps": false,
|
14
14
|
"skip_action_mailer": false,
|
15
15
|
"skip_action_mailbox": false,
|
@@ -36,24 +36,24 @@
|
|
36
36
|
"api": false,
|
37
37
|
"minimal": false,
|
38
38
|
"javascript": "importmap",
|
39
|
-
"css": "
|
39
|
+
"css": "",
|
40
40
|
"skip_bundle": false,
|
41
41
|
"note": "",
|
42
42
|
"test": "rspec",
|
43
43
|
"add_acts_as_list": false,
|
44
44
|
"add_administrate": false,
|
45
|
-
"add_annotate":
|
46
|
-
"add_avo":
|
45
|
+
"add_annotate": false,
|
46
|
+
"add_avo": false,
|
47
47
|
"add_bcrypt": false,
|
48
|
-
"add_brakeman":
|
48
|
+
"add_brakeman": false,
|
49
49
|
"add_browser": false,
|
50
|
-
"add_bundler_audit":
|
50
|
+
"add_bundler_audit": false,
|
51
51
|
"add_chartkick": false,
|
52
|
-
"add_devise":
|
52
|
+
"add_devise": false,
|
53
53
|
"add_devise_masquerade": false,
|
54
|
-
"add_dotenv":
|
55
|
-
"add_factory_bot_rails":
|
56
|
-
"add_faker":
|
54
|
+
"add_dotenv": false,
|
55
|
+
"add_factory_bot_rails": false,
|
56
|
+
"add_faker": false,
|
57
57
|
"add_friendly_id": false,
|
58
58
|
"add_groupdate": false,
|
59
59
|
"add_hexapdf": false,
|
@@ -62,7 +62,7 @@
|
|
62
62
|
"add_image_processing": false,
|
63
63
|
"add_kaminari": false,
|
64
64
|
"add_lograge": false,
|
65
|
-
"add_minimal_css":
|
65
|
+
"add_minimal_css": true,
|
66
66
|
"minimal_css_library": "water.css",
|
67
67
|
"add_mini_magick": false,
|
68
68
|
"add_motor_admin": false,
|
@@ -70,10 +70,11 @@
|
|
70
70
|
"add_pretender": false,
|
71
71
|
"add_public_suffix": false,
|
72
72
|
"add_rails_html_sanitizer": false,
|
73
|
+
"add_scenic": true,
|
73
74
|
"add_ransack": false,
|
74
75
|
"add_redcarpet": false,
|
75
76
|
"add_rolify": false,
|
76
|
-
"add_rubocop":
|
77
|
+
"add_rubocop": false,
|
77
78
|
"add_twilio_ruby": false
|
78
79
|
}
|
79
80
|
}
|
data/package-lock.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "rails_app_generator",
|
3
|
-
"version": "0.2.
|
3
|
+
"version": "0.2.43",
|
4
4
|
"lockfileVersion": 2,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "rails_app_generator",
|
9
|
-
"version": "0.2.
|
9
|
+
"version": "0.2.43",
|
10
10
|
"dependencies": {
|
11
11
|
"daisyui": "^2.20.0"
|
12
12
|
},
|
data/package.json
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"args": {
|
3
|
+
"app_path": "r7_scenic",
|
4
|
+
"destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons"
|
5
|
+
},
|
6
|
+
"opts": {
|
7
|
+
"skip_git": true,
|
8
|
+
"skip_test": true,
|
9
|
+
"database": "postgresql",
|
10
|
+
"add_minimal_css": true,
|
11
|
+
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/scenic/_.rb",
|
12
|
+
"add_scenic": true
|
13
|
+
}
|
14
|
+
}
|
data/tasks/profile.thor
CHANGED
@@ -42,6 +42,7 @@ class Profile < Thor
|
|
42
42
|
template('profile/after_template.rb' , after_template_path('_.rb') , force: options[:force])
|
43
43
|
template('profile/app/controllers/home_controller.rb' , after_template_path('app/controllers/home_controller.rb') , force: options[:force])
|
44
44
|
template('profile/app/views/home/index.html.erb' , after_template_path('app/views/home/index.html.erb') , force: options[:force])
|
45
|
+
template('profile/app/services/seed_service.rb' , after_template_path('app/services/seed_service.rb') , force: options[:force])
|
45
46
|
|
46
47
|
copy_file('profile/app/views/layouts/_navbar.html.erb' , after_template_path('app/views/layouts/_navbar.html.erb') , force: options[:force])
|
47
48
|
copy_file('profile/app/views/layouts/_footer.html.erb' , after_template_path('app/views/layouts/_footer.html.erb') , force: options[:force])
|
@@ -11,9 +11,10 @@ gac 'base rails 7 image created'
|
|
11
11
|
prepare_environment
|
12
12
|
|
13
13
|
after_bundle do
|
14
|
+
create_db
|
14
15
|
scaffolds
|
15
16
|
setup_customizations
|
16
|
-
|
17
|
+
migrate_db
|
17
18
|
end
|
18
19
|
|
19
20
|
def scaffolds
|
@@ -33,38 +34,26 @@ def setup_customizations
|
|
33
34
|
directory "app/models"
|
34
35
|
directory "app/views"
|
35
36
|
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
37
|
+
directory "app/services"
|
36
38
|
end
|
37
39
|
|
38
|
-
def
|
40
|
+
def create_db
|
41
|
+
# uncomment this if you need custom configuration in database.yml
|
42
|
+
# gsub_file('config/database.yml', ' encoding: unicode', db_development_settings)
|
43
|
+
db(drop: true, create: true)
|
44
|
+
end
|
45
|
+
|
46
|
+
def migrate_db
|
39
47
|
template 'db/seeds.rb' , 'db/seeds.rb'
|
40
48
|
|
41
|
-
|
42
|
-
db_seed
|
49
|
+
db(migrate: true, seed: true)
|
43
50
|
end
|
44
51
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
# run('bin/importmap pin sortablejs')
|
54
|
-
# run('npm install daisyui')
|
55
|
-
# rubocop
|
56
|
-
#
|
57
|
-
# directory 'app/assets/images'
|
58
|
-
# create_file 'app/assets/stylesheets/custom-bootstrap-import.scss' , read_template('custom-bootstrap-import.scss')
|
59
|
-
# append_to_file 'app/assets/config/manifest.js' , read_template('manifest.js')
|
60
|
-
# insert_into_file 'app/views/layouts/application.html.erb', read_template('application.html.erb'),
|
61
|
-
# before: %( <%%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>)
|
62
|
-
# gsub_file 'app/views/layouts/application.html.erb', %(container mx-auto mt-28 px-5 flex), 'container mx-auto px-5'
|
63
|
-
# template 'home.css', 'app/assets/stylesheets/home.css'
|
64
|
-
#
|
65
|
-
# add_controller('page', 'benefits', 'faq', 'terms', 'privacy', '--skip-routes')
|
66
|
-
# route(<<-'RUBY')
|
67
|
-
# PageController.action_methods.each do |action|
|
68
|
-
# get "/#{action}", to: "page##{action}", as: "page_#{action}"
|
69
|
-
# end
|
70
|
-
# RUBY
|
52
|
+
def db_development_settings
|
53
|
+
<<-'RUBY'
|
54
|
+
encoding: unicode
|
55
|
+
host: <%= ENV['DATABASE_HOST'] %>
|
56
|
+
username: <%= ENV['DATABASE_USERNAME'] %>
|
57
|
+
password: <%= ENV['DATABASE_PASSWORD'] %>
|
58
|
+
RUBY
|
59
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class SeedService
|
2
|
+
class << self
|
3
|
+
def seed
|
4
|
+
service = SeedService.new
|
5
|
+
service.call
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def call
|
10
|
+
reset
|
11
|
+
create
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def reset
|
17
|
+
# Person.delete_all
|
18
|
+
# Post.delete_all
|
19
|
+
# Project.delete_all
|
20
|
+
end
|
21
|
+
|
22
|
+
def create
|
23
|
+
# FactoryBot.create_list(:post, rand(10..20))
|
24
|
+
# FactoryBot.create_list(:person, rand(10..20))
|
25
|
+
# FactoryBot.create_list(:project, rand(10..20))
|
26
|
+
end
|
27
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# SeedService.seed
|
1
2
|
# david = User.create(email: 'david@site.com', name: 'david', password: 'password')
|
2
3
|
# james = User.create(email: 'james@site.com', name: 'james', password: 'password')
|
3
4
|
# sally = User.create(email: 'sally@site.com', name: 'sally', password: 'password')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_app_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.43
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Cruwys
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|
@@ -440,6 +440,19 @@ files:
|
|
440
440
|
- after_templates/addons/rubocop/app/controllers/home_controller.rb
|
441
441
|
- after_templates/addons/rubocop/app/views/home/index.html.erb
|
442
442
|
- after_templates/addons/rubocop/app/views/layouts/application.html.erb
|
443
|
+
- after_templates/addons/scenic/_.rb
|
444
|
+
- after_templates/addons/scenic/app/controllers/home_controller.rb
|
445
|
+
- after_templates/addons/scenic/app/services/seed_service.rb
|
446
|
+
- after_templates/addons/scenic/app/views/home/index.html.erb
|
447
|
+
- after_templates/addons/scenic/app/views/home/individual_visitors_by_monument.html.erb
|
448
|
+
- after_templates/addons/scenic/app/views/home/reseed.html.erb
|
449
|
+
- after_templates/addons/scenic/app/views/home/visitors_by_monument.html.erb
|
450
|
+
- after_templates/addons/scenic/app/views/layouts/_footer.html.erb
|
451
|
+
- after_templates/addons/scenic/app/views/layouts/_navbar.html.erb
|
452
|
+
- after_templates/addons/scenic/app/views/layouts/application.html.erb
|
453
|
+
- after_templates/addons/scenic/db/seeds.rb
|
454
|
+
- after_templates/addons/scenic/db/views/individual_visitors_by_monuments_v01.sql
|
455
|
+
- after_templates/addons/scenic/db/views/visitors_by_monuments_v01.sql
|
443
456
|
- after_templates/addons/twilio_ruby/_.rb
|
444
457
|
- after_templates/addons/twilio_ruby/app/controllers/home_controller.rb
|
445
458
|
- after_templates/addons/twilio_ruby/app/views/home/index.html.erb
|
@@ -800,6 +813,7 @@ files:
|
|
800
813
|
- profiles/addons/redcarpet.json
|
801
814
|
- profiles/addons/rolify.json
|
802
815
|
- profiles/addons/rubocop.json
|
816
|
+
- profiles/addons/scenic.json
|
803
817
|
- profiles/addons/twilio_ruby.json
|
804
818
|
- profiles/application/klueless.json
|
805
819
|
- profiles/application/printspeak.json
|
@@ -861,6 +875,7 @@ files:
|
|
861
875
|
- templates/thor_task/addon/addon.tt
|
862
876
|
- templates/thor_task/profile/after_template.rb
|
863
877
|
- templates/thor_task/profile/app/controllers/home_controller.rb
|
878
|
+
- templates/thor_task/profile/app/services/seed_service.rb
|
864
879
|
- templates/thor_task/profile/app/views/home/index.html.erb.tt
|
865
880
|
- templates/thor_task/profile/app/views/layouts/_footer.html.erb.tt
|
866
881
|
- templates/thor_task/profile/app/views/layouts/_navbar.html.erb
|