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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27fa8b6f3ac907d41af32dc550fa4556dc127895ace2e296969b49b8dc8f887a
4
- data.tar.gz: 8b5099fd20fc5f804d792c48da12b694755b18e8d51a9f65442ad61e1b2a7f6d
3
+ metadata.gz: ba556f54f55566ad5502aff210ab368c040d332a62313411377314b99a507ab0
4
+ data.tar.gz: f8a71c1947ea6eb6544f637f53641ce87fc904543efadac7e30c244b6d1e8c85
5
5
  SHA512:
6
- metadata.gz: be4dabb30c708af3c0ce9b1cb0a20eb1b58d79924e2303c880b2d4b0a563eb304d906d456b105b24999baaaebb05053d618136de336c0b5b579581f07817a9b6
7
- data.tar.gz: ddd55a8d86a0c9f5666c7fb686ed137c442e8d377341279856eb140d39a2eb08fe5538f05aa3be29ae9448ce1aee6e64eb0d93187c6bf8a1f45b1f4bdf44f12b
6
+ metadata.gz: a8b32c159a66aa00df226c792f99e3d8a2ca96706a6189f3f442fec764eefe9f4a90e66f7f4c050a6a3c84212f46469e5f232c219b10999ebe543affb659a3f2
7
+ data.tar.gz: eb01a40f84c3e8437be75b05d716f9702c0ed15666041015d06f74449f317f144558bd4c798ac94710008e63bf4c7a062556c14dcfbb9b3ee693217e905c86e0
@@ -47,12 +47,12 @@ module Clapton
47
47
  js += "\n"
48
48
  js += "import { c } from 'c';"
49
49
  js += "\n"
50
- code.scan(/(\w+)Component\.new/).each do |match|
51
- js += "import { #{match[0]}Component } from '#{match[0]}Component';"
52
- js += "\n"
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} };"
@@ -1,3 +1,3 @@
1
1
  module Clapton
2
- VERSION = '0.0.21'
2
+ VERSION = '0.0.22'
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clapton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.21
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moeki Kawakami