vueck 1.0.1 → 1.0.2
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/.gitignore +2 -0
- data/Rakefile +5 -2
- data/lib/element.rb +4 -2
- data/lib/plugin.rb +16 -9
- data/test/test.rb +4 -5
- data/vueck.gemspec +2 -2
- metadata +1 -5
- data/test/vue/test.vue +0 -23
- data/test/vue/test2.vue +0 -27
- data/test/vue/test3.vue +0 -21
- data/test/vue/test4.vue +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f3219558cc9f68995e1e41751c35bb43813c177
|
4
|
+
data.tar.gz: d0ced4059f101e42138a4c8c463d5b5723b9cd3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4168d034c64bd32dbc0e6769dd029a3f3fc0d4ee7a8181310fe27910071c77f3c26cc31509fa4a0cf7e130fb3d6afe971e77d90aa1d62dc4c36c48b3bdc13f9d
|
7
|
+
data.tar.gz: 286ca80b3aa0a3720d69a6b20282e3b6ae43819b14c249a5b29ddf791256f79c1e3e6570188e602d94505aded8e7f055a717d8999b273660b23b6eb8cf94373c
|
data/.gitignore
CHANGED
data/Rakefile
CHANGED
data/lib/element.rb
CHANGED
@@ -12,7 +12,9 @@ module VueCK
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def lang
|
15
|
-
@node.attribute(ATTRIBUTES[:lang]).first
|
15
|
+
lang_attribute = @node.attribute(ATTRIBUTES[:lang]).first
|
16
|
+
return LANG_DEFALTS[@type] unless lang_attribute
|
17
|
+
lang_attribute.value
|
16
18
|
end
|
17
19
|
|
18
20
|
def empty?
|
@@ -24,7 +26,7 @@ module VueCK
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def render
|
27
|
-
return text if lang == LANG_DEFALTS[
|
29
|
+
return text if lang == LANG_DEFALTS[@type]
|
28
30
|
raise InvalidTemplateEngine unless Tilt[lang]
|
29
31
|
Tilt[lang].new { text }.render
|
30
32
|
end
|
data/lib/plugin.rb
CHANGED
@@ -1,8 +1,14 @@
|
|
1
1
|
module VueCK
|
2
2
|
class Plugin
|
3
|
-
|
4
|
-
"vue.js"
|
5
|
-
|
3
|
+
REQUEST_MAP = {
|
4
|
+
"/vue/vue.js" => {
|
5
|
+
file: "vue.js",
|
6
|
+
content_type: "application/javascript"
|
7
|
+
},
|
8
|
+
"/vue/vue.css" => {
|
9
|
+
file: "vue.css",
|
10
|
+
content_type: "text/css"
|
11
|
+
}
|
6
12
|
}
|
7
13
|
|
8
14
|
def initialize(app={})
|
@@ -11,18 +17,19 @@ module VueCK
|
|
11
17
|
|
12
18
|
def call(env)
|
13
19
|
return unless env["REQUEST_METHOD"] == "GET"
|
14
|
-
|
15
|
-
return @app.call(env) unless
|
16
|
-
vueck = VueCK.new
|
20
|
+
path = env["PATH_INFO"]
|
21
|
+
return @app.call(env) unless REQUEST_MAP[path]
|
22
|
+
vueck = VueCK.new REQUEST_MAP[path][:file]
|
17
23
|
content = vueck.serve_file
|
18
|
-
response(content,
|
24
|
+
response(content, path)
|
19
25
|
end
|
20
26
|
|
21
|
-
def response(content,
|
27
|
+
def response(content, path)
|
22
28
|
["200", {
|
23
|
-
"Content-Type" =>
|
29
|
+
"Content-Type" => REQUEST_MAP[path][:content_type],
|
24
30
|
"Content-Length" => content.size.to_s },
|
25
31
|
[content]]
|
26
32
|
end
|
33
|
+
|
27
34
|
end
|
28
35
|
end
|
data/test/test.rb
CHANGED
@@ -2,19 +2,18 @@ require 'minitest/autorun'
|
|
2
2
|
require 'vueck'
|
3
3
|
|
4
4
|
class VueCKTest < Minitest::Test
|
5
|
-
CSS = ["200", {"Content-Type"=>"text/css", "Content-Length"=>"
|
6
|
-
JS = ["200",{"Content-Type"=>"application/javascript", "Content-Length"=>"
|
5
|
+
CSS = ["200", {"Content-Type"=>"text/css", "Content-Length"=>"32"}, [".dogs{color:red}.post{color:red}"]]
|
6
|
+
JS = ["200",{"Content-Type"=>"application/javascript", "Content-Length"=>"691"},[%q{var one_lang_and_no_style = Vue.component('one_lang_and_no_style',{template:'<div class="post"><h1>Other Guy</h1><h1>Oh hai mark</h1></div>', props: ["test"], data: { adam: true, drew: true }, methods: { yo: function() { } } });var two_langs = Vue.component('two_langs',{template:'<div class="dogs"><h1>Are Cool</h1></div>', props: ["test"], data: { adam: true, drew: true }, methods: { yo: function() { } } });var default_langs = Vue.component('default_langs',{template:' Oh hai mark props: ["test"], data: { adam: true }, methods: { yo: function() { return this.adam; } } .post { color: red; } ', props: ["test"], data: { adam: true }, methods: { yo: function() { return this.adam; } } });}]]
|
7
7
|
|
8
8
|
def test_render_css
|
9
9
|
plugin = VueCK::Plugin.new()
|
10
|
-
response = plugin.call({"PATH_INFO"=>"/vue.css", "REQUEST_METHOD"=>"GET"})
|
11
|
-
require pry ; binding.pry
|
10
|
+
response = plugin.call({"PATH_INFO"=>"/vue/vue.css", "REQUEST_METHOD"=>"GET"})
|
12
11
|
assert response == CSS
|
13
12
|
end
|
14
13
|
|
15
14
|
def test_render_js
|
16
15
|
plugin = VueCK::Plugin.new()
|
17
|
-
response = plugin.call({"PATH_INFO"=>"/vue.js", "REQUEST_METHOD"=>"GET"})
|
16
|
+
response = plugin.call({"PATH_INFO"=>"/vue/vue.js", "REQUEST_METHOD"=>"GET"})
|
18
17
|
assert response == JS
|
19
18
|
end
|
20
19
|
end
|
data/vueck.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'vueck'
|
3
3
|
s.homepage = 'https://github.com/adamrdrew/vueck'
|
4
|
-
s.version = '1.0.
|
4
|
+
s.version = '1.0.2'
|
5
5
|
s.date = '2018-01-30'
|
6
6
|
s.summary = "VueCK"
|
7
7
|
s.description = "Rack middleware for compiling and serving VueJS single file components"
|
@@ -16,4 +16,4 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.add_runtime_dependency "slim", '~> 3.0', '>= 3.0.0'
|
17
17
|
s.add_runtime_dependency "sass", '~> 3.5', '>= 3.5.5'
|
18
18
|
end
|
19
|
-
|
19
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vueck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Drew
|
@@ -130,10 +130,6 @@ files:
|
|
130
130
|
- lib/vueck.rb
|
131
131
|
- license
|
132
132
|
- test/test.rb
|
133
|
-
- test/vue/test.vue
|
134
|
-
- test/vue/test2.vue
|
135
|
-
- test/vue/test3.vue
|
136
|
-
- test/vue/test4.vue
|
137
133
|
- vueck.gemspec
|
138
134
|
homepage: https://github.com/adamrdrew/vueck
|
139
135
|
licenses:
|
data/test/vue/test.vue
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
<component name="test_component">
|
2
|
-
<template lang="slim">
|
3
|
-
.post
|
4
|
-
h1 Adam
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script lang="javascript">
|
8
|
-
props: ["test"],
|
9
|
-
data: {
|
10
|
-
adam: true
|
11
|
-
},
|
12
|
-
methods: {
|
13
|
-
yo: function() {
|
14
|
-
|
15
|
-
}
|
16
|
-
}
|
17
|
-
</script>
|
18
|
-
|
19
|
-
<style lang="sass">
|
20
|
-
.post
|
21
|
-
color: red
|
22
|
-
</style>
|
23
|
-
</component>
|
data/test/vue/test2.vue
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
<component name="test_component">
|
2
|
-
<template lang="slim">
|
3
|
-
.post
|
4
|
-
h1 Other Guy
|
5
|
-
h1 Oh hai mark
|
6
|
-
</template>
|
7
|
-
|
8
|
-
<script lang="javascript">
|
9
|
-
props: ["test"],
|
10
|
-
data: {
|
11
|
-
adam: true,
|
12
|
-
drew: true
|
13
|
-
},
|
14
|
-
methods: {
|
15
|
-
yo: function() {
|
16
|
-
|
17
|
-
}
|
18
|
-
}
|
19
|
-
</script>
|
20
|
-
|
21
|
-
<style lang="sass">
|
22
|
-
.post
|
23
|
-
color: green
|
24
|
-
h1
|
25
|
-
color: pink
|
26
|
-
</style>
|
27
|
-
</component>
|
data/test/vue/test3.vue
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
<component name="test_component">
|
2
|
-
<template lang="slim">
|
3
|
-
<div>
|
4
|
-
<h1>Oh, Hai Mark!</h1>
|
5
|
-
</div>
|
6
|
-
</template>
|
7
|
-
|
8
|
-
<script lang="javascript">
|
9
|
-
props: ["test"],
|
10
|
-
data: {
|
11
|
-
adam: true,
|
12
|
-
drew: true
|
13
|
-
},
|
14
|
-
methods: {
|
15
|
-
yo: function() {
|
16
|
-
|
17
|
-
}
|
18
|
-
}
|
19
|
-
</script>
|
20
|
-
|
21
|
-
</component>
|
data/test/vue/test4.vue
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
<component name="test_component">
|
2
|
-
<template lang="slim">
|
3
|
-
<div>
|
4
|
-
<h1>Oh, Hai Mark!</h1>
|
5
|
-
</div>
|
6
|
-
</template>
|
7
|
-
|
8
|
-
<script lang="javascript">
|
9
|
-
props: ["test"],
|
10
|
-
data: {
|
11
|
-
adam: true,
|
12
|
-
drew: true
|
13
|
-
},
|
14
|
-
methods: {
|
15
|
-
yo: function() {
|
16
|
-
|
17
|
-
}
|
18
|
-
}
|
19
|
-
</script>
|
20
|
-
|
21
|
-
</component>
|