rails_app_generator 0.3.3 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/after_templates/addons/view_component/_.rb +57 -0
  4. data/after_templates/addons/view_component/app/components/price_card_component.html.erb +24 -0
  5. data/after_templates/addons/view_component/app/components/price_card_component.rb +13 -0
  6. data/after_templates/addons/view_component/app/components/price_chart_component.html.erb +12 -0
  7. data/after_templates/addons/view_component/app/components/price_chart_component.rb +20 -0
  8. data/after_templates/addons/view_component/app/controllers/home_controller.rb +55 -0
  9. data/after_templates/addons/view_component/app/services/seed_service.rb +31 -0
  10. data/after_templates/addons/view_component/app/views/home/_price_card.html.erb +25 -0
  11. data/after_templates/addons/view_component/app/views/home/_price_container.html.erb +13 -0
  12. data/after_templates/addons/view_component/app/views/home/component.html.erb +8 -0
  13. data/after_templates/addons/view_component/app/views/home/index.html.erb +206 -0
  14. data/after_templates/addons/view_component/app/views/home/partial.html.erb +6 -0
  15. data/after_templates/addons/view_component/app/views/layouts/_footer.html.erb +0 -0
  16. data/after_templates/addons/view_component/app/views/layouts/_navbar.html.erb +4 -0
  17. data/after_templates/addons/view_component/app/views/layouts/application.html.erb +29 -0
  18. data/docs/last_run/app_generator_class.json +9 -1
  19. data/docs/last_run/app_generator_data.json +9 -7
  20. data/docs/last_run/rails_options_class.json +9 -1
  21. data/docs/last_run/rails_options_data.json +9 -8
  22. data/lib/rails_app_generator/addons/view_component.rb +11 -0
  23. data/lib/rails_app_generator/app_generator.rb +1 -0
  24. data/lib/rails_app_generator/rag_initializer.rb +1 -0
  25. data/lib/rails_app_generator/version.rb +1 -1
  26. data/package-lock.json +2 -2
  27. data/package.json +1 -1
  28. data/profiles/addons/view_component.json +18 -0
  29. metadata +19 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7ceb2efc08d6f164b434c85b95ad2f33648e545d7482fd78ec3678aa50c91b11
4
- data.tar.gz: d8380a66709a7907f26cf22db768c714e32cb9058e336207fd19b9f64e76b17f
3
+ metadata.gz: 8163ec9479b6d60bf7d1f73d82d0a5d155553bd166544ff80feb1c245e1ce855
4
+ data.tar.gz: 2d45e9e75b0bb8ef09f05f7accf8c38bbb57a7d1b93c6fe681c3b4e38dbfed08
5
5
  SHA512:
