hanami-cli_bulma 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.
- checksums.yaml +7 -0
- data/.github/FUNDING.yml +1 -0
- data/.github/workflows/ci.yml +68 -0
- data/.gitignore +13 -0
- data/.repobot.yml +9 -0
- data/.rspec +2 -0
- data/.rubocop.yml +46 -0
- data/.tool-versions +1 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +374 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +31 -0
- data/LICENSE.md +22 -0
- data/README.md +61 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/docker-compose.yml +14 -0
- data/exe/hanami +15 -0
- data/hanami-cli_bulma.gemspec +47 -0
- data/lib/hanami/cli_bulma/bundler.rb +16 -0
- data/lib/hanami/cli_bulma/commands/app/command.rb +21 -0
- data/lib/hanami/cli_bulma/commands/app/generate/action.rb +25 -0
- data/lib/hanami/cli_bulma/commands/app/generate/slice.rb +27 -0
- data/lib/hanami/cli_bulma/commands/app/generate/view.rb +23 -0
- data/lib/hanami/cli_bulma/commands/app/generate.rb +16 -0
- data/lib/hanami/cli_bulma/commands/app.rb +30 -0
- data/lib/hanami/cli_bulma/commands/gem/new.rb +28 -0
- data/lib/hanami/cli_bulma/commands/gem.rb +21 -0
- data/lib/hanami/cli_bulma/commands.rb +35 -0
- data/lib/hanami/cli_bulma/generators/app/action/action.erb +17 -0
- data/lib/hanami/cli_bulma/generators/app/action/slice_action.erb +17 -0
- data/lib/hanami/cli_bulma/generators/app/action.rb +72 -0
- data/lib/hanami/cli_bulma/generators/app/slice/action.erb +7 -0
- data/lib/hanami/cli_bulma/generators/app/slice/app_css.erb +7 -0
- data/lib/hanami/cli_bulma/generators/app/slice/app_js.erb +1 -0
- data/lib/hanami/cli_bulma/generators/app/slice/app_layout.erb +46 -0
- data/lib/hanami/cli_bulma/generators/app/slice/favicon.ico +0 -0
- data/lib/hanami/cli_bulma/generators/app/slice/helpers.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/slice/keep.erb +0 -0
- data/lib/hanami/cli_bulma/generators/app/slice/operation.erb +7 -0
- data/lib/hanami/cli_bulma/generators/app/slice/relation.erb +8 -0
- data/lib/hanami/cli_bulma/generators/app/slice/repo.erb +8 -0
- data/lib/hanami/cli_bulma/generators/app/slice/routes.erb +3 -0
- data/lib/hanami/cli_bulma/generators/app/slice/struct.erb +8 -0
- data/lib/hanami/cli_bulma/generators/app/slice/view.erb +7 -0
- data/lib/hanami/cli_bulma/generators/app/slice.rb +26 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_template-edit.html.erb +24 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_template-index.html.erb +24 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_template-new.html.erb +24 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_template-show.html.erb +5 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_template.html.erb +5 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_view-edit.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_view-index.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_view-new.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_view-show.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/app_view.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_template-edit.html.erb +24 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_template-index.html.erb +26 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_template-new.html.erb +24 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_template-show.html.erb +5 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_template.html.erb +5 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_view-edit.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_view-index.erb +13 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_view-new.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_view-show.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view/slice_view.erb +10 -0
- data/lib/hanami/cli_bulma/generators/app/view.rb +73 -0
- data/lib/hanami/cli_bulma/generators/app/view_context.rb +19 -0
- data/lib/hanami/cli_bulma/generators/gem/app/404.html +82 -0
- data/lib/hanami/cli_bulma/generators/gem/app/500.html +82 -0
- data/lib/hanami/cli_bulma/generators/gem/app/action.erb +12 -0
- data/lib/hanami/cli_bulma/generators/gem/app/app.erb +8 -0
- data/lib/hanami/cli_bulma/generators/gem/app/app_css.erb +7 -0
- data/lib/hanami/cli_bulma/generators/gem/app/app_js.erb +1 -0
- data/lib/hanami/cli_bulma/generators/gem/app/app_layout.erb +45 -0
- data/lib/hanami/cli_bulma/generators/gem/app/assets.js +16 -0
- data/lib/hanami/cli_bulma/generators/gem/app/config_ru.erb +5 -0
- data/lib/hanami/cli_bulma/generators/gem/app/dev +8 -0
- data/lib/hanami/cli_bulma/generators/gem/app/env.erb +4 -0
- data/lib/hanami/cli_bulma/generators/gem/app/favicon.ico +0 -0
- data/lib/hanami/cli_bulma/generators/gem/app/gemfile.erb +44 -0
- data/lib/hanami/cli_bulma/generators/gem/app/gitignore.erb +9 -0
- data/lib/hanami/cli_bulma/generators/gem/app/helpers.erb +10 -0
- data/lib/hanami/cli_bulma/generators/gem/app/keep.erb +0 -0
- data/lib/hanami/cli_bulma/generators/gem/app/operation.erb +13 -0
- data/lib/hanami/cli_bulma/generators/gem/app/package.json.erb +8 -0
- data/lib/hanami/cli_bulma/generators/gem/app/procfile.erb +4 -0
- data/lib/hanami/cli_bulma/generators/gem/app/puma.erb +47 -0
- data/lib/hanami/cli_bulma/generators/gem/app/rakefile.erb +3 -0
- data/lib/hanami/cli_bulma/generators/gem/app/readme.erb +1 -0
- data/lib/hanami/cli_bulma/generators/gem/app/relation.erb +10 -0
- data/lib/hanami/cli_bulma/generators/gem/app/repo.erb +10 -0
- data/lib/hanami/cli_bulma/generators/gem/app/routes.erb +7 -0
- data/lib/hanami/cli_bulma/generators/gem/app/settings.erb +9 -0
- data/lib/hanami/cli_bulma/generators/gem/app/struct.erb +10 -0
- data/lib/hanami/cli_bulma/generators/gem/app/types.erb +11 -0
- data/lib/hanami/cli_bulma/generators/gem/app/validator.erb +12 -0
- data/lib/hanami/cli_bulma/generators/gem/app/view.erb +9 -0
- data/lib/hanami/cli_bulma/generators/gem/app.rb +114 -0
- data/lib/hanami/cli_bulma/version.rb +11 -0
- data/lib/hanami/cli_bulma.rb +50 -0
- data/lib/hanami-cli_bulma.rb +3 -0
- data/project.yml +2 -0
- metadata +242 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "erb"
|
|
4
|
+
|
|
5
|
+
module Hanami
|
|
6
|
+
module CLIBulma
|
|
7
|
+
module Generators
|
|
8
|
+
module App
|
|
9
|
+
# @since 2.0.0
|
|
10
|
+
# @api private
|
|
11
|
+
class Slice < Hanami::CLI::Generators::App::Slice
|
|
12
|
+
def template(path, context)
|
|
13
|
+
require "erb"
|
|
14
|
+
|
|
15
|
+
ERB.new(
|
|
16
|
+
File.read(__dir__ + "/slice/#{path}"),
|
|
17
|
+
trim_mode: "-"
|
|
18
|
+
).result(context.ctx)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
alias_method :t, :template
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_app_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<%%= form_for :item, '#' do |f| %>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<%%= f.label(:title, class: "label") %>
|
|
7
|
+
<div class="control">
|
|
8
|
+
<%%= f.text_field(:title, class: 'input', placeholder: 'Title') %>
|
|
9
|
+
<span class="icon is-small is-left">
|
|
10
|
+
<i class="fas fa-pencil"></i>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="field is-grouped">
|
|
16
|
+
<div class="control">
|
|
17
|
+
<%%= f.submit "Submit", class: "button is-link" %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="control">
|
|
20
|
+
<%%= link_to "Cancel", "/", class: "button is-link is-light"%>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_app_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<table class="table">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr><td>Title</td><td>Content</td><td>Actions</td></tr>
|
|
7
|
+
</thead>
|
|
8
|
+
<tfoot>
|
|
9
|
+
<tr><td>Title</td><td>Content</td><td>Actions</td></tr>
|
|
10
|
+
</tfoot>
|
|
11
|
+
<tbody>
|
|
12
|
+
<%% items.each do |item| %>
|
|
13
|
+
<tr>
|
|
14
|
+
<td>Item title</td>
|
|
15
|
+
<td>Item Content</td>
|
|
16
|
+
<td>
|
|
17
|
+
<%%= link_to 'Edit', '#', class: 'button is-link' %>
|
|
18
|
+
<%%= link_to 'Destroy', '#', class: 'button is-danger' %>
|
|
19
|
+
</td>
|
|
20
|
+
</tr>
|
|
21
|
+
<%% end %>
|
|
22
|
+
</tbody>
|
|
23
|
+
</table>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_app_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<%%= form_for :item, '#' do |f| %>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<%%= f.label(:title, class: "label") %>
|
|
7
|
+
<div class="control">
|
|
8
|
+
<%%= f.text_field(:title, class: 'input', placeholder: 'Title') %>
|
|
9
|
+
<span class="icon is-small is-left">
|
|
10
|
+
<i class="fas fa-pencil"></i>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="field is-grouped">
|
|
16
|
+
<div class="control">
|
|
17
|
+
<%%= f.submit "Submit", class: "button is-link" %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="control">
|
|
20
|
+
<%%= link_to "Cancel", "/", class: "button is-link is-light"%>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_app_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_app_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_app_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_app_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_app_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_app_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_app_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_app_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_app_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_app_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_slice_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<%%= form_for :item, '#' do |f| %>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<%%= f.label(:title, class: "label") %>
|
|
7
|
+
<div class="control">
|
|
8
|
+
<%%= f.text_field(:title, class: 'input', placeholder: 'Title') %>
|
|
9
|
+
<span class="icon is-small is-left">
|
|
10
|
+
<i class="fas fa-pencil"></i>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="field is-grouped">
|
|
16
|
+
<div class="control">
|
|
17
|
+
<%%= f.submit "Submit", class: "button is-link" %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="control">
|
|
20
|
+
<%%= link_to "Cancel", "/", class: "button is-link is-light"%>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_slice_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<table class="table">
|
|
5
|
+
<thead>
|
|
6
|
+
<tr><td>Title</td><td>Content</td><td>Actions</td></tr>
|
|
7
|
+
</thead>
|
|
8
|
+
<tfoot>
|
|
9
|
+
<tr><td>Title</td><td>Content</td><td>Actions</td></tr>
|
|
10
|
+
</tfoot>
|
|
11
|
+
<tbody>
|
|
12
|
+
<%% items.each do |item| %>
|
|
13
|
+
<tr>
|
|
14
|
+
<td>Item title</td>
|
|
15
|
+
<td>Item Content</td>
|
|
16
|
+
<td>
|
|
17
|
+
<%%= link_to 'Edit', '#', class: 'button is-link is-small' %>
|
|
18
|
+
<%%= form_for :article, '#', method: :delete, id: 'id' do |f| %>
|
|
19
|
+
<%%= f.submit "Destroy" , class: 'button is-danger is-small' %>
|
|
20
|
+
<%% end %>
|
|
21
|
+
</td>
|
|
22
|
+
</tr>
|
|
23
|
+
<%% end %>
|
|
24
|
+
</tbody>
|
|
25
|
+
</table>
|
|
26
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<h1 class="title is-1"><%= camelized_slice_name %>::Views::<%= camelized_namespace %>::<%= camelized_name %></h1>
|
|
2
|
+
|
|
3
|
+
<div class="content">
|
|
4
|
+
<%%= form_for :item, '#' do |f| %>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<%%= f.label(:title, class: "label") %>
|
|
7
|
+
<div class="control">
|
|
8
|
+
<%%= f.text_field(:title, class: 'input', placeholder: 'Title') %>
|
|
9
|
+
<span class="icon is-small is-left">
|
|
10
|
+
<i class="fas fa-pencil"></i>
|
|
11
|
+
</span>
|
|
12
|
+
</div>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="field is-grouped">
|
|
16
|
+
<div class="control">
|
|
17
|
+
<%%= f.submit "Submit", class: "button is-link" %>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="control">
|
|
20
|
+
<%%= link_to "Cancel", "/", class: "button is-link is-light"%>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
<%% end %>
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_slice_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_slice_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_slice_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_slice_name %>::View
|
|
7
|
+
<%= module_namespace_offset %> expose :items do
|
|
8
|
+
<%= module_namespace_offset %> []
|
|
9
|
+
<%= module_namespace_offset %> end
|
|
10
|
+
<%= module_namespace_offset %>end
|
|
11
|
+
<%= module_namespace_end %>
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_slice_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_slice_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_slice_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_slice_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module <%= camelized_slice_name %>
|
|
4
|
+
module Views
|
|
5
|
+
<%= module_namespace_declaration %>
|
|
6
|
+
<%= module_namespace_offset %>class <%= camelized_name %> < <%= camelized_slice_name %>::View
|
|
7
|
+
<%= module_namespace_offset %>end
|
|
8
|
+
<%= module_namespace_end %>
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "erb"
|
|
4
|
+
|
|
5
|
+
module Hanami
|
|
6
|
+
module CLIBulma
|
|
7
|
+
module Generators
|
|
8
|
+
module App
|
|
9
|
+
# @since 0.0.1
|
|
10
|
+
# @api private
|
|
11
|
+
class View < Hanami::CLI::Generators::App::View
|
|
12
|
+
def call(app, key, format, slice)
|
|
13
|
+
context = ViewContext.new(inflector, app, slice, key)
|
|
14
|
+
|
|
15
|
+
if slice
|
|
16
|
+
generate_for_slice(context, format, slice)
|
|
17
|
+
else
|
|
18
|
+
generate_for_app(context, format, slice)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
private
|
|
23
|
+
|
|
24
|
+
def generate_for_slice(context, format, slice)
|
|
25
|
+
base_directory = fs.join("slices", slice)
|
|
26
|
+
raise MissingSliceError.new(slice) unless fs.directory?(base_directory)
|
|
27
|
+
|
|
28
|
+
generate(base_directory, "slice", context, format)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def generate_for_app(context, format)
|
|
32
|
+
base_directory = fs.join("app")
|
|
33
|
+
|
|
34
|
+
generate(base_directory, "app", context, format)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def generate(base_directory, template_prefix, context, format)
|
|
38
|
+
# generate view folder
|
|
39
|
+
directory = fs.join(base_directory, "views", context.namespaces)
|
|
40
|
+
fs.mkdir(directory)
|
|
41
|
+
|
|
42
|
+
# generate view file
|
|
43
|
+
template_name = context.crud? ? "#{template_prefix}_view-#{context.name}.erb" : "#{template_prefix}_view.erb"
|
|
44
|
+
fs.write(fs.join(directory, "#{context.name}.rb"), t(template_name, context))
|
|
45
|
+
|
|
46
|
+
# generate template folder
|
|
47
|
+
directory = fs.join(base_directory, "templates", context.namespaces)
|
|
48
|
+
fs.mkdir(directory)
|
|
49
|
+
|
|
50
|
+
# generate template file
|
|
51
|
+
template_name = context.crud? ? "#{template_prefix}_template-#{context.name}" : "#{template_prefix}_template"
|
|
52
|
+
fs.write(
|
|
53
|
+
fs.join(directory, "#{context.name}.#{format}.erb"),
|
|
54
|
+
t(template_with_format_ext(template_name, format), context)
|
|
55
|
+
)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# @since 0.0.1
|
|
59
|
+
# @api private
|
|
60
|
+
def template(path, context)
|
|
61
|
+
require "erb"
|
|
62
|
+
|
|
63
|
+
ERB.new(
|
|
64
|
+
File.read(__dir__ + "/view/#{path}")
|
|
65
|
+
).result(context.ctx)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
alias_method :t, :template
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Hanami
|
|
4
|
+
module CLIBulma
|
|
5
|
+
module Generators
|
|
6
|
+
# @since 2.1.0
|
|
7
|
+
# @api private
|
|
8
|
+
module App
|
|
9
|
+
# @since 2.1.0
|
|
10
|
+
# @api private
|
|
11
|
+
class ViewContext < Hanami::CLI::Generators::App::ViewContext
|
|
12
|
+
def crud?
|
|
13
|
+
%w[new edit index show].include?(name)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>The page you were looking for doesn’t exist (404)</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--foreground-rgb: 0, 0, 0;
|
|
10
|
+
--background-rgb: 255, 255, 255;
|
|
11
|
+
--font-sans: ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (prefers-color-scheme: dark) {
|
|
15
|
+
:root {
|
|
16
|
+
--foreground-rgb: 255, 255, 255;
|
|
17
|
+
--background-rgb: 0, 0, 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
* {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
body,
|
|
28
|
+
html {
|
|
29
|
+
max-width: 100vw;
|
|
30
|
+
overflow-x: hidden;
|
|
31
|
+
font-size: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
color: rgb(var(--foreground-rgb));
|
|
36
|
+
background: rgb(var(--background-rgb));
|
|
37
|
+
font-family: var(--font-sans);
|
|
38
|
+
font-style: normal;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
main {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
height: 100vh;
|
|
47
|
+
padding: 0 4vw;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.message {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 1rem;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.message h1 {
|
|
58
|
+
font-size: 2rem;
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
p {
|
|
63
|
+
line-height: 1.6;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (prefers-color-scheme: dark) {
|
|
67
|
+
html {
|
|
68
|
+
color-scheme: dark;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<!-- This file lives in public/404.html -->
|
|
75
|
+
<main>
|
|
76
|
+
<div class="message">
|
|
77
|
+
<h1>404</h1>
|
|
78
|
+
<p>The page you were looking for doesn’t exist.</p>
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>We’re sorry, but something went wrong (500)</title>
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
--foreground-rgb: 0, 0, 0;
|
|
10
|
+
--background-rgb: 255, 255, 255;
|
|
11
|
+
--font-sans: ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (prefers-color-scheme: dark) {
|
|
15
|
+
:root {
|
|
16
|
+
--foreground-rgb: 255, 255, 255;
|
|
17
|
+
--background-rgb: 0, 0, 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
* {
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
body,
|
|
28
|
+
html {
|
|
29
|
+
max-width: 100vw;
|
|
30
|
+
overflow-x: hidden;
|
|
31
|
+
font-size: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
body {
|
|
35
|
+
color: rgb(var(--foreground-rgb));
|
|
36
|
+
background: rgb(var(--background-rgb));
|
|
37
|
+
font-family: var(--font-sans);
|
|
38
|
+
font-style: normal;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
main {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
height: 100vh;
|
|
47
|
+
padding: 0 4vw;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.message {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 1rem;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.message h1 {
|
|
58
|
+
font-size: 2rem;
|
|
59
|
+
font-weight: 500;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
p {
|
|
63
|
+
line-height: 1.6;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@media (prefers-color-scheme: dark) {
|
|
67
|
+
html {
|
|
68
|
+
color-scheme: dark;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
</style>
|
|
72
|
+
</head>
|
|
73
|
+
<body>
|
|
74
|
+
<!-- This file lives in public/500.html -->
|
|
75
|
+
<main>
|
|
76
|
+
<div class="message">
|
|
77
|
+
<h1>500</h1>
|
|
78
|
+
<p>We’re sorry, but something went wrong.</p>
|
|
79
|
+
</div>
|
|
80
|
+
</main>
|
|
81
|
+
</body>
|
|
82
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# auto_register: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "hanami/action"
|
|
5
|
+
require "dry/monads"
|
|
6
|
+
|
|
7
|
+
module <%= camelized_app_name %>
|
|
8
|
+
class Action < Hanami::Action
|
|
9
|
+
# Provide `Success` and `Failure` for pattern matching on operation results
|
|
10
|
+
include Dry::Monads[:result]
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../css/app.css";
|