rails_app_generator 0.2.35 → 0.2.36
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 +7 -0
- data/after_templates/addons/avo/_.rb +36 -24
- data/after_templates/addons/avo/app/avo/dashboards/dashboard.rb +12 -0
- data/after_templates/addons/avo/app/avo/resources/category_resource.rb +27 -0
- data/after_templates/addons/avo/app/avo/resources/post_resource.rb +25 -0
- data/after_templates/addons/avo/app/avo/resources/user_resource.rb +23 -0
- data/after_templates/addons/avo/app/controllers/home_controller.rb +4 -0
- data/after_templates/addons/avo/app/models/category.rb +7 -0
- data/after_templates/addons/avo/app/models/post.rb +9 -0
- data/after_templates/addons/avo/app/views/home/index.html.erb +1 -1
- data/after_templates/addons/avo/app/views/home/quick_signin.html.erb +3 -0
- data/after_templates/addons/avo/app/views/layouts/_footer.html.erb +0 -3
- data/after_templates/addons/avo/app/views/layouts/_navbar.html.erb +13 -8
- data/after_templates/addons/avo/app/views/layouts/application.html.erb +15 -2
- data/after_templates/addons/avo/config/initializers/avo.rb +105 -0
- data/after_templates/addons/avo/config/locales/en.yml +4 -0
- data/after_templates/addons/avo/db/seeds.rb +69 -12
- data/docs/last_run/app_generator_class.json +17 -1
- data/docs/last_run/app_generator_data.json +3 -1
- data/docs/last_run/rails_options_class.json +17 -1
- data/docs/last_run/rails_options_data.json +3 -1
- data/lib/rails_app_generator/addons/avo.rb +8 -0
- data/lib/rails_app_generator/addons/ransack.rb +34 -0
- data/lib/rails_app_generator/app_generator.rb +8 -1
- data/lib/rails_app_generator/rag_initializer.rb +1 -1
- data/lib/rails_app_generator/version.rb +1 -1
- data/package-lock.json +2 -2
- data/package.json +1 -1
- data/profiles/addons/avo.json +4 -2
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cee7a5479ca62a445db49b49b597da3a641a39efb84d56f7da3c4c6b973ad52f
|
4
|
+
data.tar.gz: 9e12b9abed0a5c13bf57b3cdccacf95d97be64ac2a9e3097d84039f00e66c438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42698c111605eda6d7e8d014a7d1472b2438227f8f663cc4ab92837373a1f4a8526704adbfcab21fc1ea367fa2879586621ea06371ea511fe728989bb2c43925
|
7
|
+
data.tar.gz: d798bef8f2dc50312db9708ece229b14eb69215bc3de141a66aa51ea8e31df62fc83bef8b2540045e2097c25e136b140bb868dc0e55a5cffcf89fdf1c9dfa438
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [0.2.35](https://github.com/klueless-io/rails_app_generator/compare/v0.2.34...v0.2.35) (2022-08-20)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add image-processing addon ([3466708](https://github.com/klueless-io/rails_app_generator/commit/3466708e66cfc8da487f619f77516f863ef5cb46))
|
7
|
+
|
1
8
|
## [0.2.34](https://github.com/klueless-io/rails_app_generator/compare/v0.2.33...v0.2.34) (2022-08-19)
|
2
9
|
|
3
10
|
|
@@ -13,46 +13,58 @@ gac 'base rails 7 image created'
|
|
13
13
|
|
14
14
|
prepare_environment
|
15
15
|
|
16
|
-
add_controller('home', 'index')
|
17
|
-
|
18
|
-
route("root 'home#index'")
|
19
|
-
|
20
|
-
force_copy
|
21
|
-
|
22
|
-
directory "app/controllers"
|
23
|
-
directory "app/views/home"
|
24
|
-
directory "app/views/layouts"
|
25
|
-
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
26
|
-
|
27
|
-
template 'db/seeds.rb' , 'db/seeds.rb'
|
28
|
-
|
29
16
|
after_bundle do
|
17
|
+
scaffolds
|
18
|
+
setup_customizations
|
30
19
|
setup_db
|
31
20
|
setup_avo
|
32
21
|
end
|
33
22
|
|
23
|
+
def scaffolds
|
24
|
+
add_scaffold_controller('users', 'name', 'email')
|
25
|
+
# add_scaffold('author', 'name', 'email', 'bio:text')
|
26
|
+
add_scaffold('category', 'title', 'description:text')
|
27
|
+
add_scaffold('post', 'title content:text', 'published:boolean', 'user:references', 'category:references')
|
28
|
+
add_scaffold('location', 'name', 'description:text') #, 'photo:file')
|
29
|
+
add_scaffold('room', 'name', 'description:text', 'location:references') #, 'photo:file'
|
30
|
+
add_scaffold('booking', 'user:references', 'room:references', 'booked_at:datetime', 'booked_for:integer')
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup_customizations
|
34
|
+
route("root 'home#index'")
|
35
|
+
|
36
|
+
force_copy
|
37
|
+
|
38
|
+
add_controller('home', 'index', 'quick_signin')
|
39
|
+
|
40
|
+
directory "app/controllers"
|
41
|
+
directory "app/models"
|
42
|
+
directory "app/views"
|
43
|
+
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
44
|
+
end
|
45
|
+
|
34
46
|
def setup_db
|
35
|
-
|
36
|
-
add_scaffold('category', 'title:string', 'description:text')
|
37
|
-
add_scaffold('post', 'title:string content:text', 'published:boolean', 'author:references', 'category:references')
|
38
|
-
add_scaffold('product', 'name', 'quantity:integer', 'price:decimal', 'author:references')
|
39
|
-
add_scaffold('location', 'name', 'description:text', 'photo:file')
|
40
|
-
add_scaffold('room', 'name', 'description:text', 'photo:file', 'location:references')
|
41
|
-
add_scaffold('booking', 'user:references', 'room:references', 'booked_at:timestamp', 'booked_for:number')
|
47
|
+
template 'db/seeds.rb' , 'db/seeds.rb'
|
42
48
|
|
43
49
|
db_migrate
|
44
50
|
db_seed
|
45
51
|
end
|
46
52
|
|
47
53
|
def setup_avo
|
48
|
-
generate('avo:install')
|
49
|
-
|
50
|
-
generate('avo:resource Post')
|
51
|
-
generate('avo:resource Author')
|
54
|
+
# generate('avo:install')
|
55
|
+
|
52
56
|
generate('avo:resource Category')
|
57
|
+
generate('avo:resource Post')
|
58
|
+
generate('avo:resource Location')
|
59
|
+
generate('avo:resource Room')
|
60
|
+
generate('avo:resource Booking')
|
53
61
|
generate('avo:resource User')
|
54
62
|
generate('avo:dashboard Dashboard')
|
55
63
|
|
64
|
+
directory "app/avo"
|
65
|
+
directory "config/initializers"
|
66
|
+
directory "config/locales"
|
67
|
+
|
56
68
|
# add devise support
|
57
69
|
gsub_file 'config/initializers/avo.rb', %(# config.current_user_method = {}), 'config.current_user_method = :current_user'
|
58
70
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Dashboard < Avo::Dashboards::BaseDashboard
|
2
|
+
self.id = "dashboard"
|
3
|
+
self.name = "Dashboard"
|
4
|
+
# self.description = "Tiny dashboard description"
|
5
|
+
# self.grid_cols = 3
|
6
|
+
# self.visible = -> do
|
7
|
+
# true
|
8
|
+
# end
|
9
|
+
|
10
|
+
# cards go here
|
11
|
+
# card UsersCount
|
12
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class CategoryResource < Avo::BaseResource
|
2
|
+
# tutorial (related category): https://youtu.be/WgNK-oINFww?t=328
|
3
|
+
|
4
|
+
self.title = :title
|
5
|
+
self.includes = []
|
6
|
+
|
7
|
+
self.search_query = ->(params:) do
|
8
|
+
scope
|
9
|
+
.ransack(id_eq: params[:q], name_cont: params[:q], title_cont: params[:q], description_cont: params[:q], m: "or")
|
10
|
+
.result(distinct: false)
|
11
|
+
end
|
12
|
+
|
13
|
+
field :id, as: :id
|
14
|
+
field :title, as: :text
|
15
|
+
field :excerpt, as: :text, only_on: :index
|
16
|
+
field :description, as: :textarea
|
17
|
+
|
18
|
+
# tutorial (computed field): https://youtu.be/WgNK-oINFww?t=514
|
19
|
+
field :posts_count, as: :text do |model|
|
20
|
+
model.posts.count
|
21
|
+
end
|
22
|
+
|
23
|
+
# tutorial (attach scope): https://youtu.be/WgNK-oINFww?t=423
|
24
|
+
field :posts, as: :has_many, attach_scope: -> {
|
25
|
+
query.where.not(category_id: parent.id).or(query.where(category_id: nil))
|
26
|
+
}
|
27
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class PostResource < Avo::BaseResource
|
2
|
+
# tutorial (title): https://youtu.be/WgNK-oINFww?t=301
|
3
|
+
self.title = :title
|
4
|
+
|
5
|
+
# tutorial (n+1): https://youtu.be/WgNK-oINFww?t=557
|
6
|
+
self.includes = [:category]
|
7
|
+
|
8
|
+
# tutorial (search): https://youtu.be/WgNK-oINFww?t=244
|
9
|
+
self.search_query = ->(params:) do
|
10
|
+
scope
|
11
|
+
.ransack(id_eq: params[:q], title_cont: params[:q], m: "or")
|
12
|
+
.result(distinct: false)
|
13
|
+
end
|
14
|
+
|
15
|
+
# tutorial (edit fields): https://youtu.be/WgNK-oINFww?t=133
|
16
|
+
field :id, as: :id
|
17
|
+
field :title, as: :text
|
18
|
+
field :content, as: :trix
|
19
|
+
|
20
|
+
# tutorial (read only fields): https://youtu.be/WgNK-oINFww?t=228
|
21
|
+
field :excerpt, as: :text, only_on: :index
|
22
|
+
|
23
|
+
# tutorial (related category): https://youtu.be/WgNK-oINFww?t=328
|
24
|
+
field :category, as: :belongs_to
|
25
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# tutorial (user resource): https://youtu.be/WgNK-oINFww?t=599
|
2
|
+
class UserResource < Avo::BaseResource
|
3
|
+
# https://docs.avohq.io/2.0/resources.html#devise-password-optional
|
4
|
+
# you need to fill in the password when creating a new user,
|
5
|
+
# but when editing a user you can leave the password field empty
|
6
|
+
self.devise_password_optional = true
|
7
|
+
|
8
|
+
# tutorial (better search experience): https://youtu.be/WgNK-oINFww?t=649
|
9
|
+
self.title = :email
|
10
|
+
self.includes = []
|
11
|
+
|
12
|
+
self.search_query = ->(params:) do
|
13
|
+
scope
|
14
|
+
.ransack(id_eq: params[:q], name_cont: params[:q], email_cont: params[:q], m: "or")
|
15
|
+
.result(distinct: false)
|
16
|
+
end
|
17
|
+
|
18
|
+
field :id, as: :id
|
19
|
+
field :email, as: :gravatar, link_to_resource: true, as_avatar: true
|
20
|
+
field :name, as: :text
|
21
|
+
field :email, as: :text, as_description: true
|
22
|
+
field :password, as: :text
|
23
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
<h1>
|
1
|
+
<h1>I18n.t('application_name')</h1>
|
2
2
|
|
3
3
|
<p>Avo abstracts away the common parts of building apps, letting your engineers work on your app's essential components. The result is a full-featured admin panel that works out of the box, ready to give to your end-users.</p>
|
@@ -1,8 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<%= link_to 'Home', root_path %> |
|
2
|
+
<%= link_to 'Quick Sign In', home_quick_signin_path %> |
|
3
|
+
<%= link_to 'AVO', avo_path %>
|
4
|
+
(
|
5
|
+
<%= link_to 'Posts', posts_path, class: 'simple_scaffold' %> |
|
6
|
+
<%= link_to 'Categories', categories_path, class: 'simple_scaffold' %> |
|
7
|
+
<%= link_to 'Authors', users_path, class: 'simple_scaffold' %>
|
8
|
+
)
|
9
|
+
(
|
10
|
+
<%= link_to 'Locations', locations_path, class: 'simple_scaffold' %> |
|
11
|
+
<%= link_to 'Rooms', rooms_path, class: 'simple_scaffold' %> |
|
12
|
+
<%= link_to 'Bookings', bookings_path, class: 'simple_scaffold' %>
|
13
|
+
)
|
@@ -11,13 +11,26 @@
|
|
11
11
|
<%- else -%>
|
12
12
|
<%%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
|
13
13
|
<%- end -%>
|
14
|
+
<style>
|
15
|
+
.bold {
|
16
|
+
font-weight: bold;
|
17
|
+
}
|
18
|
+
.simple_scaffold {
|
19
|
+
color: #333333;
|
20
|
+
}
|
21
|
+
</style>
|
14
22
|
</head>
|
15
23
|
|
16
24
|
<body>
|
17
|
-
|
25
|
+
<header>
|
26
|
+
<%%= render 'layouts/navbar' %>
|
27
|
+
</header>
|
28
|
+
<hr>
|
18
29
|
<main>
|
19
30
|
<%%= yield %>
|
20
31
|
</main>
|
21
|
-
|
32
|
+
<footer>
|
33
|
+
<%%= render 'layouts/footer' %>
|
34
|
+
</footer>
|
22
35
|
</body>
|
23
36
|
</html>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# For more information regaring these settings check out our docs https://docs.avohq.io
|
4
|
+
Avo.configure do |config|
|
5
|
+
## == Routing ==
|
6
|
+
config.root_path = '/admin'
|
7
|
+
|
8
|
+
# https://docs.avohq.io/2.0/customization.html
|
9
|
+
config.app_name = 'Custom Application'
|
10
|
+
config.id_links_to_resource = true
|
11
|
+
# config.resource_controls_placement = :left
|
12
|
+
|
13
|
+
# Where should the user be redirected when visting the `/avo` url
|
14
|
+
# config.home_path = nil
|
15
|
+
|
16
|
+
## == Licensing ==
|
17
|
+
config.license = 'pro' # change this to 'pro' when you add the license key
|
18
|
+
config.license_key = ENV['AVO_LICENSE_KEY']
|
19
|
+
|
20
|
+
## == Set the context ==
|
21
|
+
config.set_context do
|
22
|
+
# Return a context object that gets evaluated in Avo::ApplicationController
|
23
|
+
end
|
24
|
+
|
25
|
+
## == Authentication ==
|
26
|
+
config.current_user_method = :current_user
|
27
|
+
# config.authenticate_with = {}
|
28
|
+
|
29
|
+
## == Authorization ==
|
30
|
+
# config.authorization_methods = {
|
31
|
+
# index: 'index?',
|
32
|
+
# show: 'show?',
|
33
|
+
# edit: 'edit?',
|
34
|
+
# new: 'new?',
|
35
|
+
# update: 'update?',
|
36
|
+
# create: 'create?',
|
37
|
+
# destroy: 'destroy?',
|
38
|
+
# }
|
39
|
+
# config.raise_error_on_missing_policy = false
|
40
|
+
|
41
|
+
## == Localization ==
|
42
|
+
# config.locale = 'en-US'
|
43
|
+
|
44
|
+
## == Customization ==
|
45
|
+
# config.app_name = 'Avocadelicious'
|
46
|
+
# config.timezone = 'UTC'
|
47
|
+
# config.currency = 'USD'
|
48
|
+
# config.per_page = 24
|
49
|
+
# config.per_page_steps = [12, 24, 48, 72]
|
50
|
+
# config.via_per_page = 8
|
51
|
+
# config.default_view_type = :table
|
52
|
+
# config.hide_layout_when_printing = false
|
53
|
+
# config.id_links_to_resource = false
|
54
|
+
# config.full_width_container = false
|
55
|
+
# config.full_width_index_view = false
|
56
|
+
# config.cache_resources_on_index_view = true
|
57
|
+
# config.search_debounce = 300
|
58
|
+
# config.view_component_path = "app/components"
|
59
|
+
# config.display_license_request_timeout_error = true
|
60
|
+
# config.disabled_features = []
|
61
|
+
|
62
|
+
## == Breadcrumbs ==
|
63
|
+
# config.display_breadcrumbs = true
|
64
|
+
config.set_initial_breadcrumbs do
|
65
|
+
add_breadcrumb "Home", '/admin'
|
66
|
+
end
|
67
|
+
|
68
|
+
## == Menus ==
|
69
|
+
config.main_menu = -> {
|
70
|
+
section "Dashboards", icon: "dashboards" do
|
71
|
+
all_dashboards
|
72
|
+
end
|
73
|
+
|
74
|
+
section "Resources", icon: "resources" do
|
75
|
+
group "Blog" do
|
76
|
+
resource :post
|
77
|
+
# resource :comment
|
78
|
+
resource :category
|
79
|
+
resource :author
|
80
|
+
end
|
81
|
+
|
82
|
+
group "Reservations" do # , collapsable: true, collapsed: true
|
83
|
+
resource :location
|
84
|
+
resource :room
|
85
|
+
resource :booking
|
86
|
+
end
|
87
|
+
|
88
|
+
group "Admin" do
|
89
|
+
resource :user
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
section "Tools", icon: "tools" do
|
94
|
+
all_tools
|
95
|
+
end
|
96
|
+
|
97
|
+
section I18n.t('admin.external_links'), icon: "heroicons/outline/link", collapsable: true, collapsed: true do
|
98
|
+
link 'Appy Dave', path: 'https://appydave.com', target: :_blank
|
99
|
+
link 'Klueless', path: 'https://klueless.io/', target: :_blank
|
100
|
+
end
|
101
|
+
}
|
102
|
+
config.profile_menu = -> {
|
103
|
+
link "Profile", path: "/admin/profile", icon: "user-circle"
|
104
|
+
}
|
105
|
+
end
|
@@ -10,6 +10,46 @@ def fake_category
|
|
10
10
|
]
|
11
11
|
end
|
12
12
|
|
13
|
+
def avatar_emails
|
14
|
+
[
|
15
|
+
'ben@ben.com',
|
16
|
+
'david@hey.com',
|
17
|
+
'adrian@adrianthedev.com',
|
18
|
+
'david@ideasmen.com.au'
|
19
|
+
]
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def email_domain
|
24
|
+
[
|
25
|
+
'gmail.com',
|
26
|
+
'outlook.com',
|
27
|
+
'yahoo.com',
|
28
|
+
'hotmail.com',
|
29
|
+
'aol.com',
|
30
|
+
'mail.com',
|
31
|
+
].sample
|
32
|
+
end
|
33
|
+
|
34
|
+
def common_names
|
35
|
+
[
|
36
|
+
'Ben',
|
37
|
+
'John',
|
38
|
+
'James',
|
39
|
+
'Robert',
|
40
|
+
'Michael',
|
41
|
+
'William',
|
42
|
+
'Mary',
|
43
|
+
'Patricia',
|
44
|
+
'Linda',
|
45
|
+
'Barbara',
|
46
|
+
'Elizabeth',
|
47
|
+
'Jennifer',
|
48
|
+
'Maria',
|
49
|
+
'Susan',
|
50
|
+
]
|
51
|
+
end
|
52
|
+
|
13
53
|
def fake_title
|
14
54
|
[
|
15
55
|
'Fundamentals of Wavelets',
|
@@ -108,25 +148,42 @@ def fake_title
|
|
108
148
|
].sample
|
109
149
|
end
|
110
150
|
|
111
|
-
|
112
|
-
|
151
|
+
User.find_or_create_by(email: "admin@admin.com") do |user|
|
152
|
+
user.name = 'Admin'
|
153
|
+
user.password = 'password'
|
154
|
+
user.role = :admin
|
113
155
|
end
|
114
156
|
|
157
|
+
common_names.each do |first_name|
|
158
|
+
last_name = Faker::Name.last_name
|
159
|
+
email = Faker::Internet.email(name: first_name.downcase, domain: email_domain)
|
160
|
+
User.create!(name: "#{first_name} #{last_name}", email: email, password: 'password', role: :user)
|
161
|
+
end
|
162
|
+
|
163
|
+
avatar_emails.each do |email|
|
164
|
+
first_name = email.split('@').first
|
165
|
+
last_name = Faker::Name.last_name
|
166
|
+
User.create!(name: "#{first_name} #{last_name}", email: email, password: 'password', role: :user)
|
167
|
+
end
|
168
|
+
# bio: Faker::Lorem.words(number: 5).join(' ')
|
169
|
+
|
115
170
|
fake_category.each do |category|
|
116
171
|
Category.create!(title: category, description: Faker::Lorem.sentence)
|
117
172
|
end
|
118
173
|
|
119
|
-
|
174
|
+
40.times do
|
120
175
|
Post.create!(title: fake_title,
|
121
|
-
content:
|
176
|
+
content: Faker::Lorem.sentences(number: 5).join('<br />'),
|
122
177
|
published: Faker::Boolean.boolean(true_ratio: 0.6),
|
123
|
-
|
178
|
+
category: Category.all.sample,
|
179
|
+
author: User.all.sample)
|
124
180
|
end
|
125
181
|
|
126
|
-
200.times do
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
182
|
+
# 200.times do
|
183
|
+
# Product.create!(
|
184
|
+
# name: Faker::Name.name,
|
185
|
+
# quantity: Faker::Number.number(digits: 2),
|
186
|
+
# price: Faker::Number.decimal(l_digits: 4),
|
187
|
+
# author: Author.all.sample
|
188
|
+
# )
|
189
|
+
# end
|
@@ -57,6 +57,7 @@
|
|
57
57
|
"add_hexapdf",
|
58
58
|
"add_httparty",
|
59
59
|
"add_honeybadger",
|
60
|
+
"add_image_processing",
|
60
61
|
"add_kaminari",
|
61
62
|
"add_lograge",
|
62
63
|
"add_minimal_css",
|
@@ -67,6 +68,7 @@
|
|
67
68
|
"add_pretender",
|
68
69
|
"add_public_suffix",
|
69
70
|
"add_rails_html_sanitizer",
|
71
|
+
"add_ransack",
|
70
72
|
"add_redcarpet",
|
71
73
|
"add_rolify",
|
72
74
|
"add_rubocop",
|
@@ -119,7 +121,7 @@
|
|
119
121
|
"name": "ruby",
|
120
122
|
"description": "Path to the Ruby binary of your choice",
|
121
123
|
"type": "string",
|
122
|
-
"default": "/Users/davidcruwys/.asdf/installs/ruby/
|
124
|
+
"default": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
123
125
|
"required": false
|
124
126
|
},
|
125
127
|
{
|
@@ -472,6 +474,13 @@
|
|
472
474
|
"default": false,
|
473
475
|
"required": false
|
474
476
|
},
|
477
|
+
{
|
478
|
+
"name": "add_image_processing",
|
479
|
+
"description": "Indicates when to generate add image processing",
|
480
|
+
"type": "boolean",
|
481
|
+
"default": false,
|
482
|
+
"required": false
|
483
|
+
},
|
475
484
|
{
|
476
485
|
"name": "add_kaminari",
|
477
486
|
"description": "Indicates when to generate add kaminari",
|
@@ -542,6 +551,13 @@
|
|
542
551
|
"default": false,
|
543
552
|
"required": false
|
544
553
|
},
|
554
|
+
{
|
555
|
+
"name": "add_ransack",
|
556
|
+
"description": "Indicates when to generate add ransack",
|
557
|
+
"type": "boolean",
|
558
|
+
"default": false,
|
559
|
+
"required": false
|
560
|
+
},
|
545
561
|
{
|
546
562
|
"name": "add_redcarpet",
|
547
563
|
"description": "Indicates when to generate add redcarpet",
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"options": {
|
3
3
|
"skip_namespace": false,
|
4
4
|
"skip_collision_check": false,
|
5
|
-
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/
|
5
|
+
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
6
6
|
"database": "sqlite3",
|
7
7
|
"skip_git": true,
|
8
8
|
"skip_keeps": false,
|
@@ -47,6 +47,7 @@
|
|
47
47
|
"add_hexapdf": false,
|
48
48
|
"add_httparty": false,
|
49
49
|
"add_honeybadger": false,
|
50
|
+
"add_image_processing": true,
|
50
51
|
"add_kaminari": false,
|
51
52
|
"add_lograge": false,
|
52
53
|
"add_minimal_css": true,
|
@@ -57,6 +58,7 @@
|
|
57
58
|
"add_pretender": false,
|
58
59
|
"add_public_suffix": false,
|
59
60
|
"add_rails_html_sanitizer": false,
|
61
|
+
"add_ransack": true,
|
60
62
|
"add_redcarpet": false,
|
61
63
|
"add_rolify": false,
|
62
64
|
"add_rubocop": true,
|
@@ -57,6 +57,7 @@
|
|
57
57
|
"add_hexapdf",
|
58
58
|
"add_httparty",
|
59
59
|
"add_honeybadger",
|
60
|
+
"add_image_processing",
|
60
61
|
"add_kaminari",
|
61
62
|
"add_lograge",
|
62
63
|
"add_minimal_css",
|
@@ -67,6 +68,7 @@
|
|
67
68
|
"add_pretender",
|
68
69
|
"add_public_suffix",
|
69
70
|
"add_rails_html_sanitizer",
|
71
|
+
"add_ransack",
|
70
72
|
"add_redcarpet",
|
71
73
|
"add_rolify",
|
72
74
|
"add_rubocop",
|
@@ -119,7 +121,7 @@
|
|
119
121
|
"name": "ruby",
|
120
122
|
"description": "Path to the Ruby binary of your choice",
|
121
123
|
"type": "string",
|
122
|
-
"default": "/Users/davidcruwys/.asdf/installs/ruby/
|
124
|
+
"default": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
123
125
|
"required": false
|
124
126
|
},
|
125
127
|
{
|
@@ -472,6 +474,13 @@
|
|
472
474
|
"default": false,
|
473
475
|
"required": false
|
474
476
|
},
|
477
|
+
{
|
478
|
+
"name": "add_image_processing",
|
479
|
+
"description": "",
|
480
|
+
"type": "boolean",
|
481
|
+
"default": false,
|
482
|
+
"required": false
|
483
|
+
},
|
475
484
|
{
|
476
485
|
"name": "add_kaminari",
|
477
486
|
"description": "",
|
@@ -542,6 +551,13 @@
|
|
542
551
|
"default": false,
|
543
552
|
"required": false
|
544
553
|
},
|
554
|
+
{
|
555
|
+
"name": "add_ransack",
|
556
|
+
"description": "",
|
557
|
+
"type": "boolean",
|
558
|
+
"default": false,
|
559
|
+
"required": false
|
560
|
+
},
|
545
561
|
{
|
546
562
|
"name": "add_redcarpet",
|
547
563
|
"description": "",
|
@@ -6,7 +6,7 @@
|
|
6
6
|
"pretend": false,
|
7
7
|
"quiet": false,
|
8
8
|
"skip": false,
|
9
|
-
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/
|
9
|
+
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
10
10
|
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb",
|
11
11
|
"database": "sqlite3",
|
12
12
|
"skip_git": true,
|
@@ -57,6 +57,7 @@
|
|
57
57
|
"add_hexapdf": false,
|
58
58
|
"add_httparty": false,
|
59
59
|
"add_honeybadger": false,
|
60
|
+
"add_image_processing": true,
|
60
61
|
"add_kaminari": false,
|
61
62
|
"add_lograge": false,
|
62
63
|
"add_minimal_css": true,
|
@@ -67,6 +68,7 @@
|
|
67
68
|
"add_pretender": false,
|
68
69
|
"add_public_suffix": false,
|
69
70
|
"add_rails_html_sanitizer": false,
|
71
|
+
"add_ransack": true,
|
70
72
|
"add_redcarpet": false,
|
71
73
|
"add_rolify": false,
|
72
74
|
"add_rubocop": true,
|
@@ -9,6 +9,14 @@ module RailsAppGenerator
|
|
9
9
|
|
10
10
|
def apply
|
11
11
|
# copy_file 'config/initializers/avo.rb'
|
12
|
+
|
13
|
+
generate('avo:install')
|
14
|
+
|
15
|
+
gsub_file 'config/routes.rb', %(mount Avo::Engine, at: Avo.configuration.root_path), <<-RUBY
|
16
|
+
authenticate :user do
|
17
|
+
mount Avo::Engine, at: Avo.configuration.root_path
|
18
|
+
end
|
19
|
+
RUBY
|
12
20
|
end
|
13
21
|
|
14
22
|
def before_template
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsAppGenerator
|
4
|
+
# Custom add-ons for RailsAppGenerator
|
5
|
+
module AddOns
|
6
|
+
# Add Ransack to rails application
|
7
|
+
class Ransack < RailsAppGenerator::Addon
|
8
|
+
required_gem gem.version('ransack', '3.2.1', 'Object-based searching.')
|
9
|
+
|
10
|
+
def apply
|
11
|
+
say 'Setting up Ransack'
|
12
|
+
# template('ransack_template.rb', 'target/ransack.rb', force: true)
|
13
|
+
# template('app/javascript/stylesheets/components.scss')
|
14
|
+
# create_file('target/ransack.rb', 'put your content here')
|
15
|
+
# directory 'app/template', 'app/target', force: true
|
16
|
+
# empty_directory 'app/target'
|
17
|
+
# inject_into_file('app/application.js', "some content")
|
18
|
+
# rails_command('tailwindcss:install')
|
19
|
+
end
|
20
|
+
|
21
|
+
def before_template
|
22
|
+
say 'Setting up Ransack - before custom template'
|
23
|
+
end
|
24
|
+
|
25
|
+
def before_bundle
|
26
|
+
say 'Setting up Ransack - before bundle install'
|
27
|
+
end
|
28
|
+
|
29
|
+
def after_bundle
|
30
|
+
say 'Setting up Ransack - after bundle install'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -167,6 +167,7 @@ module RailsAppGenerator
|
|
167
167
|
def finish_template
|
168
168
|
puts 'finish template'
|
169
169
|
|
170
|
+
# https://github.com/AaronLasseigne/active_interaction
|
170
171
|
add_if(:acts_as_list) # tested
|
171
172
|
add_if(:administrate) # tested
|
172
173
|
add_if(:annotate) # tested
|
@@ -190,7 +191,8 @@ module RailsAppGenerator
|
|
190
191
|
add_if(:httparty) # tested
|
191
192
|
add_if(:high_voltage) # TODO: needs testing
|
192
193
|
add_if(:honeybadger) # tested
|
193
|
-
add_if(:image_processing) #
|
194
|
+
add_if(:image_processing) # TODO: needs testing
|
195
|
+
# https://github.com/collectiveidea/interactor
|
194
196
|
add_if(:kaminari) # tested
|
195
197
|
add_if(:lograge) # tested
|
196
198
|
add_if(:minimal_css) # tested (this is NOT a GEM)
|
@@ -207,6 +209,7 @@ module RailsAppGenerator
|
|
207
209
|
add_if(:services) # TODO: needs testing
|
208
210
|
add_if(:shoulda) # TODO: needs testing
|
209
211
|
add_if(:sidekiq) # TODO: needs testing
|
212
|
+
add_if(:ransack) # TODO: needs testing
|
210
213
|
add_if(:rubocop) # tested
|
211
214
|
add_if(:twilio_ruby) # tested
|
212
215
|
add(:views, :errors, :scaffold) if active?(:views)
|
@@ -270,6 +273,10 @@ module RailsAppGenerator
|
|
270
273
|
generate(:scaffold, name, *args)
|
271
274
|
end
|
272
275
|
|
276
|
+
def add_scaffold_controller(name, *args)
|
277
|
+
generate(:scaffold_controller, name, *args)
|
278
|
+
end
|
279
|
+
|
273
280
|
def add_migration(name, *args)
|
274
281
|
generate(:migration, name, *args)
|
275
282
|
end
|
@@ -138,7 +138,7 @@ KConfig.configure do |config|
|
|
138
138
|
# pundit
|
139
139
|
rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
|
140
140
|
# rails_app_generator
|
141
|
-
|
141
|
+
rag.add_option :add_ransack , type: :boolean, default: false
|
142
142
|
rag.add_option :add_redcarpet , type: :boolean, default: false
|
143
143
|
rag.add_option :add_rolify , type: :boolean, default: false
|
144
144
|
# services
|
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.36",
|
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.36",
|
10
10
|
"dependencies": {
|
11
11
|
"daisyui": "^2.20.0"
|
12
12
|
},
|
data/package.json
CHANGED
data/profiles/addons/avo.json
CHANGED
@@ -6,12 +6,14 @@
|
|
6
6
|
"opts": {
|
7
7
|
"skip_git": true,
|
8
8
|
"skip_test": true,
|
9
|
+
"add_minimal_css": true,
|
9
10
|
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb",
|
10
11
|
"add_annotate": true,
|
11
12
|
"add_avo": true,
|
12
13
|
"add_devise": true,
|
13
14
|
"add_faker": true,
|
14
|
-
"
|
15
|
-
"
|
15
|
+
"add_image_processing": true,
|
16
|
+
"add_ransack": true,
|
17
|
+
"add_rubocop": true
|
16
18
|
}
|
17
19
|
}
|
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.36
|
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-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootsnap
|
@@ -207,11 +207,20 @@ files:
|
|
207
207
|
- after_templates/addons/annotate/app/views/layouts/_navbar.html.erb
|
208
208
|
- after_templates/addons/annotate/app/views/layouts/application.html.erb
|
209
209
|
- after_templates/addons/avo/_.rb
|
210
|
+
- after_templates/addons/avo/app/avo/dashboards/dashboard.rb
|
211
|
+
- after_templates/addons/avo/app/avo/resources/category_resource.rb
|
212
|
+
- after_templates/addons/avo/app/avo/resources/post_resource.rb
|
213
|
+
- after_templates/addons/avo/app/avo/resources/user_resource.rb
|
210
214
|
- after_templates/addons/avo/app/controllers/home_controller.rb
|
215
|
+
- after_templates/addons/avo/app/models/category.rb
|
216
|
+
- after_templates/addons/avo/app/models/post.rb
|
211
217
|
- after_templates/addons/avo/app/views/home/index.html.erb
|
218
|
+
- after_templates/addons/avo/app/views/home/quick_signin.html.erb
|
212
219
|
- after_templates/addons/avo/app/views/layouts/_footer.html.erb
|
213
220
|
- after_templates/addons/avo/app/views/layouts/_navbar.html.erb
|
214
221
|
- after_templates/addons/avo/app/views/layouts/application.html.erb
|
222
|
+
- after_templates/addons/avo/config/initializers/avo.rb
|
223
|
+
- after_templates/addons/avo/config/locales/en.yml
|
215
224
|
- after_templates/addons/avo/db/seeds.rb
|
216
225
|
- after_templates/addons/bcrypt/_.rb
|
217
226
|
- after_templates/addons/bcrypt/app/controllers/home_controller.rb
|
@@ -656,6 +665,7 @@ files:
|
|
656
665
|
- lib/rails_app_generator/addons/public_suffix.rb
|
657
666
|
- lib/rails_app_generator/addons/pundit.rb
|
658
667
|
- lib/rails_app_generator/addons/rails_html_sanitizer.rb
|
668
|
+
- lib/rails_app_generator/addons/ransack.rb
|
659
669
|
- lib/rails_app_generator/addons/redcarpet.rb
|
660
670
|
- lib/rails_app_generator/addons/rolify.rb
|
661
671
|
- lib/rails_app_generator/addons/rspec.rb
|