rails_app_generator 0.2.34 → 0.2.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -0
  3. data/after_templates/addons/avo/_.rb +38 -22
  4. data/after_templates/addons/avo/app/avo/dashboards/dashboard.rb +12 -0
  5. data/after_templates/addons/avo/app/avo/resources/category_resource.rb +27 -0
  6. data/after_templates/addons/avo/app/avo/resources/post_resource.rb +25 -0
  7. data/after_templates/addons/avo/app/avo/resources/user_resource.rb +23 -0
  8. data/after_templates/addons/avo/app/controllers/home_controller.rb +4 -0
  9. data/after_templates/addons/avo/app/models/category.rb +7 -0
  10. data/after_templates/addons/avo/app/models/post.rb +9 -0
  11. data/after_templates/addons/avo/app/views/home/index.html.erb +1 -1
  12. data/after_templates/addons/avo/app/views/home/quick_signin.html.erb +3 -0
  13. data/after_templates/addons/avo/app/views/layouts/_footer.html.erb +0 -3
  14. data/after_templates/addons/avo/app/views/layouts/_navbar.html.erb +13 -8
  15. data/after_templates/addons/avo/app/views/layouts/application.html.erb +15 -2
  16. data/after_templates/addons/avo/config/initializers/avo.rb +105 -0
  17. data/after_templates/addons/avo/config/locales/en.yml +4 -0
  18. data/after_templates/addons/avo/db/seeds.rb +69 -12
  19. data/docs/last_run/app_generator_class.json +17 -1
  20. data/docs/last_run/app_generator_data.json +9 -7
  21. data/docs/last_run/rails_options_class.json +17 -1
  22. data/docs/last_run/rails_options_data.json +9 -7
  23. data/lib/rails_app_generator/addons/avo.rb +8 -0
  24. data/lib/rails_app_generator/addons/friendly_id.rb +15 -0
  25. data/lib/rails_app_generator/addons/image_processing.rb +21 -0
  26. data/lib/rails_app_generator/addons/ransack.rb +34 -0
  27. data/lib/rails_app_generator/app_generator.rb +9 -0
  28. data/lib/rails_app_generator/rag_initializer.rb +3 -1
  29. data/lib/rails_app_generator/version.rb +1 -1
  30. data/package-lock.json +2 -2
  31. data/package.json +1 -1
  32. data/profiles/addons/avo.json +3 -0
  33. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b3d7a66cf0c689a6ae83cdf1bf1222b0027b26b71099970c1e1025d04abb86e
4
- data.tar.gz: 51a7736f7d181418b5385f72922d53ea4762e445f18946ca467e40ab9b41ae96
3
+ metadata.gz: 2f4ca958feef477475984a4ba7c07c2bacca73ab9e08c3bfa6159230b9e5da13
4
+ data.tar.gz: d0d6cb5bdfbcc3cf808e99f6d28e55752353ac359981495684f63c373e1002f7
5
5
  SHA512:
