birdel 0.3.3 → 1.0.0
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/Gemfile +3 -1
- data/Gemfile.lock +3 -1
- data/lib/birdel/cli.rb +15 -0
- data/lib/birdel/com/com_actor.rb +68 -0
- data/lib/birdel/component/component_actor.rb +7 -0
- data/lib/birdel/map/map_actor.rb +116 -0
- data/lib/birdel/rona/rona_actor.rb +1 -1
- data/lib/birdel/version.rb +1 -1
- data/lib/birdel.rb +3 -6
- metadata +6 -4
- data/lib/birdel/com/com.rb +0 -63
- data/lib/birdel/map/map.rb +0 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c69242d504f173a3f2205c233f4c14985464d2067ab94ec8ac6bfa3916c98d8
|
4
|
+
data.tar.gz: '085ebfa1d118f7d9a17918bec92ee3c53c4bf236cc23a1ac278f624d2ce0d905'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb3ae839ec2fea84c5dd02bf38ab8fba11b4c968bd3336f1a5720ba573c34d4525546330b0bf6c898848880d9abb3b85a0d4b8e7ec38d5b659c2c5afd69da60a
|
7
|
+
data.tar.gz: 697841acce5a77178a9b4314a4e9ba6819849b772a65b22b5b904d4b424191a2b9808f986001197fcf18f1aed3f29d4f6ba892c80722efe294391167540f9eaf
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
birdel (0.
|
4
|
+
birdel (0.3.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -52,6 +52,7 @@ GEM
|
|
52
52
|
rubocop-ast (1.27.0)
|
53
53
|
parser (>= 3.2.1.0)
|
54
54
|
ruby-progressbar (1.13.0)
|
55
|
+
thor (1.2.1)
|
55
56
|
tzinfo (2.0.6)
|
56
57
|
concurrent-ruby (~> 1.0)
|
57
58
|
unicode-display_width (2.4.2)
|
@@ -66,6 +67,7 @@ DEPENDENCIES
|
|
66
67
|
rake (~> 13.0)
|
67
68
|
rspec (~> 3.0)
|
68
69
|
rubocop (~> 1.21)
|
70
|
+
thor (~> 1.2, >= 1.2.1)
|
69
71
|
|
70
72
|
BUNDLED WITH
|
71
73
|
2.4.6
|
data/lib/birdel/cli.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Birdel
|
4
|
+
class CLI < Thor
|
5
|
+
desc "gcom NAME", "Generate a new component"
|
6
|
+
def gcom(name)
|
7
|
+
Birdel::Com.roll(name)
|
8
|
+
end
|
9
|
+
|
10
|
+
desc "synth", "Syncronize components assets"
|
11
|
+
def synth
|
12
|
+
Birdel::Synth.roll(name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
module Birdel
|
2
|
+
module Com
|
3
|
+
def roll
|
4
|
+
app_path = Pathname.new("#{Dir.pwd}")
|
5
|
+
components_path = app_path.join("app", "components")
|
6
|
+
component_ns = ARGV[0]
|
7
|
+
component_ns_camelized = component_ns.split("::").map(&:camelize).join("::")
|
8
|
+
component_name = component_ns_camelized.split("::").last
|
9
|
+
component_path = component_ns.split("::").join("/")
|
10
|
+
full_component_path = components_path.join(component_path.underscore)
|
11
|
+
|
12
|
+
variable_name = "css_class"
|
13
|
+
css_class = component_ns_camelized.underscore.gsub('_', '-').gsub('/', '--')
|
14
|
+
actor_name = "#{component_name}Actor"
|
15
|
+
files = [
|
16
|
+
{
|
17
|
+
name: "#{component_name.underscore}.rb",
|
18
|
+
content: "
|
19
|
+
class #{component_ns_camelized}::#{component_name} < ViewComponent::Base
|
20
|
+
include Birdel::Component
|
21
|
+
end
|
22
|
+
"
|
23
|
+
},
|
24
|
+
{ name: "#{component_name.underscore}.css", content: ".#{css_class}{}" },
|
25
|
+
{ name: "#{component_name.underscore}.js", content: "" },
|
26
|
+
{
|
27
|
+
name: "#{component_name.underscore}_controller.js",
|
28
|
+
content: "
|
29
|
+
import { #{actor_name} } from \"./#{component_name.underscore}_actor\";
|
30
|
+
import { Controller } from \"@hotwired/stimulus\";
|
31
|
+
export default class extends Controller {
|
32
|
+
connect() {}
|
33
|
+
}
|
34
|
+
" },
|
35
|
+
{
|
36
|
+
name: "#{component_name.underscore}_actor.js",
|
37
|
+
content: "
|
38
|
+
import { ActorBase } from \"birdeljs\"
|
39
|
+
export class #{actor_name} extends ActorBase {
|
40
|
+
constructor() {
|
41
|
+
console.log(\"#{actor_name}!\");
|
42
|
+
}
|
43
|
+
}
|
44
|
+
"},
|
45
|
+
{ name: "#{component_name.underscore}.html.erb", content: "<div class=\"<%= #{variable_name} %>\" data-controller=\"<%= #{variable_name} %>\">\n</div>" },
|
46
|
+
]
|
47
|
+
|
48
|
+
files.each do |file|
|
49
|
+
file_path = full_component_path.join(file[:name])
|
50
|
+
if file_path.exist?
|
51
|
+
puts "File already exists: #{file_path}".red
|
52
|
+
else
|
53
|
+
puts "Creating file: #{file_path}".yellow
|
54
|
+
#create new file and folders if needed
|
55
|
+
file_path.dirname.mkpath
|
56
|
+
File.open(file_path, "w") do |f|
|
57
|
+
f.puts file[:content]
|
58
|
+
end
|
59
|
+
if file_path.exist?
|
60
|
+
puts "Done!".bold.green
|
61
|
+
else
|
62
|
+
puts "Failed".red
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
|
2
|
+
module Birdel
|
3
|
+
module Map
|
4
|
+
def roll(entry_ns)
|
5
|
+
myapp_path = Pathname.new("#{Dir.pwd}")
|
6
|
+
stylesheets_path = myapp_path.join("app", "assets", "stylesheets")
|
7
|
+
javascript_path = myapp_path.join("app", "javascript")
|
8
|
+
layouts_path = myapp_path.join("app", "views", "layouts")
|
9
|
+
css_bentries_path = stylesheets_path.join("ui", "bentries")
|
10
|
+
js_bentries_path = javascript_path.join("ui", "bentries")
|
11
|
+
layouts_bentries_path = layouts_path.join("ui", "bentries")
|
12
|
+
|
13
|
+
entry_ns_camelized = entry_ns.split("::").map(&:camelize).join("::")
|
14
|
+
entry_name = entry_ns_camelized.split("::").last
|
15
|
+
entry_path = entry_ns.split("::").join("/")
|
16
|
+
|
17
|
+
full_css_entry_path = css_bentries_path.join(entry_path.underscore)
|
18
|
+
full_js_entry_path = js_bentries_path.join(entry_path.underscore)
|
19
|
+
full_layout_entry_path = layouts_bentries_path.join(entry_path.underscore)
|
20
|
+
|
21
|
+
if full_css_entry_path.exist?
|
22
|
+
puts "Entry #{full_css_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
23
|
+
else
|
24
|
+
full_css_entry_path.mkpath
|
25
|
+
css_entry_files = [
|
26
|
+
{ name: "components.css", content: "" },
|
27
|
+
{ name: "components.css.json", content: "[]" },
|
28
|
+
{ name: "precomponents.css", content: "" },
|
29
|
+
{ name: "precomponents.css.json", content: "[]" },
|
30
|
+
{ name: "index.css", content: "@import url(\"./components.css\");" },
|
31
|
+
]
|
32
|
+
css_entry_files.each do |file|
|
33
|
+
if full_css_entry_path.join(file[:name]).exist?
|
34
|
+
puts "File #{full_css_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
35
|
+
else
|
36
|
+
puts full_css_entry_path.join(file[:name]).to_s.green.bold
|
37
|
+
full_css_entry_path.join(file[:name]).open("w") do |f|
|
38
|
+
f.write(file[:content])
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
if full_js_entry_path.exist?
|
45
|
+
puts "Entry #{full_js_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
46
|
+
else
|
47
|
+
full_js_entry_path.mkpath
|
48
|
+
js_entry_files = [
|
49
|
+
{ name: "components.js", content: "" },
|
50
|
+
{ name: "components.js.json", content: "[]" },
|
51
|
+
{ name: "precomponents.js", content: "" },
|
52
|
+
{ name: "precomponents.js.json", content: "[]" },
|
53
|
+
{ name: "index.js", content: "import \"./components\";"},
|
54
|
+
]
|
55
|
+
js_entry_files.each do |file|
|
56
|
+
if full_js_entry_path.join(file[:name]).exist?
|
57
|
+
puts "File #{full_js_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
58
|
+
else
|
59
|
+
puts "+ #{full_js_entry_path.join(file[:name]).relative_path_from(myapp_path).to_s}".green.bold
|
60
|
+
full_js_entry_path.join(file[:name]).open("w") do |f|
|
61
|
+
f.write(file[:content])
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
css_index_path = full_css_entry_path.join("index.css").relative_path_from(stylesheets_path)
|
68
|
+
js_index_path = full_js_entry_path.join("index.js").relative_path_from(javascript_path)
|
69
|
+
|
70
|
+
js_index_directory_path = js_index_path.dirname.to_s
|
71
|
+
js_index_filename_without_extension = js_index_path.basename('.js').to_s
|
72
|
+
js_index_formatted_path = "#{js_index_directory_path}/#{js_index_filename_without_extension}"
|
73
|
+
|
74
|
+
css_index_directory_path = css_index_path.dirname.to_s
|
75
|
+
css_index_filename_without_extension = css_index_path.basename('.css').to_s
|
76
|
+
css_index_formatted_path = "#{css_index_directory_path}/#{css_index_filename_without_extension}"
|
77
|
+
|
78
|
+
|
79
|
+
if full_layout_entry_path.exist?
|
80
|
+
puts "Entry #{full_layout_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
81
|
+
else
|
82
|
+
full_layout_entry_path.mkpath
|
83
|
+
layout_entry_files = [
|
84
|
+
{ name: "index.html.erb", content: "
|
85
|
+
<!DOCTYPE html>
|
86
|
+
<html>
|
87
|
+
<head>
|
88
|
+
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1, maximum-scale=1.0, user-scalable=no\" >
|
89
|
+
<%= action_cable_meta_tag %>
|
90
|
+
<%= csrf_meta_tags %>
|
91
|
+
<%= csp_meta_tag %>
|
92
|
+
<%= display_meta_tags %>
|
93
|
+
<%= stylesheet_link_tag \"#{css_index_formatted_path}\", \"data-turbo-track\": \"reload\" %>
|
94
|
+
<%= javascript_include_tag \"#{js_index_formatted_path}\", \"data-turbo-track\": \"reload\", defer: true, type: \"module\" %>
|
95
|
+
</head>
|
96
|
+
|
97
|
+
<body>
|
98
|
+
<%= yield %>
|
99
|
+
</body>
|
100
|
+
</html>
|
101
|
+
" },
|
102
|
+
]
|
103
|
+
layout_entry_files.each do |file|
|
104
|
+
if full_layout_entry_path.join(file[:name]).exist?
|
105
|
+
puts "File #{full_layout_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
106
|
+
else
|
107
|
+
puts "+ #{full_layout_entry_path.join(file[:name]).relative_path_from(myapp_path).to_s}".green.bold
|
108
|
+
full_layout_entry_path.join(file[:name]).open("w") do |f|
|
109
|
+
f.write(file[:content])
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -48,7 +48,7 @@ module Birdel
|
|
48
48
|
}
|
49
49
|
}
|
50
50
|
res[:callback] = callback
|
51
|
-
res[:callback][:resourceId] =
|
51
|
+
res[:callback][:resourceId] = callback[:resource_id]
|
52
52
|
ActionCable.server.broadcast(self.first_stream, res)
|
53
53
|
end
|
54
54
|
end
|
data/lib/birdel/version.rb
CHANGED
data/lib/birdel.rb
CHANGED
@@ -5,16 +5,13 @@ require 'colored'
|
|
5
5
|
require 'active_support/inflector'
|
6
6
|
|
7
7
|
require_relative "birdel/version"
|
8
|
-
# require_relative "birdel/com/com"
|
9
|
-
# require_relative "birdel/map/map"
|
10
8
|
require_relative "birdel/rona/rona_actor"
|
11
9
|
require_relative "birdel/synth/synth_actor"
|
12
|
-
|
10
|
+
require_relative "birdel/com/com_actor"
|
11
|
+
require_relative "birdel/map/map_actor"
|
12
|
+
require_relative "birdel/component/component_actor"
|
13
13
|
module Birdel
|
14
14
|
class Error < StandardError; end
|
15
15
|
class << self
|
16
|
-
def test1
|
17
|
-
puts "Birdel is a gem for sending messages to your actors and getting view_components back!"
|
18
|
-
end
|
19
16
|
end
|
20
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: birdel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhii
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Send json messages to your actors and get view_components back! Now you
|
14
14
|
can be sure that your actors are processed correctly.
|
@@ -29,8 +29,10 @@ files:
|
|
29
29
|
- Rakefile
|
30
30
|
- esbuild.config.js
|
31
31
|
- lib/birdel.rb
|
32
|
-
- lib/birdel/
|
33
|
-
- lib/birdel/
|
32
|
+
- lib/birdel/cli.rb
|
33
|
+
- lib/birdel/com/com_actor.rb
|
34
|
+
- lib/birdel/component/component_actor.rb
|
35
|
+
- lib/birdel/map/map_actor.rb
|
34
36
|
- lib/birdel/rona/rona_actor.rb
|
35
37
|
- lib/birdel/synth/synth_actor.rb
|
36
38
|
- lib/birdel/version.rb
|
data/lib/birdel/com/com.rb
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
require "pathname"
|
2
|
-
require 'active_support/inflector'
|
3
|
-
require 'colored'
|
4
|
-
|
5
|
-
class Birdel::Com
|
6
|
-
def initialize
|
7
|
-
end
|
8
|
-
|
9
|
-
def roll
|
10
|
-
app_path = Pathname.new("#{Dir.pwd}")
|
11
|
-
components_path = app_path.join("app", "components")
|
12
|
-
component_ns = ARGV[0]
|
13
|
-
component_ns_camelized = component_ns.split("::").map(&:camelize).join("::")
|
14
|
-
component_name = component_ns_camelized.split("::").last
|
15
|
-
component_path = component_ns.split("::").join("/")
|
16
|
-
full_component_path = components_path.join(component_path.underscore)
|
17
|
-
|
18
|
-
variable_name = "css_class"
|
19
|
-
css_class = component_ns_camelized.underscore.gsub('_', '-').gsub('/', '--')
|
20
|
-
actor_name = "#{component_name.gsub("Component", "")}Actor"
|
21
|
-
files = [
|
22
|
-
{ name: "#{component_name.underscore}.rb", content: "class #{component_ns_camelized}::#{component_name} < ViewComponent::Base\nend" },
|
23
|
-
{ name: "#{component_name.underscore}.css", content: ".#{css_class}{}" },
|
24
|
-
{ name: "#{component_name.underscore}.js", content: "" },
|
25
|
-
{ name: "#{component_name.underscore}_controller.js", content: "
|
26
|
-
import { Controller } from \"@hotwired/stimulus\";
|
27
|
-
|
28
|
-
export default class extends Controller {
|
29
|
-
connect() {
|
30
|
-
console.log(\"Hello, component!\");
|
31
|
-
}
|
32
|
-
}
|
33
|
-
" },
|
34
|
-
{ name: "#{component_name.underscore}_actor.js", content: "
|
35
|
-
export class #{actor_name}{
|
36
|
-
constructor() {
|
37
|
-
console.log(\"Hi, #{actor_name}!\");
|
38
|
-
}
|
39
|
-
}
|
40
|
-
" },
|
41
|
-
{ name: "#{component_name.underscore}.html.erb", content: "<div class=\"<%= #{variable_name} %>\" data-controller=\"<%= #{variable_name} %>\">\n</div>" },
|
42
|
-
]
|
43
|
-
|
44
|
-
files.each do |file|
|
45
|
-
file_path = full_component_path.join(file[:name])
|
46
|
-
if file_path.exist?
|
47
|
-
puts "File already exists: #{file_path}".red
|
48
|
-
else
|
49
|
-
puts "Creating file: #{file_path}".yellow
|
50
|
-
#create new file and folders if needed
|
51
|
-
file_path.dirname.mkpath
|
52
|
-
File.open(file_path, "w") do |f|
|
53
|
-
f.puts file[:content]
|
54
|
-
end
|
55
|
-
if file_path.exist?
|
56
|
-
puts "Done!".bold.green
|
57
|
-
else
|
58
|
-
puts "Failed".red
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
data/lib/birdel/map/map.rb
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
|
2
|
-
class Birdel::Map
|
3
|
-
def initialize
|
4
|
-
end
|
5
|
-
|
6
|
-
def roll
|
7
|
-
myapp_path = Pathname.new("#{Dir.pwd}")
|
8
|
-
stylesheets_path = myapp_path.join("app", "assets", "stylesheets")
|
9
|
-
javascript_path = myapp_path.join("app", "javascript")
|
10
|
-
layouts_path = myapp_path.join("app", "views", "layouts")
|
11
|
-
css_bentries_path = stylesheets_path.join("ui", "bentries")
|
12
|
-
js_bentries_path = javascript_path.join("ui", "bentries")
|
13
|
-
layouts_bentries_path = layouts_path.join("ui", "bentries")
|
14
|
-
|
15
|
-
entry_ns = ARGV[0]
|
16
|
-
entry_ns_camelized = entry_ns.split("::").map(&:camelize).join("::")
|
17
|
-
entry_name = entry_ns_camelized.split("::").last
|
18
|
-
entry_path = entry_ns.split("::").join("/")
|
19
|
-
|
20
|
-
full_css_entry_path = css_bentries_path.join(entry_path.underscore)
|
21
|
-
full_js_entry_path = js_bentries_path.join(entry_path.underscore)
|
22
|
-
full_layout_entry_path = layouts_bentries_path.join(entry_path.underscore)
|
23
|
-
|
24
|
-
if full_css_entry_path.exist?
|
25
|
-
puts "Entry #{full_css_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
26
|
-
else
|
27
|
-
full_css_entry_path.mkpath
|
28
|
-
css_entry_files = [
|
29
|
-
{ name: "components.css", content: "" },
|
30
|
-
{ name: "components.css.json", content: "[]" },
|
31
|
-
{ name: "precomponents.css", content: "" },
|
32
|
-
{ name: "precomponents.css.json", content: "[]" },
|
33
|
-
{ name: "index.css", content: "@import url(\"./components.css\");" },
|
34
|
-
]
|
35
|
-
css_entry_files.each do |file|
|
36
|
-
if full_css_entry_path.join(file[:name]).exist?
|
37
|
-
puts "File #{full_css_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
38
|
-
else
|
39
|
-
puts full_css_entry_path.join(file[:name]).to_s.green.bold
|
40
|
-
full_css_entry_path.join(file[:name]).open("w") do |f|
|
41
|
-
f.write(file[:content])
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
if full_js_entry_path.exist?
|
48
|
-
puts "Entry #{full_js_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
49
|
-
else
|
50
|
-
full_js_entry_path.mkpath
|
51
|
-
js_entry_files = [
|
52
|
-
{ name: "components.js", content: "" },
|
53
|
-
{ name: "components.js.json", content: "[]" },
|
54
|
-
{ name: "precomponents.js", content: "" },
|
55
|
-
{ name: "precomponents.js.json", content: "[]" },
|
56
|
-
{ name: "index.js", content: "import \"./components\";"},
|
57
|
-
]
|
58
|
-
js_entry_files.each do |file|
|
59
|
-
if full_js_entry_path.join(file[:name]).exist?
|
60
|
-
puts "File #{full_js_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
61
|
-
else
|
62
|
-
puts "+ #{full_js_entry_path.join(file[:name]).relative_path_from(myapp_path).to_s}".green.bold
|
63
|
-
full_js_entry_path.join(file[:name]).open("w") do |f|
|
64
|
-
f.write(file[:content])
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
css_index_path = full_css_entry_path.join("index.css").relative_path_from(stylesheets_path)
|
71
|
-
js_index_path = full_js_entry_path.join("index.js").relative_path_from(javascript_path)
|
72
|
-
|
73
|
-
js_index_directory_path = js_index_path.dirname.to_s
|
74
|
-
js_index_filename_without_extension = js_index_path.basename('.js').to_s
|
75
|
-
js_index_formatted_path = "#{js_index_directory_path}/#{js_index_filename_without_extension}"
|
76
|
-
|
77
|
-
css_index_directory_path = css_index_path.dirname.to_s
|
78
|
-
css_index_filename_without_extension = css_index_path.basename('.css').to_s
|
79
|
-
css_index_formatted_path = "#{css_index_directory_path}/#{css_index_filename_without_extension}"
|
80
|
-
|
81
|
-
|
82
|
-
if full_layout_entry_path.exist?
|
83
|
-
puts "Entry #{full_layout_entry_path.relative_path_from(myapp_path)} already exists".red.bold
|
84
|
-
else
|
85
|
-
full_layout_entry_path.mkpath
|
86
|
-
layout_entry_files = [
|
87
|
-
{ name: "index.html.erb", content: "
|
88
|
-
<!DOCTYPE html>
|
89
|
-
<html>
|
90
|
-
<head>
|
91
|
-
<meta name=\"viewport\" content=\"width=device-width,initial-scale=1, maximum-scale=1.0, user-scalable=no\" >
|
92
|
-
<%= action_cable_meta_tag %>
|
93
|
-
<%= csrf_meta_tags %>
|
94
|
-
<%= csp_meta_tag %>
|
95
|
-
<%= display_meta_tags %>
|
96
|
-
<%= stylesheet_link_tag \"#{css_index_formatted_path}\", \"data-turbo-track\": \"reload\" %>
|
97
|
-
<%= javascript_include_tag \"#{js_index_formatted_path}\", \"data-turbo-track\": \"reload\", defer: true, type: \"module\" %>
|
98
|
-
</head>
|
99
|
-
|
100
|
-
<body>
|
101
|
-
<%= yield %>
|
102
|
-
</body>
|
103
|
-
</html>
|
104
|
-
" },
|
105
|
-
]
|
106
|
-
layout_entry_files.each do |file|
|
107
|
-
if full_layout_entry_path.join(file[:name]).exist?
|
108
|
-
puts "File #{full_layout_entry_path.join(file[:name]).relative_path_from(myapp_path)} already exists".red.bold
|
109
|
-
else
|
110
|
-
puts "+ #{full_layout_entry_path.join(file[:name]).relative_path_from(myapp_path).to_s}".green.bold
|
111
|
-
full_layout_entry_path.join(file[:name]).open("w") do |f|
|
112
|
-
f.write(file[:content])
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|