clapton 0.0.21 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clapton/engine.rb +5 -5
- data/lib/clapton/version.rb +1 -1
- data/lib/tasks/clapton_tasks.rake +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba556f54f55566ad5502aff210ab368c040d332a62313411377314b99a507ab0
|
4
|
+
data.tar.gz: f8a71c1947ea6eb6544f637f53641ce87fc904543efadac7e30c244b6d1e8c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b32c159a66aa00df226c792f99e3d8a2ca96706a6189f3f442fec764eefe9f4a90e66f7f4c050a6a3c84212f46469e5f232c219b10999ebe543affb659a3f2
|
7
|
+
data.tar.gz: eb01a40f84c3e8437be75b05d716f9702c0ed15666041015d06f74449f317f144558bd4c798ac94710008e63bf4c7a062556c14dcfbb9b3ee693217e905c86e0
|
data/lib/clapton/engine.rb
CHANGED
@@ -47,12 +47,12 @@ module Clapton
|
|
47
47
|
js += "\n"
|
48
48
|
js += "import { c } from 'c';"
|
49
49
|
js += "\n"
|
50
|
-
|
51
|
-
|
52
|
-
|
50
|
+
Dir.glob(Rails.root.join("app", "components", "**", "*.rb")).each do |f|
|
51
|
+
if File.basename(file, ".rb") != File.basename(f, ".rb")
|
52
|
+
js += "import { #{File.basename(f, ".rb").camelize} } from '#{File.basename(f, ".rb").camelize}';"
|
53
|
+
js += "\n"
|
54
|
+
end
|
53
55
|
end
|
54
|
-
code = code.gsub(/([^a-zA-Z0-9])c\.(\w+?)\(/, '\1@c.\2(')
|
55
|
-
code = code.gsub(/([^a-zA-Z0-9])c\.(\w+?)(\.|$)/, '\1@c.\2()\3')
|
56
56
|
js += Ruby2JS.convert(code, preset: true)
|
57
57
|
js += "\n"
|
58
58
|
js += "export { #{File.basename(file, ".rb").camelize} };"
|
data/lib/clapton/version.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
namespace :clapton do
|
2
2
|
task compile: :environment do
|
3
|
+
FileUtils.mkdir_p(Rails.root.join("public", "clapton")) unless Rails.root.join("public", "clapton").exist?
|
4
|
+
File.write(Rails.root.join("public", "clapton", "components.js"), File.read(File.join(__dir__, "..", "clapton", "javascripts", "dist", "components.js")))
|
5
|
+
File.write(Rails.root.join("public", "clapton", "client.js"), File.read(File.join(__dir__, "..", "clapton", "javascripts", "dist", "client.js")))
|
6
|
+
File.write(Rails.root.join("public", "clapton", "c.js"), File.read(File.join(__dir__, "..", "clapton", "javascripts", "dist", "c.js")))
|
7
|
+
|
3
8
|
Clapton::Engine.compile_components
|
4
|
-
puts "Clapton components compiled"
|
5
9
|
end
|
6
10
|
end
|