vueonrails 0.1.0 → 0.2.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +21 -0
  3. data/README.md +7 -7
  4. data/lib/generators/generator_templates/forms/index.vue.erb +45 -0
  5. data/lib/generators/generator_templates/packs/index.js +13 -13
  6. data/lib/generators/generator_templates/packs/index.vue +3 -3
  7. data/lib/generators/generator_templates/packs/pack.js.erb +3 -3
  8. data/lib/generators/generator_templates/sfc/single-file-component.vue +3 -3
  9. data/lib/generators/generator_templates/tests/unit.test.js.erb +2 -2
  10. data/lib/generators/generator_templates/turbolinks/turbolinks-pack.js.erb +3 -3
  11. data/lib/generators/options/child.rb +6 -0
  12. data/lib/generators/options/click.rb +0 -1
  13. data/lib/generators/options/form.rb +1 -19
  14. data/lib/generators/options/list.rb +0 -1
  15. data/lib/generators/options/modal.rb +0 -1
  16. data/lib/generators/options/parent.rb +3 -0
  17. data/lib/generators/options/seperate.rb +0 -1
  18. data/lib/generators/options/single.rb +0 -1
  19. data/lib/generators/options/table.rb +0 -1
  20. data/lib/generators/options/test.rb +1 -2
  21. data/lib/generators/options/turbolinks-seperate.rb +0 -1
  22. data/lib/generators/options/turbolinks-single.rb +0 -1
  23. data/lib/generators/options/vuex.rb +0 -1
  24. data/lib/generators/vue/vue_generator.rb +76 -18
  25. data/lib/install/setup.rb +4 -5
  26. data/lib/install/spv.rb +0 -1
  27. data/lib/install/test.rb +0 -3
  28. data/lib/install/ui.rb +0 -3
  29. data/lib/vueonrails/post_message.rb +1 -1
  30. data/lib/vueonrails/version.rb +1 -1
  31. metadata +10 -23
  32. data/vendor/assets/javascripts/axios.js +0 -1545
  33. data/vendor/assets/javascripts/axios.map +0 -1
  34. data/vendor/assets/javascripts/element-ui.js +0 -12
  35. data/vendor/assets/javascripts/vue-resource.js +0 -1531
  36. data/vendor/assets/javascripts/vue-router.js +0 -2709
  37. data/vendor/assets/javascripts/vue-router2.js +0 -2284
  38. data/vendor/assets/javascripts/vue-validator.js +0 -910
  39. data/vendor/assets/javascripts/vue-validator2.js +0 -2615
  40. data/vendor/assets/javascripts/vue-validator3.js +0 -2054
  41. data/vendor/assets/javascripts/vue.js +0 -10237
  42. data/vendor/assets/javascripts/vue.min.js +0 -9
  43. data/vendor/assets/javascripts/vue2.js +0 -8568
  44. data/vendor/assets/javascripts/vue2.min.js +0 -8
  45. data/vendor/assets/javascripts/vueonrails.js +0 -39
  46. data/vendor/assets/javascripts/vuex.js +0 -722
  47. data/vendor/assets/javascripts/vuex2.js +0 -805
  48. data/vendor/assets/stylesheets/element-ui.css +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fca55cc783008efe3aa7a536b250238566075ca33fca7d3212a9bec8f79eed63
4
- data.tar.gz: 6bb87bc9edc75b27701d4d1f603d7ff579965000ffcf81d8e2c5db0def45e4cf
3
+ metadata.gz: 7a743b4c5529d0e040aaf7fce35bf646505f40ee6024822dcf51ff7240ef235a
4
+ data.tar.gz: 319e78203b55fd528551b67275a999629149673f72e2ab2a2235cd5b953efcee
5
5
  SHA512:
