vueonrails 0.2.0 → 0.3.0
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 +36 -19
- data/app/helpers/syntax_helper.rb +7 -7
- data/lib/generators/generator_templates/I18n/cn.yml +2 -0
- data/lib/generators/generator_templates/I18n/index.js +22 -0
- data/lib/generators/generator_templates/forms/index.vue.erb +6 -3
- data/lib/generators/generator_templates/packs/index.js +5 -3
- data/lib/generators/generator_templates/packs/index.vue +1 -2
- data/lib/generators/generator_templates/packs/pack.js.erb +3 -3
- data/lib/generators/generator_templates/{sfc/single-file-component.vue → single_file_components/index.vue} +6 -5
- data/lib/generators/generator_templates/stores/index.js +19 -0
- data/lib/generators/generator_templates/tests/{unit.test.js.erb → index.js.erb} +1 -1
- data/lib/generators/generator_templates/turbolinks/{turbolinks-pack.js.erb → index.js.erb} +3 -3
- data/lib/generators/options/child.rb +2 -2
- data/lib/generators/options/parent.rb +1 -1
- data/lib/generators/options/single.rb +1 -1
- data/lib/generators/options/test.rb +1 -1
- data/lib/generators/options/{turbolinks-seperate.rb → turbolinks_seperate.rb} +1 -1
- data/lib/generators/options/turbolinks_single.rb +2 -0
- data/lib/generators/vue/vue_generator.rb +2 -2
- data/lib/{install → installs}/Procfile +0 -0
- data/lib/installs/config/alias.js +14 -0
- data/lib/installs/locale.rb +1 -0
- data/lib/{install → installs}/setup.rb +13 -4
- data/lib/{install/spv.rb → installs/specific_page_vue.rb} +3 -1
- data/lib/{install → installs}/test.rb +0 -0
- data/lib/installs/turbolinks.rb +1 -0
- data/lib/{install → installs}/ui.rb +0 -0
- data/lib/{install → installs}/vuex.rb +0 -0
- data/lib/tasks/assets.rake +2 -0
- data/lib/tasks/info.rake +1 -1
- data/lib/tasks/translate.rake +19 -0
- data/lib/tasks/vue.rake +3 -2
- data/lib/vueonrails.rb +1 -7
- data/lib/vueonrails/version.rb +2 -2
- metadata +43 -19
- data/lib/generators/options/turbolinks-single.rb +0 -2
- data/lib/install/config/alias.js +0 -9
- data/lib/install/turbolinks.rb +0 -3
- data/lib/vueonrails/post_message.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c980f48cce804008547de766266a31c5e3bb370b99883b90649bb2086650999
|
4
|
+
data.tar.gz: a6799eb9d6ca5f26e90a1b5ea9431b2ffecea361e54a117c7fcab116e460864b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb9534dac453815cfe61c5283083f3de7fa39650405ca2fe495aeb5721452a5da0b9bed8b3537bc722816167f7f41405e72875420a1fc27b981b1cf59a7c745
|
7
|
+
data.tar.gz: 30dcff3bda7536b5a495441b23a7297e8c7af103a2978fea97db391ae55b30358c243f86d3e641e43196964c02646e8db364697edb29a34f01e59298034a206f
|
data/README.md
CHANGED
@@ -1,39 +1,59 @@
|
|
1
|
-
# Welcome to Vue on Rails
|
1
|
+
# Welcome to Vue on Rails 💎
|
2
2
|
|
3
|
-
> Vue for your
|
3
|
+
> Vue for your favorite Rails projects
|
4
4
|
|
5
|
-
The Vue on Rails gem makes it easy to build your Rails
|
5
|
+
The Vue on Rails gem makes it easy to build Vue components on your Rails application.
|
6
6
|
|
7
|
-
It
|
7
|
+
It uses Rails 5.x, Vue 2.x, Webpacker 3.x, Ruby 2.x, Node 11.x, Yarn 1.12.x.
|
8
|
+
|
9
|
+
- 💎 Compatible with Rails 6/5/4 and Webpacker
|
10
|
+
- 🌎 Internationalization for component parts
|
11
|
+
- 🖖 Vue UI ready
|
12
|
+
- 🔨 Component generators and scaffolds
|
13
|
+
- 📦 Out of the box configuration
|
14
|
+
- ✂️ Specific-page Vue
|
15
|
+
- 🤡 Jest test ready
|
16
|
+
- 🎯 Simple state management
|
17
|
+
- 🗃 Easily migrate to Vuex state management
|
18
|
+
- 👷🏻️ Asset pipeline helpers
|
19
|
+
- 🏎 Kickstart with our Vue on Rails application template at https://vueonrails.com/vue
|
20
|
+
|
21
|
+
It ships out-of-the-box configuration, component generators and other solutions to make life easy for both Vue and Rails.
|
8
22
|
|
9
23
|
---
|
10
24
|
|
11
25
|
## Getting Started
|
12
26
|
|
13
|
-
Create an empty Vue on Rails project by running with an application template:
|
27
|
+
Create an empty Vue on Rails project by running with an application template:
|
14
28
|
|
15
29
|
```
|
16
|
-
rails new app -m
|
30
|
+
rails new app -m https://vueonrails.com/vue -d postgresql
|
17
31
|
```
|
18
32
|
|
19
|
-
To browse the application template, it's here
|
20
|
-
|
33
|
+
To browse the application template, it's here https://vueonrails.com/vue
|
21
34
|
|
22
35
|
## Manual Installation
|
23
36
|
|
37
|
+
Create a Rails app with vue and webpack support.
|
38
|
+
|
39
|
+
```
|
40
|
+
rails new app --webpack=vue -d postgresql
|
41
|
+
```
|
42
|
+
|
24
43
|
Add this line to your application's Gemfile and run `bundle`
|
25
44
|
|
26
45
|
```ruby
|
27
46
|
gem 'vueonrails'
|
28
47
|
```
|
48
|
+
*note*: `vuejs` gem was renamed to `vueonrails`
|
29
49
|
|
30
|
-
and run `rails vue:setup`
|
31
|
-
|
32
|
-
You can scaffold a Vue component by reading along the [Vue on Rails Handbook](/docs)
|
50
|
+
and run `rails vue:setup` to complete the installation
|
33
51
|
|
34
52
|
---
|
35
53
|
|
36
|
-
## Getting Help & Contributing Back
|
54
|
+
## Getting Help & Contributing Back
|
55
|
+
|
56
|
+
Feel free to contribute back to Vue on Rails via pull requests. Below are some links that you may find useful.
|
37
57
|
|
38
58
|
- [Official Rails documentation](https://guides.rubyonrails.org)
|
39
59
|
- [Official Vue documentation](https://vuejs.org/v2/guide/)
|
@@ -44,13 +64,13 @@ You can scaffold a Vue component by reading along the [Vue on Rails Handbook](/d
|
|
44
64
|
- [Stackoverflow.com](https://stackoverflow.com/questions/tagged/vue.js+ruby-on-rails)
|
45
65
|
- [Vue on Rails github](https://github.com/vueonrails)
|
46
66
|
|
47
|
-
- On stackoverflow.com, tag your Vue on Rails questions with Vue & Rails and we will try to answer you.
|
67
|
+
- On stackoverflow.com, tag your Vue on Rails questions with Vue & Rails and we will try to answer you.
|
48
68
|
|
49
69
|
- And it is likely that I missed some great online materials. If you think there is a more worthy resource, please edit this readme via a pull request.
|
50
70
|
|
51
71
|
- Find a bug? [Submit an issue](https://github.com/vueonrails/vueonrails/issues) on our tracker.
|
52
72
|
|
53
|
-
- Find something wrong? [Send a pull request](https://github.com/vueonrails/vueonrails/pulls).
|
73
|
+
- Find something wrong? [Send a pull request](https://github.com/vueonrails/vueonrails/pulls).
|
54
74
|
|
55
75
|
---
|
56
76
|
|
@@ -58,13 +78,10 @@ You can scaffold a Vue component by reading along the [Vue on Rails Handbook](/d
|
|
58
78
|
|
59
79
|
📮 Bryan Lim ytbryan@gmail.com
|
60
80
|
|
61
|
-
|
62
|
-
|
63
|
-
Richard LaFranchi and I are writing a book [Vue on Rails](http://vueonrails.com). If you are interested to be one of the early reviewers of our drafts, please email me.
|
81
|
+
Richard LaFranchi and I are writing a book [Vue on Rails](https://vueonrails.com). If you are interested to be one of the early reviewers of our drafts, please email me.
|
64
82
|
|
65
83
|
---
|
66
84
|
|
67
85
|
## MIT License
|
68
86
|
|
69
|
-
|
70
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
87
|
+
[MIT](LICENSE.md)
|
@@ -1,25 +1,25 @@
|
|
1
1
|
module SyntaxHelper
|
2
2
|
def specific_page_vue
|
3
|
-
|
3
|
+
" #{controller_name} #{action_name} "
|
4
4
|
end
|
5
5
|
|
6
|
-
def vue_include_tag
|
7
|
-
javascript_include_tag "https://
|
6
|
+
def vue_include_tag
|
7
|
+
javascript_include_tag "https://cdn.jsdelivr.net/npm/vue/dist/vue.js" if Rails.env.development?
|
8
8
|
end
|
9
9
|
|
10
10
|
def rails_version
|
11
|
-
|
11
|
+
content_tag :p, Rails.version
|
12
12
|
end
|
13
13
|
|
14
14
|
def vue_on_rails_version
|
15
|
-
|
15
|
+
content_tag :p, Vueonrails::VERSION
|
16
16
|
end
|
17
|
-
|
17
|
+
|
18
18
|
def vue_component(identifier, variable=nil)
|
19
19
|
concat("<div id=\"#{identifier}\" refs=\"#{identifier}\">".html_safe)
|
20
20
|
concat("</div>".html_safe)
|
21
21
|
if(variable != nil)
|
22
|
-
variable.each {|key, value|
|
22
|
+
variable.each {|key, value|
|
23
23
|
concat("<div id=\"vueonrails-#{key}\" data-#{key}=\'#{value}\'>".html_safe)
|
24
24
|
concat("</div>".html_safe)
|
25
25
|
}; nil
|
@@ -0,0 +1,22 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
|
3
|
+
// Generate these JSON locales by running command: rails vue:translate
|
4
|
+
// import en from "./en.json";
|
5
|
+
// import cn from "./cn.json";
|
6
|
+
|
7
|
+
// Import the created JSON locales after running vue:translate command
|
8
|
+
const messages = {
|
9
|
+
// ...en,
|
10
|
+
// ...cn
|
11
|
+
};
|
12
|
+
|
13
|
+
import Vue from "vue";
|
14
|
+
import VueI18n from "vue-i18n";
|
15
|
+
Vue.use(VueI18n);
|
16
|
+
|
17
|
+
const i18n = new VueI18n({
|
18
|
+
locale: "en",
|
19
|
+
messages
|
20
|
+
});
|
21
|
+
|
22
|
+
export default i18n;
|
@@ -1,6 +1,7 @@
|
|
1
|
-
<!-- Generated by Vue on Rails
|
1
|
+
<!-- Generated by Vue on Rails https://github.com/vueonrails/vueonrails -->
|
2
2
|
<!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
|
3
3
|
<!-- Generate another component part like this by running command `rails generate vue something` -->
|
4
|
+
|
4
5
|
<template>
|
5
6
|
<div id="<%= name %>">
|
6
7
|
<form-for model="<%= name %>">
|
@@ -10,8 +11,9 @@
|
|
10
11
|
</template>
|
11
12
|
|
12
13
|
<script>
|
14
|
+
|
15
|
+
// import store from '@/store'
|
13
16
|
export default {
|
14
|
-
// props: {},
|
15
17
|
data: function() {
|
16
18
|
return {
|
17
19
|
message: "Hello <%= name %>!"
|
@@ -23,12 +25,13 @@ export default {
|
|
23
25
|
}
|
24
26
|
},
|
25
27
|
methods: {
|
26
|
-
//
|
28
|
+
//Add the button to your .vue template: <button @click="onClick">click this</button>
|
27
29
|
onClick: function() {
|
28
30
|
console.log("clicked");
|
29
31
|
}
|
30
32
|
},
|
31
33
|
computed: {}
|
34
|
+
// props: {},
|
32
35
|
// components: {},
|
33
36
|
// mixins: [],
|
34
37
|
// directives: {},
|
@@ -1,11 +1,12 @@
|
|
1
|
-
// Generated by Vue on Rails
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
2
|
// Generate a component part like this by running command `rails generate vue something`
|
3
3
|
// Display this Vue component by adding `require('./<%= name %>')` to app/javascript/packs/application.js
|
4
4
|
|
5
|
+
// import store from '@/store'
|
5
6
|
export default {
|
6
|
-
// props: {},
|
7
7
|
data: function() {
|
8
8
|
return {
|
9
|
+
// sharedState: store.state,
|
9
10
|
message: "Hello <%= name %>!",
|
10
11
|
items: []
|
11
12
|
};
|
@@ -16,12 +17,13 @@ export default {
|
|
16
17
|
}
|
17
18
|
},
|
18
19
|
methods: {
|
19
|
-
//
|
20
|
+
//Add the button to your .vue template: <button @click="onClick">click this</button>
|
20
21
|
onClick: function() {
|
21
22
|
console.log("clicked");
|
22
23
|
}
|
23
24
|
},
|
24
25
|
computed: {}
|
26
|
+
// props: {},
|
25
27
|
// components: {},
|
26
28
|
// mixins: [],
|
27
29
|
// directives: {},
|
@@ -1,11 +1,10 @@
|
|
1
|
-
<!-- Generated by Vue on Rails
|
1
|
+
<!-- Generated by Vue on Rails https://github.com/vueonrails/vueonrails -->
|
2
2
|
<!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
|
3
3
|
<!-- Generate a component part with separation of concern by running command `rails generate vue something --seperate` -->
|
4
4
|
|
5
5
|
<template>
|
6
6
|
<div id="<%= name %>">
|
7
7
|
<p>{{ message }}</p>
|
8
|
-
<!-- <button @click="onClick">click this</button> -->
|
9
8
|
</div>
|
10
9
|
</template>
|
11
10
|
|
@@ -1,12 +1,12 @@
|
|
1
|
-
// Generated by Vue on Rails
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
2
|
// Display this Vue component on Rails View by adding `require('./<%= name %>')` to app/javascript/application.js
|
3
3
|
// Generate a component part by running command `rails generate vue something`
|
4
4
|
|
5
5
|
import Vue from 'vue'
|
6
6
|
<% if options['seperate'] -%>
|
7
|
-
import App from '
|
7
|
+
import App from '@/<%= name %>/<%= name %>.vue'
|
8
8
|
<% else -%>
|
9
|
-
import App from '
|
9
|
+
import App from '@/<%= name %>.vue'
|
10
10
|
<% end -%>
|
11
11
|
|
12
12
|
document.addEventListener('DOMContentLoaded', () => {
|
@@ -1,19 +1,19 @@
|
|
1
|
-
<!-- Generated by Vue on Rails
|
1
|
+
<!-- Generated by Vue on Rails https://github.com/vueonrails/vueonrails -->
|
2
2
|
<!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
|
3
3
|
<!-- Generate a Single File Component part by running command `rails generate vue something` -->
|
4
4
|
|
5
|
-
<template>
|
5
|
+
<template>
|
6
6
|
<div id="<%= name %>">
|
7
7
|
<p>{{ message }}</p>
|
8
|
-
<!-- <button @click="onClick">click this</button> -->
|
9
8
|
</div>
|
10
9
|
</template>
|
11
10
|
|
12
11
|
<script>
|
12
|
+
// import store from '@/store'
|
13
13
|
export default {
|
14
|
-
// props: {},
|
15
14
|
data: function() {
|
16
15
|
return {
|
16
|
+
// sharedState: store.state,
|
17
17
|
message: "Hello <%= name %>!"
|
18
18
|
};
|
19
19
|
},
|
@@ -23,12 +23,13 @@ export default {
|
|
23
23
|
}
|
24
24
|
},
|
25
25
|
methods: {
|
26
|
-
//
|
26
|
+
//Add the button to your template: <button @click="onClick">click this</button>
|
27
27
|
onClick: function() {
|
28
28
|
console.log("clicked");
|
29
29
|
}
|
30
30
|
},
|
31
31
|
computed: {}
|
32
|
+
// props: {},
|
32
33
|
// components: {},
|
33
34
|
// mixins: [],
|
34
35
|
// directives: {},
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
// A simple state management as described in https://vuejs.org/v2/guide/state-management.html
|
3
|
+
|
4
|
+
var store = {
|
5
|
+
debug: true,
|
6
|
+
state: {
|
7
|
+
message: "Hello from Simple Store!"
|
8
|
+
},
|
9
|
+
setMessageAction(newValue) {
|
10
|
+
if (this.debug) console.log("setMessageAction triggered with", newValue);
|
11
|
+
this.state.message = newValue;
|
12
|
+
},
|
13
|
+
clearMessageAction() {
|
14
|
+
if (this.debug) console.log("clearMessageAction triggered");
|
15
|
+
this.state.message = "";
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
export default store;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
// Generated by Vue on Rails
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
2
|
// Generate a component part with test by running command `rails generate vue something --test`
|
3
3
|
|
4
4
|
import { shallowMount } from '@vue/test-utils'
|
@@ -1,13 +1,13 @@
|
|
1
|
-
// Generated by Vue on Rails
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
2
|
// Display this Vue component by adding `require('./<%= name %>')` to app/javascript/packs/application.js
|
3
3
|
// Generate a component part like this by running command `rails generate vue something`
|
4
4
|
|
5
5
|
import TurbolinksAdapter from 'vue-turbolinks';
|
6
6
|
import Vue from 'vue.esm'
|
7
7
|
<% if options['seperate'] -%>
|
8
|
-
import App from '
|
8
|
+
import App from '@/<%= name %>/<%= name %>.vue'
|
9
9
|
<% else -%>
|
10
|
-
import App from '
|
10
|
+
import App from '@/<%= name %>.vue'
|
11
11
|
<% end -%>
|
12
12
|
|
13
13
|
Vue.use(TurbolinksAdapter)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
2
|
-
template "
|
3
|
-
template "
|
2
|
+
template "single_file_components/index.vue", "#{PARTS_PATH}/#{name}.vue"
|
3
|
+
template "single_file_components/index.vue", "#{PARTS_PATH}/#{child}.vue"
|
4
4
|
|
5
5
|
insert_into_file "#{PARTS_PATH}/#{name}.vue",
|
6
6
|
"import #{child} from './#{child}.vue'\n", after: "<script>\n"
|
@@ -1,2 +1,2 @@
|
|
1
1
|
template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
|
2
|
-
template "
|
2
|
+
template "single_file_components/index.vue", "#{PARTS_PATH}/#{name}.vue"
|
@@ -1 +1 @@
|
|
1
|
-
template "tests/
|
1
|
+
template "tests/index.js.erb", "#{TESTS_PATH}/#{name}.test.js"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
template "turbolinks/
|
1
|
+
template "turbolinks/index.js.erb", "#{PACKS_PATH}/#{name}.js"
|
2
2
|
template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
|
3
3
|
template "packs/index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
|
4
4
|
copy_file "packs/index.css", "#{PARTS_PATH}/#{name}/#{name}.css"
|
@@ -39,13 +39,13 @@ class VueGenerator < Rails::Generators::NamedBase
|
|
39
39
|
else
|
40
40
|
if options[:seperate]
|
41
41
|
if options[:turbolinks]
|
42
|
-
add_to_component("
|
42
|
+
add_to_component("turbolinks_seperate", name)
|
43
43
|
else
|
44
44
|
add_to_component("seperate", name)
|
45
45
|
end
|
46
46
|
else
|
47
47
|
if options[:turbolinks]
|
48
|
-
add_to_component("
|
48
|
+
add_to_component("turbolinks_single", name)
|
49
49
|
else
|
50
50
|
add_to_component("single", name)
|
51
51
|
end
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// Generated by Vue on Rails https://github.com/vueonrails/vueonrails
|
2
|
+
// DO NOT remove as generated components depend on these aliases
|
3
|
+
|
4
|
+
module.exports = {
|
5
|
+
resolve: {
|
6
|
+
alias: {
|
7
|
+
"@": "../parts",
|
8
|
+
vue$: "vue/dist/vue.esm.js",
|
9
|
+
tests: "../tests",
|
10
|
+
locales: "../locales"
|
11
|
+
},
|
12
|
+
extensions: [".vue"]
|
13
|
+
}
|
14
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
run "yarn add vue-i18n"
|
@@ -1,5 +1,5 @@
|
|
1
|
-
say "Adding @vue/test-utils and other Jest devdependencies"
|
2
|
-
run "yarn add vueonrails @vue/test-utils jest jest-serializer-vue vue-jest babel-jest --dev"
|
1
|
+
say "Adding vueonrails, internationalization, @vue/test-utils and other Jest devdependencies"
|
2
|
+
run "yarn add vueonrails vue-i18n @vue/test-utils jest jest-serializer-vue vue-jest babel-jest --dev"
|
3
3
|
|
4
4
|
# Copy alias.js into Vue on Rails project
|
5
5
|
copy_file "#{__dir__}/config/alias.js", Rails.root.join("config/webpack/alias/alias.js").to_s
|
@@ -68,10 +68,19 @@ eos
|
|
68
68
|
|
69
69
|
insert_into_file Rails.root.join(".babelrc").to_s,
|
70
70
|
babelrc, before: " \"presets\": ["
|
71
|
-
|
71
|
+
|
72
|
+
# Insert locale.js as a default i18n and add second locale cn.yml
|
73
|
+
copy_file "#{__dir__}/../generators/generator_templates/i18n/index.js", Rails.root.join("app/javascript/locales/locale.js").to_s
|
74
|
+
copy_file "#{__dir__}/../generators/generator_templates/i18n/cn.yml", Rails.root.join("config/locales/cn.yml").to_s
|
75
|
+
|
76
|
+
# Insert store.js as a simple store for components' state
|
77
|
+
copy_file "#{__dir__}/../generators/generator_templates/stores/index.js", Rails.root.join("app/javascript/parts/store.js").to_s
|
78
|
+
|
72
79
|
# Add Procfile for foreman
|
73
80
|
template "#{__dir__}/Procfile", Rails.root.join("Procfile").to_s
|
74
81
|
|
75
82
|
# Add specific_page_vue helper to enable Specific-page Vue
|
76
83
|
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
77
|
-
/<body>/, '
|
84
|
+
/<body>/, '<%= content_tag :body, class: specific_page_vue do %>'
|
85
|
+
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
86
|
+
/<\/body>/, '<% end %>'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
2
|
-
/<body>/, '
|
2
|
+
/<body>/, '<%= content_tag :body, class: specific_page_vue do %>'
|
3
|
+
gsub_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
|
4
|
+
/<\/body>/, '<% end %>'
|
3
5
|
|
4
6
|
pack_tag = <<-eos
|
5
7
|
<%= javascript_pack_tag 'application' %>
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
run "yarn list vue-turbolinks --no-progress --silent"
|
File without changes
|
File without changes
|
data/lib/tasks/assets.rake
CHANGED
@@ -5,6 +5,8 @@ namespace :vue do
|
|
5
5
|
task :assets do
|
6
6
|
version = "2.5.16"
|
7
7
|
source = "https://cdnjs.cloudflare.com/ajax/libs/vue/#{version}/vue.js"
|
8
|
+
# TODO move the old vue.js into a folder and timestamp it.
|
9
|
+
# TODO
|
8
10
|
output = "app/assets/javascripts/vue.js"
|
9
11
|
done = File.write output, open(source).read
|
10
12
|
$stdout.puts "Added Vue.js #{version} (#{source}) into assets pipeline (#{output})" if done != nil
|
data/lib/tasks/info.rake
CHANGED
@@ -11,7 +11,7 @@ namespace :vue do
|
|
11
11
|
$stdout.puts "Node: #{`node --version`}"
|
12
12
|
$stdout.puts "Yarn: #{`yarn --version`}"
|
13
13
|
$stdout.puts "\n"
|
14
|
-
$stdout.puts "#{`yarn list @rails/webpacker vue vue-loader vuex vue-template-compiler webpack-dev-server @vue/test-utils
|
14
|
+
$stdout.puts "#{`yarn list @rails/webpacker vueonrails vue-i18n vue vue-loader vuex vue-template-compiler webpack-dev-server @vue/test-utils jest jest-serializer-vue vue-jest babel-jest`}"
|
15
15
|
$stdout.puts "\n"
|
16
16
|
|
17
17
|
$stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
namespace :vue do
|
2
|
+
desc "Translate Rails' locale into Vue's locale"
|
3
|
+
task :translate do
|
4
|
+
Dir.foreach("config/locales/").each do |locale|
|
5
|
+
next if locale == '.' or locale == '..'
|
6
|
+
config = YAML.load_file("config/locales/#{locale}")
|
7
|
+
name = locale.to_s.split('.').first if locale.to_s.split('.') != nil
|
8
|
+
if name != nil
|
9
|
+
hash = Hash.new
|
10
|
+
hash[name] = config[name]
|
11
|
+
|
12
|
+
File.open("app/javascript/locales/#{name}.json", 'w') { |file|
|
13
|
+
file.puts JSON.pretty_generate(hash)
|
14
|
+
$stdout.puts "Created app/javascript/locales/#{name}.json"
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/tasks/vue.rake
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
bin_path = ENV["BUNDLE_BIN"] || "./bin"
|
2
2
|
|
3
3
|
TASKS = {
|
4
|
+
locale: "install vue-i18n",
|
4
5
|
turbolinks: "Check Vue-turbolinks ready",
|
5
6
|
setup: "Check Vue on Rails ready",
|
6
7
|
test: "Check Jest tests ready",
|
7
8
|
vuex: "Check Vuex ready",
|
8
9
|
ui: "Check Vue-ui ready",
|
9
|
-
|
10
|
+
specific_page_vue: "Check Specific-page Vue ready?"
|
10
11
|
}.freeze
|
11
12
|
|
12
13
|
namespace :vue do
|
13
14
|
TASKS.each do |task_name, description|
|
14
15
|
desc description
|
15
16
|
task task_name do
|
16
|
-
template = File.expand_path("../
|
17
|
+
template = File.expand_path("../installs/#{task_name}.rb", __dir__)
|
17
18
|
base_path =
|
18
19
|
if Rails::VERSION::MAJOR >= 5
|
19
20
|
"#{RbConfig.ruby} #{bin_path}/rails app:template"
|
data/lib/vueonrails.rb
CHANGED
data/lib/vueonrails/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.
|
1
|
+
module Vueonrails
|
2
|
+
VERSION = "0.3.0"
|
3
3
|
end
|
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: 0.
|
4
|
+
version: 0.3.0
|
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-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.8'
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 3.8.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '3.8'
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 3.8.0
|
41
61
|
description: Ruby on Rails with the power of Vue components
|
42
62
|
email:
|
43
63
|
- ytbryan@gmail.com
|
@@ -51,14 +71,17 @@ files:
|
|
51
71
|
- app/helpers/syntax_helper.rb
|
52
72
|
- app/views/vue/index.html.erb
|
53
73
|
- config/routes.rb
|
74
|
+
- lib/generators/generator_templates/I18n/cn.yml
|
75
|
+
- lib/generators/generator_templates/I18n/index.js
|
54
76
|
- lib/generators/generator_templates/forms/index.vue.erb
|
55
77
|
- lib/generators/generator_templates/packs/index.css
|
56
78
|
- lib/generators/generator_templates/packs/index.js
|
57
79
|
- lib/generators/generator_templates/packs/index.vue
|
58
80
|
- lib/generators/generator_templates/packs/pack.js.erb
|
59
|
-
- lib/generators/generator_templates/
|
60
|
-
- lib/generators/generator_templates/
|
61
|
-
- lib/generators/generator_templates/
|
81
|
+
- lib/generators/generator_templates/single_file_components/index.vue
|
82
|
+
- lib/generators/generator_templates/stores/index.js
|
83
|
+
- lib/generators/generator_templates/tests/index.js.erb
|
84
|
+
- lib/generators/generator_templates/turbolinks/index.js.erb
|
62
85
|
- lib/generators/options/child.rb
|
63
86
|
- lib/generators/options/click.rb
|
64
87
|
- lib/generators/options/form.rb
|
@@ -69,30 +92,31 @@ files:
|
|
69
92
|
- lib/generators/options/single.rb
|
70
93
|
- lib/generators/options/table.rb
|
71
94
|
- lib/generators/options/test.rb
|
72
|
-
- lib/generators/options/
|
73
|
-
- lib/generators/options/
|
95
|
+
- lib/generators/options/turbolinks_seperate.rb
|
96
|
+
- lib/generators/options/turbolinks_single.rb
|
74
97
|
- lib/generators/options/vuex.rb
|
75
98
|
- lib/generators/vue/USAGE
|
76
99
|
- lib/generators/vue/vue_generator.rb
|
77
|
-
- lib/
|
78
|
-
- lib/
|
79
|
-
- lib/
|
80
|
-
- lib/
|
81
|
-
- lib/
|
82
|
-
- lib/
|
83
|
-
- lib/
|
84
|
-
- lib/
|
100
|
+
- lib/installs/Procfile
|
101
|
+
- lib/installs/config/alias.js
|
102
|
+
- lib/installs/locale.rb
|
103
|
+
- lib/installs/setup.rb
|
104
|
+
- lib/installs/specific_page_vue.rb
|
105
|
+
- lib/installs/test.rb
|
106
|
+
- lib/installs/turbolinks.rb
|
107
|
+
- lib/installs/ui.rb
|
108
|
+
- lib/installs/vuex.rb
|
85
109
|
- lib/tasks/assets.rake
|
86
110
|
- lib/tasks/info.rake
|
111
|
+
- lib/tasks/translate.rake
|
87
112
|
- lib/tasks/vue.rake
|
88
113
|
- lib/vueonrails.rb
|
89
|
-
- lib/vueonrails/post_message.rb
|
90
114
|
- lib/vueonrails/version.rb
|
91
|
-
homepage:
|
115
|
+
homepage: https://github.com/vueonrails/vueonrails
|
92
116
|
licenses:
|
93
117
|
- MIT
|
94
118
|
metadata: {}
|
95
|
-
post_install_message:
|
119
|
+
post_install_message:
|
96
120
|
rdoc_options: []
|
97
121
|
require_paths:
|
98
122
|
- lib
|
@@ -111,5 +135,5 @@ rubyforge_project:
|
|
111
135
|
rubygems_version: 2.7.6
|
112
136
|
signing_key:
|
113
137
|
specification_version: 4
|
114
|
-
summary: Vue on Rails
|
138
|
+
summary: Vue on Rails https://vueonrails.com
|
115
139
|
test_files: []
|
data/lib/install/config/alias.js
DELETED
data/lib/install/turbolinks.rb
DELETED