vuejs 1.1.0.beta7 → 1.1.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36a4be4ce6736f60e78d6bdc3f349e56508b1b3d92b0f88ee96bed4a49519d19
4
- data.tar.gz: 7c9f2bae0f26f22a71f0d8a539fbf6c29bdc15f18f6d3b0cc93c59c547b6f9b2
3
+ metadata.gz: 59a21c8c271288914f0c2042c6e66d0f1dfcf3794ecb2cb1d3337d5ee52de411
4
+ data.tar.gz: 8bbd932072c3118d5a06d6bf048cff093d2f7bf502f5f99f8d2353a7c8f040fb
5
5
  SHA512:
6
- metadata.gz: 44c0deee485bcb941f7e6e6e3c50b59a1f38a23a6958f6f6c183e2b13665327e30426f820b98a9b47581f9cd08658c996109ca4dd411095871f71974b9a3e9eb
7
- data.tar.gz: 46502fab90c2567371e4c9c0658dcb72357a3ab6d6eb9960de4bde7b188e06894afbe9568b68fe8aa9d9522e0d9e8cb2af257d5f3864ce0721e02059508bf216
6
+ metadata.gz: a32bb28637f9d5a9b508a1da3c7f93da4298977c29714579d85f3557dc144284e96b8901c0f158b4921fa8e0fc1f6a7d10b3a6697d64d192a6bc18547a4c8d5c
7
+ data.tar.gz: 4518bd397157286fadbae01837a51734ed03e2c2648c7fa9060a63fab27b9934d347cc067c9cec1359c58a2e314c2d5d1bba72919e64827adb3758657f0e3857
@@ -15,13 +15,15 @@ module SyntaxHelper
15
15
  "<p>#{Vuejs::VERSION}</p>".html_safe
16
16
  end
17
17
 
18
- def vue_component(identifier, variable)
18
+ def vue_component(identifier, variable=nil)
19
19
  concat("<div id=\"#{identifier}\" refs=\"#{identifier}\">".html_safe)
20
20
  concat("</div>".html_safe)
21
- variable.each {|key, value|
22
- concat("<div id=\"vueonrails-#{key}\" data-#{key}=\"#{value}\">".html_safe)
23
- concat("</div>".html_safe)
24
- }; nil
21
+ if(variable != nil)
22
+ variable.each {|key, value|
23
+ concat("<div id=\"vueonrails-#{key}\" data-#{key}=\'#{value}\'>".html_safe)
24
+ concat("</div>".html_safe)
25
+ }; nil
26
+ end
25
27
  end
26
28
 
27
29
  def vue(identifier)
@@ -1,5 +1 @@
1
- <%= vue_component params[:name] %>
2
-
3
- <script>
4
- //poll
5
- </script>
1
+ <%= vue_component params[:name], nil %>
@@ -3,7 +3,6 @@ class VueGenerator < Rails::Generators::NamedBase
3
3
 
4
4
  argument :name, type: :string, default: :index
5
5
  class_option :seperate, type: :boolean, default: false
6
- class_option :single, type: :boolean, default: false
7
6
  class_option :vuex, type: :boolean, default: false
8
7
  class_option :turbolinks, type: :boolean, default: false
9
8
  class_option :test, type: :boolean, default: false
@@ -37,14 +36,9 @@ class VueGenerator < Rails::Generators::NamedBase
37
36
 
38
37
  def add_tests_to_component name
39
38
  template "tests/unit.test.js.erb", "#{TESTS_PATH}/#{name}.test.js"
40
-
41
- # say "adding vue-test-utils and other Jest dependencies"
42
- # run "yarn add @vue/test-utils jest-serializer-vue vue-jest babel-jest"
43
39
  end
44
40
 
45
41
  def add_helpers_to_component name
46
- run "yarn add vue-form-for"
47
-
48
42
  insert_into_file "#{PACKS_PATH}/#{name}.js" ,
49
43
  "import FormFor from 'vue-form-for'",
50
44
  after: "import Vue from 'vue'\n"
@@ -52,21 +46,23 @@ class VueGenerator < Rails::Generators::NamedBase
52
46
  insert_into_file "#{PACKS_PATH}/#{name}.js",
53
47
  "Vue.use(FormFor)\n",
54
48
  before: "document.addEventListener"
49
+
50
+ run "yarn add vue-form-for"
55
51
  end
56
52
 
57
53
  def add_vuex_to_component name
58
- run "yarn add vuex"
59
54
  insert_into_file "#{PACKS_PATH}/#{name}.js" ,
