sun-sword 0.0.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.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +1141 -0
  4. data/CHANGELOG.md +5 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +96 -0
  7. data/Rakefile +12 -0
  8. data/lib/generators/sun_sword/USAGE +9 -0
  9. data/lib/generators/sun_sword/frontend_generator.rb +148 -0
  10. data/lib/generators/sun_sword/scaffold_generator.rb +97 -0
  11. data/lib/generators/sun_sword/templates_frontend/Procfile.dev +1 -0
  12. data/lib/generators/sun_sword/templates_frontend/assets/config/manifest.js +1 -0
  13. data/lib/generators/sun_sword/templates_frontend/bin/watch +3 -0
  14. data/lib/generators/sun_sword/templates_frontend/config/database.yml +21 -0
  15. data/lib/generators/sun_sword/templates_frontend/config/vite.json +17 -0
  16. data/lib/generators/sun_sword/templates_frontend/controllers/application_controller.rb.tt +36 -0
  17. data/lib/generators/sun_sword/templates_frontend/controllers/dashboard/site_controller.rb +6 -0
  18. data/lib/generators/sun_sword/templates_frontend/controllers/site_controller.rb +15 -0
  19. data/lib/generators/sun_sword/templates_frontend/env.development +14 -0
  20. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/.keep +0 -0
  21. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/kotaro.ico +0 -0
  22. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/logo.svg +16 -0
  23. data/lib/generators/sun_sword/templates_frontend/frontend/assets/images/profile.jpeg +0 -0
  24. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/application.js +17 -0
  25. data/lib/generators/sun_sword/templates_frontend/frontend/entrypoints/stimulus.js +9 -0
  26. data/lib/generators/sun_sword/templates_frontend/frontend/pages/stimulus.js +10 -0
  27. data/lib/generators/sun_sword/templates_frontend/frontend/pages/web.js +122 -0
  28. data/lib/generators/sun_sword/templates_frontend/frontend/stylesheets/application.scss +198 -0
  29. data/lib/generators/sun_sword/templates_frontend/helpers/application_helper.rb +5 -0
  30. data/lib/generators/sun_sword/templates_frontend/package.json +7 -0
  31. data/lib/generators/sun_sword/templates_frontend/postcss.config.js +6 -0
  32. data/lib/generators/sun_sword/templates_frontend/rubocop.yml.tt +1141 -0
  33. data/lib/generators/sun_sword/templates_frontend/tailwind.config.js +39 -0
  34. data/lib/generators/sun_sword/templates_frontend/views/components/_action_destroy.html.erb.tt +48 -0
  35. data/lib/generators/sun_sword/templates_frontend/views/components/_action_edit.html.erb.tt +7 -0
  36. data/lib/generators/sun_sword/templates_frontend/views/components/_action_show.html.erb.tt +8 -0
  37. data/lib/generators/sun_sword/templates_frontend/views/components/_alert.html.erb.tt +66 -0
  38. data/lib/generators/sun_sword/templates_frontend/views/components/_error_form_submit.html.erb.tt +20 -0
  39. data/lib/generators/sun_sword/templates_frontend/views/components/_link_action.html.erb.tt +9 -0
  40. data/lib/generators/sun_sword/templates_frontend/views/components/layouts/_sidebar_logo.html.erb +18 -0
  41. data/lib/generators/sun_sword/templates_frontend/views/layouts/application.html.erb.tt +42 -0
  42. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/_sidebar.html.erb.tt +60 -0
  43. data/lib/generators/sun_sword/templates_frontend/views/layouts/dashboard/application.html.erb.tt +71 -0
  44. data/lib/generators/sun_sword/templates_frontend/views/site/_comment.html.erb.tt +3 -0
  45. data/lib/generators/sun_sword/templates_frontend/views/site/stimulus.html.erb.tt +26 -0
  46. data/lib/generators/sun_sword/templates_frontend/vite.config.ts.tt +27 -0
  47. data/lib/generators/sun_sword/templates_scaffold/controllers/controller.rb.tt +90 -0
  48. data/lib/generators/sun_sword/templates_scaffold/example.rb.tt +2 -0
  49. data/lib/generators/sun_sword/templates_scaffold/views/_form.html.erb.tt +22 -0
  50. data/lib/generators/sun_sword/templates_scaffold/views/components/menu/link.html.erb.tt +1 -0
  51. data/lib/generators/sun_sword/templates_scaffold/views/edit.html.erb.tt +10 -0
  52. data/lib/generators/sun_sword/templates_scaffold/views/index.html.erb.tt +50 -0
  53. data/lib/generators/sun_sword/templates_scaffold/views/new.html.erb.tt +10 -0
  54. data/lib/generators/sun_sword/templates_scaffold/views/show.html.erb.tt +26 -0
  55. data/lib/sun-sword.rb +7 -0
  56. data/lib/sun_sword/version.rb +6 -0
  57. metadata +141 -0
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-09-08
4
+
5
+ - Initial release
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 kotarominami
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # SunSword
2
+ This gem provides helper interfaces and classes to assist in the construction of application with
3
+ Clean Architecture, as described in [Robert Martin's seminal book](https://www.amazon.com/gp/product/0134494164).
4
+
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'rider-kick'
12
+ gem 'sun-sword'
13
+
14
+ ```
15
+
16
+ And then execute:
17
+ $ rails new kotaro_minami -d=postgresql -T --skip-javascript --skip-asset-pipeline
18
+ $ bundle install
19
+ $ rails generate rider_kick:init
20
+ $ rails generate rider_kick:clean_arch --setup
21
+ $ rails db:drop db:create db:migrate db:seed
22
+ $ rails generate sun_sword:frontend
23
+
24
+ $ rubocop -a
25
+
26
+ ## Usage
27
+ ```bash
28
+ Description:
29
+ Clean Architecture CRUD generator
30
+ rails new kotaro_minami -d=postgresql -T --skip-javascript --skip-asset-pipeline
31
+
32
+ Example:
33
+ To Generate Init:
34
+ bin/rails generate rider_kick:init
35
+
36
+ To Generate Pattern:
37
+ bin/rails generate rider_kick:clean_arch --setup
38
+
39
+ To Generate Frontend:
40
+ bin/rails generate sun_sword:frontend --setup
41
+
42
+ To Generate scaffold:
43
+ bin/rails generate sun_sword:scaffold Models::Contact actor:user
44
+ ```
45
+
46
+ ## Philosophy
47
+
48
+ The intention of this gem is to help you build applications that are built from the use case down,
49
+ and decisions about I/O can be deferred until the last possible moment.
50
+
51
+ ## Clean Architecture
52
+ This structure provides helper interfaces and classes to assist in the construction of application with Clean Architecture, as described in Robert Martin's seminal book.
53
+
54
+ ```
55
+ - app
56
+ - controllers
57
+ - ...
58
+ - models
59
+ - models
60
+ - ...
61
+ - domains
62
+ - entities (Contract Response)
63
+ - builder
64
+ - repositories (Business logic)
65
+ - use_cases (Just Usecase)
66
+ - utils (Class Reusable)
67
+ ```
68
+ ## Screaming architecture - use cases as an organisational principle
69
+ Uncle Bob suggests that your source code organisation should allow developers to easily find a listing of all use cases your application provides. Here's an example of how this might look in a this application.
70
+ ```
71
+ - app
72
+ - controllers
73
+ - ...
74
+ - models
75
+ - models
76
+ - ...
77
+ - domains
78
+ - core
79
+ ...
80
+ - usecase
81
+ - retail_customer_opens_bank_account.rb
82
+ - retail_customer_makes_deposit.rb
83
+ - ...
84
+ ```
85
+ Note that the use case name contains:
86
+
87
+ - the user role
88
+ - the action
89
+ - the (sometimes implied) subject
90
+ ```ruby
91
+ [user role][action][subject].rb
92
+ # retail_customer_opens_bank_account.rb
93
+ # admin_fetch_info.rb [specific usecase]
94
+ # fetch_info.rb [generic usecase] every role can access it
95
+ ```
96
+
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,9 @@
1
+ Description:
2
+ Clean Architecture CRUD generator
3
+ rails new jendral_jack -d=postgresql -T --skip-javascript --skip-asset-pipeline
4
+
5
+ Example:
6
+ bin/rails generate sun_sword:frontend --setup
7
+ bin/rails generate sun_sword:scaffold contacts<check in db/structure>
8
+
9
+
@@ -0,0 +1,148 @@
1
+ module SunSword
2
+ class FrontendGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates_frontend', __dir__)
4
+
5
+ class_option :setup, type: :boolean, default: false, desc: 'Setup domain structure'
6
+
7
+ def validate_setup_option
8
+ unless options.setup
9
+ raise Thor::Error, 'The --setup option must be specified to create the domain structure.'
10
+ end
11
+ end
12
+
13
+ desc 'This generator installs Vite with Rails 7 configuration'
14
+
15
+ def setup
16
+ remove_assets_folder
17
+ copy_assets_from_template
18
+
19
+ # copy_database_config
20
+ # copy_env_development
21
+
22
+ add_vite_to_gemfile
23
+ install_vite
24
+ configure_vite
25
+
26
+ modify_application_js
27
+ generate_default_frontend
28
+ generate_controllers_site
29
+ generate_components
30
+ modify_layout_for_vite
31
+ end
32
+
33
+ private
34
+
35
+ def remove_assets_folder
36
+ assets_path = "#{path_app}/assets"
37
+ if Dir.exist?(assets_path)
38
+ remove_dir(assets_path)
39
+ say "Folder '#{assets_path}' has been removed.", :green
40
+ else
41
+ say "Folder '#{assets_path}' does not exist.", :yellow
42
+ end
43
+ end
44
+
45
+ def copy_assets_from_template
46
+ template 'assets/config/manifest.js', File.join('assets/config/manifest.js')
47
+ say "File '#{path_app}/assets' has been copied from template.", :green
48
+ end
49
+
50
+ def copy_database_config
51
+ template 'config/database.yml', File.join('config/database.yml')
52
+ end
53
+
54
+ def copy_env_development
55
+ template 'env.development', File.join('.env.development')
56
+ template 'env.development', File.join('env.example')
57
+ end
58
+
59
+ def add_vite_to_gemfile
60
+ gem_dependencies = <<~RUBY
61
+
62
+ # --- SunSword Package frontend
63
+ gem "turbo-rails"
64
+ gem "stimulus-rails"
65
+ gem "vite_rails"
66
+ RUBY
67
+ append_to_file('Gemfile', gem_dependencies)
68
+ say 'Vite Rails gem added and bundle installed', :green
69
+ end
70
+
71
+ def install_vite
72
+ template 'package.json', 'package.json'
73
+ run 'bundle exec vite install'
74
+ run 'yarn add -D sass vite-plugin-full-reload vite-plugin-ruby vite-plugin-stimulus-hmr'
75
+ run 'yarn add -D tailwindcss @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio @tailwindcss/forms @tailwindcss/line-clamp autoprefixer'
76
+ run 'yarn add -D eslint prettier eslint-plugin-prettier eslint-config-prettier eslint-plugin-tailwindcss path'
77
+ run 'yarn add @hotwired/stimulus @hotwired/turbo-rails stimulus-vite-helpers vite animejs stimulus-use'
78
+ say 'Vite installed successfully', :green
79
+ end
80
+
81
+ def configure_vite
82
+ say 'Configuring Vite...'
83
+
84
+ # Add a basic Vite configuration file to your Rails app
85
+ template 'tailwind.config.js', 'tailwind.config.js'
86
+ template 'postcss.config.js', 'postcss.config.js'
87
+ template 'vite.config.ts.tt', 'vite.config.ts'
88
+ template 'Procfile.dev', 'Procfile.dev'
89
+ template 'bin/watch', 'bin/watch'
90
+ run 'chmod +x bin/watch'
91
+ template 'config/vite.json', 'config/vite.json'
92
+
93
+ say 'Vite configuration completed', :green
94
+ end
95
+
96
+ def modify_application_js
97
+ if File.exist?('app/javascript/application.js')
98
+
99
+ say 'Updated application.js for Vite', :green
100
+ end
101
+ end
102
+
103
+ def generate_default_frontend
104
+ directory('frontend', 'app/frontend')
105
+ say 'Generate default controller', :green
106
+ end
107
+
108
+ def generate_components
109
+ directory('views/components', 'app/views/components')
110
+ say 'Generate default controller', :green
111
+ end
112
+
113
+ def generate_controllers_site
114
+ run 'rails g controller site stimulus'
115
+ template 'controllers/site_controller.rb', File.join('app/controllers/site_controller.rb')
116
+ template 'controllers/application_controller.rb.tt', File.join('app/controllers/application_controller.rb')
117
+ site_route = <<-RUBY
118
+
119
+ root "site#stimulus"
120
+ get "site/jadi_a"
121
+ get "site/jadi_b"
122
+
123
+ namespace :dashboard do
124
+ get "site" => "site#index", as: :dashboard_site_index
125
+ end
126
+
127
+ RUBY
128
+ inject_into_file 'config/routes.rb', site_route, after: "Rails.application.routes.draw do\n"
129
+
130
+ say 'Generate default controller', :green
131
+ end
132
+
133
+ def path_app
134
+ 'app'
135
+ end
136
+
137
+ def modify_layout_for_vite
138
+ template 'views/site/stimulus.html.erb.tt', 'app/views/site/stimulus.html.erb'
139
+ template 'views/site/_comment.html.erb.tt', 'app/views/site/_comment.html.erb'
140
+ template 'views/layouts/application.html.erb.tt', 'app/views/layouts/application.html.erb'
141
+
142
+ directory('views/layouts/dashboard', 'app/views/layouts/dashboard')
143
+ directory('helpers', 'app/helpers')
144
+ template('controllers/dashboard/site_controller.rb', 'app/controllers/dashboard/site_controller.rb')
145
+ say 'Updated application layout for Vite integration', :green
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,97 @@
1
+ module SunSword
2
+ class ScaffoldGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates_scaffold', __dir__)
4
+
5
+ argument :arg_structure, type: :string, default: '', banner: ''
6
+
7
+ def running
8
+ validation!
9
+ setup_variables
10
+ create_root_folder
11
+ create_controller_file
12
+ create_view_file
13
+ create_link_file
14
+ end
15
+
16
+ private
17
+
18
+ def validation!
19
+ unless File.exist?('config/initializers/rider_kick.rb')
20
+ say 'Error must create init configuration for rider_kick!'
21
+ raise Thor::Error, 'run: bin/rails generate rider_kick:init'
22
+ end
23
+ end
24
+
25
+ def setup_variables
26
+ config = YAML.load_file("db/structures/#{arg_structure}_structure.yaml")
27
+ @structure = Hashie::Mash.new(config)
28
+
29
+ # Mengambil detail konfigurasi
30
+ model_name = @structure.model
31
+ resource_name = @structure.resource_name.singularize.underscore.downcase
32
+ entity = @structure.entity || {}
33
+
34
+ @actor = @structure.actor
35
+ @uploaders = @structure.uploaders || []
36
+ @search_able = @structure.search_able || []
37
+ @services = @structure.domains || {}
38
+ @controllers = @structure.controllers || {}
39
+ @contract_list = @services.action_list.use_case.contract || []
40
+ @contract_fetch_by_id = @services.action_fetch_by_id.use_case.contract || []
41
+ @contract_create = @services.action_create.use_case.contract || []
42
+ @contract_update = @services.action_update.use_case.contract || []
43
+ @contract_destroy = @services.action_destroy.use_case.contract || []
44
+ @skipped_fields = entity.skipped_fields || []
45
+ @custom_fields = entity.custom_fields || []
46
+ @route_scope_path = @structure.controllers.route_scope.downcase rescue ''
47
+ @route_scope_class = @route_scope_path.camelize rescue ''
48
+
49
+ @variable_subject = model_name.split('::').last.underscore.downcase
50
+ @scope_path = resource_name.pluralize.underscore.downcase
51
+ @scope_class = @scope_path.camelize
52
+ @model_class = model_name.camelize.constantize
53
+ @subject_class = resource_name.camelize
54
+ @fields = contract_fields
55
+ end
56
+
57
+ def build_usecase_filename(action, suffix = '')
58
+ "#{@actor}_#{action}_#{@variable_subject}#{suffix}".camelize
59
+ end
60
+
61
+ def create_root_folder
62
+ empty_directory File.join('app/views', @route_scope_path.to_s, @scope_path.to_s)
63
+ end
64
+
65
+ def create_controller_file
66
+ template 'controllers/controller.rb.tt', File.join('app/controllers', @route_scope_path.to_s, "#{@scope_path}_controller.rb")
67
+ end
68
+
69
+ def create_view_file
70
+ template 'views/_form.html.erb.tt', File.join('app/views', @route_scope_path.to_s, @scope_path.to_s, '_form.html.erb')
71
+ template 'views/edit.html.erb.tt', File.join('app/views', @route_scope_path.to_s, @scope_path.to_s, 'edit.html.erb')
72
+ template 'views/index.html.erb.tt', File.join('app/views', @route_scope_path.to_s, @scope_path.to_s, 'index.html.erb')
73
+ template 'views/new.html.erb.tt', File.join('app/views', @route_scope_path.to_s, @scope_path.to_s, 'new.html.erb')
74
+ template 'views/show.html.erb.tt', File.join('app/views', @route_scope_path.to_s, @scope_path.to_s, 'show.html.erb')
75
+ end
76
+
77
+ def create_link_file
78
+ template 'views/components/menu/link.html.erb.tt', File.join('app/views/components/menu', "_link_to_#{@scope_path}.html.erb")
79
+ link_to = " <li><%= render 'components/menu/#{"link_to_#{@scope_path}"}' %></li>\n"
80
+ inject_into_file 'app/views/layouts/dashboard/_sidebar.html.erb', link_to, before: " <%# generate_link %>\n"
81
+ end
82
+
83
+ def contract_fields
84
+ skip_contract_fields = @skipped_fields.map(&:strip).uniq
85
+ if RiderKick.scope_owner_column.present?
86
+ skip_contract_fields << RiderKick.scope_owner_column.to_s
87
+ end
88
+ @model_class.columns.reject { |column| skip_contract_fields.include?(column.name.to_s) }.map(&:name).map(&:to_s)
89
+ end
90
+
91
+ def strong_params
92
+ results = ''
93
+ @controllers.form_fields.map { |tc| results << ":#{tc}," }
94
+ results[0..-2]
95
+ end
96
+ end
97
+ end
@@ -0,0 +1 @@
1
+ vite: bin/vite dev --clobber
@@ -0,0 +1 @@
1
+ //= link application.css
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env sh
2
+
3
+ vite dev --clobber
@@ -0,0 +1,21 @@
1
+ default: &default
2
+ adapter: postgresql
3
+ encoding: unicode
4
+ pool: <%%= ENV.fetch("DATABASE_POOL") { 50 } %>
5
+ database: <%%= ENV["DATABASE_NAME"] %>
6
+ username: <%%= ENV["DATABASE_USERNAME"] %>
7
+ password: <%%= ENV["DATABASE_PASSWORD"] %>
8
+ host: <%%= ENV['DATABASE_HOSTNAME'] %>
9
+ port: <%%= ENV['DATABASE_PORT'].to_i %>
10
+
11
+
12
+ production:
13
+ primary:
14
+ <<: *default
15
+
16
+ development:
17
+ primary:
18
+ <<: *default
19
+
20
+ test:
21
+ <<: *default
@@ -0,0 +1,17 @@
1
+ {
2
+ "all": {
3
+ "sourceCodeDir": "app/frontend",
4
+ "watchAdditionalPaths": []
5
+ },
6
+ "development": {
7
+ "autoBuild": true,
8
+ "host": "127.0.0.1",
9
+ "publicOutputDir": "vite-dev",
10
+ "port": 3036
11
+ },
12
+ "test": {
13
+ "autoBuild": true,
14
+ "publicOutputDir": "vite-test",
15
+ "port": 3037
16
+ }
17
+ }
@@ -0,0 +1,36 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3
+ allow_browser versions: :modern
4
+
5
+ protected
6
+
7
+ def build_contract(params)
8
+ # { "<%=RiderKick.scope_owner_column.to_s%>": current_auth.account.id SecureRandom.uuid }.merge(params)
9
+ { <%=RiderKick.scope_owner_column.to_s%>: SecureRandom.uuid }.merge(params)
10
+ end
11
+
12
+ def build_form_errors(params, model, errors)
13
+ params.keys.each do |key|
14
+ model[key] = params[key]
15
+ end
16
+ if errors.is_a?(Hash)
17
+ errors.keys.each do |key|
18
+ model.errors.add(key, :invalid, message: errors[key][0])
19
+ end
20
+ elsif errors.is_a?(Array)
21
+ errors.each do |error|
22
+ if error.options.present?
23
+ model.errors.add(error.attribute, error.type, message: error.options['message'])
24
+ else
25
+ model.errors.add(error.attribute, error.type)
26
+ end
27
+ end
28
+ end
29
+ model
30
+ end
31
+
32
+ def set_layouts
33
+ # "#{current_auth.user.role}/application"
34
+ 'dashboard/application'
35
+ end
36
+ end
@@ -0,0 +1,6 @@
1
+ class Dashboard::SiteController < ApplicationController
2
+ layout :set_layouts
3
+ def index
4
+ render 'site/stimulus'
5
+ end
6
+ end
@@ -0,0 +1,15 @@
1
+ class SiteController < ApplicationController
2
+ def stimulus
3
+ @comment = '- WELCOME -'
4
+ end
5
+
6
+ def jadi_a
7
+ @comment = 'Kotaro'
8
+ render partial: 'site/comment'
9
+ end
10
+
11
+ def jadi_b
12
+ @comment = 'Minami'
13
+ render partial: 'site/comment'
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ BASE_URL="http://localhost:3000"
2
+
3
+ # database primary
4
+ DATABASE_NAME=<%= Rails.application.class.module_parent_name.underscore %>_development
5
+ DATABASE_USERNAME=postgres
6
+ DATABASE_PASSWORD=bayangan
7
+ DATABASE_HOSTNAME=localhost
8
+ DATABASE_PORT="5433"
9
+ DATABASE_POOL="10"
10
+
11
+ RAILS_MAX_THREADS="5"
12
+ RAILS_ENV="development"
13
+ WEB_CONCURRENCY="5"
14
+ WORKER_TIMEOUT="3600"
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 26.4.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 1024 704" style="enable-background:new 0 0 1024 704;" xml:space="preserve">
5
+ <path d="M759.9,602.1c-15.8,11.4-26.8,26.1-35.4,42.9c-5,9.7-5,9.6-15.4,6.4c-69.1-21-138.3-41.9-207.5-62.8
6
+ c-81.7-24.7-163.4-49.2-245.1-73.9c-75-22.6-150-45.3-225-68c-2.9-0.9-6.2-1.1-8.5-3.6c0.1-2.5,1.9-3.8,3.3-5.3
7
+ c79.8-89.3,172.4-162.3,278.4-218.3c20-10.5,40.3-20.4,60.9-29.5c5-2.2,6.2-4.5,4.7-10c-16.3-57.2,8-115.9,58.2-141.2
8
+ c44.8-22.6,104-7.6,129.9,32.8c6.9,10.8,8.8,23.1,10.6,35.4c0.6,4.1,1.2,8.4,2.6,12.3c4.1,11.4,12.4,17.9,24.5,18.9
9
+ c10.5,0.9,21-0.6,31.6-1.1c18.4-0.8,36.5,2.4,54.5,6.2c27.6,5.8,54,14.7,78.9,28.3c33,18.1,55.2,44.7,66.6,80.8
10
+ c6.3,20,10.2,40.4,13.4,60.9c3.3,21.6,15.9,35.8,35.2,44.6c21.7,9.9,43.8,18.7,67.8,21.5c10.5,1.2,20.9,2.1,31.4,3.2
11
+ c18.3,1.9,27.8,12.9,25,30.9c-4.5,29-11.2,57.6-22.1,84.8c-19.4,48.3-55.9,77.1-106.3,88.4c-14.5,3.3-29.4,2.5-44.1,1.1
12
+ C804,585.5,780.7,586.5,759.9,602.1 M725,357.5c4.3,7.8,9.3,15.1,16.1,21c11.6,10.1,23.4,10.3,35.5,0.7
13
+ c11.2-8.9,17.9-21.1,24.9-33.1c2.7-4.6,2-7.2-2.7-10.1c-23.7-14.2-47.1-28.9-70.6-43.3c-7.1-4.3-13.7-9.4-22.5-13.1
14
+ C707.4,307.2,712,332.9,725,357.5 M980.8,448.6c1.5,2.1,3,4.3,5.2,7.4c5.8-17.4,9.6-33.7,7.4-50.8c-0.8-6.1-4.2-10.8-9.8-13.9
15
+ c-5.7-3.1-11.9-4.1-18.1-4.9c-8.8-1.1-17.7-2.1-28.1-3.2C952.2,405.7,966.2,426.8,980.8,448.6z"/>
16
+ </svg>
@@ -0,0 +1,17 @@
1
+ // LOAD everything
2
+ import "@hotwired/turbo-rails"
3
+ import {stimulus} from "./stimulus"
4
+
5
+ import WebController from "../pages/web"
6
+ import SiteStimulusController from "../pages/stimulus.js"
7
+
8
+ import "../stylesheets/application.scss"
9
+ console.log("Kotaro is here")
10
+ console.log(window.location.hash.slice(1))
11
+
12
+ const textElement = document.getElementById(window.location.hash.slice(1))
13
+ if(textElement !== null){
14
+ textElement.scrollIntoView({behavior: "smooth"})
15
+ }
16
+ stimulus.register("web", WebController)
17
+ stimulus.register("site-stimulus", SiteStimulusController)
@@ -0,0 +1,9 @@
1
+ import {Application} from "@hotwired/stimulus"
2
+
3
+ const stimulus = Application.start()
4
+
5
+ // Configure Stimulus development experience
6
+ stimulus.debug = false
7
+ window.Stimulus = stimulus
8
+
9
+ export {stimulus}
@@ -0,0 +1,10 @@
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
+ }