6
- metadata.gz: fbe0bf9a3d1e771891e1deed60f6a3640658e6408b2aa0ceec5f8a1d43135d67ec4e3a8572801ffd4cb24d0d24337c4f736b791af197b0347b7931354b1d7c28
7
- data.tar.gz: c4c1dd1a0a1c4f07953a9130802d29a4ed7d222107c2f0690d6fd47b76a4993fdbe8016109383f906a81bb64020bdbb71e43e3ecd5b649e349a535bfab6bebe8
6
+ metadata.gz: 91ae09bd0d8c5862513271f14b04f25790bfcb7ea736afc4d0a1919e01f630bfb4d68b8a5f83cf6bd5d27ad40d07125fda61084354091c01db09cbf89e268993
7
+ data.tar.gz: 0ef16644d1b5582bda93ac8f612db54e6f3e089eb886ed3c688ba22763beec7f37efdc27c6877bf4a68a2d3887acea9f69db890000089afb5ad2b674e5b3f8e7
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ # The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Bryan Lim (@ytbryan)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Vue for your favourite Ruby on Rails projects
4
4
 
5
- The Vue on Rails gem makes it easy to build your Rails with Vue application.
5
+ The Vue on Rails gem makes it easy to build your Rails with Vue components.
6
6
 
7
7
  It ships out-of-the-box configuration, component generators and solutions to make life easy for both Vue and Rails.
8
8
 
@@ -10,7 +10,7 @@ It ships out-of-the-box configuration, component generators and solutions to mak
10
10
 
11
11
  ## Getting Started
12
12
 
13
- To create an empty Vue on Rails project, please run the following Rails command with an application template
13
+ Create an empty Vue on Rails project by running with an application template:
14
14
 