60
- "import Vuex from 'vuex'",
55
+ "import Vuex from 'vuex'\n",
61
56
  after: "import Vue from 'vue'\n"
62
57
 
63
58
  insert_into_file "#{PACKS_PATH}/#{name}.js",
64
59
  "Vue.use(Vuex)\n",
65
60
  before: "document.addEventListener"
61
+ run "yarn add vuex"
66
62
  end
67
63
 
68
64
  def create_component_with_seperate_concern_using name
69
- say "Generated a Vue component with seperation of concern"
65
+ say "Generated a vue component with seperation of concern"
70
66
  @code = "<%= vue \"#{name}\" %>"
71
67
  template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
72
68
  template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
@@ -75,21 +71,21 @@ class VueGenerator < Rails::Generators::NamedBase
75
71
  end
76
72
 
77
73
  def create_single_file_component_using name
78
- say "Generated a Single File Component"
74
+ say "Generated a single file component"
79
75
  @code = "<%= vue \"#{name}\" %>"
80
76
  template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
81
77
  template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
82
78
  end
83
79
 
84
80
  def create_turbolink_single_file_component_using name
85
- say "Adding Turbolinks to a Single File Component"
81
+ say "Adding turbolinks to a single file component"
86
82
  @code = "<%= vue \"#{name}\" %>"
87
83
  template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
88
84
  template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue"
89
85
  end
90
86
 
91
87
  def create_turbolink_component_with_seperate_concern_using name
92
- say "Adding turbolinks to Vue component with seperate of concerns"
88
+ say "Adding turbolinks to vue component with seperate of concerns"
93
89
  @code = "<%= vue \"#{name}\" %>"
94
90
  template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js"
95
91
  template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
@@ -6,11 +6,22 @@ insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
6
6
  "const alias = require('./alias/alias')\n",
7
7
  after: "require('@rails/webpacker')\n"
8
8
 
9
+ say "Adding javascript_packs_tag and stylesheet_packs_tag into head"
10
+ insert_into_file Rails.root.join("app/views/layouts/application.html.erb").to_s,
11
+ " <%= javascript_pack_tag 'application' %>
12
+ <%= stylesheet_pack_tag 'application' %>\n",
13
+ before: " </head>\n"
14
+
15
+ say "Adding hello vue example"
16
+ insert_into_file Rails.root.join("app/javascript/packs/application.js").to_s,
17
+ "\nrequire('./hello_vue')\n",
18
+ after: "console.log('Hello World from Webpacker')\n"
19
+
9
20
  insert_into_file Rails.root.join("config/webpack/environment.js").to_s,
10
21
  "environment.config.merge(alias)\n",
11
22
  before: "module.exports"
12
23
 