6
- metadata.gz: d354a5e6692cab7168c879df4c44824b171c97a5699e3a5416f067ed0a40ee2910ad2cbf0e74a25ac94ac229d859a01dcf92f4689023405a352260cc2bf3258c
7
- data.tar.gz: 9c65703baf6aef3a6c224c936a29847e5ba960ab9a0e7a86aa5620f9910801d7b8f6c1a69df9d8411555e274a597b181dd257bf485cb73b174be3a6a345a4e20
6
+ metadata.gz: 9fe692be0b91354f45d868b6e5180110547895fb812dd01470babd91d1282f06e33abc615d9b332ba0ae0c5ed8d04da6fc6d73db280e5031f246eb4ef239b6ca
7
+ data.tar.gz: 03b60799b0a908b6cbc54dd354cd8a58f4ae0f56d276359080f9482ce27e6cab675bba980218366136d48c5dc561b8e0767e0aad89a394e058b037d497d911e2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [0.2.36](https://github.com/klueless-io/rails_app_generator/compare/v0.2.35...v0.2.36) (2022-08-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update avo profile ([f02ee7f](https://github.com/klueless-io/rails_app_generator/commit/f02ee7f7e6e5e25842a023f210674d9602edfe58))
7
+
8
+ ## [0.2.35](https://github.com/klueless-io/rails_app_generator/compare/v0.2.34...v0.2.35) (2022-08-20)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add image-processing addon ([3466708](https://github.com/klueless-io/rails_app_generator/commit/3466708e66cfc8da487f619f77516f863ef5cb46))
14
+
15
+ ## [0.2.34](https://github.com/klueless-io/rails_app_generator/compare/v0.2.33...v0.2.34) (2022-08-19)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add kaminari profile ([f9b044b](https://github.com/klueless-io/rails_app_generator/commit/f9b044b6e718fdfa851562ea7d4ddab39066d0de))
21
+
1
22
  ## [0.2.33](https://github.com/klueless-io/rails_app_generator/compare/v0.2.32...v0.2.33) (2022-08-19)
2
23
 
3
24
 
@@ -4,7 +4,8 @@
4
4
  #
5
5
  # exe/rag addons/avo
6
6
  #
7
- # based on: https://www.youtube.com/watch?v=WgNK-oINFww
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
- add_scaffold('author', 'name:string', 'email:string', 'bio:text')
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
- generate('avo:resource Product')
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,4 +1,8 @@
1
1
  class HomeController < ApplicationController
2
2
  def index
3
3
  end
4
+
5
+ def quick_signin
6
+ sign_in(:user, User.first)
7
+ end
4
8
  end
@@ -0,0 +1,7 @@
1
+ class Category < ApplicationRecord
2
+ has_many :posts
3
+
4
+ def excerpt
5
+ ActionView::Base.full_sanitizer.sanitize(description).truncate(100)
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ class Post < ApplicationRecord
2
+ belongs_to :author, class_name: 'User', foreign_key: :user_id
3
+ belongs_to :category
4
+
5
+ # tutorial: https://youtu.be/WgNK-oINFww?t=209
6
+ def excerpt
7
+ ActionView::Base.full_sanitizer.sanitize(content).truncate(100)
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
- <h1>Avo</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>
@@ -0,0 +1,3 @@
1
+ <h1>Quick SignIn</h1>
2
+
3
+ <p>You are signed in as: <b><%= current_user.email %></b></p>
@@ -1,3 +0,0 @@
1
- <footer>
2
- <hr />
3
- </footer>
@@ -1,8 +1,13 @@
1
- <header>
2
- <%= link_to 'Home', root_path %> |
3
- <%= link_to 'Authors', authors_path %> |
4
- <%= link_to 'Posts', posts_path %> |
5
- <%= link_to 'Products', products_path %> |
6
- <%= link_to 'ADMIN', avo_path %>
7
- <hr />
8
- </header>
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
- <%%= render 'layouts/navbar' %>
25
+ <header>
26
+ <%%= render 'layouts/navbar' %>
27
+ </header>
28
+ <hr>
18
29
  <main>
19
30
  <%%= yield %>
20
31
  </main>
21
- <%%= render 'layouts/footer' %>
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
@@ -0,0 +1,4 @@
1
+ en:
2
+ application_name: "AVO Sample Application"
3
+ admin:
4
+ external_links: 'External Links'
@@ -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
- 60.times do
112
- Author.create!(name: Faker::Name.name, bio: Faker::Lorem.words(number: 5).join(' '), email: Faker::Internet.email)
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
- 100.times do |i|
174
+ 40.times do
120
175
  Post.create!(title: fake_title,
121
- content: "This is the body of post #{i}",
176
+ content: Faker::Lorem.sentences(number: 5).join('<br />'),
122
177
  published: Faker::Boolean.boolean(true_ratio: 0.6),
123
- author: Author.all.sample)
178
+ category: Category.all.sample,
179
+ author: User.all.sample)
124
180
  end
125
181
 
126
- 200.times do
127
- Product.create!(
128
- name: Faker::Name.name,
129
- quantity: Faker::Number.number(digits: 2),
130
- price: Faker::Number.decimal(l_digits: 4)
131
- )
132
- end
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/2.7.6/bin/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/2.7.6/bin/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,14 +32,14 @@
32
32
  "test": "rspec",
