inertia_rails 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/generators/inertia_rails/install/{react.jsx → react/InertiaExample.jsx} +0 -0
- data/lib/generators/inertia_rails/install/{inertia.jsx → react/inertia.jsx} +0 -0
- data/lib/generators/inertia_rails/install/vue/InertiaExample.vue +11 -0
- data/lib/generators/inertia_rails/install/vue/inertia.js +24 -0
- data/lib/generators/inertia_rails/install_generator.rb +15 -3
- data/lib/inertia_rails/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7912624c7ea6f1c71a896b969b704d8ff329ee41a3d1bc7277c28900b35a6516
|
4
|
+
data.tar.gz: 30098f0f5dd3cf41987cd40f139a12259d5501375b85685ab0d427c0e69d230e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97f62fa00d4489ff8364e6b4f9914161a1394905e5830526ba0baa9ae6888ee933a4e7739e18aeb6969f470989fb4aba9031cb62f57b68ed89065ff433d4e54
|
7
|
+
data.tar.gz: e9d7b942b9e1b7f4cdb98e9941143b0e08501586266aac08390a510126233ffeca8328e75e9b0f63aea49d1d19820d02b97e65af0fb178bb822c8bf63ad9925c
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
6
|
|
7
|
+
## [1.11.0] - 2021-03-23
|
8
|
+
|
9
|
+
* Fixed the install generator. `installable?` was always returning false, preventing it from actually running.
|
10
|
+
* Added an install generator for Vue.
|
11
|
+
|
7
12
|
## [1.10.0] - 2021-03-22
|
8
13
|
|
9
14
|
* Added install generator to quickly add Inertia to existing rails apps via `rails inertia_rails:install:react`
|
File without changes
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import axios from 'axios'
|
2
|
+
import Vue from 'vue'
|
3
|
+
|
4
|
+
import { app, plugin } from '@inertiajs/inertia-vue'
|
5
|
+
import { InertiaProgress } from '@inertiajs/progress'
|
6
|
+
|
7
|
+
document.addEventListener('DOMContentLoaded', () => {
|
8
|
+
const csrfToken = document.querySelector('meta[name=csrf-token]').content
|
9
|
+
axios.defaults.headers.common['X-CSRF-Token'] = csrfToken
|
10
|
+
|
11
|
+
InertiaProgress.init();
|
12
|
+
const el = document.getElementById('app')
|
13
|
+
|
14
|
+
Vue.use(plugin)
|
15
|
+
|
16
|
+
new Vue({
|
17
|
+
render: h => h(app, {
|
18
|
+
props: {
|
19
|
+
initialPage: JSON.parse(el.dataset.page),
|
20
|
+
resolveComponent: name => require(`../Pages/${name}`).default,
|
21
|
+
},
|
22
|
+
}),
|
23
|
+
}).$mount(el)
|
24
|
+
})
|
@@ -5,6 +5,7 @@ module InertiaRails
|
|
5
5
|
|
6
6
|
FRONT_END_INSTALLERS = [
|
7
7
|
'react',
|
8
|
+
'vue',
|
8
9
|
]
|
9
10
|
|
10
11
|
def install
|
@@ -32,6 +33,8 @@ module InertiaRails
|
|
32
33
|
|
33
34
|
return false
|
34
35
|
end
|
36
|
+
|
37
|
+
true
|
35
38
|
end
|
36
39
|
|
37
40
|
def install_base!
|
@@ -53,10 +56,19 @@ module InertiaRails
|
|
53
56
|
def install_react!
|
54
57
|
say "Creating a React page component...", :blue
|
55
58
|
run 'yarn add @inertiajs/inertia-react'
|
56
|
-
template "react.jsx", Rails.root.join("app/javascript/Pages/InertiaExample.js").to_s
|
59
|
+
template "react/InertiaExample.jsx", Rails.root.join("app/javascript/Pages/InertiaExample.js").to_s
|
57
60
|
say "Copying inertia.jsx into webpacker's packs folder...", :blue
|
58
|
-
template "inertia.jsx", Rails.root.join("app/javascript/packs/inertia.jsx").to_s
|
61
|
+
template "react/inertia.jsx", Rails.root.join("app/javascript/packs/inertia.jsx").to_s
|
62
|
+
say "done!", :green
|
63
|
+
end
|
64
|
+
|
65
|
+
def install_vue!
|
66
|
+
say "Creating a Vue page component...", :blue
|
67
|
+
run 'yarn add @inertiajs/inertia-vue'
|
68
|
+
template "vue/InertiaExample.vue", Rails.root.join("app/javascript/Pages/InertiaExample.vue").to_s
|
69
|
+
say "Copying inertia.js into webpacker's packs folder...", :blue
|
70
|
+
template "vue/inertia.js", Rails.root.join("app/javascript/packs/inertia.js").to_s
|
59
71
|
say "done!", :green
|
60
72
|
end
|
61
73
|
end
|
62
|
-
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: inertia_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Knoles
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-03-
|
13
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -154,8 +154,10 @@ files:
|
|
154
154
|
- gemfiles/rails_6.1.gemfile
|
155
155
|
- inertia_rails.gemspec
|
156
156
|
- lib/generators/inertia_rails/install/controller.rb
|
157
|
-
- lib/generators/inertia_rails/install/
|
158
|
-
- lib/generators/inertia_rails/install/react.jsx
|
157
|
+
- lib/generators/inertia_rails/install/react/InertiaExample.jsx
|
158
|
+
- lib/generators/inertia_rails/install/react/inertia.jsx
|
159
|
+
- lib/generators/inertia_rails/install/vue/InertiaExample.vue
|
160
|
+
- lib/generators/inertia_rails/install/vue/inertia.js
|
159
161
|
- lib/generators/inertia_rails/install_generator.rb
|
160
162
|
- lib/inertia_rails.rb
|
161
163
|
- lib/inertia_rails/controller.rb
|