13
- scripts = <<-eos
24
+ scripts = <<-eos
14
25
  "scripts": {
15
26
  "rails server": "rails server",
16
27
  "webpack-dev-server": "./bin/webpack-dev-server",
@@ -1,7 +1,7 @@
1
1
  require 'open-uri'
2
2
 
3
3
  namespace :vue do
4
- desc "Install vue.js into assets pipeline"
4
+ desc "install vue.js into assets pipeline"
5
5
  task :assets do
6
6
  version = "2.5.16"
7
7
  source = "https://cdnjs.cloudflare.com/ajax/libs/vue/#{version}/vue.js"
@@ -1,13 +1,17 @@
1
1
  namespace :vue do
2
- desc "Provide information on Webpacker's environment"
2
+ desc "provide information on Webpacker's environment"
3
3
  task :info do
4
4
  $stdout.puts "Ruby: #{`ruby --version`}"
5
5
  $stdout.puts "Rails: #{Rails.version}"
6
- # $stdout.puts "Webpacker: #{Webpacker::VERSION}"
6
+ begin
7
+ $stdout.puts "Webpacker: #{Webpacker::VERSION}"
8
+ rescue NameError
9
+ $stdout.puts "Webpacker: Not installed"
10
+ end
7
11
  $stdout.puts "Node: #{`node --version`}"
8
12
  $stdout.puts "Yarn: #{`yarn --version`}"
9
13
  $stdout.puts "\n"
10
- $stdout.puts "#{`yarn list @rails/webpacker vue vue-loader vuex version -s`}"
14
+ $stdout.puts "#{`yarn list @rails/webpacker vue vue-loader vuex vue-template-compiler webpack-dev-server @vue/test-utils babel-jest jest jest-serializer-vue vue-jest`}"
11
15
  $stdout.puts "\n"
12
16
 
13
17
  $stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
@@ -1,6 +1,6 @@
1
1
  bin_path = ENV["BUNDLE_BIN"] || "./bin"
2
2
  namespace :vue do
3
- desc "Setup your Vue on Rails project"
3
+ desc "setup your vue on rails project"
4
4
  task :setup do
5
5
  template = File.expand_path("../install/setup.rb", __dir__)
6
6
  base_path =
@@ -26,7 +26,7 @@ namespace :vue do
26
26
  exec "#{base_path} LOCATION=#{template}"
27
27
  end
28
28
 
29
- desc "setup Vue on Rails to be ready for Jest tests"
29
+ desc "setup vue on rails to be ready for Jest tests"
30
30
  task :test do
31
31
  template = File.expand_path("../install/test.rb", __dir__)
32
32
  base_path =
@@ -39,7 +39,7 @@ namespace :vue do
39
39
  exec "#{base_path} LOCATION=#{template}"
40
40
  end
41
41
 
42
- desc "install Vuex and vuex-rails-plugins"
42
+ desc "install vuex and vuex-rails-plugins"
43
43
  task :vuex do
44
44
  template = File.expand_path("../install/vuex.rb", __dir__)
45
45
  base_path =
@@ -52,7 +52,7 @@ namespace :vue do
52
52
  exec "#{base_path} LOCATION=#{template}"
53
53
  end
54
54
 
55
- desc "make this Rails project Vue-ui compatible"
55
+ desc "make this rails project vue-ui compatible"
56
56
  task :ui do
57
57
  template = File.expand_path("../install/ui.rb", __dir__)
58
58
  base_path =
@@ -64,4 +64,9 @@ namespace :vue do
64
64
 
65
65
  exec "#{base_path} LOCATION=#{template}"
66
66
  end
67
+
68
+ desc "is this rail project specific-page vue enabled?"
69
+ task :spv do
70
+ puts "check if spv is enabled and setup?"
71
+ end
67
72
  end
@@ -1,3 +1,3 @@
1
1
  module Vuejs
2
- VERSION = "1.1.0.beta7"
2
+ VERSION = "1.1.0.beta8"
3
3
  end
@@ -1,5 +1,7 @@
1
1
  function erb(variable){
2
- return document.getElementById("vueonrails-" + variable).getAttribute("data-" + variable)
2
+ var something = document.getElementById("vueonrails-" + variable).getAttribute("data-" + variable)
3
+ console.log(something)
4
+ return something
3
5
  }
4
6
 
5
7
  function isView(pageClassString){
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vuejs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.beta7
4
+ version: 1.1.0.beta8
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-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -57,14 +57,11 @@ files:
57
57
  - lib/generators/generator_templates/packs/index.vue
58
58
  - lib/generators/generator_templates/packs/pack.js.erb
59
59
  - lib/generators/generator_templates/sfc/single-file-component.vue
60
- - lib/generators/generator_templates/tests/jest.package.json
61
- - lib/generators/generator_templates/tests/test.babelrc
62
60
  - lib/generators/generator_templates/tests/unit.test.js.erb
63
61
  - lib/generators/generator_templates/turbolinks/turbolinks-pack.js.erb
64
62
  - lib/generators/generator_templates/vuex/index.js
65
63
  - lib/generators/vue/USAGE
66
64
  - lib/generators/vue/vue_generator.rb
67
- - lib/install/component_with_seperate_concern.rb
68
65
  - lib/install/config/alias.js
69
66
  - lib/install/setup.rb
70
67
  - lib/install/test.rb
@@ -1,16 +0,0 @@
1
- "jest": {
2
- "moduleFileExtensions": [
3
- "js",
4
- "vue"
5
- ],
6
- "moduleNameMapper": {
7
- "^@/(.*)$": "<rootDir>/app/javascript/parts/$1",
8
- },
9
- "transform": {
10
- "^.+\\.js$": "<rootDir>/node_modules/babel-jest",
11
- ".*\\.(vue)$": "<rootDir>/node_modules/vue-jest"
12
- },
13
- "snapshotSerializers": [
14
- "<rootDir>/node_modules/jest-serializer-vue"
15
- ]
16
- }
@@ -1,7 +0,0 @@
1
- "env": {
2
- "test": {
3
- "presets": [
4
- ["env", { "targets": { "node": "current" }}]
5
- ]
6
- }
7
- }
@@ -1,4 +0,0 @@
1
- template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js"
2
- template "index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue"
3
- template "index.js", "#{PARTS_PATH}/#{name}/#{name}.js"
4
- copy_file "index.css", "#{PARTS_PATH}/#{name}/#{name}.css"