ultimate_turbo_modal 2.1.1 → 2.2.1
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/.tool-versions +1 -1
- data/CHANGELOG.md +15 -0
- data/CLAUDE.md +190 -4
- data/Gemfile.lock +1 -1
- data/README.md +55 -2
- data/VERSION +1 -1
- data/javascript/index.js +12 -3
- data/javascript/modal_controller.js +52 -3
- data/javascript/package.json +2 -1
- data/javascript/styles/vanilla.css +86 -0
- data/lib/generators/ultimate_turbo_modal/templates/flavors/custom.rb +29 -2
- data/lib/generators/ultimate_turbo_modal/templates/flavors/tailwind.rb +30 -3
- data/lib/generators/ultimate_turbo_modal/templates/flavors/tailwind3.rb +29 -2
- data/lib/generators/ultimate_turbo_modal/templates/flavors/vanilla.rb +31 -3
- data/lib/generators/ultimate_turbo_modal/update_generator.rb +97 -0
- data/lib/ultimate_turbo_modal/base.rb +35 -14
- data/lib/ultimate_turbo_modal.rb +1 -0
- data/script/build_and_release.sh +20 -7
- metadata +7 -99
- data/demo-app/.gitattributes +0 -7
- data/demo-app/.gitignore +0 -34
- data/demo-app/.ruby-version +0 -1
- data/demo-app/.tool-versions +0 -2
- data/demo-app/Gemfile +0 -41
- data/demo-app/Gemfile.lock +0 -248
- data/demo-app/Procfile.dev +0 -3
- data/demo-app/README.md +0 -15
- data/demo-app/Rakefile +0 -6
- data/demo-app/app/assets/builds/.keep +0 -0
- data/demo-app/app/assets/images/.keep +0 -0
- data/demo-app/app/assets/stylesheets/application.css +0 -42
- data/demo-app/app/controllers/application_controller.rb +0 -10
- data/demo-app/app/controllers/concerns/.keep +0 -0
- data/demo-app/app/controllers/concerns/set_flavor.rb +0 -10
- data/demo-app/app/controllers/hide_from_backends_controller.rb +0 -34
- data/demo-app/app/controllers/modal_controller.rb +0 -11
- data/demo-app/app/controllers/posts_controller.rb +0 -69
- data/demo-app/app/controllers/welcome_controller.rb +0 -2
- data/demo-app/app/helpers/application_helper.rb +0 -9
- data/demo-app/app/javascript/application.js +0 -4
- data/demo-app/app/javascript/controllers/application.js +0 -13
- data/demo-app/app/javascript/controllers/dark_mode_controller.js +0 -28
- data/demo-app/app/javascript/controllers/flash_controller.js +0 -9
- data/demo-app/app/javascript/controllers/hello_controller.js +0 -7
- data/demo-app/app/javascript/controllers/index.js +0 -15
- data/demo-app/app/models/application_record.rb +0 -3
- data/demo-app/app/models/concerns/.keep +0 -0
- data/demo-app/app/models/post.rb +0 -4
- data/demo-app/app/views/hide_from_backends/_notice.html.erb +0 -10
- data/demo-app/app/views/hide_from_backends/create.turbo_stream.erb +0 -2
- data/demo-app/app/views/hide_from_backends/new.html.erb +0 -30
- data/demo-app/app/views/layouts/application.html.erb +0 -40
- data/demo-app/app/views/modal/index.html.erb +0 -45
- data/demo-app/app/views/modal/show.html.erb +0 -39
- data/demo-app/app/views/posts/_form.html.erb +0 -36
- data/demo-app/app/views/posts/_post.html.erb +0 -9
- data/demo-app/app/views/posts/edit.html.erb +0 -9
- data/demo-app/app/views/posts/index.html.erb +0 -14
- data/demo-app/app/views/posts/new.html.erb +0 -3
- data/demo-app/app/views/posts/show.html.erb +0 -21
- data/demo-app/app/views/shared/_flash.html.erb +0 -13
- data/demo-app/app/views/welcome/index.html.erb +0 -19
- data/demo-app/bin/bundle +0 -109
- data/demo-app/bin/dev +0 -7
- data/demo-app/bin/rails +0 -4
- data/demo-app/bin/rake +0 -4
- data/demo-app/bin/setup +0 -34
- data/demo-app/config/application.rb +0 -43
- data/demo-app/config/boot.rb +0 -3
- data/demo-app/config/credentials.yml.enc +0 -1
- data/demo-app/config/database.yml +0 -25
- data/demo-app/config/environment.rb +0 -14
- data/demo-app/config/environments/development.rb +0 -51
- data/demo-app/config/environments/production.rb +0 -67
- data/demo-app/config/environments/test.rb +0 -42
- data/demo-app/config/initializers/assets.rb +0 -7
- data/demo-app/config/initializers/content_security_policy.rb +0 -25
- data/demo-app/config/initializers/filter_parameter_logging.rb +0 -8
- data/demo-app/config/initializers/inflections.rb +0 -14
- data/demo-app/config/initializers/new_framework_defaults_8_0.rb +0 -30
- data/demo-app/config/initializers/permissions_policy.rb +0 -11
- data/demo-app/config/initializers/ultimate_turbo_modal.rb +0 -12
- data/demo-app/config/initializers/ultimate_turbo_modal_tailwind.rb +0 -21
- data/demo-app/config/initializers/ultimate_turbo_modal_vanilla.rb +0 -21
- data/demo-app/config/locales/en.yml +0 -33
- data/demo-app/config/puma.rb +0 -41
- data/demo-app/config/routes.rb +0 -9
- data/demo-app/config.ru +0 -6
- data/demo-app/db/migrate/20230331002502_create_posts.rb +0 -10
- data/demo-app/db/migrate/20231031012703_add_post.rb +0 -9
- data/demo-app/db/migrate/20231128141054_add_publish_on_to_posts.rb +0 -5
- data/demo-app/db/schema.rb +0 -22
- data/demo-app/lib/assets/.keep +0 -0
- data/demo-app/lib/tasks/.keep +0 -0
- data/demo-app/log/.keep +0 -0
- data/demo-app/package.json +0 -28
- data/demo-app/postcss.config.js +0 -7
- data/demo-app/public/400.html +0 -114
- data/demo-app/public/404.html +0 -114
- data/demo-app/public/406-unsupported-browser.html +0 -114
- data/demo-app/public/422.html +0 -114
- data/demo-app/public/500.html +0 -114
- data/demo-app/public/apple-touch-icon-precomposed.png +0 -0
- data/demo-app/public/apple-touch-icon.png +0 -0
- data/demo-app/public/favicon.ico +0 -0
- data/demo-app/public/icon.png +0 -0
- data/demo-app/public/icon.svg +0 -3
- data/demo-app/public/img/bootstrap-logo-shadow.png +0 -0
- data/demo-app/public/img/unicat.jpg +0 -0
- data/demo-app/public/img/vanilla.png +0 -0
- data/demo-app/public/robots.txt +0 -1
- data/demo-app/tmp/.keep +0 -0
- data/demo-app/tmp/pids/.keep +0 -0
- data/demo-app/vendor/.keep +0 -0
- data/demo-app/yarn.lock +0 -1022
@@ -1,45 +0,0 @@
|
|
1
|
-
<%= render partial: "hide_from_backends/notice" %>
|
2
|
-
<div class="fixed left-3 bottom-3 text-lg text-gray-600">
|
3
|
-
Rendered at <%= Time.now %>
|
4
|
-
</div>
|
5
|
-
|
6
|
-
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
|
7
|
-
<!-- We've used 3xl here, but feel free to try other max-widths based on your needs -->
|
8
|
-
<div class="mx-auto max-w-3xl space-y-24">
|
9
|
-
<div>
|
10
|
-
<h1 class="<%= h1_classes %>">CRUD modals</h1>
|
11
|
-
<ul class="list-disc ml-6 dark:text-white">
|
12
|
-
<li class="py-2"><%= link_to "Show Post", post_path(@post, close_button: 1), data: {turbo_frame: "modal"} %>
|
13
|
-
<li class="py-2"><%= link_to "New Post", new_post_path(Post.new, close_button: 1), data: {turbo_frame: "modal"} %>
|
14
|
-
<li class="py-2"><%= link_to "Show Post (w/ advance history)", post_path(@post, advance: "1", close_button: 1), data: {turbo_frame: "modal"} %>
|
15
|
-
</ul>
|
16
|
-
</div>
|
17
|
-
|
18
|
-
<div>
|
19
|
-
<h1 class="<%= h1_classes %>">More modals</h1>
|
20
|
-
<ul class="list-disc ml-6 dark:text-white">
|
21
|
-
<li class="py-2">Photo: <%= link_to "without header or padding", modal_path(:photo, padding: 0, advance: 1, close_button: 1), data: {turbo_frame: "modal"} %> | <%= link_to "without close button", modal_path(:photo, padding: 0, advance: 1, close_button: 0), data: {turbo_frame: "modal"} %>
|
22
|
-
<li class="py-2"><%= link_to "Long scrolling content", modal_path(:long, advance: 1, close_button: 1), data: {turbo_frame: "modal"} %>
|
23
|
-
<li class="py-2"><%= link_to "Form closing from backend on success", new_hide_from_backend_path(close_button: 1), data: {turbo_frame: "modal"} %>
|
24
|
-
|
25
|
-
</ul>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
|
-
|
30
|
-
|
31
|
-
<div class="mx-auto text-center">
|
32
|
-
<% 30.times do %>
|
33
|
-
<div class="my-48 text-gray-300 mx-auto">
|
34
|
-
This is a long page!
|
35
|
-
</div>
|
36
|
-
<% end %>
|
37
|
-
|
38
|
-
<div>
|
39
|
-
<input type="text" class="rounded border-gray-300 placeholder-gray-300" placeholder="Test for focus trap" />
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div class="my-20 text-center">
|
44
|
-
<%= link_to "Click for a unicat", modal_path(:photo, padding: 0, advance: 1), class: button_classes, data: {turbo_frame: "modal"} %>
|
45
|
-
</div>
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<%= modal(padding: @padding, advance: @override_url || @advance, header: @header, close_button: @close_button) do %>
|
2
|
-
<% unless inside_modal? %>
|
3
|
-
<h1 class="text-2xl mb-8">This is not inside a modal</h1>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<% if params[:id] == "long" %>
|
7
|
-
<div class="space-y-2 max-w-3xl">
|
8
|
-
<% 30.times do %>
|
9
|
-
<p><%= Faker::Lorem.paragraph(sentence_count: 50) %></p>
|
10
|
-
<% end %>
|
11
|
-
</div>
|
12
|
-
<% elsif params[:id] == "photo" %>
|
13
|
-
<div class="w-full">
|
14
|
-
<img src="/img/unicat.jpg">
|
15
|
-
</div>
|
16
|
-
<% elsif params[:id] == "photo_no_advance" %>
|
17
|
-
<div class="w-full">
|
18
|
-
<img src="/img/unicat.jpg">
|
19
|
-
</div>
|
20
|
-
<% elsif params[:id] == "form" %>
|
21
|
-
<div class="w-full p-4">
|
22
|
-
<form>
|
23
|
-
<div class="mb-4">
|
24
|
-
<label class="block mb-2" for="fname">First Name:</label>
|
25
|
-
<input class="rounded border-gray-300 border" type="text" id="fname" name="fname" autofocus>
|
26
|
-
</div>
|
27
|
-
<div class="mb-4">
|
28
|
-
<label class="block mb-2" for="lname">Last Name:</label>
|
29
|
-
<input class="rounded border-gray-300 border" type="text" id="lname" name="lname">
|
30
|
-
</div>
|
31
|
-
<button class="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" type="submit">Submit</button>
|
32
|
-
</form>
|
33
|
-
</div>
|
34
|
-
<% else %>
|
35
|
-
<div class="w-full">
|
36
|
-
Not sure what you're looking for!
|
37
|
-
</div>
|
38
|
-
<% end %>
|
39
|
-
<% end %>
|
@@ -1,36 +0,0 @@
|
|
1
|
-
<div class="w-96">
|
2
|
-
<%= form_with(model: post, class: "contents") do |form| %>
|
3
|
-
<% if post.errors.any? %>
|
4
|
-
<div id="error_explanation" class="bg-red-50 text-red-500 px-3 py-2 font-medium rounded-lg mt-3">
|
5
|
-
<h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2>
|
6
|
-
<ul>
|
7
|
-
<% post.errors.each do |error| %>
|
8
|
-
<li><%= error.full_message %></li>
|
9
|
-
<% end %>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<% end %>
|
13
|
-
<div class="my-5">
|
14
|
-
<%= form.label :title %>
|
15
|
-
<%= form.text_field :title, class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full" %>
|
16
|
-
</div>
|
17
|
-
<div class="my-5">
|
18
|
-
<%= form.label :body %>
|
19
|
-
<%= form.text_field :body, class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full" %>
|
20
|
-
</div>
|
21
|
-
<div class="my-5">
|
22
|
-
<%= form.label :publish_on %>
|
23
|
-
<div class="text-xs">Modal will not close when clicking the calendar, even when outside of the modal boundaries.</div>
|
24
|
-
<%= form.text_field :publish_on,
|
25
|
-
class: "block shadow-sm rounded-md border border-gray-200 outline-hidden px-3 py-2 mt-2 w-full",
|
26
|
-
data: {
|
27
|
-
controller: "flatpickr",
|
28
|
-
flatpickr_min_date: Date.current.strftime("%Y-%m-%d"),
|
29
|
-
}
|
30
|
-
%>
|
31
|
-
</div>
|
32
|
-
<div class="inline">
|
33
|
-
<%= form.submit class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" %>
|
34
|
-
</div>
|
35
|
-
<% end %>
|
36
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div class="w-full">
|
2
|
-
<% if notice.present? %>
|
3
|
-
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<div class="flex justify-between items-center">
|
7
|
-
<h1 class="font-bold text-4xl">Posts</h1>
|
8
|
-
<%= link_to 'New post', new_post_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
|
9
|
-
</div>
|
10
|
-
|
11
|
-
<div id="posts" class="min-w-full">
|
12
|
-
<%= render @posts %>
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<%= modal(padding: @padding, advance: @override_url || @advance, title: @modal_title, close_button: @close_button) do |m| %>
|
2
|
-
<%= m.title do %>
|
3
|
-
<div>Custom Header Block</div>
|
4
|
-
<% end %>
|
5
|
-
|
6
|
-
<div class="max-w-3xl">
|
7
|
-
<% if notice.present? %>
|
8
|
-
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= render @post %>
|
12
|
-
</div>
|
13
|
-
|
14
|
-
<%= m.footer do %>
|
15
|
-
<%= link_to 'Edit this post', edit_post_path(@post), class: "rounded-lg py-3 px-5 bg-blue-800 text-white inline-block font-medium" %>
|
16
|
-
|
17
|
-
<div class="inline-block ml-2">
|
18
|
-
<%= button_to 'Destroy this post', post_path(@post), method: :delete, class: "py-3 px-5 bg-transparent text-red-600" %>
|
19
|
-
</div>
|
20
|
-
<% end %>
|
21
|
-
<% end %>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<% if flash.any? %>
|
2
|
-
<div class="px-5 py-2 absolute top-3 right-3" data-controller="flash">
|
3
|
-
<% flash.each do |key, value| %>
|
4
|
-
<% if key == "alert" %>
|
5
|
-
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded-sm relative" role="alert">
|
6
|
-
<% else %>
|
7
|
-
<div class="bg-indigo-100 border border-indigo-400 text-indigo-700 px-4 py-3 rounded-sm relative" role="notice">
|
8
|
-
<% end %>
|
9
|
-
<span class="block sm:inline"><%= value %></span>
|
10
|
-
</div>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<div class="grid h-screen place-items-center dark:text-white">
|
2
|
-
<dl class="grid grid-cols-1 gap-x-20 gap-y-32 text-center xl:grid-cols-2">
|
3
|
-
<div class="mx-auto">
|
4
|
-
<a href="/modal?flavor=tailwind">
|
5
|
-
<svg class="h-6 sm:h-12 w-auto" viewBox="0 0 248 31" class="text-slate-900 dark:text-white w-auto h-5"><path fill-rule="evenodd" clip-rule="evenodd" d="M25.517 0C18.712 0 14.46 3.382 12.758 10.146c2.552-3.382 5.529-4.65 8.931-3.805 1.941.482 3.329 1.882 4.864 3.432 2.502 2.524 5.398 5.445 11.722 5.445 6.804 0 11.057-3.382 12.758-10.145-2.551 3.382-5.528 4.65-8.93 3.804-1.942-.482-3.33-1.882-4.865-3.431C34.736 2.92 31.841 0 25.517 0zM12.758 15.218C5.954 15.218 1.701 18.6 0 25.364c2.552-3.382 5.529-4.65 8.93-3.805 1.942.482 3.33 1.882 4.865 3.432 2.502 2.524 5.397 5.445 11.722 5.445 6.804 0 11.057-3.381 12.758-10.145-2.552 3.382-5.529 4.65-8.931 3.805-1.941-.483-3.329-1.883-4.864-3.432-2.502-2.524-5.398-5.446-11.722-5.446z" fill="#38bdf8"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M76.546 12.825h-4.453v8.567c0 2.285 1.508 2.249 4.453 2.106v3.463c-5.962.714-8.332-.928-8.332-5.569v-8.567H64.91V9.112h3.304V4.318l3.879-1.143v5.937h4.453v3.713zM93.52 9.112h3.878v17.849h-3.878v-2.57c-1.365 1.891-3.484 3.034-6.285 3.034-4.884 0-8.942-4.105-8.942-9.389 0-5.318 4.058-9.388 8.942-9.388 2.801 0 4.92 1.142 6.285 2.999V9.112zm-5.674 14.636c3.232 0 5.674-2.392 5.674-5.712s-2.442-5.711-5.674-5.711-5.674 2.392-5.674 5.711c0 3.32 2.442 5.712 5.674 5.712zm16.016-17.313c-1.364 0-2.477-1.142-2.477-2.463a2.475 2.475 0 012.477-2.463 2.475 2.475 0 012.478 2.463c0 1.32-1.113 2.463-2.478 2.463zm-1.939 20.526V9.112h3.879v17.849h-3.879zm8.368 0V.9h3.878v26.06h-3.878zm29.053-17.849h4.094l-5.638 17.849h-3.807l-3.735-12.03-3.771 12.03h-3.806l-5.639-17.849h4.094l3.484 12.315 3.771-12.315h3.699l3.734 12.315 3.52-12.315zm8.906-2.677c-1.365 0-2.478-1.142-2.478-2.463a2.475 2.475 0 012.478-2.463 2.475 2.475 0 012.478 2.463c0 1.32-1.113 2.463-2.478 2.463zm-1.939 20.526V9.112h3.878v17.849h-3.878zm17.812-18.313c4.022 0 6.895 2.713 6.895 7.354V26.96h-3.878V16.394c0-2.713-1.58-4.14-4.022-4.14-2.55 0-4.561 1.499-4.561 5.14v9.567h-3.879V9.112h3.879v2.285c1.185-1.856 3.124-2.749 5.566-2.749zm25.282-6.675h3.879V26.96h-3.879v-2.57c-1.364 1.892-3.483 3.034-6.284 3.034-4.884 0-8.942-4.105-8.942-9.389 0-5.318 4.058-9.388 8.942-9.388 2.801 0 4.92 1.142 6.284 2.999V1.973zm-5.674 21.775c3.232 0 5.674-2.392 5.674-5.712s-2.442-5.711-5.674-5.711-5.674 2.392-5.674 5.711c0 3.32 2.442 5.712 5.674 5.712zm22.553 3.677c-5.423 0-9.481-4.105-9.481-9.389 0-5.318 4.058-9.388 9.481-9.388 3.519 0 6.572 1.82 8.008 4.605l-3.34 1.928c-.79-1.678-2.549-2.749-4.704-2.749-3.16 0-5.566 2.392-5.566 5.604 0 3.213 2.406 5.605 5.566 5.605 2.155 0 3.914-1.107 4.776-2.749l3.34 1.892c-1.508 2.82-4.561 4.64-8.08 4.64zm14.472-13.387c0 3.249 9.661 1.285 9.661 7.89 0 3.57-3.125 5.497-7.003 5.497-3.591 0-6.177-1.607-7.326-4.177l3.34-1.927c.574 1.606 2.011 2.57 3.986 2.57 1.724 0 3.052-.571 3.052-2 0-3.176-9.66-1.391-9.66-7.781 0-3.356 2.909-5.462 6.572-5.462 2.945 0 5.387 1.357 6.644 3.713l-3.268 1.82c-.647-1.392-1.904-2.035-3.376-2.035-1.401 0-2.622.607-2.622 1.892zm16.556 0c0 3.249 9.66 1.285 9.66 7.89 0 3.57-3.124 5.497-7.003 5.497-3.591 0-6.176-1.607-7.326-4.177l3.34-1.927c.575 1.606 2.011 2.57 3.986 2.57 1.724 0 3.053-.571 3.053-2 0-3.176-9.66-1.391-9.66-7.781 0-3.356 2.908-5.462 6.572-5.462 2.944 0 5.386 1.357 6.643 3.713l-3.268 1.82c-.646-1.392-1.903-2.035-3.375-2.035-1.401 0-2.622.607-2.622 1.892z" fill="currentColor"></path></svg>
|
6
|
-
</a>
|
7
|
-
</div>
|
8
|
-
|
9
|
-
<div class="mx-auto">
|
10
|
-
<a href="/modal?flavor=vanilla">
|
11
|
-
<span class="sm:pr-1 h-6 sm:h-12 inline-block">
|
12
|
-
<img class="h-8 sm:h-16 -mt-1 sm:-mt-2" src="/img/vanilla.png">
|
13
|
-
</span>
|
14
|
-
|
15
|
-
<span class="inline-block h-6 sm:h-12 m-0 align-top text-2xl sm:text-5xl leading-6 sm:leading-10 font-semibold sm:mt-0.5 text-black dark:text-white" style='font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue"'>Plain ol' CSS</span>
|
16
|
-
</a>
|
17
|
-
</div>
|
18
|
-
</dl>
|
19
|
-
</div>
|
data/demo-app/bin/bundle
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# This file was generated by Bundler.
|
6
|
-
#
|
7
|
-
# The application 'bundle' is installed as part of a gem, and
|
8
|
-
# this file is here to facilitate running it.
|
9
|
-
#
|
10
|
-
|
11
|
-
require "rubygems"
|
12
|
-
|
13
|
-
m = Module.new do
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def invoked_as_script?
|
17
|
-
File.expand_path($0) == File.expand_path(__FILE__)
|
18
|
-
end
|
19
|
-
|
20
|
-
def env_var_version
|
21
|
-
ENV["BUNDLER_VERSION"]
|
22
|
-
end
|
23
|
-
|
24
|
-
def cli_arg_version
|
25
|
-
return unless invoked_as_script? # don't want to hijack other binstubs
|
26
|
-
return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
|
27
|
-
bundler_version = nil
|
28
|
-
update_index = nil
|
29
|
-
ARGV.each_with_index do |a, i|
|
30
|
-
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
|
31
|
-
bundler_version = a
|
32
|
-
end
|
33
|
-
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
|
34
|
-
bundler_version = $1
|
35
|
-
update_index = i
|
36
|
-
end
|
37
|
-
bundler_version
|
38
|
-
end
|
39
|
-
|
40
|
-
def gemfile
|
41
|
-
gemfile = ENV["BUNDLE_GEMFILE"]
|
42
|
-
return gemfile if gemfile && !gemfile.empty?
|
43
|
-
|
44
|
-
File.expand_path("../Gemfile", __dir__)
|
45
|
-
end
|
46
|
-
|
47
|
-
def lockfile
|
48
|
-
lockfile =
|
49
|
-
case File.basename(gemfile)
|
50
|
-
when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
|
51
|
-
else "#{gemfile}.lock"
|
52
|
-
end
|
53
|
-
File.expand_path(lockfile)
|
54
|
-
end
|
55
|
-
|
56
|
-
def lockfile_version
|
57
|
-
return unless File.file?(lockfile)
|
58
|
-
lockfile_contents = File.read(lockfile)
|
59
|
-
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
60
|
-
Regexp.last_match(1)
|
61
|
-
end
|
62
|
-
|
63
|
-
def bundler_requirement
|
64
|
-
@bundler_requirement ||=
|
65
|
-
env_var_version ||
|
66
|
-
cli_arg_version ||
|
67
|
-
bundler_requirement_for(lockfile_version)
|
68
|
-
end
|
69
|
-
|
70
|
-
def bundler_requirement_for(version)
|
71
|
-
return "#{Gem::Requirement.default}.a" unless version
|
72
|
-
|
73
|
-
bundler_gem_version = Gem::Version.new(version)
|
74
|
-
|
75
|
-
bundler_gem_version.approximate_recommendation
|
76
|
-
end
|
77
|
-
|
78
|
-
def load_bundler!
|
79
|
-
ENV["BUNDLE_GEMFILE"] ||= gemfile
|
80
|
-
|
81
|
-
activate_bundler
|
82
|
-
end
|
83
|
-
|
84
|
-
def activate_bundler
|
85
|
-
gem_error = activation_error_handling do
|
86
|
-
gem "bundler", bundler_requirement
|
87
|
-
end
|
88
|
-
return if gem_error.nil?
|
89
|
-
require_error = activation_error_handling do
|
90
|
-
require "bundler/version"
|
91
|
-
end
|
92
|
-
return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
|
93
|
-
warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
|
94
|
-
exit 42
|
95
|
-
end
|
96
|
-
|
97
|
-
def activation_error_handling
|
98
|
-
yield
|
99
|
-
nil
|
100
|
-
rescue StandardError, LoadError => e
|
101
|
-
e
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
m.load_bundler!
|
106
|
-
|
107
|
-
if m.invoked_as_script?
|
108
|
-
load Gem.bin_path("bundler", "bundle")
|
109
|
-
end
|
data/demo-app/bin/dev
DELETED
data/demo-app/bin/rails
DELETED
data/demo-app/bin/rake
DELETED
data/demo-app/bin/setup
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require "fileutils"
|
3
|
-
|
4
|
-
APP_ROOT = File.expand_path("..", __dir__)
|
5
|
-
|
6
|
-
def system!(*args)
|
7
|
-
system(*args, exception: true)
|
8
|
-
end
|
9
|
-
|
10
|
-
FileUtils.chdir APP_ROOT do
|
11
|
-
# This script is a way to set up or update your development environment automatically.
|
12
|
-
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
|
13
|
-
# Add necessary setup steps to this file.
|
14
|
-
|
15
|
-
puts "== Installing dependencies =="
|
16
|
-
system("bundle check") || system!("bundle install")
|
17
|
-
|
18
|
-
# puts "\n== Copying sample files =="
|
19
|
-
# unless File.exist?("config/database.yml")
|
20
|
-
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
|
21
|
-
# end
|
22
|
-
|
23
|
-
puts "\n== Preparing database =="
|
24
|
-
system! "bin/rails db:prepare"
|
25
|
-
|
26
|
-
puts "\n== Removing old logs and tempfiles =="
|
27
|
-
system! "bin/rails log:clear tmp:clear"
|
28
|
-
|
29
|
-
unless ARGV.include?("--skip-server")
|
30
|
-
puts "\n== Starting development server =="
|
31
|
-
STDOUT.flush # flush the output before exec(2) so that it displays
|
32
|
-
exec "bin/dev"
|
33
|
-
end
|
34
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
require_relative "boot"
|
2
|
-
|
3
|
-
require "rails"
|
4
|
-
# Pick the frameworks you want:
|
5
|
-
require "active_model/railtie"
|
6
|
-
# require "active_job/railtie"
|
7
|
-
require "active_record/railtie"
|
8
|
-
# require "active_storage/engine"
|
9
|
-
require "action_controller/railtie"
|
10
|
-
# require "action_mailer/railtie"
|
11
|
-
# require "action_mailbox/engine"
|
12
|
-
# require "action_text/engine"
|
13
|
-
require "action_view/railtie"
|
14
|
-
# require "action_cable/engine"
|
15
|
-
# require "rails/test_unit/railtie"
|
16
|
-
|
17
|
-
# Require the gems listed in Gemfile, including any gems
|
18
|
-
# you've limited to :test, :development, or :production.
|
19
|
-
Bundler.require(*Rails.groups)
|
20
|
-
|
21
|
-
module UltimateTurboModal
|
22
|
-
class Application < Rails::Application
|
23
|
-
config.autoload_paths << Rails.root.join("app", "views", "components")
|
24
|
-
# Initialize configuration defaults for originally generated Rails version.
|
25
|
-
config.load_defaults 7.0
|
26
|
-
|
27
|
-
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
28
|
-
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
29
|
-
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
30
|
-
config.autoload_lib(ignore: %w[assets tasks])
|
31
|
-
|
32
|
-
# Configuration for the application, engines, and railties goes here.
|
33
|
-
#
|
34
|
-
# These settings can be overridden in specific environments using the files
|
35
|
-
# in config/environments, which are processed later.
|
36
|
-
#
|
37
|
-
# config.time_zone = "Central Time (US & Canada)"
|
38
|
-
# config.eager_load_paths << Rails.root.join("extras")
|
39
|
-
|
40
|
-
# Don't generate system test files.
|
41
|
-
config.generators.system_tests = nil
|
42
|
-
end
|
43
|
-
end
|
data/demo-app/config/boot.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
a5bdfDeJOIdOPg9vQawREE40DSR+QV0uJ08GB8VeEzc1lxUuV4q8V0kkjJyVIyjreqrt7U3J4c0K1B0n1Au/Z/K2b1t3tfOlQJe1WdMdg7UNrPCrXEaXorEj6N95D1fiMWmqf16pRwbzKASHXCt8JSq1kT1UQnUpkk70mHKVaugRjYNKKYEpyFopSCnP26rOWtixmD0R0w6UUheb0hdmfP3wyiKmXnSxUsvGl04bWvFqFz85A4jRnj+Ou7UFFprtvC0fO/yVpkjFWh6otqZVd9a0WW1O6bAbFwJ57PWA3k5OBsbkv+o08LfWNpgykOSSyL3ha+fSirdGyMWhI9pIU+s5zYKjn+puRvy0F9KUbFzxsdyD60BxkkLxhS8y4LFEO4ilB4GuzLqixh5EZ0MT4YXVgARv89VGQIc+--pKR/h8Ok35Flu/uI--4gHuVGG4C07WVcLYRE71iA==
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# SQLite. Versions 3.8.0 and up are supported.
|
2
|
-
# gem install sqlite3
|
3
|
-
#
|
4
|
-
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
-
# gem "sqlite3"
|
6
|
-
#
|
7
|
-
default: &default
|
8
|
-
adapter: sqlite3
|
9
|
-
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
10
|
-
timeout: 5000
|
11
|
-
|
12
|
-
development:
|
13
|
-
<<: *default
|
14
|
-
database: db/development.sqlite3
|
15
|
-
|
16
|
-
# Warning: The database defined as "test" will be erased and
|
17
|
-
# re-generated from your development database when you run "rake".
|
18
|
-
# Do not set this db to the same as development or production.
|
19
|
-
test:
|
20
|
-
<<: *default
|
21
|
-
database: db/test.sqlite3
|
22
|
-
|
23
|
-
production:
|
24
|
-
<<: *default
|
25
|
-
database: db/production.sqlite3
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# Load the Rails application.
|
2
|
-
require_relative "application"
|
3
|
-
|
4
|
-
# Initialize the Rails application.
|
5
|
-
Rails.application.initialize!
|
6
|
-
|
7
|
-
begin
|
8
|
-
# Load seeds on bootup
|
9
|
-
unless Post.any?
|
10
|
-
puts "Seeding database..."
|
11
|
-
Rails.application.load_seed
|
12
|
-
end
|
13
|
-
rescue ActiveRecord::StatementInvalid
|
14
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# Make code changes take effect immediately without server restart.
|
7
|
-
config.enable_reloading = true
|
8
|
-
|
9
|
-
# Do not eager load code on boot.
|
10
|
-
config.eager_load = false
|
11
|
-
|
12
|
-
# Show full error reports.
|
13
|
-
config.consider_all_requests_local = true
|
14
|
-
|
15
|
-
# Enable server timing.
|
16
|
-
config.server_timing = true
|
17
|
-
|
18
|
-
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
|
19
|
-
# Run rails dev:cache to toggle Action Controller caching.
|
20
|
-
if Rails.root.join("tmp/caching-dev.txt").exist?
|
21
|
-
config.action_controller.perform_caching = true
|
22
|
-
config.action_controller.enable_fragment_cache_logging = true
|
23
|
-
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
|
24
|
-
else
|
25
|
-
config.action_controller.perform_caching = false
|
26
|
-
end
|
27
|
-
|
28
|
-
# Change to :null_store to avoid any caching.
|
29
|
-
config.cache_store = :memory_store
|
30
|
-
|
31
|
-
# Print deprecation notices to the Rails logger.
|
32
|
-
config.active_support.deprecation = :log
|
33
|
-
|
34
|
-
# Raise an error on page load if there are pending migrations.
|
35
|
-
config.active_record.migration_error = :page_load
|
36
|
-
|
37
|
-
# Highlight code that triggered database queries in logs.
|
38
|
-
config.active_record.verbose_query_logs = true
|
39
|
-
|
40
|
-
# Append comments with runtime information tags to SQL queries in logs.
|
41
|
-
config.active_record.query_log_tags_enabled = true
|
42
|
-
|
43
|
-
# Raises error for missing translations.
|
44
|
-
# config.i18n.raise_on_missing_translations = true
|
45
|
-
|
46
|
-
# Annotate rendered view with file names.
|
47
|
-
config.action_view.annotate_rendered_view_with_filenames = true
|
48
|
-
|
49
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
50
|
-
config.action_controller.raise_on_missing_callback_actions = true
|
51
|
-
end
|
@@ -1,67 +0,0 @@
|
|
1
|
-
require "active_support/core_ext/integer/time"
|
2
|
-
|
3
|
-
Rails.application.configure do
|
4
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
5
|
-
|
6
|
-
# Code is not reloaded between requests.
|
7
|
-
config.enable_reloading = false
|
8
|
-
|
9
|
-
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
|
10
|
-
config.eager_load = true
|
11
|
-
|
12
|
-
# Full error reports are disabled.
|
13
|
-
config.consider_all_requests_local = false
|
14
|
-
|
15
|
-
# Turn on fragment caching in view templates.
|
16
|
-
config.action_controller.perform_caching = true
|
17
|
-
|
18
|
-
# Cache assets for far-future expiry since they are all digest stamped.
|
19
|
-
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
|
20
|
-
|
21
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
22
|
-
# config.asset_host = "http://assets.example.com"
|
23
|
-
|
24
|
-
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
25
|
-
config.assume_ssl = true
|
26
|
-
|
27
|
-
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
28
|
-
config.force_ssl = true
|
29
|
-
|
30
|
-
# Skip http-to-https redirect for the default health check endpoint.
|
31
|
-
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
|
32
|
-
|
33
|
-
# Log to STDOUT with the current request id as a default log tag.
|
34
|
-
config.log_tags = [ :request_id ]
|
35
|
-
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
|
36
|
-
|
37
|
-
# Change to "debug" to log everything (including potentially personally-identifiable information!)
|
38
|
-
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
39
|
-
|
40
|
-
# Prevent health checks from clogging up the logs.
|
41
|
-
config.silence_healthcheck_path = "/up"
|
42
|
-
|
43
|
-
# Don't log any deprecations.
|
44
|
-
config.active_support.report_deprecations = false
|
45
|
-
|
46
|
-
# Replace the default in-process memory cache store with a durable alternative.
|
47
|
-
# config.cache_store = :mem_cache_store
|
48
|
-
|
49
|
-
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
50
|
-
# the I18n.default_locale when a translation cannot be found).
|
51
|
-
config.i18n.fallbacks = true
|
52
|
-
|
53
|
-
# Do not dump schema after migrations.
|
54
|
-
config.active_record.dump_schema_after_migration = false
|
55
|
-
|
56
|
-
# Only use :id for inspections in production.
|
57
|
-
config.active_record.attributes_for_inspect = [ :id ]
|
58
|
-
|
59
|
-
# Enable DNS rebinding protection and other `Host` header attacks.
|
60
|
-
# config.hosts = [
|
61
|
-
# "example.com", # Allow requests from example.com
|
62
|
-
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
63
|
-
# ]
|
64
|
-
#
|
65
|
-
# Skip DNS rebinding protection for the default health check endpoint.
|
66
|
-
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
67
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# The test environment is used exclusively to run your application's
|
2
|
-
# test suite. You never need to work with it otherwise. Remember that
|
3
|
-
# your test database is "scratch space" for the test suite and is wiped
|
4
|
-
# and recreated between test runs. Don't rely on the data there!
|
5
|
-
|
6
|
-
Rails.application.configure do
|
7
|
-
# Settings specified here will take precedence over those in config/application.rb.
|
8
|
-
|
9
|
-
# While tests run files are not watched, reloading is not necessary.
|
10
|
-
config.enable_reloading = false
|
11
|
-
|
12
|
-
# Eager loading loads your entire application. When running a single test locally,
|
13
|
-
# this is usually not necessary, and can slow down your test suite. However, it's
|
14
|
-
# recommended that you enable it in continuous integration systems to ensure eager
|
15
|
-
# loading is working properly before deploying your code.
|
16
|
-
config.eager_load = ENV["CI"].present?
|
17
|
-
|
18
|
-
# Configure public file server for tests with cache-control for performance.
|
19
|
-
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
|
20
|
-
|
21
|
-
# Show full error reports.
|
22
|
-
config.consider_all_requests_local = true
|
23
|
-
config.cache_store = :null_store
|
24
|
-
|
25
|
-
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
26
|
-
config.action_dispatch.show_exceptions = :rescuable
|
27
|
-
|
28
|
-
# Disable request forgery protection in test environment.
|
29
|
-
config.action_controller.allow_forgery_protection = false
|
30
|
-
|
31
|
-
# Print deprecation notices to the stderr.
|
32
|
-
config.active_support.deprecation = :stderr
|
33
|
-
|
34
|
-
# Raises error for missing translations.
|
35
|
-
# config.i18n.raise_on_missing_translations = true
|
36
|
-
|
37
|
-
# Annotate rendered view with file names.
|
38
|
-
# config.action_view.annotate_rendered_view_with_filenames = true
|
39
|
-
|
40
|
-
# Raise error when a before_action's only/except options reference missing actions.
|
41
|
-
config.action_controller.raise_on_missing_callback_actions = true
|
42
|
-
end
|
@@ -1,7 +0,0 @@
|
|
1
|
-
# Be sure to restart your server when you modify this file.
|
2
|
-
|
3
|
-
# Version of your assets, change this if you want to expire all your assets.
|
4
|
-
Rails.application.config.assets.version = "1.0"
|
5
|
-
|
6
|
-
# Add additional assets to the asset load path.
|
7
|
-
# Rails.application.config.assets.paths << Emoji.images_path
|