vuejs 1.0.39 → 1.1.0.beta1
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/README.md +6 -4
- data/app/helpers/syntax_helper.rb +15 -3
- data/lib/generators/generator_templates/index.js +18 -2
- data/lib/generators/generator_templates/index.vue +1 -0
- data/lib/generators/generator_templates/{pack.js → pack.js.erb} +5 -1
- data/lib/generators/generator_templates/single.vue +17 -1
- data/lib/generators/generator_templates/turbolink-pack.js.erb +19 -0
- data/lib/generators/generator_templates/vuex-pack.js.erb +25 -0
- data/lib/generators/generator_templates/vuex/index.js +22 -0
- data/lib/generators/vue/vue_generator.rb +32 -7
- data/lib/tasks/assets.rake +12 -0
- data/lib/tasks/info.rake +22 -0
- data/lib/vuejs/version.rb +1 -1
- data/vendor/assets/javascripts/vue-on-rails.js +13 -0
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8f1446ad03bbe2e2aefda493c213f7bed4903419fe01f48d0caf2381ad7a3b9
|
4
|
+
data.tar.gz: 97ab05d969db96b1b9d0902c839164b1b3dcd9644258f0af1b4869b588d12305
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4db4fe4b12d82c89fa201b6ddfe126afcb317cca6bef7195f8b0014fe73728a014257ae917435aaf81b23cb63d16756e3ac549151f8b66a32def911c74a12ce
|
7
|
+
data.tar.gz: ed27c6fffab540dac7f7207ed6c39526389275a59988c32b924b56461a93bcc6aa69700e15aa401dd32b764c2bd5ec4d60d4a3d4d7e0891e1306dcc9cf40e2d7
|
data/README.md
CHANGED
@@ -16,11 +16,13 @@ And then execute:
|
|
16
16
|
|
17
17
|
$ bundle
|
18
18
|
|
19
|
-
|
19
|
+
# Webpacker
|
20
20
|
|
21
|
-
|
21
|
+
## Vue component view helper
|
22
22
|
|
23
|
-
|
23
|
+
```
|
24
|
+
<%= vue_component "" %>
|
25
|
+
```
|
24
26
|
|
25
27
|
## Vue component generator
|
26
28
|
|
@@ -40,7 +42,7 @@ rails destroy vue <NAME>
|
|
40
42
|
|
41
43
|
## Vue viewer
|
42
44
|
|
43
|
-
Vue viewer allows you to browse your vue component easily. Simply
|
45
|
+
Vue viewer allows you to browse your vue component easily. Simply visit http://localhost:3000/vue/<name>
|
44
46
|
|
45
47
|
At routes.rb
|
46
48
|
|
@@ -1,13 +1,25 @@
|
|
1
1
|
module SyntaxHelper
|
2
|
+
def page_specific_vue
|
3
|
+
return " #{controller_name} #{action_name} "
|
4
|
+
end
|
5
|
+
|
6
|
+
def vue_include_tag(version)
|
7
|
+
javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/vue/#{version}/vue.js" if Rails.env.development?
|
8
|
+
end
|
9
|
+
|
2
10
|
def rails_version
|
3
11
|
"<p>#{Rails.version}</p>".html_safe
|
4
12
|
end
|
5
13
|
|
6
|
-
def
|
14
|
+
def vuejs_gem_version
|
7
15
|
"<p>#{Vuejs::VERSION}</p>".html_safe
|
8
16
|
end
|
9
17
|
|
10
|
-
def
|
11
|
-
|
18
|
+
def vue(identifier)
|
19
|
+
concat("<div id=\"#{identifier}\" refs=\"#{identifier}\">".html_safe)
|
20
|
+
yield
|
21
|
+
concat("</div>".html_safe)
|
12
22
|
end
|
23
|
+
|
24
|
+
alias v vue
|
13
25
|
end
|
@@ -1,10 +1,26 @@
|
|
1
|
+
// Generated by http://github.com/ytbryan/vuejs
|
2
|
+
|
1
3
|
export default {
|
4
|
+
// components: {},
|
5
|
+
// mixins: [],
|
6
|
+
// props: {},
|
2
7
|
data: function() {
|
3
8
|
return {
|
4
|
-
message: "Hello <%= name %>!"
|
9
|
+
message: "Hello <%= name %>!",
|
10
|
+
items: []
|
5
11
|
};
|
6
12
|
},
|
13
|
+
watch: {
|
14
|
+
onCreated: function(response){
|
15
|
+
this.items = response.data
|
16
|
+
}
|
17
|
+
},
|
7
18
|
methods: {
|
8
|
-
|
19
|
+
click: function(response){
|
20
|
+
console.log("clicked")
|
21
|
+
}
|
22
|
+
},
|
23
|
+
computed: {
|
24
|
+
|
9
25
|
}
|
10
26
|
};
|
@@ -1,3 +1,7 @@
|
|
1
|
+
// Generated by http://github.com/ytbryan/vuejs
|
2
|
+
// Use this on Rails' view
|
3
|
+
// <%# code %> at your rails view.
|
4
|
+
|
1
5
|
import Vue from 'vue'
|
2
6
|
<% if options[:single] %>
|
3
7
|
import App from '../parts/<%= name %>.vue'
|
@@ -10,5 +14,5 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
10
14
|
const app = new Vue({
|
11
15
|
render: h => h(App)
|
12
16
|
}).$mount('hello')
|
13
|
-
|
17
|
+
console.log({app})
|
14
18
|
})
|
@@ -1,18 +1,34 @@
|
|
1
|
+
<!-- Generated by http://github.com/ytbryan/vuejs -->
|
2
|
+
|
1
3
|
<template>
|
2
4
|
<div id="app">
|
3
5
|
<p>{{ message }}</p>
|
6
|
+
<button @click="click">toggle</button>
|
4
7
|
</div>
|
5
8
|
</template>
|
6
9
|
|
7
10
|
<script>
|
8
11
|
export default {
|
12
|
+
// components: {},
|
13
|
+
// mixins: [],
|
14
|
+
// props: {},
|
9
15
|
data: function () {
|
10
16
|
return {
|
11
17
|
message: "Hello <%= name %>!"
|
12
18
|
}
|
13
19
|
},
|
20
|
+
watch: {
|
21
|
+
onCreated: function(response){
|
22
|
+
this.items = response.data
|
23
|
+
}
|
24
|
+
},
|
14
25
|
methods: {
|
15
|
-
|
26
|
+
click: function(response){
|
27
|
+
console.log("clicked")
|
28
|
+
}
|
29
|
+
},
|
30
|
+
computed: {
|
31
|
+
|
16
32
|
}
|
17
33
|
}
|
18
34
|
</script>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Generated by http://github.com/ytbryan/vuejs
|
2
|
+
|
3
|
+
import TurbolinksAdapter from 'vue-turbolinks';
|
4
|
+
import Vue from 'vue/dist/vue.esm'
|
5
|
+
<% if options[:single] %>
|
6
|
+
import App from '../parts/<%= name %>.vue'
|
7
|
+
<% else %>
|
8
|
+
import App from '../parts/<%= name %>/<%= name %>.vue'
|
9
|
+
<% end %>
|
10
|
+
Vue.use(TurbolinksAdapter)
|
11
|
+
|
12
|
+
document.addEventListener('turbolinks:load', () => {
|
13
|
+
if(isView("###")){
|
14
|
+
const app = new Vue({
|
15
|
+
render: h => h(App)
|
16
|
+
}).$mount('#something')
|
17
|
+
console.log({app})
|
18
|
+
}
|
19
|
+
})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// Generated by http://github.com/ytbryan/vuejs
|
2
|
+
|
3
|
+
import VuexRailsPlugin from 'vuex-rails-plugin'
|
4
|
+
import VueFormFor from 'vue-form-for'
|
5
|
+
import Autorequest from 'vue-autorequest'
|
6
|
+
import TurbolinksAdapter from 'vue-turbolinks';
|
7
|
+
import Vue from 'vue/dist/vue.esm'
|
8
|
+
<% if options[:single] %>
|
9
|
+
import App from '../parts/<%= name %>.vue'
|
10
|
+
<% else %>
|
11
|
+
import App from '../parts/<%= name %>/<%= name %>.vue'
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
Vue.use(TurbolinksAdapter)
|
15
|
+
Vue.use(VuexRailsPlugin)
|
16
|
+
Vue.use(VueFormFor)
|
17
|
+
Vue.use(Autorequest)
|
18
|
+
|
19
|
+
document.addEventListener('turbolinks:load', () => {
|
20
|
+
if(isView("###")){
|
21
|
+
const app = new Vue({
|
22
|
+
render: h => h(App)
|
23
|
+
}).$mount('#something')
|
24
|
+
}
|
25
|
+
})
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Generated by http://github.com/ytbryan/vuejs
|
2
|
+
|
3
|
+
export default {
|
4
|
+
// components: {},
|
5
|
+
// mixins: [],
|
6
|
+
// props: {},
|
7
|
+
data: function() {
|
8
|
+
return {
|
9
|
+
message: "Hello <%= name %>!"
|
10
|
+
};
|
11
|
+
},
|
12
|
+
watch: {
|
13
|
+
onMounted: function(response){
|
14
|
+
this.items = response.data
|
15
|
+
}
|
16
|
+
},
|
17
|
+
methods: {
|
18
|
+
click: function(response){
|
19
|
+
console.log("clicked")
|
20
|
+
}
|
21
|
+
}
|
22
|
+
};
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class VueGenerator < Rails::Generators::NamedBase
|
2
2
|
source_root File.expand_path('../../generator_templates', __FILE__)
|
3
3
|
|
4
|
-
argument :name, :
|
4
|
+
argument :name, type: :string, default: :index
|
5
5
|
class_option :single, type: :boolean, default: false
|
6
6
|
class_option :vuex, type: :boolean, default: false
|
7
|
+
class_option :turbolink, type: :boolean, default: false
|
7
8
|
# class_option :helpers, type: :boolean, default: false
|
8
9
|
|
9
10
|
PACKS_PATH = "app/javascript/packs"
|
@@ -11,9 +12,17 @@ class VueGenerator < Rails::Generators::NamedBase
|
|
11
12
|
|
12
13
|
def vue
|
13
14
|
if options[:single]
|
14
|
-
|
15
|
+
if options[:turbolink]
|
16
|
+
create_turbolink_single_file_component_using(name)
|
17
|
+
else
|
18
|
+
create_single_file_component_using(name)
|
19
|
+
end
|
15
20
|
else
|
16
|
-
|
21
|
+
if options[:turbolink]
|
22
|
+
create_turbolink_component_with_seperate_concern_using(name)
|
23
|
+
else
|
24
|
+
create_component_with_seperate_concern_using(name)
|
25
|
+
end
|
17
26
|
end
|
18
27
|
|
19
28
|
# options[:vuex] ? add_vuex_to_component(name) : nil
|
@@ -22,11 +31,11 @@ class VueGenerator < Rails::Generators::NamedBase
|
|
22
31
|
|
23
32
|
private
|
24
33
|
def add_helpers_to_component name
|
25
|
-
puts "adding helpers"
|
34
|
+
puts "adding helpers support"
|
26
35
|
end
|
27
36
|
|
28
37
|
def add_vuex_to_component name
|
29
|
-
puts "adding vuex"
|
38
|
+
puts "adding vuex support"
|
30
39
|
# yarn add vuex
|
31
40
|
# import vuex from 'vuex'
|
32
41
|
# Vue.use(vuex)
|
@@ -34,14 +43,30 @@ class VueGenerator < Rails::Generators::NamedBase
|
|
34
43
|
end
|
35
44
|
|
36
45
|
def create_component_with_seperate_concern_using name
|
37
|
-
|
46
|
+
@code = "<%= vue \"#{name}\" %>"
|
47
|
+
template "pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
38
48
|
template "index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
|
39
49
|
template "index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
|
40
50
|
copy_file "index.css", "#{PARTS_PATH}/#{name}/#{name}.css"
|
41
51
|
end
|
42
52
|
|
43
53
|
def create_single_file_component_using name
|
44
|
-
|
54
|
+
@code = "<%= vue \"#{name}\" %>"
|
55
|
+
template "pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
45
56
|
template "single.vue", "#{PARTS_PATH}/#{name}.vue"
|
46
57
|
end
|
58
|
+
|
59
|
+
def create_turbolink_single_file_component_using name
|
60
|
+
@code = "<%= vue \"#{name}\" %>"
|
61
|
+
template "turbolink-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
62
|
+
template "single.vue", "#{PARTS_PATH}/#{name}.vue"
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_turbolink_component_with_seperate_concern_using name
|
66
|
+
@code = "<%= vue \"#{name}\" %>"
|
67
|
+
template "turbolink-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
68
|
+
template "index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
|
69
|
+
template "index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
|
70
|
+
copy_file "index.css", "#{PARTS_PATH}/#{name}/#{name}.css"
|
71
|
+
end
|
47
72
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
3
|
+
namespace :vue do
|
4
|
+
desc "Install vue.js into assets pipeline"
|
5
|
+
task :assets do
|
6
|
+
version = "2.5.16"
|
7
|
+
source = "https://cdnjs.cloudflare.com/ajax/libs/vue/#{version}/vue.js"
|
8
|
+
output = "app/assets/javascripts/vue.js"
|
9
|
+
done = File.write output, open(source).read
|
10
|
+
$stdout.puts "Added Vue.js #{version} (#{source}) into assets pipeline (#{output})" if done != nil
|
11
|
+
end
|
12
|
+
end
|
data/lib/tasks/info.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :vue do
|
2
|
+
desc "Provide information on Webpacker's environment"
|
3
|
+
task :info do
|
4
|
+
$stdout.puts "Ruby: #{`ruby --version`}"
|
5
|
+
$stdout.puts "Rails: #{Rails.version}"
|
6
|
+
# $stdout.puts "Webpacker: #{Webpacker::VERSION}"
|
7
|
+
$stdout.puts "Node: #{`node --version`}"
|
8
|
+
$stdout.puts "Yarn: #{`yarn --version`}"
|
9
|
+
$stdout.puts "\n"
|
10
|
+
$stdout.puts "#{`yarn list @rails/webpacker vue vue-loader vuex version -s`}"
|
11
|
+
$stdout.puts "\n"
|
12
|
+
|
13
|
+
$stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
|
14
|
+
$stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
|
15
|
+
$stdout.puts "Is bin/yarn present?: #{File.exist? 'bin/yarn'}"
|
16
|
+
end
|
17
|
+
|
18
|
+
desc "install turbolinks"
|
19
|
+
task :install do
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
data/lib/vuejs/version.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
function isView(pageClassString){
|
2
|
+
if(pageClassString == "###") return
|
3
|
+
if(pageClassString != "") pageClassString = pageClassString.replace(/#/g , " ");
|
4
|
+
return document.getElementsByClassName(pageClassString).length == 1
|
5
|
+
}
|
6
|
+
|
7
|
+
function puts(obj){
|
8
|
+
console.log({obj})
|
9
|
+
}
|
10
|
+
|
11
|
+
function p(obj){
|
12
|
+
console.log({obj})
|
13
|
+
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vuejs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Lim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,16 +55,22 @@ files:
|
|
55
55
|
- lib/generators/generator_templates/index.css
|
56
56
|
- lib/generators/generator_templates/index.js
|
57
57
|
- lib/generators/generator_templates/index.vue
|
58
|
-
- lib/generators/generator_templates/pack.js
|
58
|
+
- lib/generators/generator_templates/pack.js.erb
|
59
59
|
- lib/generators/generator_templates/single.vue
|
60
|
+
- lib/generators/generator_templates/turbolink-pack.js.erb
|
61
|
+
- lib/generators/generator_templates/vuex-pack.js.erb
|
62
|
+
- lib/generators/generator_templates/vuex/index.js
|
60
63
|
- lib/generators/vue/USAGE
|
61
64
|
- lib/generators/vue/vue_generator.rb
|
65
|
+
- lib/tasks/assets.rake
|
66
|
+
- lib/tasks/info.rake
|
62
67
|
- lib/vuejs.rb
|
63
68
|
- lib/vuejs/post_message.rb
|
64
69
|
- lib/vuejs/version.rb
|
65
70
|
- vendor/assets/javascripts/axios.js
|
66
71
|
- vendor/assets/javascripts/axios.map
|
67
72
|
- vendor/assets/javascripts/element-ui.js
|
73
|
+
- vendor/assets/javascripts/vue-on-rails.js
|
68
74
|
- vendor/assets/javascripts/vue-resource.js
|
69
75
|
- vendor/assets/javascripts/vue-router.js
|
70
76
|
- vendor/assets/javascripts/vue-router2.js
|
@@ -93,9 +99,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
99
|
version: '0'
|
94
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
101
|
requirements:
|
96
|
-
- - "
|
102
|
+
- - ">"
|
97
103
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
104
|
+
version: 1.3.1
|
99
105
|
requirements: []
|
100
106
|
rubyforge_project:
|
101
107
|
rubygems_version: 2.7.6
|