33
33
  "add_acts_as_list": false,
34
34
  "add_administrate": false,
35
- "add_annotate": false,
36
- "add_avo": false,
35
+ "add_annotate": true,
36
+ "add_avo": true,
37
37
  "add_bcrypt": false,
38
38
  "add_brakeman": false,
39
39
  "add_browser": false,
40
40
  "add_bundler_audit": false,
41
41
  "add_chartkick": false,
42
- "add_devise": false,
42
+ "add_devise": true,
43
43
  "add_devise_masquerade": false,
44
44
  "add_dotenv": false,
45
45
  "add_faker": true,
@@ -47,7 +47,8 @@
47
47
  "add_hexapdf": false,
48
48
  "add_httparty": false,
49
49
  "add_honeybadger": false,
50
- "add_kaminari": true,
50
+ "add_image_processing": true,
51
+ "add_kaminari": false,
51
52
  "add_lograge": false,
52
53
  "add_minimal_css": true,
53
54
  "minimal_css_library": "water.css",
@@ -57,10 +58,11 @@
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
- "add_rubocop": false,
64
+ "add_rubocop": true,
63
65
  "add_twilio_ruby": false,
64
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/kaminari/_.rb"
66
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/avo/_.rb"
65
67
  }
66
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/2.7.6/bin/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/2.7.6/bin/ruby",
10
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/kaminari/_.rb",
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,14 +42,14 @@
42
42
  "test": "rspec",
43
43
  "add_acts_as_list": false,
44
44
  "add_administrate": false,
45
- "add_annotate": false,
46
- "add_avo": false,
45
+ "add_annotate": true,
46
+ "add_avo": true,
47
47
  "add_bcrypt": false,
48
48
  "add_brakeman": false,
49
49
  "add_browser": false,
50
50
  "add_bundler_audit": false,
51
51
  "add_chartkick": false,
52
- "add_devise": false,
52
+ "add_devise": true,
53
53
  "add_devise_masquerade": false,
54
54
  "add_dotenv": false,
55
55
  "add_faker": true,
@@ -57,7 +57,8 @@
57
57
  "add_hexapdf": false,
58
58
  "add_httparty": false,
59
59
  "add_honeybadger": false,
60
- "add_kaminari": true,
60
+ "add_image_processing": true,
61
+ "add_kaminari": false,
61
62
  "add_lograge": false,
62
63
  "add_minimal_css": true,
63
64
  "minimal_css_library": "water.css",
@@ -67,9 +68,10 @@
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
- "add_rubocop": false,
74
+ "add_rubocop": true,
73
75
  "add_twilio_ruby": false
74
76
  }
75
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,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsAppGenerator
4
+ # Custom add-ons for RailsAppGenerator
5
+ module AddOns
6
+ # Add FriendlyId to rails application
7
+ class FriendlyId < RailsAppGenerator::Addon
8
+ required_gem gem.version('friendly_id', '5.4.2', '')
9
+
10
+ def apply
11
+ generate('friendly_id')
12
+ end
13
+ end
14
+ end
15
+ end
@@ -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
@@ -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
@@ -184,12 +185,15 @@ module RailsAppGenerator
184
185
  add_if(:dotenv) # tested
185
186
  add_if(:factory_bot) # TODO: needs testing
186
187
  add_if(:faker) # tested
188
+ add_if(:friendly_id) # tested
187
189
  add_if(:generators) # TODO: needs testing
188
190
  add_if(:groupdate) # TODO: does not have a profile
189
191
  add_if(:hexapdf) # tested
190
192
  add_if(:httparty) # tested
191
193
  add_if(:high_voltage) # TODO: needs testing
192
194
  add_if(:honeybadger) # tested
195
+ add_if(:image_processing) # TODO: needs testing
196
+ # https://github.com/collectiveidea/interactor
193
197
  add_if(:kaminari) # tested
194
198
  add_if(:lograge) # tested
195
199
  add_if(:minimal_css) # tested (this is NOT a GEM)
@@ -206,6 +210,7 @@ module RailsAppGenerator
206
210
  add_if(:services) # TODO: needs testing
207
211
  add_if(:shoulda) # TODO: needs testing
