lib/generators/vue/vue_generator.rb in vuejs-1.1.0.beta7 vs lib/generators/vue/vue_generator.rb in vuejs-1.1.0.beta8

- old
+ new

@@ -1,11 +1,10 @@ class VueGenerator < Rails::Generators::NamedBase source_root File.expand_path('../../generator_templates', __FILE__) argument :name, type: :string, default: :index class_option :seperate, type: :boolean, default: false - class_option :single, type: :boolean, default: false class_option :vuex, type: :boolean, default: false class_option :turbolinks, type: :boolean, default: false class_option :test, type: :boolean, default: false class_option 'form-for', type: :boolean, default: false @@ -35,62 +34,59 @@ private def add_tests_to_component name template "tests/unit.test.js.erb", "#{TESTS_PATH}/#{name}.test.js" - - # say "adding vue-test-utils and other Jest dependencies" - # run "yarn add @vue/test-utils jest-serializer-vue vue-jest babel-jest" end def add_helpers_to_component name - run "yarn add vue-form-for" - insert_into_file "#{PACKS_PATH}/#{name}.js" , "import FormFor from 'vue-form-for'", after: "import Vue from 'vue'\n" insert_into_file "#{PACKS_PATH}/#{name}.js", "Vue.use(FormFor)\n", before: "document.addEventListener" + + run "yarn add vue-form-for" end def add_vuex_to_component name - run "yarn add vuex" insert_into_file "#{PACKS_PATH}/#{name}.js" , - "import Vuex from 'vuex'", + "import Vuex from 'vuex'\n", after: "import Vue from 'vue'\n" insert_into_file "#{PACKS_PATH}/#{name}.js", "Vue.use(Vuex)\n", before: "document.addEventListener" + run "yarn add vuex" end def create_component_with_seperate_concern_using name - say "Generated a Vue component with seperation of concern" + say "Generated a vue component with seperation of concern" @code = "<%= vue \"#{name}\" %>" template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js" template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue" template "packs/index.js", "#{PARTS_PATH}/#{name}/#{name}.js" copy_file "packs/index.css", "#{PARTS_PATH}/#{name}/#{name}.css" end def create_single_file_component_using name - say "Generated a Single File Component" + say "Generated a single file component" @code = "<%= vue \"#{name}\" %>" template "packs/pack.js.erb", "#{PACKS_PATH}/#{name}.js" template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue" end def create_turbolink_single_file_component_using name - say "Adding Turbolinks to a Single File Component" + say "Adding turbolinks to a single file component" @code = "<%= vue \"#{name}\" %>" template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js" template "sfc/single-file-component.vue", "#{PARTS_PATH}/#{name}.vue" end def create_turbolink_component_with_seperate_concern_using name - say "Adding turbolinks to Vue component with seperate of concerns" + say "Adding turbolinks to vue component with seperate of concerns" @code = "<%= vue \"#{name}\" %>" template "turbolinks/turbolinks-pack.js.erb", "#{PACKS_PATH}/#{name}.js" template "packs/index.vue", "#{PARTS_PATH}/#{name}/#{name}.vue" template "packs/index.js", "#{PARTS_PATH}/#{name}/#{name}.js" copy_file "packs/index.css", "#{PARTS_PATH}/#{name}/#{name}.css"