rails_app_generator 0.2.33 → 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 +22 -0
- data/after_templates/addons/avo/_.rb +38 -22
- 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/after_templates/addons/kaminari/_.rb +4 -4
- data/after_templates/addons/kaminari/app/assets/images/kaminari-custom-views-detailed.png +0 -0
- data/after_templates/addons/kaminari/app/assets/images/kaminari-custom-views.png +0 -0
- data/after_templates/addons/kaminari/app/controllers/posts_controller.rb +70 -0
- data/after_templates/addons/kaminari/app/views/home/index.html.erb +19 -1
- data/after_templates/addons/kaminari/app/views/layouts/_footer.html.erb +0 -1
- data/after_templates/addons/kaminari/app/views/layouts/_navbar.html.erb +1 -3
- data/after_templates/addons/kaminari/app/views/layouts/application.html.erb +5 -0
- data/after_templates/addons/kaminari/app/views/posts/index.html.erb +32 -0
- data/after_templates/addons/kaminari/db/seeds.rb +3 -7
- data/docs/last_run/app_generator_class.json +17 -1
- data/docs/last_run/app_generator_data.json +11 -8
- data/docs/last_run/rails_options_class.json +17 -1
- data/docs/last_run/rails_options_data.json +11 -8
- data/lib/rails_app_generator/addons/avo.rb +8 -0
- data/lib/rails_app_generator/addons/image_processing.rb +21 -0
- data/lib/rails_app_generator/addons/kaminari.rb +1 -7
- data/lib/rails_app_generator/addons/ransack.rb +34 -0
- data/lib/rails_app_generator/app_generator.rb +8 -0
- data/lib/rails_app_generator/rag_initializer.rb +2 -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 +3 -0
- data/profiles/addons/kaminari.json +1 -0
- data/templates/thor_task/profile/app/views/layouts/_footer.html.erb.tt +0 -1
- 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: 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,25 @@
|
|
|
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
|
+
|
|
8
|
+
## [0.2.34](https://github.com/klueless-io/rails_app_generator/compare/v0.2.33...v0.2.34) (2022-08-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add kaminari profile ([f9b044b](https://github.com/klueless-io/rails_app_generator/commit/f9b044b6e718fdfa851562ea7d4ddab39066d0de))
|
|
14
|
+
|
|
15
|
+
## [0.2.33](https://github.com/klueless-io/rails_app_generator/compare/v0.2.32...v0.2.33) (2022-08-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* add kaminari addon ([b57fd5b](https://github.com/klueless-io/rails_app_generator/commit/b57fd5bdda219852b659404660187cbd0d8ec5dc))
|
|
21
|
+
* add kaminari addon ([d5774ed](https://github.com/klueless-io/rails_app_generator/commit/d5774ed173b0d594e2228278c2d34edce3a80ac9))
|
|
22
|
+
|
|
1
23
|
## [0.2.32](https://github.com/klueless-io/rails_app_generator/compare/v0.2.31...v0.2.32) (2022-08-19)
|
|
2
24
|
|
|
3
25
|
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
#
|
|
5
5
|
# exe/rag addons/avo
|
|
6
6
|
#
|
|
7
|
-
# based on: https://
|
|
7
|
+
# based on: https://youtu.be/WgNK-oINFww
|
|
8
|
+
# https://youtu.be/BK47E7TMXn0
|
|
8
9
|
|
|
9
10
|
self.local_template_path = File.dirname(__FILE__)
|
|
10
11
|
|
|
@@ -12,43 +13,58 @@ gac 'base rails 7 image created'
|
|
|
12
13
|
|
|
13
14
|
prepare_environment
|
|
14
15
|
|
|
15
|
-
add_controller('home', 'index')
|
|
16
|
-
|
|
17
|
-
route("root 'home#index'")
|
|
18
|
-
|
|
19
|
-
force_copy
|
|
20
|
-
|
|
21
|
-
directory "app/controllers"
|
|
22
|
-
directory "app/views/home"
|
|
23
|
-
directory "app/views/layouts"
|
|
24
|
-
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
|
25
|
-
|
|
26
|
-
template 'db/seeds.rb' , 'db/seeds.rb'
|
|
27
|
-
|
|
28
16
|
after_bundle do
|
|
17
|
+
scaffolds
|
|
18
|
+
setup_customizations
|
|
29
19
|
setup_db
|
|
30
20
|
setup_avo
|
|
31
21
|
end
|
|
32
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
|
+
|
|
33
46
|
def setup_db
|
|
34
|
-
|
|
35
|
-
add_scaffold('category', 'title:string', 'description:text')
|
|
36
|
-
add_scaffold('post', 'title:string content:text', 'published:boolean', 'author:references', 'category:references')
|
|
37
|
-
add_scaffold('product', 'name', 'quantity:integer', 'price:decimal', 'author:references')
|
|
47
|
+
template 'db/seeds.rb' , 'db/seeds.rb'
|
|
38
48
|
|
|
39
49
|
db_migrate
|
|
40
50
|
db_seed
|
|
41
51
|
end
|
|
42
52
|
|
|
43
53
|
def setup_avo
|
|
44
|
-
generate('avo:install')
|
|
45
|
-
|
|
46
|
-
generate('avo:resource Post')
|
|
47
|
-
generate('avo:resource Author')
|
|
54
|
+
# generate('avo:install')
|
|
55
|
+
|
|
48
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')
|
|
49
61
|
generate('avo:resource User')
|
|
50
62
|
generate('avo:dashboard Dashboard')
|
|
51
63
|
|
|
64
|
+
directory "app/avo"
|
|
65
|
+
directory "config/initializers"
|
|
66
|
+
directory "config/locales"
|
|
67
|
+
|
|
52
68
|
# add devise support
|
|
53
69
|
gsub_file 'config/initializers/avo.rb', %(# config.current_user_method = {}), 'config.current_user_method = :current_user'
|
|
54
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
|
|
@@ -17,9 +17,7 @@ after_bundle do
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
def scaffolds
|
|
20
|
-
|
|
21
|
-
# add_scaffold('people', 'first_name', 'last_name', 'age:integer', 'address:text')
|
|
22
|
-
# add_scaffold('product', 'name', 'price:integer')
|
|
20
|
+
add_scaffold('post', 'title', 'body:text', 'order:integer')
|
|
23
21
|
end
|
|
24
22
|
|
|
25
23
|
def setup_customizations
|
|
@@ -30,9 +28,11 @@ def setup_customizations
|
|
|
30
28
|
add_controller('home', 'index')
|
|
31
29
|
|
|
32
30
|
directory "app/controllers"
|
|
33
|
-
directory "app/
|
|
31
|
+
directory "app/assets"
|
|
34
32
|
directory "app/views"
|
|
35
33
|
template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
|
|
34
|
+
|
|
35
|
+
gsub_file 'config/initializers/kaminari_config.rb', '# config.default_per_page = 25', 'config.default_per_page = 10'
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
def setup_db
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
class PostsController < ApplicationController
|
|
2
|
+
before_action :set_post, only: %i[ show edit update destroy ]
|
|
3
|
+
|
|
4
|
+
# GET /posts or /posts.json
|
|
5
|
+
def index
|
|
6
|
+
@posts = Post.page(params[:page])
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# GET /posts/1 or /posts/1.json
|
|
10
|
+
def show
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# GET /posts/new
|
|
14
|
+
def new
|
|
15
|
+
@post = Post.new
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# GET /posts/1/edit
|
|
19
|
+
def edit
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# POST /posts or /posts.json
|
|
23
|
+
def create
|
|
24
|
+
@post = Post.new(post_params)
|
|
25
|
+
|
|
26
|
+
respond_to do |format|
|
|
27
|
+
if @post.save
|
|
28
|
+
format.html { redirect_to post_url(@post), notice: "Post was successfully created." }
|
|
29
|
+
format.json { render :show, status: :created, location: @post }
|
|
30
|
+
else
|
|
31
|
+
format.html { render :new, status: :unprocessable_entity }
|
|
32
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# PATCH/PUT /posts/1 or /posts/1.json
|
|
38
|
+
def update
|
|
39
|
+
respond_to do |format|
|
|
40
|
+
if @post.update(post_params)
|
|
41
|
+
format.html { redirect_to post_url(@post), notice: "Post was successfully updated." }
|
|
42
|
+
format.json { render :show, status: :ok, location: @post }
|
|
43
|
+
else
|
|
44
|
+
format.html { render :edit, status: :unprocessable_entity }
|
|
45
|
+
format.json { render json: @post.errors, status: :unprocessable_entity }
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# DELETE /posts/1 or /posts/1.json
|
|
51
|
+
def destroy
|
|
52
|
+
@post.destroy
|
|
53
|
+
|
|
54
|
+
respond_to do |format|
|
|
55
|
+
format.html { redirect_to posts_url, notice: "Post was successfully destroyed." }
|
|
56
|
+
format.json { head :no_content }
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
# Use callbacks to share common setup or constraints between actions.
|
|
62
|
+
def set_post
|
|
63
|
+
@post = Post.find(params[:id])
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Only allow a list of trusted parameters through.
|
|
67
|
+
def post_params
|
|
68
|
+
params.require(:post).permit(:title, :body, :order)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
<h1>Kaminari</h1>
|
|
2
2
|
|
|
3
|
-
<p>
|
|
3
|
+
<p>Easily add pagination to your Ruby web apps</p>
|
|
4
|
+
|
|
5
|
+
<h2>Configuration for this example is located at</h2>
|
|
6
|
+
|
|
7
|
+
<pre><code>config/initializers/kaminari_config.rb</code></pre>
|
|
8
|
+
|
|
9
|
+
<pre><code><%= File.read("config/initializers/kaminari_config.rb") %></code></pre>
|
|
10
|
+
|
|
11
|
+
<h2>Run this template generator if you need to customize the pagination views</h2>
|
|
12
|
+
|
|
13
|
+
<pre><code>rails g kaminari:views default</code></pre>
|
|
14
|
+
|
|
15
|
+
<h3>List of files</h3>
|
|
16
|
+
|
|
17
|
+
<%= image_tag("kaminari-custom-views.png") %>
|
|
18
|
+
|
|
19
|
+
<h3>File details</h3>
|
|
20
|
+
|
|
21
|
+
<%= image_tag("kaminari-custom-views-detailed.png") %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<hr />
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<p style="color: green"><%= notice %></p>
|
|
2
|
+
|
|
3
|
+
<h1>Posts</h1>
|
|
4
|
+
|
|
5
|
+
<%= link_to "New post", new_post_path %>
|
|
6
|
+
|
|
7
|
+
<hr>
|
|
8
|
+
<%= paginate @posts %>
|
|
9
|
+
<hr>
|
|
10
|
+
|
|
11
|
+
<div id="posts">
|
|
12
|
+
<h1>Players List</h1>
|
|
13
|
+
<table>
|
|
14
|
+
<tr>
|
|
15
|
+
<th>Title</th>
|
|
16
|
+
<th>Body</th>
|
|
17
|
+
<th>Order</th>
|
|
18
|
+
<th></th>
|
|
19
|
+
</tr>
|
|
20
|
+
<% @posts.each do |post| %>
|
|
21
|
+
<tr>
|
|
22
|
+
<td><%=post.title %></td>
|
|
23
|
+
<td><%=post.body %></td><td>
|
|
24
|
+
<td><%=post.order %></td>
|
|
25
|
+
<td><%= link_to 'Show', post %></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<% end %>
|
|
28
|
+
</table>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<%= page_entries_info @posts %>
|
|
32
|
+
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# 10.times do |i|
|
|
6
|
-
# Post.create(title: "Post #{i}", body: "This is the body of post #{i}", user: User.all.sample)
|
|
7
|
-
# end
|
|
1
|
+
105.times do |i|
|
|
2
|
+
Post.create(title: "Post #{i}", body: Faker::Lorem.words(number: 5).join(' '), order: i)
|
|
3
|
+
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,
|
|
@@ -32,21 +32,23 @@
|
|
|
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": true,
|
|
36
|
+
"add_avo": true,
|
|
37
37
|
"add_bcrypt": false,
|
|
38
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": true,
|
|
43
43
|
"add_devise_masquerade": false,
|
|
44
44
|
"add_dotenv": false,
|
|
45
|
-
"add_faker":
|
|
45
|
+
"add_faker": true,
|
|
46
46
|
"add_groupdate": false,
|
|
47
47
|
"add_hexapdf": false,
|
|
48
48
|
"add_httparty": false,
|
|
49
49
|
"add_honeybadger": false,
|
|
50
|
+
"add_image_processing": true,
|
|
51
|
+
"add_kaminari": false,
|
|
50
52
|
"add_lograge": false,
|
|
51
53
|
"add_minimal_css": true,
|
|
52
54
|
"minimal_css_library": "water.css",
|
|
@@ -56,10 +58,11 @@
|
|
|
56
58
|
"add_pretender": false,
|
|
57
59
|
"add_public_suffix": false,
|
|
58
60
|
"add_rails_html_sanitizer": false,
|
|
61
|
+
"add_ransack": true,
|
|
59
62
|
"add_redcarpet": false,
|
|
60
63
|
"add_rolify": false,
|
|
61
|
-
"add_rubocop":
|
|
64
|
+
"add_rubocop": true,
|
|
62
65
|
"add_twilio_ruby": false,
|
|
63
|
-
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/
|
|
66
|
+
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb"
|
|
64
67
|
}
|
|
65
68
|
}
|
|
@@ -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,8 +6,8 @@
|
|
|
6
6
|
"pretend": false,
|
|
7
7
|
"quiet": false,
|
|
8
8
|
"skip": false,
|
|
9
|
-
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/
|
|
10
|
-
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/
|
|
9
|
+
"ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
|
|
10
|
+
"template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb",
|
|
11
11
|
"database": "sqlite3",
|
|
12
12
|
"skip_git": true,
|
|
13
13
|
"skip_keeps": false,
|
|
@@ -42,21 +42,23 @@
|
|
|
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": true,
|
|
46
|
+
"add_avo": true,
|
|
47
47
|
"add_bcrypt": false,
|
|
48
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": true,
|
|
53
53
|
"add_devise_masquerade": false,
|
|
54
54
|
"add_dotenv": false,
|
|
55
|
-
"add_faker":
|
|
55
|
+
"add_faker": true,
|
|
56
56
|
"add_groupdate": false,
|
|
57
57
|
"add_hexapdf": false,
|
|
58
58
|
"add_httparty": false,
|
|
59
59
|
"add_honeybadger": false,
|
|
60
|
+
"add_image_processing": true,
|
|
61
|
+
"add_kaminari": false,
|
|
60
62
|
"add_lograge": false,
|
|
61
63
|
"add_minimal_css": true,
|
|
62
64
|
"minimal_css_library": "water.css",
|
|
@@ -66,9 +68,10 @@
|
|
|
66
68
|
"add_pretender": false,
|
|
67
69
|
"add_public_suffix": false,
|
|
68
70
|
"add_rails_html_sanitizer": false,
|
|
71
|
+
"add_ransack": true,
|
|
69
72
|
"add_redcarpet": false,
|
|
70
73
|
"add_rolify": false,
|
|
71
|
-
"add_rubocop":
|
|
74
|
+
"add_rubocop": true,
|
|
72
75
|
"add_twilio_ruby": false
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -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,21 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module RailsAppGenerator
|
|
4
|
+
# Custom add-ons for RailsAppGenerator
|
|
5
|
+
module AddOns
|
|
6
|
+
# Add ImageProcessing to rails application
|
|
7
|
+
class ImageProcessing < RailsAppGenerator::Addon
|
|
8
|
+
required_gem gem.version('image_processing', '1.12.2', '')
|
|
9
|
+
|
|
10
|
+
def apply
|
|
11
|
+
say 'Setting up ImageProcessing'
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def before_template; end
|
|
15
|
+
|
|
16
|
+
def before_bundle; end
|
|
17
|
+
|
|
18
|
+
def after_bundle; end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -8,14 +8,8 @@ module RailsAppGenerator
|
|
|
8
8
|
required_gem gem.version('kaminari', '1.2.2', 'Easily add pagination to your Ruby web apps')
|
|
9
9
|
|
|
10
10
|
def apply
|
|
11
|
-
|
|
11
|
+
generate('kaminari:config')
|
|
12
12
|
end
|
|
13
|
-
|
|
14
|
-
def before_template; end
|
|
15
|
-
|
|
16
|
-
def before_bundle; end
|
|
17
|
-
|
|
18
|
-
def after_bundle; end
|
|
19
13
|
end
|
|
20
14
|
end
|
|
21
15
|
end
|
|
@@ -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,6 +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
|
|
194
|
+
add_if(:image_processing) # TODO: needs testing
|
|
195
|
+
# https://github.com/collectiveidea/interactor
|
|
193
196
|
add_if(:kaminari) # tested
|
|
194
197
|
add_if(:lograge) # tested
|
|
195
198
|
add_if(:minimal_css) # tested (this is NOT a GEM)
|
|
@@ -206,6 +209,7 @@ module RailsAppGenerator
|
|
|
206
209
|
add_if(:services) # TODO: needs testing
|
|
207
210
|
add_if(:shoulda) # TODO: needs testing
|
|
208
211
|
add_if(:sidekiq) # TODO: needs testing
|
|
212
|
+
add_if(:ransack) # TODO: needs testing
|
|
209
213
|
add_if(:rubocop) # tested
|
|
210
214
|
add_if(:twilio_ruby) # tested
|
|
211
215
|
add(:views, :errors, :scaffold) if active?(:views)
|
|
@@ -269,6 +273,10 @@ module RailsAppGenerator
|
|
|
269
273
|
generate(:scaffold, name, *args)
|
|
270
274
|
end
|
|
271
275
|
|
|
276
|
+
def add_scaffold_controller(name, *args)
|
|
277
|
+
generate(:scaffold_controller, name, *args)
|
|
278
|
+
end
|
|
279
|
+
|
|
272
280
|
def add_migration(name, *args)
|
|
273
281
|
generate(:migration, name, *args)
|
|
274
282
|
end
|
|
@@ -125,6 +125,7 @@ KConfig.configure do |config|
|
|
|
125
125
|
rag.add_option :add_httparty , type: :boolean, default: false
|
|
126
126
|
# high_voltage
|
|
127
127
|
rag.add_option :add_honeybadger , type: :boolean, default: false
|
|
128
|
+
rag.add_option :add_image_processing , type: :boolean, default: false
|
|
128
129
|
rag.add_option :add_kaminari , type: :boolean, default: false
|
|
129
130
|
rag.add_option :add_lograge , type: :boolean, default: false
|
|
130
131
|
rag.add_option :add_minimal_css , type: :boolean, default: false
|
|
@@ -137,7 +138,7 @@ KConfig.configure do |config|
|
|
|
137
138
|
# pundit
|
|
138
139
|
rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
|
|
139
140
|
# rails_app_generator
|
|
140
|
-
|
|
141
|
+
rag.add_option :add_ransack , type: :boolean, default: false
|
|
141
142
|
rag.add_option :add_redcarpet , type: :boolean, default: false
|
|
142
143
|
rag.add_option :add_rolify , type: :boolean, default: false
|
|
143
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,11 +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,
|
|
15
|
+
"add_image_processing": true,
|
|
16
|
+
"add_ransack": true,
|
|
14
17
|
"add_rubocop": true
|
|
15
18
|
}
|
|
16
19
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<hr />
|
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
|
|
@@ -314,11 +323,15 @@ files:
|
|
|
314
323
|
- after_templates/addons/httparty/app/views/layouts/_navbar.html.erb
|
|
315
324
|
- after_templates/addons/httparty/app/views/layouts/application.html.erb
|
|
316
325
|
- after_templates/addons/kaminari/_.rb
|
|
326
|
+
- after_templates/addons/kaminari/app/assets/images/kaminari-custom-views-detailed.png
|
|
327
|
+
- after_templates/addons/kaminari/app/assets/images/kaminari-custom-views.png
|
|
317
328
|
- after_templates/addons/kaminari/app/controllers/home_controller.rb
|
|
329
|
+
- after_templates/addons/kaminari/app/controllers/posts_controller.rb
|
|
318
330
|
- after_templates/addons/kaminari/app/views/home/index.html.erb
|
|
319
331
|
- after_templates/addons/kaminari/app/views/layouts/_footer.html.erb
|
|
320
332
|
- after_templates/addons/kaminari/app/views/layouts/_navbar.html.erb
|
|
321
333
|
- after_templates/addons/kaminari/app/views/layouts/application.html.erb
|
|
334
|
+
- after_templates/addons/kaminari/app/views/posts/index.html.erb
|
|
322
335
|
- after_templates/addons/kaminari/db/seeds.rb
|
|
323
336
|
- after_templates/addons/lograge/_.rb
|
|
324
337
|
- after_templates/addons/lograge/app/controllers/home_controller.rb
|
|
@@ -639,6 +652,7 @@ files:
|
|
|
639
652
|
- lib/rails_app_generator/addons/high_voltage.rb
|
|
640
653
|
- lib/rails_app_generator/addons/honeybadger.rb
|
|
641
654
|
- lib/rails_app_generator/addons/httparty.rb
|
|
655
|
+
- lib/rails_app_generator/addons/image_processing.rb
|
|
642
656
|
- lib/rails_app_generator/addons/inline_svg.rb
|
|
643
657
|
- lib/rails_app_generator/addons/irbrc.rb
|
|
644
658
|
- lib/rails_app_generator/addons/kaminari.rb
|
|
@@ -651,6 +665,7 @@ files:
|
|
|
651
665
|
- lib/rails_app_generator/addons/public_suffix.rb
|
|
652
666
|
- lib/rails_app_generator/addons/pundit.rb
|
|
653
667
|
- lib/rails_app_generator/addons/rails_html_sanitizer.rb
|
|
668
|
+
- lib/rails_app_generator/addons/ransack.rb
|
|
654
669
|
- lib/rails_app_generator/addons/redcarpet.rb
|
|
655
670
|
- lib/rails_app_generator/addons/rolify.rb
|
|
656
671
|
- lib/rails_app_generator/addons/rspec.rb
|