208
212
  add_if(:sidekiq) # TODO: needs testing
213
+ add_if(:ransack) # TODO: needs testing
209
214
  add_if(:rubocop) # tested
210
215
  add_if(:twilio_ruby) # tested
211
216
  add(:views, :errors, :scaffold) if active?(:views)
@@ -269,6 +274,10 @@ module RailsAppGenerator
269
274
  generate(:scaffold, name, *args)
270
275
  end
271
276
 
277
+ def add_scaffold_controller(name, *args)
278
+ generate(:scaffold_controller, name, *args)
279
+ end
280
+
272
281
  def add_migration(name, *args)
273
282
  generate(:migration, name, *args)
274
283
  end
@@ -119,12 +119,14 @@ KConfig.configure do |config|
119
119
  rag.add_option :add_dotenv , type: :boolean, default: false
120
120
  # factory_bot
121
121
  rag.add_option :add_faker , type: :boolean, default: false
122
+ rag.add_option :add_friendly_id , type: :boolean, default: false
122
123
  # generators
123
124
  rag.add_option :add_groupdate , type: :boolean, default: false
124
125
  rag.add_option :add_hexapdf , type: :boolean, default: false
125
126
  rag.add_option :add_httparty , type: :boolean, default: false
126
127
  # high_voltage
127
128
  rag.add_option :add_honeybadger , type: :boolean, default: false
129
+ rag.add_option :add_image_processing , type: :boolean, default: false
128
130
  rag.add_option :add_kaminari , type: :boolean, default: false
129
131
  rag.add_option :add_lograge , type: :boolean, default: false
130
132
  rag.add_option :add_minimal_css , type: :boolean, default: false
@@ -137,7 +139,7 @@ KConfig.configure do |config|
137
139
  # pundit
138
140
  rag.add_option :add_rails_html_sanitizer , type: :boolean, default: false
139
141
  # rails_app_generator
140
- # RANSACK
142
+ rag.add_option :add_ransack , type: :boolean, default: false
141
143
  rag.add_option :add_redcarpet , type: :boolean, default: false
142
144
  rag.add_option :add_rolify , type: :boolean, default: false
143
145
  # services
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.2.34'
4
+ VERSION = '0.2.37'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.2.34",
3
+ "version": "0.2.37",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.2.34",
9
+ "version": "0.2.37",
10
10
  "dependencies": {
11
11
  "daisyui": "^2.20.0"
12
12
  },
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.2.34",
3
+ "version": "0.2.37",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -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
  }
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.34
4
+ version: 0.2.37
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-19 00:00:00.000000000 Z
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
@@ -637,12 +646,14 @@ files:
637
646
  - lib/rails_app_generator/addons/factory_bot.rb
638
647
  - lib/rails_app_generator/addons/faker.rb
639
648
  - lib/rails_app_generator/addons/foreman.rb
649
+ - lib/rails_app_generator/addons/friendly_id.rb
640
650
  - lib/rails_app_generator/addons/generators.rb
641
651
  - lib/rails_app_generator/addons/groupdate.rb
642
652
  - lib/rails_app_generator/addons/hexapdf.rb
643
653
  - lib/rails_app_generator/addons/high_voltage.rb
644
654
  - lib/rails_app_generator/addons/honeybadger.rb
645
655
  - lib/rails_app_generator/addons/httparty.rb
656
+ - lib/rails_app_generator/addons/image_processing.rb
646
657
  - lib/rails_app_generator/addons/inline_svg.rb
647
658
  - lib/rails_app_generator/addons/irbrc.rb
648
659
  - lib/rails_app_generator/addons/kaminari.rb
@@ -655,6 +666,7 @@ files:
655
666
  - lib/rails_app_generator/addons/public_suffix.rb
656
667
  - lib/rails_app_generator/addons/pundit.rb
657
668
  - lib/rails_app_generator/addons/rails_html_sanitizer.rb
669
+ - lib/rails_app_generator/addons/ransack.rb
658
670
  - lib/rails_app_generator/addons/redcarpet.rb
659
671
  - lib/rails_app_generator/addons/rolify.rb
660
672
  - lib/rails_app_generator/addons/rspec.rb