15
15
  ```
16
16
  rails new app -m http://vueonrails.com/vue
@@ -40,17 +40,17 @@ You can scaffold a Vue component by reading along the [Vue on Rails Handbook](/d
40
40
  - [Official Vue Curated components](https://curated.vuejs.org)
41
41
  - [Vuecomponents.com](https://vuecomponents.com)
42
42
  - [Vuetoolbox.com](http://www.vuetoolbox.com)
43
- - [Github search for vue stuffs](https://github.com/search?o=desc&q=vue&s=stars&type=Repositories)
43
+ - [Github search for Vue stuffs](https://github.com/search?o=desc&q=vue&s=stars&type=Repositories)
44
44
  - [Stackoverflow.com](https://stackoverflow.com/questions/tagged/vue.js+ruby-on-rails)
45
-
45
+ - [Vue on Rails github](https://github.com/vueonrails)
46
46
 
47
47
  - On stackoverflow.com, tag your Vue on Rails questions with Vue & Rails and we will try to answer you.
48
48
 
49
49
  - 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
50
 
51
- - Find a bug? [Submit an issue](https://github.com/ytbryan/vueonrails/issues) on our tracker.
51
+ - Find a bug? [Submit an issue](https://github.com/vueonrails/vueonrails/issues) on our tracker.
52
52
 
53
- - Find something wrong? [Send a pull request](https://github.com/ytbryan/vueonrails/pulls).
53
+ - Find something wrong? [Send a pull request](https://github.com/vueonrails/vueonrails/pulls).
54
54
 
55
55
  ---
56
56
 
@@ -66,5 +66,5 @@ Richard LaFranchi and I are writing a book [Vue on Rails](http://vueonrails.com)
66
66
 
67
67
  ## MIT License
68
68
 
69
- Bug reports and pull requests are welcome on GitHub at https://github.com/ytbryan/vueonrails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
69
+ Bug reports and pull requests are welcome on GitHub at https://github.com/vueonrails/vueonrails. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
70
70
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,45 @@
1
+ <!-- Generated by Vue on Rails http://github.com/vueonrails/vueonrails -->
2
+ <!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
3
+ <!-- Generate another component part like this by running command `rails generate vue something` -->
4
+ <template>
5
+ <div id="<%= name %>">
6
+ <form-for model="<%= name %>">
7
+ <%# something %>
8
+ </form-for>
9
+ </div>
10
+ </template>
11
+
12
+ <script>
13
+ export default {
14
+ // props: {},
15
+ data: function() {
16
+ return {
17
+ message: "Hello <%= name %>!"
18
+ };
19
+ },
20
+ watch: {
21
+ onCreated: function(response) {
22
+ this.items = response.data;
23
+ }
24
+ },
25
+ methods: {
26
+ //uncomment the <button @click="onClick"> at your template
27
+ onClick: function() {
28
+ console.log("clicked");
29
+ }
30
+ },
31
+ computed: {}
32
+ // components: {},
33
+ // mixins: [],
34
+ // directives: {},
35
+ // filters: {},
36
+ // asyncComputed: {},
37
+ };
38
+ </script>
39
+
40
+ <style scoped>
41
+ p {
42
+ font-size: 2em;
43
+ text-align: center;
44
+ }
45
+ </style>
@@ -1,30 +1,30 @@
1
- // Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails
2
- // To generate component part like this, please run `rails generate vue something`
3
- // To display this Vue component, add `require('./<%= name %>')` to app/javascript/packs/application.js
1
+ // Generated by Vue on Rails http://github.com/vueonrails/vueonrails
2
+ // Generate a component part like this by running command `rails generate vue something`
3
+ // Display this Vue component by adding `require('./<%= name %>')` to app/javascript/packs/application.js
4
4
 
5
5
  export default {
6
6
  // props: {},
7
- data: function () {
7
+ data: function() {
8
8
  return {
9
9
  message: "Hello <%= name %>!",
10
10
  items: []
11
11
  };
12
12
  },
13
13
  watch: {
14
- onCreated: function (response) {
15
- this.items = response.data
14
+ onCreated: function(response) {
15
+ this.items = response.data;
16
16
  }
17
17
  },
18
18
  methods: {
19
- //uncomment the <button @click="onClick"> at your <%= name %>.vue
20
- onClick: function () {
21
- console.log("clicked")
19
+ //uncomment the <button @click="onClick"> at your <%= name %>.vue
20
+ onClick: function() {
21
+ console.log("clicked");
22
22
  }
23
23
  },
24
- computed: {},
24
+ computed: {}
25
25
  // components: {},
26
- // mixins: [],
27
- // directives: {},
26
+ // mixins: [],
27
+ // directives: {},
28
28
  // filters: {},
29
29
  // asyncComputed: {}, // yarn add vue-async-computed
30
- };
30
+ };
@@ -1,6 +1,6 @@
1
- <!-- Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails -->
2
- <!-- To find the corresponding pack, go to app/javascript/packs/<%= name %>.js -->
3
- <!-- To generate component part like this, please run `rails generate vue something --seperate` -->
1
+ <!-- Generated by Vue on Rails http://github.com/vueonrails/vueonrails -->
2
+ <!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
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 %>">
@@ -1,6 +1,6 @@
1
- // Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails
2
- // To display this Vue component on Rails View, add `require('./<%= name %>')` to app/javascript/application.js
3
- // To generate another component part, please run `rails generate vue something`
1
+ // Generated by Vue on Rails http://github.com/vueonrails/vueonrails
2
+ // Display this Vue component on Rails View by adding `require('./<%= name %>')` to app/javascript/application.js
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'] -%>
@@ -1,6 +1,6 @@
1
- <!-- Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails -->
2
- <!-- To find the corresponding pack, go to app/javascript/packs/<%= name %>.js -->
3
- <!-- To generate component part like this, please run `rails generate vue something` -->
1
+ <!-- Generated by Vue on Rails http://github.com/vueonrails/vueonrails -->
2
+ <!-- The corresponding pack is app/javascript/packs/<%= name %>.js -->
3
+ <!-- Generate a Single File Component part by running command `rails generate vue something` -->
4
4
 
5
5
  <template>
6
6
  <div id="<%= name %>">
@@ -1,5 +1,5 @@
1
- // Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails
2
- // To generate component part with test, please run `rails generate vue something --test`
1
+ // Generated by Vue on Rails http://github.com/vueonrails/vueonrails
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'
5
5
  <% if options['seperate'] -%>
@@ -1,6 +1,6 @@
1
- // Generated by Vue on Rails gem ~> github.com/ytbryan/vueonrails
2
- // To display this Vue component, add `require('./<%= name %>')` to app/javascript/packs/application.js
3
- // To generate component part like this, please run `rails generate vue something`
1
+ // Generated by Vue on Rails http://github.com/vueonrails/vueonrails
2
+ // Display this Vue component by adding `require('./<%= name %>')` to app/javascript/packs/application.js
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'
@@ -0,0 +1,6 @@
1
+ template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
2
+ template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
3
+ template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{child}.vue"
4
+
5
+ insert_into_file "#{PARTS_PATH}/#{name}.vue",
6
+ "import #{child} from './#{child}.vue'\n", after: "<script>\n"
@@ -2,7 +2,6 @@ click = <<-eos
2
2
  <button @click="onClick()">click</button>
3
3
  eos
4
4
 
5
- say "Inserted click example into component"
6
5
  insert_into_file "#{PARTS_PATH}/#{name}.vue",
7
6
  click, after: "<p>{{ message }}</p>\n"
8
7
 
@@ -1,19 +1 @@
1
- say "Inserted form example into component"
2
- insert_into_file "#{PACKS_PATH}/#{name}.js" ,
3
- "import FormFor from 'vue-form-for'\n",
4
- after: "import Vue from 'vue'\n"
5
-
6
- insert_into_file "#{PACKS_PATH}/#{name}.js",
7
- "Vue.use(FormFor)\n",
8
- before: "document.addEventListener"
9
-
10
- form = <<-eos
11
- <form-for model="#{name}">
12
- <text-field/>
13
- <submit-tag/>
14
- </form-for>
15
- eos
16
-
17
- insert_into_file "#{PARTS_PATH}/#{name}.vue",
18
- form,
19
- after: "<p>{{ message }}</p>\n"
1
+ template "forms/index.vue.erb", "#{PACKS_PATH}/#{name}.vue"
@@ -21,7 +21,6 @@ addandremove = <<-eos
21
21
  },
22
22
  eos
23
23
 
24
- say "Inserted list example into component"
25
24
  insert_into_file "#{PARTS_PATH}/#{name}.vue",
26
25
  list, after: "<p>{{ message }}</p>\n"
27
26
 
@@ -1,6 +1,5 @@
1
1
  run "yarn add vue-js-modal"
2
2
 
3
- say "Inserted vue-js-modal example into component"
4
3
  insert_into_file "#{PACKS_PATH}/#{name}.js" ,
5
4
  "import VModal from 'vue-js-modal'\n",
6
5
  after: "import Vue from 'vue'\n"
@@ -0,0 +1,3 @@
1
+ template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
2
+ insert_into_file "#{PARTS_PATH}/#{parent}.vue",
3
+ "import #{name} from './#{name}.vue';\n", after: "<script>\n"
@@ -1,4 +1,3 @@
1
- say "Generated a vue component with seperation of concern"
2
1
  template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
3
2
  template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
4
3
  template "packs/index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
@@ -1,3 +1,2 @@
1
- say "Generated a single file component"
2
1
  template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
3
2
  template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
@@ -1,6 +1,5 @@
1
1
  run "yarn add vuetable-2"
2
2
 
3
- say "Inserted table example into component"
4
3
  insert_into_file "#{PACKS_PATH}/#{name}.js" ,
5
4
  "import Vuetable from 'vuetable-2/src/components/Vuetable'\n",
6
5
  after: "import Vue from 'vue'\n"
@@ -1,2 +1 @@
1
- say "Included Jest test"
2
- template "tests/unit.test.js.erb", "#{TESTS_PATH}/#{name}.test.js"
1
+ template "tests/unit.test.js.erb", "#{TESTS_PATH}/#{name}.test.js"
@@ -1,4 +1,3 @@
1
- say "Adding turbolinks to a single file component"
2
1
  template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
3
2
  template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
4
3
  template "packs/index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
@@ -1,3 +1,2 @@
1
- say "Added turbolinks to a single file component"
2
1
  template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
3
2
  template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
@@ -1,6 +1,5 @@
1
1
  run "yarn add vuex"
2
2
 
3
- say "Added Vuex"
4
3
  insert_into_file "#{PACKS_PATH}/#{name}.js" ,
5
4
  "import Vuex from 'vuex'\n",
6
5
  after: "import Vue from 'vue'\n"
@@ -1,25 +1,27 @@
1
1
  require 'ostruct'
2
2
 
3
3
  class VueGenerator < Rails::Generators::NamedBase
4
- source_root File.expand_path('../../generator_templates', __FILE__)
5
-
6
- argument :name, type: :string, default: ""
7
-
8
4
  PACKS_PATH = "app/javascript/packs"
9
5
  PARTS_PATH = "app/javascript/parts"
10
6
  TESTS_PATH = "app/javascript/tests"
7
+
8
+ source_root File.expand_path('../../generator_templates', __FILE__)
9
+
10
+ argument :name, type: :string, default: nil
11
11
 
12
12
  OPTIONS = {
13
13
  test: {type: :boolean, default: false},
14
14
  vuex: {type: :boolean, default: false},
15
15
  form: {type: :boolean, default: false},
16
- tab: {type: :boolean, default: false},
16
+ tab: {type: :boolean, default: false},
17
17
  list: {type: :boolean, default: false},
18
18
  table: {type: :boolean, default: false},
19
19
  modal: {type: :boolean, default: false},
20
20
  click: {type: :boolean, default: false},
21
21
  }.freeze
22
-
22
+
23
+ class_option :child, type: :string, default: nil
24
+ class_option :parent, type: :string, default: nil
23
25
  class_option :seperate, type: :boolean, default: false
24
26
  class_option :turbolinks, type: :boolean, default: false
25
27
 
@@ -29,32 +31,88 @@ class VueGenerator < Rails::Generators::NamedBase
29
31
 
30
32
  def vue
31
33
  return if name.empty?
32
-
33
- if options[:seperate]
34
- if options[:turbolinks]
35
- add_to_component("turbolinks-seperate", name)
36
- else
37
- add_to_component("seperate", name)
38
- end
34
+
35
+ if options[:child]
36
+ adding_nested_component(:child, name, nil, options[:child])
37
+ elsif options[:parent]
38
+ adding_nested_component(:parent, name, options[:parent], nil)
39
39
  else
40
- if options[:turbolinks]
41
- add_to_component("turbolinks-single", name)
40
+ if options[:seperate]
41
+ if options[:turbolinks]
42
+ add_to_component("turbolinks-seperate", name)
43
+ else
44
+ add_to_component("seperate", name)
45
+ end
42
46
  else
43
- add_to_component("single", name)
47
+ if options[:turbolinks]
48
+ add_to_component("turbolinks-single", name)
49
+ else
50
+ add_to_component("single", name)
51
+ end
44
52
  end
45
53
  end
46
54
 
47
55
  OPTIONS.each do |each_option, value|
48
- options[each_option] ? add_to_component(each_option, name) : nil
56
+ if each_option == :form
57
+ options[:form] ? add_form_to_component(ARGV, each_option, name) : nil
58
+ else
59
+ options[each_option] ? add_to_component(each_option, name) : nil
60
+ end
49
61
  end
50
62
  end
51
63
 
52
64
  private
65
+
66
+ def filter_for_form_attributes(argv)
67
+ return argv.select{ |item| item.include? ":" }
68
+ end
69
+
70
+ def process_args(attribute)
71
+ return if (attribute == "") || (attribute.include? ":")
72
+ attr = attribute.split(':').first
73
+ case attribute
74
+ when :integer then 'number-field'
75
+ when :float, :decimal then 'text-field'
76
+ when :time then 'time-select'
77
+ when :datetime, :timestamp then 'datetime-select'
78
+ when :date then 'date-select'
79
+ when :text then 'text-area'
80
+ when :boolean then 'check-box'
81
+ else
82
+ 'text-field'
83
+ end
84
+ end
85
+
86
+ def process_name(attribute)
87
+ return if (attribute == "") || (attribute.include? ":")
88
+ return attribute.split(':')[1]
89
+ end
90
+
91
+ def adding_nested_component(example, name, parent, child)
92
+ namespace = OpenStruct.new(TESTS_PATH: TESTS_PATH, PARTS_PATH: PARTS_PATH, PACKS_PATH: PACKS_PATH, name: name, child: child, parent: parent)
93
+ template = File.read(File.expand_path("../options/#{example}.rb", __dir__))
94
+ erbtemplate = ERB.new(template).result(namespace.instance_eval { binding })
95
+ eval erbtemplate
96
+ end
97
+
53
98
  def add_to_component(example, name)
54
- puts "add to component #{name} running #{example}"
55
99
  namespace = OpenStruct.new(TESTS_PATH: TESTS_PATH, PARTS_PATH: PARTS_PATH, PACKS_PATH: PACKS_PATH, name: name)
56
100
  template = File.read(File.expand_path("../options/#{example}.rb", __dir__))
57
101
  erbtemplate = ERB.new(template).result(namespace.instance_eval { binding })
58
102
  eval erbtemplate
59
103
  end
104
+
105
+ # To handle field_type https://github.com/rails/rails/blob/b1f140ef2e5af605ea12d8ee1c932eaf728a398d/railties/lib/rails/generators/generated_attribute.rb
106
+ def add_form_to_component argv, example, name
107
+ something = filter_for_form_attributes(argv)
108
+ namespace = OpenStruct.new(TESTS_PATH: TESTS_PATH,
109
+ PARTS_PATH: PARTS_PATH,
110
+ PACKS_PATH: PACKS_PATH,
111
+ name: name,
112
+ something: something )
113
+ template = File.read(File.expand_path("../options/form.rb", __dir__))
114
+ erbtemplate = ERB.new(template).result(namespace.instance_eval { binding })
115
+ eval erbtemplate
116
+ end
60
117
  end
118
+
data/lib/install/setup.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  say "Adding @vue/test-utils and other Jest devdependencies"
2
- run "yarn add vueonrails"
3
- run "yarn add @vue/test-utils jest jest-serializer-vue vue-jest babel-jest --dev"
2
+ run "yarn add vueonrails @vue/test-utils jest jest-serializer-vue vue-jest babel-jest --dev"
4
3
 
5
4
  # Copy alias.js into Vue on Rails project
6
5
  copy_file "#{__dir__}/config/alias.js", Rails.root.join("config/webpack/alias/alias.js").to_s
@@ -16,7 +15,7 @@ insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
16
15
  pack_tag, before: " </head>\n"
17
16
 
18
17
  insert_into_file Rails.root.join("app/javascript/packs/application.js").to_s,
19
- "\nrequire('./hello_vue')\n", after: "console.log('Hello World from Webpacker')\n"
18
+ "\nimport './hello_vue'\n", after: "console.log('Hello World from Webpacker')\n"
20
19
 
21
20
  insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
22
21
  "environment.config.merge(alias)\n", before: "module.exports"
@@ -25,8 +24,8 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
25
24
  scripts = <<-eos
26
25
  "scripts": {
27
26
  "yarn test": "jest",
28
- "yarn install": "yarn install",
29
- "rails assets:precompile": "yarn install; rails assets:precompile",
27
+ "yarn install": "yarn install --check-files",
28
+ "rails assets:precompile": "yarn install --check-files; rails assets:precompile",
30
29
  "rails server": "rails server",
31
30
  "webpack-dev-server": "./bin/webpack-dev-server"
32
31
  },
data/lib/install/spv.rb CHANGED
@@ -6,7 +6,6 @@ pack_tag = <<-eos
6
6
  <%= stylesheet_pack_tag 'application' %>
7
7
  eos
8
8
 
9
- # say "Added javascript_packs_tag and stylesheet_packs_tag into head"
10
9
  insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
11
10
  pack_tag,
12
11
  before: " </head>\n"
data/lib/install/test.rb CHANGED
@@ -24,12 +24,10 @@ scripts = <<-eos
24
24
  },
25
25
  eos
26
26
 
27
- say "Adding scripts and jest configuration to package.json"
28
27
  insert_into_file Rails.root.join("package.json").to_s,
29
28
  "#{scripts}",
30
29
  after: "\"private\": true,\n"
31
30
 
32
- say "Adding test presets to .babelrc"
33
31
  babelrc = <<-eos
34
32
  "test": {
35
33
  "presets": [
@@ -42,5 +40,4 @@ insert_into_file Rails.root.join(".babelrc").to_s,
42
40
  "#{babelrc}",
43
41
  before: " \"presets\": ["
44
42
 
45
- say "Adding @vue/test-util and other Jest dependencies"
46
43
  run "yarn add jest-serializer-vue vue-jest babel-jest --no-progress --silent"
data/lib/install/ui.rb CHANGED
@@ -1,4 +1 @@
1
- # say "Adding @vue/cli-service to make Vue-ui compatible"
2
- # run "yarn add @vue/cli-service --dev"
3
-
4
1
  run "yarn list @vue/cli-service --no-progress --silent"
@@ -1,4 +1,4 @@
1
1
  module Log
2
2
  MESSAGE = "Please send your pull request ~>
3
- http://github.com/ytbryan/vueonrails"
3
+ http://github.com/vueonrails/vueonrails"
4
4
  end
@@ -1,3 +1,3 @@
1
1
  module VueOnRails
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.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-10-22 00:00:00.000000000 Z
11
+ date: 2018-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,18 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
- description: Vue on Rails
41
+ description: Ruby on Rails with the power of Vue components
42
42
  email:
43
43
  - ytbryan@gmail.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - LICENSE.md
48
49
  - README.md
49
50
  - app/controllers/vue_controller.rb
50
51
  - app/helpers/syntax_helper.rb
51
52
  - app/views/vue/index.html.erb
52
53
  - config/routes.rb
54
+ - lib/generators/generator_templates/forms/index.vue.erb
53
55
  - lib/generators/generator_templates/packs/index.css
54
56
  - lib/generators/generator_templates/packs/index.js
55
57
  - lib/generators/generator_templates/packs/index.vue
@@ -57,10 +59,12 @@ files:
57
59
  - lib/generators/generator_templates/sfc/single-file-component.vue
58
60
  - lib/generators/generator_templates/tests/unit.test.js.erb
59
61
  - lib/generators/generator_templates/turbolinks/turbolinks-pack.js.erb
62
+ - lib/generators/options/child.rb
60
63
  - lib/generators/options/click.rb
61
64
  - lib/generators/options/form.rb
62
65
  - lib/generators/options/list.rb
63
66
  - lib/generators/options/modal.rb
67
+ - lib/generators/options/parent.rb
64
68
  - lib/generators/options/seperate.rb
65
69
  - lib/generators/options/single.rb
66
70
  - lib/generators/options/table.rb
@@ -84,28 +88,11 @@ files:
84
88
  - lib/vueonrails.rb
85
89
  - lib/vueonrails/post_message.rb
86
90
  - lib/vueonrails/version.rb
87
- - vendor/assets/javascripts/axios.js
88
- - vendor/assets/javascripts/axios.map
89
- - vendor/assets/javascripts/element-ui.js
90
- - vendor/assets/javascripts/vue-resource.js
91
- - vendor/assets/javascripts/vue-router.js
92
- - vendor/assets/javascripts/vue-router2.js
93
- - vendor/assets/javascripts/vue-validator.js
94
- - vendor/assets/javascripts/vue-validator2.js
95
- - vendor/assets/javascripts/vue-validator3.js
96
- - vendor/assets/javascripts/vue.js
97
- - vendor/assets/javascripts/vue.min.js
98
- - vendor/assets/javascripts/vue2.js
99
- - vendor/assets/javascripts/vue2.min.js
100
- - vendor/assets/javascripts/vueonrails.js
101
- - vendor/assets/javascripts/vuex.js
102
- - vendor/assets/javascripts/vuex2.js
103
- - vendor/assets/stylesheets/element-ui.css
104
- homepage: http://github.com/ytbryan/vueonrails
91
+ homepage: http://github.com/vueonrails/vueonrails
105
92
  licenses:
106
93
  - MIT
107
94
  metadata: {}
108
- post_install_message: "Please send your pull request ~> \n http://github.com/ytbryan/vueonrails"
95
+ post_install_message: "Please send your pull request ~> \n http://github.com/vueonrails/vueonrails"
109
96
  rdoc_options: []
110
97
  require_paths:
111
98
  - lib
@@ -124,5 +111,5 @@ rubyforge_project:
124
111
  rubygems_version: 2.7.6
125
112
  signing_key:
126
113
  specification_version: 4
127
- summary: Vue on Rails
114
+ summary: Vue on Rails http://vueonrails.com
128
115
  test_files: []