6
- metadata.gz: f77a3033aa8900f2f13c7324c864d74acaee2dd3159f47c476f2ff4c7ed5b1ca50f7f8a2c3ef5dd8fdee2199663f1d7afd634d43f655ea9a3b287c39f9d77d87
7
- data.tar.gz: 267b51005953b88b77f692ab24693a49b494c66f774f0e0afa0cd7d93613d21694164e17a3b0d7e4a7c9eb1c39d704b924c9b11b67379e8c3f41d57028098ecd
6
+ metadata.gz: d32f8265a920592a8c13d4130dce8f44befb2af711ebe7b3887642164c75eceb1c580654c895b555397cf9764fdc35f21bae7cb643c704778c4e1ee475155e40
7
+ data.tar.gz: 86e6a79242935878f8887dabd985ad825668fbadc5da49631e116d771d70313d1b0f8f33b36cb95d1c165c0d1afd26d1f0652f19ab2912a778571116de927b78
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [0.3.4](https://github.com/klueless-io/rails_app_generator/compare/v0.3.3...v0.3.4) (2022-10-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * update view_component profile ([218126a](https://github.com/klueless-io/rails_app_generator/commit/218126af5df49d1c2b4b05ad99ee8e8c97ee6fb1))
7
+
8
+ ## [0.3.3](https://github.com/klueless-io/rails_app_generator/compare/v0.3.2...v0.3.3) (2022-10-05)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * update factory_bot profile ([f782f42](https://github.com/klueless-io/rails_app_generator/commit/f782f424fdfb90b5f7634e6ff12985ef10cdbdf5))
14
+
1
15
  ## [0.3.2](https://github.com/klueless-io/rails_app_generator/compare/v0.3.1...v0.3.2) (2022-09-11)
2
16
 
3
17
 
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A framework for building reusable, testable & encapsulated view components in Ruby on Rails.
4
+ #
5
+ # exe/rag addons/view_component
6
+
7
+ self.local_template_path = File.dirname(__FILE__)
8
+
9
+ gac 'base rails 7 image created'
10
+
11
+ prepare_environment
12
+
13
+ after_bundle do
14
+ create_db
15
+ scaffolds
16
+ setup_customizations
17
+ migrate_db
18
+ end
19
+
20
+ def scaffolds
21
+ # add_scaffold('post', 'title', 'body:text', 'user:references')
22
+ # add_scaffold('people', 'first_name', 'last_name', 'age:integer', 'address:text')
23
+ # add_scaffold('product', 'name', 'price:integer')
24
+ end
25
+
26
+ def setup_customizations
27
+ route("root 'home#index'")
28
+
29
+ force_copy
30
+
31
+ add_controller('home', 'index', 'partial', 'component')
32
+
33
+ directory "app/controllers"
34
+ directory "app/models"
35
+ directory "app/views"
36
+ template 'app/views/layouts/application.html.erb' , 'app/views/layouts/application.html.erb'
37
+ directory "app/services"
38
+ end
39
+
40
+ def create_db
41
+ # uncomment this if you need custom configuration in database.yml
42
+ # gsub_file('config/database.yml', ' encoding: unicode', db_development_settings)
43
+ db(drop: true, create: true)
44
+ end
45
+
46
+ def migrate_db
47
+ db(migrate: true)
48
+ end
49
+
50
+ def db_development_settings
51
+ <<-'RUBY'
52
+ encoding: unicode
53
+ host: 127.0.0.1
54
+ username: printspeak
55
+ password: printspeak
56
+ RUBY
57
+ end
@@ -0,0 +1,24 @@
1
+ <div class="<%= card_class %>">
2
+ <div class="p-6">
3
+ <h2 class="text-lg font-medium leading-6 text-gray-900"><%= card.heading %></h2>
4
+ <p class="mt-4 text-sm text-gray-500"><%= card.description %></p>
5
+ <p class="mt-8">
6
+ <span class="text-4xl font-bold tracking-tight text-gray-900"><%= card.price %></span>
7
+ <span class="text-base font-medium text-gray-500">/mo</span>
8
+ </p>
9
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Hobby</a>
10
+ </div>
11
+ <div class="px-6 pt-6 pb-8">
12
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
13
+ <ul role="list" class="mt-6 space-y-4">
14
+ <% card.items.each do |item| %>
15
+ <li class="<flex space-x-3>">
16
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
17
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
18
+ </svg>
19
+ <span class="text-sm text-gray-500"><%= item %></span>
20
+ </li>
21
+ <% end %>
22
+ </ul>
23
+ </div>
24
+ </div>
@@ -0,0 +1,13 @@
1
+ class PriceCardComponent < ViewComponent::Base
2
+ attr_reader :card
3
+
4
+ def initialize(card)
5
+ @card = card
6
+ super
7
+ end
8
+
9
+ def card_class
10
+ highlight = card.highlight == true ? 'border-7 border-red-500' : 'border-gray-200'
11
+ "divide-y divide-gray-200 rounded-lg border border-7 shadow-sm#{highlight}"
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ <div class="bg-white">
2
+ <div class="mx-auto max-w-7xl py-24 px-4 sm:px-6 lg:px-8">
3
+ <div class="sm:align-center sm:flex sm:flex-col">
4
+ <h1 class="text-5xl font-bold tracking-tight text-gray-900 sm:text-center"><%= @chart.title %></h1>
5
+ </div>
6
+ <div class="<%= card_list_class %>">
7
+ <% @chart.cards.each do |card| %>
8
+ <%= render PriceCardComponent.new(card) %>
9
+ <% end %>
10
+ </div>
11
+ </div>
12
+ </div>
@@ -0,0 +1,20 @@
1
+ class PriceChartComponent < ViewComponent::Base
2
+
3
+ CARDS_TWO = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2'
4
+ CARDS_ODD = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-3 xl:mx-0 xl:max-w-none xl:grid-cols-3'
5
+ CARDS_EVEN = 'mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-1 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl lg:max-w-none lg:grid-cols-2 xl:mx-0 xl:max-w-none xl:grid-cols-4'
6
+
7
+ def initialize(chart)
8
+ @chart = chart
9
+
10
+ @chart.title = 'Pricing Plans' if @chart.title.nil?
11
+ super
12
+ end
13
+
14
+ def card_list_class
15
+ return CARDS_TWO if @chart.cards.length == 2
16
+ return CARDS_ODD if @chart.cards.length.odd?
17
+
18
+ CARDS_EVEN
19
+ end
20
+ end
@@ -0,0 +1,55 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+
5
+ def component
6
+ @pricing_data1 = pricing_data_poro
7
+ @pricing_data1.title = nil # let the component set a default title
8
+
9
+ @pricing_data2 = pricing_data_poro(3)
10
+ @pricing_data2.cards[1].highlight = true # highlight the second card
11
+
12
+ @pricing_data3 = pricing_data_poro(2)
13
+ @pricing_data3.title = 'Only 2 Plans'
14
+ end
15
+
16
+ private
17
+
18
+ def pricing_data_poro(take_cards = nil)
19
+ data = pricing_data
20
+ data[:cards] = data[:cards].take(take_cards) if take_cards
21
+ # OpenStruct is not a good practice: But this makes the HASH and feel like a PORO model
22
+ JSON.parse(data.to_json, object_class: OpenStruct)
23
+ end
24
+
25
+ def pricing_data
26
+ {
27
+ title: 'Pricing Plans via Components',
28
+ cards: [
29
+ {
30
+ price: '$12',
31
+ heading: 'Hobby',
32
+ description: 'All the basics for having fun and make a few bucks',
33
+ items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.']
34
+ },
35
+ {
36
+ price: '$24',
37
+ heading: 'Freelancer',
38
+ description: 'All the basics for starting a new business',
39
+ items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.']
40
+ },
41
+ {
42
+ price: '$32',
43
+ heading: 'Startup',
44
+ description: 'What you need to starting building an empire',
45
+ items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.', 'Faucibus volutpat magna.'] },
46
+ {
47
+ price: '$48',
48
+ heading: 'Enterprise',
49
+ description: 'Scalability and reliablity for your business',
50
+ items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.', 'Faucibus volutpat magna.', 'Id sed tellus in varius quisque.', 'Risus egestas faucibus.', 'Risus cursus ullamcorper.']
51
+ }
52
+ ]
53
+ }
54
+ end
55
+ end
@@ -0,0 +1,31 @@
1
+ class SeedService
2
+ class << self
3
+ def seed(variant: :reset)
4
+ service = SeedService.new
5
+ service.call(variant: variant)
6
+ end
7
+ end
8
+
9
+ def call(variant: :reset)
10
+ reset if variant == :reset
11
+ refresh if variant == :refresh
12
+ create
13
+ end
14
+
15
+ private
16
+
17
+ def reset
18
+ # Person.delete_all
19
+ # Post.delete_all
20
+ # Project.delete_all
21
+ end
22
+
23
+ def refresh
24
+ end
25
+
26
+ def create
27
+ # FactoryBot.create_list(:post, rand(10..20))
28
+ # FactoryBot.create_list(:person, rand(10..20))
29
+ # FactoryBot.create_list(:project, rand(10..20))
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
2
+ <div class="p-6">
3
+ <h2 class="text-lg font-medium leading-6 text-gray-900"><%= locals[:heading] %></h2>
4
+ <p class="mt-4 text-sm text-gray-500"><%= locals[:description] %></p>
5
+ <p class="mt-8">
6
+ <span class="text-4xl font-bold tracking-tight text-gray-900"><%=locals[:price] %></span>
7
+ <span class="text-base font-medium text-gray-500">/mo</span>
8
+ </p>
9
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Hobby</a>
10
+ </div>
11
+ <div class="px-6 pt-6 pb-8">
12
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
13
+ <ul role="list" class="mt-6 space-y-4">
14
+ <%# Loop through items %>
15
+ <% locals[:items].each do |item| %>
16
+ <li class="flex space-x-3">
17
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
18
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
19
+ </svg>
20
+ <span class="text-sm text-gray-500"><%= item %></span>
21
+ </li>
22
+ <% end %>
23
+ </ul>
24
+ </div>
25
+ </div>
@@ -0,0 +1,13 @@
1
+ <div class="bg-white">
2
+ <div class="mx-auto max-w-7xl py-24 px-4 sm:px-6 lg:px-8">
3
+ <div class="sm:align-center sm:flex sm:flex-col">
4
+ <h1 class="text-5xl font-bold tracking-tight text-gray-900 sm:text-center">Pricing Plans</h1>
5
+ </div>
6
+ <div class="mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-2 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl xl:mx-0 xl:max-w-none xl:grid-cols-4">
7
+ <%= render 'price_card', locals: { price: '$12', heading: 'Hoby', description: 'All the basics for having fun and make a few bucks', items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.'] } %>
8
+ <%= render 'price_card', locals: { price: '$24', heading: 'Freelancer', description: 'All the basics for starting a new business', items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.'] } %>
9
+ <%= render 'price_card', locals: { price: '$32', heading: 'Startup', description: 'What you need to starting building an empire', items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.', 'Faucibus volutpat magna.'] } %>
10
+ <%= render 'price_card', locals: { price: '$48', heading: 'Enterprise', description: 'Scalability and reliablity for your business', items: ['Potenti felis, in cras at at ligula nunc.', 'Orci neque eget pellentesque.', 'Donec mauris sit in eu tincidunt etiam.', 'Faucibus volutpat magna.', 'Id sed tellus in varius quisque.', 'Risus egestas faucibus.', 'Risus cursus ullamcorper.'] } %>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,8 @@
1
+ <div class="border-b border-gray-200 py-5">
2
+ <h3 class="text-lg font-medium leading-6 text-gray-900">View component</h3>
3
+ <p class="mt-2 max-w-4xl text-sm text-gray-500">View Components are like partials, but with the added benefit of a class that can control logic and easily tested</p>
4
+ </div>
5
+
6
+ <%= render(PriceChartComponent.new(@pricing_data1)) %>
7
+
8
+ <%= render(PriceChartComponent.new(@pricing_data2)) %>
@@ -0,0 +1,206 @@
1
+ <div class="border-b border-gray-200 py-5">
2
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Standard HTML</h3>
3
+ <p class="mt-2 max-w-4xl text-sm text-gray-500">Standard HTML written in using Tailwind CSS</p>
4
+ </div>
5
+
6
+
7
+ <div class="bg-white">
8
+ <div class="mx-auto max-w-7xl py-24 px-4 sm:px-6 lg:px-8">
9
+ <div class="sm:align-center sm:flex sm:flex-col">
10
+ <h1 class="text-5xl font-bold tracking-tight text-gray-900 sm:text-center">Pricing Plans</h1>
11
+ </div>
12
+ <div class="mt-12 space-y-4 sm:mt-16 sm:grid sm:grid-cols-2 sm:gap-6 sm:space-y-0 lg:mx-auto lg:max-w-4xl xl:mx-0 xl:max-w-none xl:grid-cols-4">
13
+ <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
14
+ <div class="p-6">
15
+ <h2 class="text-lg font-medium leading-6 text-gray-900">Hobby</h2>
16
+ <p class="mt-4 text-sm text-gray-500">All the basics for starting a new business</p>
17
+ <p class="mt-8">
18
+ <span class="text-4xl font-bold tracking-tight text-gray-900">$12</span>
19
+ <span class="text-base font-medium text-gray-500">/mo</span>
20
+ </p>
21
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Hobby</a>
22
+ </div>
23
+ <div class="px-6 pt-6 pb-8">
24
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
25
+ <ul role="list" class="mt-6 space-y-4">
26
+ <li class="flex space-x-3">
27
+ <!-- Heroicon name: mini/check -->
28
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
29
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
30
+ </svg>
31
+ <span class="text-sm text-gray-500">Potenti felis, in cras at at ligula nunc.</span>
32
+ </li>
33
+
34
+ <li class="flex space-x-3">
35
+ <!-- Heroicon name: mini/check -->
36
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
37
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
38
+ </svg>
39
+ <span class="text-sm text-gray-500">Orci neque eget pellentesque.</span>
40
+ </li>
41
+ </ul>
42
+ </div>
43
+ </div>
44
+
45
+ <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
46
+ <div class="p-6">
47
+ <h2 class="text-lg font-medium leading-6 text-gray-900">Freelancer</h2>
48
+ <p class="mt-4 text-sm text-gray-500">All the basics for starting a new business</p>
49
+ <p class="mt-8">
50
+ <span class="text-4xl font-bold tracking-tight text-gray-900">$24</span>
51
+ <span class="text-base font-medium text-gray-500">/mo</span>
52
+ </p>
53
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Freelancer</a>
54
+ </div>
55
+ <div class="px-6 pt-6 pb-8">
56
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
57
+ <ul role="list" class="mt-6 space-y-4">
58
+ <li class="flex space-x-3">
59
+ <!-- Heroicon name: mini/check -->
60
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
61
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
62
+ </svg>
63
+ <span class="text-sm text-gray-500">Potenti felis, in cras at at ligula nunc. </span>
64
+ </li>
65
+
66
+ <li class="flex space-x-3">
67
+ <!-- Heroicon name: mini/check -->
68
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
69
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
70
+ </svg>
71
+ <span class="text-sm text-gray-500">Orci neque eget pellentesque.</span>
72
+ </li>
73
+
74
+ <li class="flex space-x-3">
75
+ <!-- Heroicon name: mini/check -->
76
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
77
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
78
+ </svg>
79
+ <span class="text-sm text-gray-500">Donec mauris sit in eu tincidunt etiam.</span>
80
+ </li>
81
+ </ul>
82
+ </div>
83
+ </div>
84
+
85
+ <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
86
+ <div class="p-6">
87
+ <h2 class="text-lg font-medium leading-6 text-gray-900">Startup</h2>
88
+ <p class="mt-4 text-sm text-gray-500">All the basics for starting a new business</p>
89
+ <p class="mt-8">
90
+ <span class="text-4xl font-bold tracking-tight text-gray-900">$32</span>
91
+ <span class="text-base font-medium text-gray-500">/mo</span>
92
+ </p>
93
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Startup</a>
94
+ </div>
95
+ <div class="px-6 pt-6 pb-8">
96
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
97
+ <ul role="list" class="mt-6 space-y-4">
98
+ <li class="flex space-x-3">
99
+ <!-- Heroicon name: mini/check -->
100
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
101
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
102
+ </svg>
103
+ <span class="text-sm text-gray-500">Potenti felis, in cras at at ligula nunc. </span>
104
+ </li>
105
+
106
+ <li class="flex space-x-3">
107
+ <!-- Heroicon name: mini/check -->
108
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
109
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
110
+ </svg>
111
+ <span class="text-sm text-gray-500">Orci neque eget pellentesque.</span>
112
+ </li>
113
+
114
+ <li class="flex space-x-3">
115
+ <!-- Heroicon name: mini/check -->
116
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
117
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
118
+ </svg>
119
+ <span class="text-sm text-gray-500">Donec mauris sit in eu tincidunt etiam.</span>
120
+ </li>
121
+
122
+ <li class="flex space-x-3">
123
+ <!-- Heroicon name: mini/check -->
124
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
125
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
126
+ </svg>
127
+ <span class="text-sm text-gray-500">Faucibus volutpat magna.</span>
128
+ </li>
129
+ </ul>
130
+ </div>
131
+ </div>
132
+
133
+ <div class="divide-y divide-gray-200 rounded-lg border border-gray-200 shadow-sm">
134
+ <div class="p-6">
135
+ <h2 class="text-lg font-medium leading-6 text-gray-900">Enterprise</h2>
136
+ <p class="mt-4 text-sm text-gray-500">All the basics for starting a new business</p>
137
+ <p class="mt-8">
138
+ <span class="text-4xl font-bold tracking-tight text-gray-900">$48</span>
139
+ <span class="text-base font-medium text-gray-500">/mo</span>
140
+ </p>
141
+ <a href="#" class="mt-8 block w-full rounded-md border border-gray-800 bg-gray-800 py-2 text-center text-sm font-semibold text-white hover:bg-gray-900">Buy Enterprise</a>
142
+ </div>
143
+ <div class="px-6 pt-6 pb-8">
144
+ <h3 class="text-sm font-medium text-gray-900">What's included</h3>
145
+ <ul role="list" class="mt-6 space-y-4">
146
+ <li class="flex space-x-3">
147
+ <!-- Heroicon name: mini/check -->
148
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
149
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
150
+ </svg>
151
+ <span class="text-sm text-gray-500">Potenti felis, in cras at at ligula nunc. </span>
152
+ </li>
153
+
154
+ <li class="flex space-x-3">
155
+ <!-- Heroicon name: mini/check -->
156
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
157
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
158
+ </svg>
159
+ <span class="text-sm text-gray-500">Orci neque eget pellentesque.</span>
160
+ </li>
161
+
162
+ <li class="flex space-x-3">
163
+ <!-- Heroicon name: mini/check -->
164
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
165
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
166
+ </svg>
167
+ <span class="text-sm text-gray-500">Donec mauris sit in eu tincidunt etiam.</span>
168
+ </li>
169
+
170
+ <li class="flex space-x-3">
171
+ <!-- Heroicon name: mini/check -->
172
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
173
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
174
+ </svg>
175
+ <span class="text-sm text-gray-500">Faucibus volutpat magna.</span>
176
+ </li>
177
+
178
+ <li class="flex space-x-3">
179
+ <!-- Heroicon name: mini/check -->
180
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
181
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
182
+ </svg>
183
+ <span class="text-sm text-gray-500">Id sed tellus in varius quisque.</span>
184
+ </li>
185
+
186
+ <li class="flex space-x-3">
187
+ <!-- Heroicon name: mini/check -->
188
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
189
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
190
+ </svg>
191
+ <span class="text-sm text-gray-500">Risus egestas faucibus.</span>
192
+ </li>
193
+
194
+ <li class="flex space-x-3">
195
+ <!-- Heroicon name: mini/check -->
196
+ <svg class="h-5 w-5 flex-shrink-0 text-green-500" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
197
+ <path fill-rule="evenodd" d="M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z" clip-rule="evenodd" />
198
+ </svg>
199
+ <span class="text-sm text-gray-500">Risus cursus ullamcorper.</span>
200
+ </li>
201
+ </ul>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </div>
206
+ </div>
@@ -0,0 +1,6 @@
1
+ <div class="border-b border-gray-200 py-5">
2
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Partials</h3>
3
+ <p class="mt-2 max-w-4xl text-sm text-gray-500">Use Rails Partials to hold the HTML</p>
4
+ </div>
5
+
6
+ <%= render 'price_container' %>
@@ -0,0 +1,4 @@
1
+ <%= link_to 'Home', root_path %>
2
+ | <%= link_to 'Partials', home_partial_path %>
3
+ | <%= link_to 'View Components', home_component_path %>
4
+ <hr />
@@ -0,0 +1,29 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title><%= camelized %></title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%%= csrf_meta_tags %>
7
+ <%%= csp_meta_tag %>
8
+
9
+ <%- if options[:skip_hotwire] || options[:skip_javascript] -%>
10
+ <%%= stylesheet_link_tag "application" %>
11
+ <%- else -%>
12
+ <%%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
13
+ <%- end -%>
14
+ </head>
15
+
16
+ <body class='container mx-auto'>
17
+ <header>
18
+ <%%= render 'layouts/navbar' %>
19
+ <hr />
20
+ </header>
21
+ <main>
22
+ <%%= yield %>
23
+ </main>
24
+ <footer>
25
+ <%%= render 'layouts/footer' %>
26
+ </footer>
27
+ </body>
28
+ </html>
29
+
@@ -76,7 +76,8 @@
76
76
  "add_scenic",
77
77
  "add_rspec",
78
78
  "add_rubocop",
79
- "add_twilio_ruby"
79
+ "add_twilio_ruby",
80
+ "add_view_component"
80
81
  ],
81
82
  "class_options": [
82
83
  {
@@ -617,6 +618,13 @@
617
618
  "type": "boolean",
618
619
  "default": false,
619
620
  "required": false
621
+ },
622
+ {
623
+ "name": "add_view_component",
624
+ "description": "Indicates when to generate add view component",
625
+ "type": "boolean",
626
+ "default": false,
627
+ "required": false
620
628
  }
621
629
  ]
622
630
  }
@@ -26,13 +26,13 @@
26
26
  "main": false,
27
27
  "no_rc": false,
28
28
  "api": false,
29
- "javascript": "importmap",
29
+ "javascript": "esbuild",
30
30
  "skip_bundle": false,
31
31
  "note": "",
32
32
  "test": "rspec",
33
33
  "add_acts_as_list": false,
34
34
  "add_administrate": false,
35
- "add_annotate": true,
35
+ "add_annotate": false,
36
36
  "add_avo": false,
37
37
  "add_bcrypt": false,
38
38
  "add_brakeman": false,
@@ -42,8 +42,8 @@
42
42
  "add_devise": false,
43
43
  "add_devise_masquerade": false,
44
44
  "add_dotenv": false,
45
- "add_factory_bot_rails": true,
46
- "add_faker": true,
45
+ "add_factory_bot_rails": false,
46
+ "add_faker": false,
47
47
  "add_friendly_id": false,
48
48
  "add_groupdate": false,
49
49
  "add_hexapdf": false,
@@ -52,7 +52,7 @@
52
52
  "add_image_processing": false,
53
53
  "add_kaminari": false,
54
54
  "add_lograge": false,
55
- "add_minimal_css": true,
55
+ "add_minimal_css": false,
56
56
  "minimal_css_library": "water.css",
57
57
  "add_mini_magick": false,
58
58
  "add_motor_admin": false,
@@ -64,9 +64,11 @@
64
64
  "add_redcarpet": false,
65
65
  "add_rolify": false,
66
66
  "add_scenic": false,
67
- "add_rspec": false,
67
+ "add_rspec": true,
68
68
  "add_rubocop": false,
69
69
  "add_twilio_ruby": false,
70
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/factory_bot/_.rb"
70
+ "add_view_component": true,
71
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/view_component/_.rb",
72
+ "css": "tailwind"
71
73
  }
72
74
  }
@@ -76,7 +76,8 @@
76
76
  "add_scenic",
77
77
  "add_rspec",
78
78
  "add_rubocop",
79
- "add_twilio_ruby"
79
+ "add_twilio_ruby",
80
+ "add_view_component"
80
81
  ],
