sun-sword 0.0.10 → 0.0.12

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +57 -2
  3. data/Gemfile +20 -0
  4. data/Gemfile.lock +252 -0
  5. data/README.md +74 -15
  6. data/Rakefile +6 -10
  7. data/lib/generators/sun_sword/USAGE +22 -3
  8. data/lib/generators/sun_sword/frontend_generator.rb +77 -39
  9. data/lib/generators/sun_sword/frontend_generator_spec.rb +539 -0
  10. data/lib/generators/sun_sword/init_generator.rb +2 -0
  11. data/lib/generators/sun_sword/init_generator_spec.rb +82 -0
  12. data/lib/generators/sun_sword/scaffold_generator.rb +212 -29
  13. data/lib/generators/sun_sword/scaffold_generator_spec.rb +1414 -0
  14. data/lib/generators/sun_sword/templates_frontend/{Procfile.dev → Procfile.dev.tt} +1 -0
  15. data/lib/generators/sun_sword/templates_frontend/bin/{watch → watch.tt} +2 -1
  16. data/lib/generators/sun_sword/templates_frontend/config/{vite.json → vite.json.tt} +2 -1
  17. data/lib/generators/sun_sword/templates_frontend/controllers/application_controller.rb.tt +2 -2
  18. data/lib/generators/sun_sword/templates_frontend/controllers/tests_controller.rb +36 -0
  19. data/lib/generators/sun_sword/templates_frontend/controllers/tests_controller_spec.rb +62 -0
  20. data/lib/generators/sun_sword/templates_frontend/env.development +1 -1
  21. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/application.js +2 -2
  22. data/lib/generators/sun_sword/templates_frontend/frontend/pages/tests-stimulus.js +31 -0
  23. data/lib/generators/sun_sword/templates_frontend/frontend/pages/web.js +12 -0
  24. data/lib/generators/sun_sword/templates_frontend/frontend/stylesheets/application.css +1 -3
  25. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper.rb +17 -0
  26. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper_spec.rb +30 -0
  27. data/lib/generators/sun_sword/templates_frontend/package.json.tt +14 -0
  28. data/lib/generators/sun_sword/templates_frontend/views/components/_action_destroy.html.erb.tt +1 -1
  29. data/lib/generators/sun_sword/templates_frontend/views/components/_alert.html.erb.tt +1 -1
  30. data/lib/generators/sun_sword/templates_frontend/views/layouts/application.html.erb.tt +3 -3
  31. data/lib/generators/sun_sword/templates_frontend/views/tests/_frame_content.html.erb +9 -0
  32. data/lib/generators/sun_sword/templates_frontend/views/tests/_log_entry.html.erb +4 -0
  33. data/lib/generators/sun_sword/templates_frontend/views/tests/_updated_content.html.erb +6 -0
  34. data/lib/generators/sun_sword/templates_frontend/views/tests/stimulus.html.erb +45 -0
  35. data/lib/generators/sun_sword/templates_frontend/views/tests/turbo_drive.html.erb +55 -0
  36. data/lib/generators/sun_sword/templates_frontend/views/tests/turbo_frame.html.erb +87 -0
  37. data/lib/generators/sun_sword/templates_frontend/vite.config.ts.tt +1 -1
  38. data/lib/generators/sun_sword/templates_init/config/initializers/sun_sword.rb +1 -0
  39. data/lib/generators/sun_sword/templates_scaffold/controllers/controller.rb.tt +24 -24
  40. data/lib/generators/sun_sword/templates_scaffold/controllers/controller_spec.rb.tt +398 -0
  41. data/lib/generators/sun_sword/templates_scaffold/views/index.html.erb.tt +5 -5
  42. data/lib/generators/sun_sword/templates_scaffold/views/show.html.erb.tt +3 -0
  43. data/lib/generators/tmp/db/structures/test_structure.yaml +42 -0
  44. data/lib/sun-sword.rb +1 -0
  45. data/lib/sun_sword/configuration_spec.rb +77 -0
  46. data/lib/sun_sword/version.rb +1 -1
  47. metadata +177 -29
  48. data/.rspec +0 -3
  49. data/.rubocop.yml +0 -1146
  50. data/lib/generators/sun_sword/templates_frontend/controllers/site_controller.rb +0 -16
  51. data/lib/generators/sun_sword/templates_frontend/db/seeds.rb +0 -3
  52. data/lib/generators/sun_sword/templates_frontend/db/structures/example.yaml.tt +0 -106
  53. data/lib/generators/sun_sword/templates_frontend/frontend/pages/stimulus.js +0 -10
  54. data/lib/generators/sun_sword/templates_frontend/package.json +0 -7
  55. data/lib/generators/sun_sword/templates_frontend/views/site/_comment.html.erb.tt +0 -3
  56. data/lib/generators/sun_sword/templates_frontend/views/site/stimulus.html.erb.tt +0 -26
