vueonrails 1.0.0.beta3 → 1.0.0.beta5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -10
- data/app/helpers/syntax_helper.rb +2 -2
- data/lib/generators/options/pug.rb +14 -0
- data/lib/generators/templates/ssr/component.js.erb +1 -1
- data/lib/generators/vue/vue_generator.rb +1 -0
- data/lib/installs/loaders/pug.js +15 -0
- data/lib/installs/pug.rb +12 -0
- data/lib/installs/setup.rb +12 -19
- data/lib/installs/spv.rb +12 -5
- data/lib/installs/ssr/component.js +4 -0
- data/lib/installs/ssr/ssr.js +5 -1
- data/lib/installs/test.rb +1 -13
- data/lib/vueonrails/version.rb +1 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d19afa02dc6893103ab2183bad342323b1cfaa8a93ecd49d7b8c2df24fa5f39
|
4
|
+
data.tar.gz: ce0746b785e5fa4a31fb29397494b55eda3bc05b07f910f91c6cfb4a2917200e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08b2fae140adf0e9b3b0ace423751e3438b6197044305831a8d93f76df0486de16784d7a57b5b7e249462084e0ec41e0547669fe93fd0a0809e41811c91eb8c7'
|
7
|
+
data.tar.gz: '08e9c0a594645b151d07332732306e38a417591ae522858473da6bac8aad728e08575b5db9d364986dede78b8ee7f71359991b6b988e8e1428e3717559686a0b'
|
data/README.md
CHANGED
@@ -1,23 +1,24 @@
|
|
1
1
|
![vue on rails](https://vueonrails.com/assets/img/vueonrails.png)
|
2
2
|
|
3
|
-
> Vue for your favorite Rails
|
3
|
+
> Vue for your favorite Rails products
|
4
4
|
|
5
|
-
The Vue on Rails gem makes it easy to build Vue components on your Rails
|
5
|
+
The Vue on Rails gem makes it easy to build Vue components on your Rails products.
|
6
6
|
|
7
7
|
It uses Rails 5.x, Vue 2.x, Webpacker 4.x, Ruby 2.x, Node 11.x, Yarn 1.12.x.
|
8
8
|
|
9
|
-
- ❄️ Server Side Rendering using Hypernova
|
10
|
-
- 💎 Compatible with Rails 6/5/4 and Webpacker
|
11
|
-
- 🌎 Internationalization for component parts
|
12
9
|
- 🖖 Vue UI ready
|
13
|
-
-
|
14
|
-
- 📦 Out of the box configuration
|
15
|
-
- ✂️ Specific-page Vue
|
10
|
+
- 🐶 Support pug
|
16
11
|
- 🤡 Jest test ready
|
12
|
+
- ✂️ Specific-page Vue
|
13
|
+
- 👷🏻️ Asset pipeline helpers
|
17
14
|
- 🎯 Simple state management
|
15
|
+
- 📦 Out of the box configuration
|
16
|
+
- 🔨 Component generators and scaffolds
|
17
|
+
- ❄️ Server Side Rendering using Hypernova
|
18
18
|
- 🗃 Easily migrate to Vuex state management
|
19
|
-
-
|
20
|
-
-
|
19
|
+
- 🌎 Internationalization for component parts
|
20
|
+
- 💎 Compatible with Rails 6/5/4 and Webpacker
|
21
|
+
- 🏎 Kickstart with our application template at https://vueonrails.com/vue
|
21
22
|
|
22
23
|
It ships out-of-the-box configuration, component generators and other solutions to make life easy for both Vue and Rails.
|
23
24
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
pugtemplate = <<-eos
|
2
|
+
<template lang="pug">
|
3
|
+
##{name}
|
4
|
+
p {{ message }}
|
5
|
+
</template>
|
6
|
+
eos
|
7
|
+
|
8
|
+
if options[:seperate] == true
|
9
|
+
gsub_file Rails.root.join("#{PARTS_PATH}/#{name}/#{name}.vue").to_s,
|
10
|
+
/<template>[^\]]*<\/template>/, pugtemplate
|
11
|
+
else
|
12
|
+
gsub_file Rails.root.join("#{PARTS_PATH}/#{name}.vue").to_s,
|
13
|
+
/<template>[^\]]*<\/template>/, pugtemplate
|
14
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
-
//
|
2
|
+
// To embed this component in Rails view, use <%= render_vue_component "component.js" %>
|
3
3
|
// To generate this component, run `rails generate vue something --ssr`
|
4
4
|
|
5
5
|
console.log("Hello, <%= name %>")
|
@@ -19,6 +19,7 @@ class VueGenerator < Rails::Generators::NamedBase
|
|
19
19
|
table: {type: :boolean, default: false},
|
20
20
|
modal: {type: :boolean, default: false},
|
21
21
|
click: {type: :boolean, default: false},
|
22
|
+
pug: {type: :boolean, default: false}
|
22
23
|
}.freeze
|
23
24
|
|
24
25
|
class_option :ssr, type: :string, default: nil
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
// This is required to support Pug in Vue on Rails.
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
test: /\.pug$/,
|
6
|
+
oneOf: [
|
7
|
+
{
|
8
|
+
resourceQuery: /^\?vue/,
|
9
|
+
use: ['pug-plain-loader']
|
10
|
+
},
|
11
|
+
{
|
12
|
+
use: ['raw-loader', 'pug-plain-loader']
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
data/lib/installs/pug.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# install pug dependencies
|
2
|
+
run "yarn add pug pug-plain-loader"
|
3
|
+
|
4
|
+
# add the pug loader
|
5
|
+
copy_file "#{__dir__}/loaders/pug.js", Rails.root.join("config/webpack/loaders/pug.js").to_s
|
6
|
+
|
7
|
+
# insert pug into the environment.js
|
8
|
+
insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
|
9
|
+
"const pug = require('./loaders/pug')\n", after: "require('@rails/webpacker')\n"
|
10
|
+
|
11
|
+
insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
|
12
|
+
"environment.loaders.prepend('pug', pug)\n", before: "module.exports = environment"
|
data/lib/installs/setup.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Check for the lack of .babelrc or webpacker 4
|
2
2
|
def check_version_and_babel
|
3
3
|
#should i check for evidence of webpacker:install?
|
4
|
-
File.exists?(Rails.root.join(".babelrc")) ==
|
5
|
-
|| (Gem.loaded_specs["webpacker"].version
|
4
|
+
(File.exists?(Rails.root.join(".babelrc")) == true) \
|
5
|
+
|| ((Gem.loaded_specs["webpacker"].version >= Gem::Version.new('4.x')) == false)
|
6
6
|
end
|
7
7
|
|
8
8
|
begin
|
@@ -33,10 +33,16 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
|
|
33
33
|
"const alias = require('./alias/alias')\n", after: "require('@rails/webpacker')\n"
|
34
34
|
|
35
35
|
# Add *_pack_tag into application.html.erb This is essential for specific-page vue setup.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
eos
|
36
|
+
if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
|
37
|
+
pack_tag = <<-eos
|
38
|
+
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
39
|
+
eos
|
40
|
+
else # non-rails 6
|
41
|
+
pack_tag = <<-eos
|
42
|
+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
43
|
+
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
44
|
+
eos
|
45
|
+
end
|
40
46
|
|
41
47
|
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
42
48
|
pack_tag, before: " </head>\n"
|
@@ -83,19 +89,6 @@ eos
|
|
83
89
|
insert_into_file Rails.root.join("package.json").to_s,
|
84
90
|
scripts, after: "\"private\": true,\n"
|
85
91
|
|
86
|
-
babelrc = <<-eos
|
87
|
-
"env": {
|
88
|
-
"test": {
|
89
|
-
"presets": [
|
90
|
-
["env", { "targets": { "node": "current" }}]
|
91
|
-
]
|
92
|
-
}
|
93
|
-
},
|
94
|
-
eos
|
95
|
-
|
96
|
-
insert_into_file Rails.root.join(".babelrc").to_s,
|
97
|
-
babelrc, before: " \"presets\": ["
|
98
|
-
|
99
92
|
# Insert locale.js as a default i18n and add second locale cn.yml
|
100
93
|
copy_file "#{__dir__}/../generators/templates/i18n/index.js", Rails.root.join("app/javascript/locales/locale.js").to_s
|
101
94
|
copy_file "#{__dir__}/../generators/templates/i18n/cn.yml", Rails.root.join("config/locales/cn.yml").to_s
|
data/lib/installs/spv.rb
CHANGED
@@ -3,10 +3,17 @@ gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
|
3
3
|
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
4
4
|
/<\/body>/, '<% end %>'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
eos
|
6
|
+
if (Gem.loaded_specs["rails"].version >= Gem::Version.new('6.x')) # rails 6 has default javascript_pack_tag
|
7
|
+
pack_tag = <<-eos
|
8
|
+
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
eos
|
10
|
+
else # non-rails 6
|
11
|
+
pack_tag = <<-eos
|
12
|
+
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
13
|
+
<%= stylesheet_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
14
|
+
eos
|
15
|
+
end
|
16
|
+
|
10
17
|
|
11
18
|
insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
12
19
|
pack_tag,
|
@@ -18,4 +25,4 @@ eos
|
|
18
25
|
|
19
26
|
insert_into_file Rails.root.join("app/assets/javascripts/application.js").to_s,
|
20
27
|
vue_on_rails,
|
21
|
-
before: "//= require_tree ."
|
28
|
+
before: "//= require_tree ."
|
@@ -1,3 +1,7 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
// To embed this component in Rails view, use <%= render_vue_component "component.js" %>
|
3
|
+
// To generate this component, run `rails generate vue something --ssr`
|
4
|
+
|
1
5
|
console.log("hello, component")
|
2
6
|
const Vue = require("vue")
|
3
7
|
const renderVue = require("hypernova-vue").renderVue
|
data/lib/installs/ssr/ssr.js
CHANGED
@@ -1,9 +1,13 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
// To run this script, simply run `node ssr`
|
3
|
+
|
1
4
|
var hypernova = require('hypernova/server');
|
2
5
|
|
3
6
|
hypernova({
|
4
7
|
devMode: true,
|
5
8
|
getComponent(name) {
|
6
|
-
//
|
9
|
+
// Console.log("The component name is -> " + name)
|
10
|
+
// Make sure you state the corresponding name correctly. In this case, 'component.js'
|
7
11
|
if (name === 'component.js') {
|
8
12
|
return require('./app/javascript/ssr/component.js')
|
9
13
|
}
|
data/lib/installs/test.rb
CHANGED
@@ -28,16 +28,4 @@ insert_into_file Rails.root.join("package.json").to_s,
|
|
28
28
|
"#{scripts}",
|
29
29
|
after: "\"private\": true,\n"
|
30
30
|
|
31
|
-
|
32
|
-
"test": {
|
33
|
-
"presets": [
|
34
|
-
["env", { "targets": { "node": "current" }}]
|
35
|
-
]
|
36
|
-
},
|
37
|
-
eos
|
38
|
-
|
39
|
-
insert_into_file Rails.root.join(".babelrc").to_s,
|
40
|
-
"#{babelrc}",
|
41
|
-
before: " \"presets\": ["
|
42
|
-
|
43
|
-
run "yarn add jest-serializer-vue vue-jest babel-jest --no-progress --silent"
|
31
|
+
run "yarn add jest-serializer-vue vue-jest babel-jest --no-progress --silent"
|
data/lib/vueonrails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vueonrails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.beta5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Lim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- lib/generators/options/list.rb
|
58
58
|
- lib/generators/options/modal.rb
|
59
59
|
- lib/generators/options/parent.rb
|
60
|
+
- lib/generators/options/pug.rb
|
60
61
|
- lib/generators/options/seperate.rb
|
61
62
|
- lib/generators/options/single.rb
|
62
63
|
- lib/generators/options/ssr.rb
|
@@ -82,6 +83,8 @@ files:
|
|
82
83
|
- lib/installs/Procfile
|
83
84
|
- lib/installs/config/alias.js
|
84
85
|
- lib/installs/i18n.rb
|
86
|
+
- lib/installs/loaders/pug.js
|
87
|
+
- lib/installs/pug.rb
|
85
88
|
- lib/installs/setup.rb
|
86
89
|
- lib/installs/spv.rb
|
87
90
|
- lib/installs/ssr.rb
|