81
82
  "class_options": [
82
83
  {
@@ -617,6 +618,13 @@
617
618
  "type": "boolean",
618
619
  "default": false,
619
620
  "required": false
621
+ },
622
+ {
623
+ "name": "add_view_component",
624
+ "description": "",
625
+ "type": "boolean",
626
+ "default": false,
627
+ "required": false
620
628
  }
621
629
  ]
622
630
  }
@@ -7,7 +7,7 @@
7
7
  "quiet": false,
8
8
  "skip": false,
9
9
  "ruby": "/Users/davidcruwys/.asdf/installs/ruby/3.1.1/bin/ruby",
10
- "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/factory_bot/_.rb",
10
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/view_component/_.rb",
11
11
  "database": "sqlite3",
12
12
  "skip_git": false,
13
13
  "skip_keeps": false,
@@ -35,14 +35,14 @@
35
35
  "version": false,
36
36
  "api": false,
37
37
  "minimal": false,
38
- "javascript": "importmap",
39
- "css": "",
38
+ "javascript": "esbuild",
39
+ "css": "tailwind",
40
40
  "skip_bundle": false,
41
41
  "note": "",
42
42
  "test": "rspec",
43
43
  "add_acts_as_list": false,
44
44
  "add_administrate": false,
45
- "add_annotate": true,
45
+ "add_annotate": false,
46
46
  "add_avo": false,