@@ -1,16 +0,0 @@
1
- class SiteController < ApplicationController
2
- layout :set_layouts
3
- def stimulus
4
- @comment = '- WELCOME -'
5
- end
6
-
7
- def jadi_a
8
- @comment = 'Kotaro'
9
- render partial: 'site/comment'
10
- end
11
-
12
- def jadi_b
13
- @comment = 'Minami'
14
- render partial: 'site/comment'
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- account = Models::Account.first_or_create(name: 'KOTAROISME')
2
- user = Models::User.create(full_name: 'Kotaro Minami', account_id: account.id, role: 'owner')
3
- Models::Auth.create(email: 'kotaroisme@gmail.com', password: 'blankblank', password_confirmation: 'blankblank', account_id: account.id, user_id: user.id)
@@ -1,106 +0,0 @@
1
- model: <%= @model_class %>
2
- resource_name: <%= @scope_path %>
3
- actor: <%= @actor %>
4
- fields:
5
- <% @model_class.columns.each do |field| -%>
6
- - <%= field.name.to_s %>
7
- <% end -%>
8
- <% @uploaders.each do |field| -%>
9
- - <%= field %>
10
- <% end -%>
11
- uploaders:
12
- <% @uploaders.each do |field| -%>
13
- - <%= field %>
14
- <% end -%>
15
- search_able:
16
- <% contract_fields.each do |field| -%>
17
- <% if ['title', 'name'].include?(field) -%>
18
- - <%= field %>
19
- <% end -%>
20
- <% end -%>
21
- controllers:
22
- list_fields:
23
- <% @fields.each do |field| -%>
24
- - <%= field %>
25
- <% end -%>
26
- show_fields:
27
- <% @model_class.columns.each do |field| -%>
28
- - <%= field.name.to_s %>
29
- <% end -%>
30
- <% @uploaders.each do |field| -%>
31
- - <%= field %>
32
- <% end -%>
33
- form_fields:
34
- <% (@fields).each do |field| -%>
35
- - name: <%= field %>
36
- type: string
37
- <% end -%>
38
- <% (@uploaders).each do |field| -%>
39
- - name: <%= field %>
40
- type: file
41
- <% end -%>
42
- domains:
43
- action_list:
44
- endpoint:
45
- is_auth: true
46
- is_skip: false
47
- parameters:
48
- use_case:
49
- contract:
50
- action_fetch_by_id:
51
- endpoint:
52
- is_auth: true
53
- is_skip: false
54
- parameters:
55
- use_case:
56
- contract:
57
- - required(:id).filled(:string)
58
- action_create:
59
- endpoint:
60
- is_auth: true
61
- is_skip: false
62
- parameters:
63
- use_case:
64
- contract:
65
- <% (@fields + @uploaders).each do |field| -%>
66
- <% column_type = get_column_type(field) -%>
67
- <% dry_type = @type_mapping[column_type.to_s] || ':string' -%>
68
- <% if @uploaders.include?(field) -%>
69
- - optional(:<%= field %>).maybe(<%= dry_type %>)
70
- <% else -%>
71
- - required(:<%= field %>).filled(<%= dry_type %>)
72
- <% end -%>
73
- <% end -%>
74
- action_update:
75
- endpoint:
76
- is_auth: true
77
- is_skip: false
78
- parameters:
79
- use_case:
80
- contract:
81
- - required(:id).filled(:string)
82
- <% (@fields + @uploaders).each do |field| -%>
83
- <% column_type = get_column_type(field) -%>
84
- <% dry_type = @type_mapping[column_type.to_s] || ':string' -%>
85
- <% if @uploaders.include?(field) -%>
86
- - optional(:<%= field %>).maybe(<%= dry_type %>)
87
- <% else -%>
88
- - optional(:<%= field %>).maybe(<%= dry_type %>)
89
- <% end -%>
90
- <% end -%>
91
- action_destroy:
92
- endpoint:
93
- is_auth: true
94
- is_skip: false
95
- parameters:
96
- use_case:
97
- contract:
98
- - required(:id).filled(:string)
99
- entity:
100
- skipped_fields:
101
- - id
102
- - created_at
103
- - updated_at
104
- <% if @model_class.columns.map(&:name).include?(:type) -%>
105
- - type
106
- <% end -%>
@@ -1,10 +0,0 @@
1
- import {Controller} from "@hotwired/stimulus"
2
-
3
- export default class extends Controller {
4
- static targets = ["name", "output"]
5
-
6
- greet() {
7
- this.outputTarget.textContent =
8
- `Hello, ${this.nameTarget.value}!`
9
- }
10
- }
@@ -1,7 +0,0 @@
1
- {
2
- "name": "sun_sword",
3
- "private": "true",
4
- "type": "module",
5
- "author": "kotarominami <kotaroisme@gmail.com>",
6
- "license": "MIT"
7
- }
@@ -1,3 +0,0 @@
1
- <%%= turbo_frame_tag "comment_show" do %>
2
- <p class="text-white"><%%= @comment %></p>
3
- <%% end %>
@@ -1,26 +0,0 @@
1
- <!--HTML from anywhere-->
2
- <container class="flex flex-col h-screen items-center justify-center bg-orange-500" data-controller="site-stimulus">
3
- <div class="w-full">
4
- <div class="font-bold flex items-center justify-center">
5
- <input data-site-stimulus-target="name" type="text" name="name" id="name" class="rounded-md border-0 py-1.5 text-orange-900 shadow-sm ring-1 ring-inset ring-orange-500 placeholder:text-orange-400 focus:ring-2 focus:ring-inset focus:ring-orange-500 mr-5" placeholder="Kotaro">
6
- <button data-action="click->site-stimulus#greet" type="button" class="rounded-full bg-white p-2 text-orange-500 shadow-sm hover:bg-white-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-orange-500">
7
- <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" data-slot="icon">
8
- <path d="M10.75 4.75a.75.75 0 0 0-1.5 0v4.5h-4.5a.75.75 0 0 0 0 1.5h4.5v4.5a.75.75 0 0 0 1.5 0v-4.5h4.5a.75.75 0 0 0 0-1.5h-4.5v-4.5Z"/>
9
- </svg>
10
- </button>
11
- </div>
12
- <br>
13
- <div class="font-bold flex items-center justify-center">
14
- <span class="text-white text-[2rem]" data-site-stimulus-target="output">. . .</span><br/>
15
- </div>
16
- </div>
17
- <div class="w-full">
18
- <div class="comment flex items-center justify-center">
19
- <%%= render partial: "site/comment" %>
20
- </div>
21
- <div class="action flex items-center justify-center">
22
- <%%= link_to "Kotaro", site_jadi_a_path, class: "class-button-outline m-2", data: { turbo_frame: "comment_show" } %>
23
- <%%= link_to "Minami", site_jadi_b_path, class: "class-button-outline m-2", data: { turbo_frame: "comment_show" } %>
24
- </div>
25
- </div>
26
- </container>