inertia_rails 1.10.0 → 1.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c76eba9ada41f6b781b030f81b43bb87169034594127e106ec4dbee472926e8e
4
- data.tar.gz: e9ed9115c9d6a678bdefdeeeafbeb1790c9a28f37521d71c699d5ca40989cd86
3
+ metadata.gz: 7912624c7ea6f1c71a896b969b704d8ff329ee41a3d1bc7277c28900b35a6516
4
+ data.tar.gz: 30098f0f5dd3cf41987cd40f139a12259d5501375b85685ab0d427c0e69d230e
5
5
  SHA512:
6
- metadata.gz: 5d0285ccf5284c9fb4d267d25dfc899d58be5f57b2166fc42251246398483aaf639c8dbec94181a1a5978c020ea2fb796872248dd3de7c14db165b8ab20755cb
7
- data.tar.gz: c06d57bec2e2c4fa55b15428055684999af1d65ee226f42263cb945d17ce4f06029bc8365b2a9f52b59db924b251f34944dd96998a7933b64fe18c6e80ae3117
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`
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <h1 :style="{ 'text-align': 'center' }">Hello {{name}}!</h1>
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ props: {
8
+ name: { type: String, required: true },
9
+ },
10
+ }
11
+ </script>
@@ -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
@@ -1,3 +1,3 @@
1
1
  module InertiaRails
2
- VERSION = "1.10.0"
2
+ VERSION = "1.11.0"
3
3
  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.10.0
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-22 00:00:00.000000000 Z
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/inertia.jsx
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