47
47
  "add_bcrypt": false,
48
48
  "add_brakeman": false,
@@ -52,8 +52,8 @@
52
52
  "add_devise": false,
53
53
  "add_devise_masquerade": false,
54
54
  "add_dotenv": false,
55
- "add_factory_bot_rails": true,
56
- "add_faker": true,
55
+ "add_factory_bot_rails": false,
56
+ "add_faker": false,
57
57
  "add_friendly_id": false,
58
58
  "add_groupdate": false,
59
59
  "add_hexapdf": false,
@@ -62,7 +62,7 @@
62
62
  "add_image_processing": false,
63
63
  "add_kaminari": false,
64
64
  "add_lograge": false,
65
- "add_minimal_css": true,
65
+ "add_minimal_css": false,
66
66
  "minimal_css_library": "water.css",
67
67
  "add_mini_magick": false,
68
68
  "add_motor_admin": false,
@@ -74,9 +74,10 @@
74
74
  "add_redcarpet": false,
75
75
  "add_rolify": false,
76
76
  "add_scenic": false,
77
- "add_rspec": false,
77
+ "add_rspec": true,
78
78
  "add_rubocop": false,
79
79
  "add_twilio_ruby": false,
80
+ "add_view_component": true,
80
81
  "add_factory_bot": true
