birdel 0.2.16 → 0.3.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 +2 -0
- data/Gemfile.lock +3 -1
- data/lib/birdel/map/map.rb +0 -3
- data/lib/birdel/rona/rona_actor.rb +44 -0
- data/lib/birdel/synth/synth_actor.rb +114 -0
- data/lib/birdel/version.rb +1 -1
- data/lib/birdel.rb +8 -4
- metadata +3 -3
- data/lib/birdel/rona/rona.rb +0 -9
- data/lib/birdel/synth/synth.rb +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c0d04dfed9dddd7ccb8d06893277400bd696bd33114d921de78ec4106b5130
|
4
|
+
data.tar.gz: 40a4a7da9294b999a66dbfff04d7672c2ae9475f2e7cfbfefc96fa2f9b32d237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92fd49cb333376fc8c0f1d30c1955f89dab617725ccb8e886597cc8bbd012d8b3a91802bfd3e36cc445b4b24d70692bf74d787461d61feb63fb897f35bb9b839
|
7
|
+
data.tar.gz: 90e849f9aa1ab7f232b1d08d36cf5f3446a7c6ca8e4db2a57bdd5b62ed9391ae41eef60db36baa67b8167318aa7b77bf65aa1951655d53525045605fa72a217e
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
birdel (0.2.
|
4
|
+
birdel (0.2.16)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -12,6 +12,7 @@ GEM
|
|
12
12
|
minitest (>= 5.1)
|
13
13
|
tzinfo (~> 2.0)
|
14
14
|
ast (2.4.2)
|
15
|
+
colored (1.2)
|
15
16
|
concurrent-ruby (1.2.2)
|
16
17
|
diff-lcs (1.5.0)
|
17
18
|
i18n (1.12.0)
|
@@ -61,6 +62,7 @@ PLATFORMS
|
|
61
62
|
DEPENDENCIES
|
62
63
|
activesupport (~> 7.0, >= 7.0.4.3)
|
63
64
|
birdel!
|
65
|
+
colored (~> 1.2)
|
64
66
|
rake (~> 13.0)
|
65
67
|
rspec (~> 3.0)
|
66
68
|
rubocop (~> 1.21)
|
data/lib/birdel/map/map.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Routing Overlay Network Actor
|
2
|
+
module Birdel
|
3
|
+
module Rona
|
4
|
+
class RonaActor
|
5
|
+
class << self
|
6
|
+
def actorDirect(data)
|
7
|
+
actor_name = data.fetch("actor")
|
8
|
+
inputs = data.fetch("inputs")
|
9
|
+
callback = data.fetch("callback")
|
10
|
+
required_component = data.fetch("required_component")
|
11
|
+
method = data.fetch("method")
|
12
|
+
|
13
|
+
actor_string = actor_name.split("__").map{|e| e.camelize}.join("::")
|
14
|
+
res_name = actor_string << "::#{actor_string.split("::")[-1]}"
|
15
|
+
actor = res_name.constantize.new()
|
16
|
+
method_res = actor.public_send(method, inputs, current_user)
|
17
|
+
res = {
|
18
|
+
"ok": method_res[:ok],
|
19
|
+
"message": method_res[:message],
|
20
|
+
"data": {
|
21
|
+
"actor": actor_name,
|
22
|
+
"method": method,
|
23
|
+
"outputs": method_res[:outputs]
|
24
|
+
}
|
25
|
+
}
|
26
|
+
if required_component
|
27
|
+
component_name = required_component.split('--').map{|i| i.gsub("-", "_").camelize}.join('::') + '::' + required_component.split('--').last.gsub("-", "_").camelize
|
28
|
+
component = component_name.constantize.new(inputs: method_res[:outputs])
|
29
|
+
res[:data][:html] = ApplicationController.render(component, layout: false)
|
30
|
+
end
|
31
|
+
if callback
|
32
|
+
res[:callback] = callback
|
33
|
+
res[:callback][:resourceId] = method_res[:resource_id] if method_res[:resource_id]
|
34
|
+
ActionCable.server.broadcast(self.first_stream, res)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def actorDirect(data)
|
41
|
+
RonaActor.actorDirect(data)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
|
2
|
+
module Birdel
|
3
|
+
module Synth
|
4
|
+
class SynthActor
|
5
|
+
class << self
|
6
|
+
def roll
|
7
|
+
root_dir_path = Pathname.new("#{Dir.pwd}")
|
8
|
+
app_folder_path = root_dir_path.join("app")
|
9
|
+
components_folder_path = app_folder_path.join("components")
|
10
|
+
js_folder_path = app_folder_path.join("javascript")
|
11
|
+
stylesheets_folder_path = app_folder_path.join("assets/stylesheets")
|
12
|
+
js_application_file_path = js_folder_path.join("ui/application.js")
|
13
|
+
css_bentries_path = stylesheets_folder_path.join("ui/bentries")
|
14
|
+
js_bentries_path = js_folder_path.join("ui/bentries")
|
15
|
+
|
16
|
+
css_entries_error = false
|
17
|
+
js_entries_error = false
|
18
|
+
css_bentries_path.each_child do |entry_folder_path|
|
19
|
+
# entry_folder_path = Pathname.new(entry_folder)
|
20
|
+
# entry_folder_index_path = Pathname.new("#{entry_folder}/components.css")
|
21
|
+
entry_folder_index_path = entry_folder_path.join("components.css")
|
22
|
+
puts "(css) Building #{entry_folder_index_path.relative_path_from(app_folder_path)}".yellow.bold
|
23
|
+
# entry_folder_components_path = Pathname.new("#{entry_folder}/components.json")
|
24
|
+
entry_folder_components_path = entry_folder_path.join("components.css.json")
|
25
|
+
entry_folder_precomponents_path = entry_folder_path.join("precomponents.css.json")
|
26
|
+
File.truncate(entry_folder_index_path, 0)
|
27
|
+
file = File.open(entry_folder_index_path, "w")
|
28
|
+
|
29
|
+
#precomponents
|
30
|
+
puts "-> Precomponents...".yellow
|
31
|
+
precomponents = JSON.parse(File.read(entry_folder_precomponents_path))
|
32
|
+
precomponents.each do |precomponent_path_string|
|
33
|
+
# # file_path = Pathname.new("#{stylesheets_folder_path.to_s}/#{precomponent_path_string}.css")
|
34
|
+
file_path = stylesheets_folder_path.join("#{precomponent_path_string}.css")
|
35
|
+
if file_path.exist?
|
36
|
+
puts "+ #{precomponent_path_string.split("/").last}.css".green
|
37
|
+
file.puts "@import url(\"#{file_path.relative_path_from(entry_folder_path).to_s}\");"
|
38
|
+
else
|
39
|
+
css_entries_error = true
|
40
|
+
puts "File not found: #{file_path}".red
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
file.puts ""
|
45
|
+
|
46
|
+
#components
|
47
|
+
puts "-> Components...".yellow
|
48
|
+
components = JSON.parse(File.read(entry_folder_components_path))
|
49
|
+
components.each do |component_path_string|
|
50
|
+
# full_component_path = Pathname.new("#{components_folder_path.to_s}/#{component_path_string}.css")
|
51
|
+
full_component_path = components_folder_path.join("#{component_path_string}.css")
|
52
|
+
if full_component_path.exist?
|
53
|
+
file_name = component_path_string.split("/").last
|
54
|
+
puts "+ #{file_name}.css".green
|
55
|
+
file.puts "@import url(\"#{full_component_path.relative_path_from(entry_folder_path).to_s}\");"
|
56
|
+
else
|
57
|
+
css_entries_error = true
|
58
|
+
puts "Component not found: #{component_path_string}".red
|
59
|
+
puts "Check => #{entry_folder_components_path.relative_path_from(root_dir_path)}".red.bold
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
if css_entries_error
|
64
|
+
puts "(css-error) Building failed.".red
|
65
|
+
exit
|
66
|
+
end
|
67
|
+
puts "(css-success) Building finished.".green
|
68
|
+
puts ""
|
69
|
+
|
70
|
+
js_bentries_path.each_child do |entry_folder_path|
|
71
|
+
# js_entries.each do |entry|
|
72
|
+
# index_path = Pathname.new("#{entry}/components.js")
|
73
|
+
index_path = entry_folder_path.join("components.js")
|
74
|
+
components_json_path = entry_folder_path.join("components.js.json")
|
75
|
+
# entry_folder_path = Pathname.new(entry)
|
76
|
+
puts "(js) Building #{index_path.relative_path_from(app_folder_path)}".green
|
77
|
+
puts "-> (js) Components...".yellow
|
78
|
+
File.truncate(index_path, 0)
|
79
|
+
component_controllers = JSON.parse(File.read(components_json_path))
|
80
|
+
file = File.open(index_path, "w")
|
81
|
+
js_application_file_name = js_application_file_path.basename.to_s.split(".").first
|
82
|
+
file.puts "import { #{js_application_file_name} } from \"#{js_application_file_path.relative_path_from(entry_folder_path).to_s.gsub(js_application_file_path.extname, "")}\";"
|
83
|
+
file.puts ""
|
84
|
+
component_controllers.each do |component_path|
|
85
|
+
path_parts = component_path.split("/")
|
86
|
+
component_name = path_parts.pop
|
87
|
+
controller_from_components = "#{component_path}/#{component_name}_controller"
|
88
|
+
# component_controller_path = Pathname.new("#{components_folder_path.to_s}/#{controller_from_components}.js")
|
89
|
+
component_controller_path = components_folder_path.join("#{controller_from_components}.js")
|
90
|
+
if component_controller_path.exist?
|
91
|
+
component_path_dashed = component_path.tr("_", "-").gsub("/", "--")
|
92
|
+
camelized_component_name = component_name.split("_").map(&:capitalize).join
|
93
|
+
controller_backpath = component_controller_path.relative_path_from(entry_folder_path)
|
94
|
+
controller_backpath_without_ext = controller_backpath.to_s.gsub(controller_backpath.extname, "")
|
95
|
+
file.puts "import #{camelized_component_name} from \"#{controller_backpath_without_ext}\";"
|
96
|
+
file.puts "application.register(\"#{component_path_dashed}\", #{camelized_component_name});"
|
97
|
+
file.puts ""
|
98
|
+
puts "+ #{component_path_dashed}"
|
99
|
+
else
|
100
|
+
js_entries_error = true
|
101
|
+
puts "Stimulus controller not found: #{component_path}".red
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
if js_entries_error
|
106
|
+
puts "(js-error) Building failed.".red
|
107
|
+
exit
|
108
|
+
end
|
109
|
+
puts "(js-success) Building finished.".green
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/birdel/version.rb
CHANGED
data/lib/birdel.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
require "json"
|
3
|
+
require 'pathname'
|
4
|
+
require 'colored'
|
5
|
+
require 'active_support/inflector'
|
2
6
|
|
3
7
|
require_relative "birdel/version"
|
4
|
-
require_relative "birdel/com/com"
|
5
|
-
require_relative "birdel/map/map"
|
6
|
-
require_relative "birdel/rona/
|
7
|
-
require_relative "birdel/synth/
|
8
|
+
# require_relative "birdel/com/com"
|
9
|
+
# require_relative "birdel/map/map"
|
10
|
+
require_relative "birdel/rona/rona_actor"
|
11
|
+
require_relative "birdel/synth/synth_actor"
|
8
12
|
|
9
13
|
module Birdel
|
10
14
|
class Error < StandardError; end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: birdel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serhii
|
@@ -31,8 +31,8 @@ files:
|
|
31
31
|
- lib/birdel.rb
|
32
32
|
- lib/birdel/com/com.rb
|
33
33
|
- lib/birdel/map/map.rb
|
34
|
-
- lib/birdel/rona/
|
35
|
-
- lib/birdel/synth/
|
34
|
+
- lib/birdel/rona/rona_actor.rb
|
35
|
+
- lib/birdel/synth/synth_actor.rb
|
36
36
|
- lib/birdel/version.rb
|
37
37
|
- sig/birdel.rbs
|
38
38
|
homepage: https://github.com/serhiijun/birdel
|
data/lib/birdel/rona/rona.rb
DELETED
data/lib/birdel/synth/synth.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
require 'pathname'
|
3
|
-
require 'colored'
|
4
|
-
|
5
|
-
class Birdel::Synth::Synth
|
6
|
-
def initialize
|
7
|
-
end
|
8
|
-
|
9
|
-
def roll
|
10
|
-
root_dir_path = Pathname.new("#{Dir.pwd}")
|
11
|
-
app_folder_path = root_dir_path.join("app")
|
12
|
-
components_folder_path = app_folder_path.join("components")
|
13
|
-
js_folder_path = app_folder_path.join("javascript")
|
14
|
-
stylesheets_folder_path = app_folder_path.join("assets/stylesheets")
|
15
|
-
js_application_file_path = js_folder_path.join("ui/application.js")
|
16
|
-
css_bentries_path = stylesheets_folder_path.join("ui/bentries")
|
17
|
-
js_bentries_path = js_folder_path.join("ui/bentries")
|
18
|
-
|
19
|
-
css_entries_error = false
|
20
|
-
js_entries_error = false
|
21
|
-
css_bentries_path.each_child do |entry_folder_path|
|
22
|
-
# entry_folder_path = Pathname.new(entry_folder)
|
23
|
-
# entry_folder_index_path = Pathname.new("#{entry_folder}/components.css")
|
24
|
-
entry_folder_index_path = entry_folder_path.join("components.css")
|
25
|
-
puts "(css) Building #{entry_folder_index_path.relative_path_from(app_folder_path)}".yellow.bold
|
26
|
-
# entry_folder_components_path = Pathname.new("#{entry_folder}/components.json")
|
27
|
-
entry_folder_components_path = entry_folder_path.join("components.css.json")
|
28
|
-
entry_folder_precomponents_path = entry_folder_path.join("precomponents.css.json")
|
29
|
-
File.truncate(entry_folder_index_path, 0)
|
30
|
-
file = File.open(entry_folder_index_path, "w")
|
31
|
-
|
32
|
-
#precomponents
|
33
|
-
puts "-> Precomponents...".yellow
|
34
|
-
precomponents = JSON.parse(File.read(entry_folder_precomponents_path))
|
35
|
-
precomponents.each do |precomponent_path_string|
|
36
|
-
# # file_path = Pathname.new("#{stylesheets_folder_path.to_s}/#{precomponent_path_string}.css")
|
37
|
-
file_path = stylesheets_folder_path.join("#{precomponent_path_string}.css")
|
38
|
-
if file_path.exist?
|
39
|
-
puts "+ #{precomponent_path_string.split("/").last}.css".green
|
40
|
-
file.puts "@import url(\"#{file_path.relative_path_from(entry_folder_path).to_s}\");"
|
41
|
-
else
|
42
|
-
css_entries_error = true
|
43
|
-
puts "File not found: #{file_path}".red
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
file.puts ""
|
48
|
-
|
49
|
-
#components
|
50
|
-
puts "-> Components...".yellow
|
51
|
-
components = JSON.parse(File.read(entry_folder_components_path))
|
52
|
-
components.each do |component_path_string|
|
53
|
-
# full_component_path = Pathname.new("#{components_folder_path.to_s}/#{component_path_string}.css")
|
54
|
-
full_component_path = components_folder_path.join("#{component_path_string}.css")
|
55
|
-
if full_component_path.exist?
|
56
|
-
file_name = component_path_string.split("/").last
|
57
|
-
puts "+ #{file_name}.css".green
|
58
|
-
file.puts "@import url(\"#{full_component_path.relative_path_from(entry_folder_path).to_s}\");"
|
59
|
-
else
|
60
|
-
css_entries_error = true
|
61
|
-
puts "Component not found: #{component_path_string}".red
|
62
|
-
puts "Check => #{entry_folder_components_path.relative_path_from(root_dir_path)}".red.bold
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
if css_entries_error
|
67
|
-
puts "(css-error) Building failed.".red
|
68
|
-
exit
|
69
|
-
end
|
70
|
-
puts "(css-success) Building finished.".green
|
71
|
-
puts ""
|
72
|
-
|
73
|
-
js_bentries_path.each_child do |entry_folder_path|
|
74
|
-
# js_entries.each do |entry|
|
75
|
-
# index_path = Pathname.new("#{entry}/components.js")
|
76
|
-
index_path = entry_folder_path.join("components.js")
|
77
|
-
components_json_path = entry_folder_path.join("components.js.json")
|
78
|
-
# entry_folder_path = Pathname.new(entry)
|
79
|
-
puts "(js) Building #{index_path.relative_path_from(app_folder_path)}".green
|
80
|
-
puts "-> (js) Components...".yellow
|
81
|
-
File.truncate(index_path, 0)
|
82
|
-
component_controllers = JSON.parse(File.read(components_json_path))
|
83
|
-
file = File.open(index_path, "w")
|
84
|
-
js_application_file_name = js_application_file_path.basename.to_s.split(".").first
|
85
|
-
file.puts "import { #{js_application_file_name} } from \"#{js_application_file_path.relative_path_from(entry_folder_path).to_s.gsub(js_application_file_path.extname, "")}\";"
|
86
|
-
file.puts ""
|
87
|
-
component_controllers.each do |component_path|
|
88
|
-
path_parts = component_path.split("/")
|
89
|
-
component_name = path_parts.pop
|
90
|
-
controller_from_components = "#{component_path}/#{component_name}_controller"
|
91
|
-
# component_controller_path = Pathname.new("#{components_folder_path.to_s}/#{controller_from_components}.js")
|
92
|
-
component_controller_path = components_folder_path.join("#{controller_from_components}.js")
|
93
|
-
if component_controller_path.exist?
|
94
|
-
component_path_dashed = component_path.tr("_", "-").gsub("/", "--")
|
95
|
-
camelized_component_name = component_name.split("_").map(&:capitalize).join
|
96
|
-
controller_backpath = component_controller_path.relative_path_from(entry_folder_path)
|
97
|
-
controller_backpath_without_ext = controller_backpath.to_s.gsub(controller_backpath.extname, "")
|
98
|
-
file.puts "import #{camelized_component_name} from \"#{controller_backpath_without_ext}\";"
|
99
|
-
file.puts "application.register(\"#{component_path_dashed}\", #{camelized_component_name});"
|
100
|
-
file.puts ""
|
101
|
-
puts "+ #{component_path_dashed}"
|
102
|
-
else
|
103
|
-
js_entries_error = true
|
104
|
-
puts "Stimulus controller not found: #{component_path}".red
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
if js_entries_error
|
109
|
-
puts "(js-error) Building failed.".red
|
110
|
-
exit
|
111
|
-
end
|
112
|
-
puts "(js-success) Building finished.".green
|
113
|
-
end
|
114
|
-
end
|