81
82
  }
82
83
  }
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsAppGenerator
4
+ # Custom add-ons for RailsAppGenerator
5
+ module AddOns
6
+ # Add ViewComponent to rails application
7
+ class ViewComponent < RailsAppGenerator::Addon
8
+ required_gem gem.version('view_component', '2.74.0', 'A framework for building reusable, testable & encapsulated view components in Ruby on Rails.')
9
+ end
10
+ end
11
+ end
@@ -212,6 +212,7 @@ module RailsAppGenerator
212
212
  add_if(:ransack) # TODO: needs testing
213
213
  add_if(:rubocop) # tested
214
214
  add_if(:twilio_ruby) # tested
215
+ add_if(:view_component)
215
216
  add(:views, :errors, :scaffold) if active?(:views)
216
217
 
217
218
  # invoke :rails_customization
@@ -152,6 +152,7 @@ KConfig.configure do |config|
152
152
  rag.add_option :add_rspec , type: :boolean, default: false
153
153
  rag.add_option :add_rubocop , type: :boolean, default: false
154
154
  rag.add_option :add_twilio_ruby , type: :boolean, default: false
155
+ rag.add_option :add_view_component , type: :boolean, default: false
155
156
  end
156
157
 
157
158
  # Make sure that RailsOptions reflect the options available from Railties
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAppGenerator
4
- VERSION = '0.3.3'
4
+ VERSION = '0.3.5'
5
5
  end
data/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "rails_app_generator",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "rails_app_generator",
9
- "version": "0.3.3",
9
+ "version": "0.3.5",
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.3.3",
3
+ "version": "0.3.5",
4
4
  "description": "Create new Rails Application with custom opinions",
5
5
  "scripts": {
6
6
  "release": "semantic-release"
@@ -0,0 +1,18 @@
1
+ {
2
+ "args": {
3
+ "app_path": "r7_view_component",
4
+ "destination_root": "/Users/davidcruwys/dev/kgems/rails_app_generator/a/addons",
5
+ "when_folder_exist": "destroy"
6
+ },
7
+ "opts": {
8
+ "skip_git": false,
9
+ "skip_test": true,
10
+ "template": "/Users/davidcruwys/dev/kgems/rails_app_generator/after_templates/addons/view_component/_.rb",
11
+ "add_view_component": true,
12
+ "css": "tailwind",
13
+ "javascript": "esbuild",
14
+ "test": "rspec",
15
+ "add_rspec": true,
16
+ "add_factory_bot": true
17
+ }
18
+ }
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.3.3
4
+ version: 0.3.5
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-10-05 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bootsnap
@@ -523,6 +523,21 @@ files:
523
523
  - after_templates/addons/twilio_ruby/app/controllers/home_controller.rb
524
524
  - after_templates/addons/twilio_ruby/app/views/home/index.html.erb
525
525
  - after_templates/addons/twilio_ruby/config/initializers/twilio.rb
526
+ - after_templates/addons/view_component/_.rb
527
+ - after_templates/addons/view_component/app/components/price_card_component.html.erb
528
+ - after_templates/addons/view_component/app/components/price_card_component.rb
529
+ - after_templates/addons/view_component/app/components/price_chart_component.html.erb
530
+ - after_templates/addons/view_component/app/components/price_chart_component.rb
531
+ - after_templates/addons/view_component/app/controllers/home_controller.rb
532
+ - after_templates/addons/view_component/app/services/seed_service.rb
533
+ - after_templates/addons/view_component/app/views/home/_price_card.html.erb
534
+ - after_templates/addons/view_component/app/views/home/_price_container.html.erb
535
+ - after_templates/addons/view_component/app/views/home/component.html.erb
536
+ - after_templates/addons/view_component/app/views/home/index.html.erb
537
+ - after_templates/addons/view_component/app/views/home/partial.html.erb
538
+ - after_templates/addons/view_component/app/views/layouts/_footer.html.erb
539
+ - after_templates/addons/view_component/app/views/layouts/_navbar.html.erb
540
+ - after_templates/addons/view_component/app/views/layouts/application.html.erb
526
541
  - after_templates/application/klueless/.rubocop.yml
527
542
  - after_templates/application/klueless/_.rb
528
543
  - after_templates/application/klueless/app/avo/cards/amount_raised.rb
@@ -829,6 +844,7 @@ files:
829
844
  - lib/rails_app_generator/addons/stimulus_components.rb
830
845
  - lib/rails_app_generator/addons/tailwind.rb
831
846
  - lib/rails_app_generator/addons/twilio_ruby.rb
847
+ - lib/rails_app_generator/addons/view_component.rb
832
848
  - lib/rails_app_generator/addons/views.rb
833
849
  - lib/rails_app_generator/app_builder.rb
834
850
  - lib/rails_app_generator/app_generator.rb
@@ -899,6 +915,7 @@ files:
899
915
  - profiles/addons/rubocop.json
900
916
  - profiles/addons/scenic.json
901
917
  - profiles/addons/twilio_ruby.json
918
+ - profiles/addons/view_component.json
902
919
  - profiles/application/klueless.json
903
920
  - profiles/application/printspeak.json
904
921
  - profiles/rag/bootstrap.json