lib/tasks/setup.rake in vuejs-1.1.0.beta3 vs lib/tasks/setup.rake in vuejs-1.1.0.beta4

- old
+ new

@@ -11,34 +11,57 @@ end exec "#{base_path} LOCATION=#{template}" end - desc "install other plugins" - task :others do - $stdout.puts "#{`yarn add @vue/cli-plugin-babel - @vue/cli-plugin-eslint - @vue/cli-plugin-unit-jest - @vue/cli-plugin-pwa - vue-i18n`}" - end - desc "install turbolinks" task :turbolinks do - $stdout.puts "#{`yarn add vue-turbolinks`}" + template = File.expand_path("../install/turbolinks.rb", __dir__) + base_path = + if Rails::VERSION::MAJOR >= 5 + "#{RbConfig.ruby} #{bin_path}/rails app:template" + else + "#{RbConfig.ruby} #{bin_path}/rake rails:template" + end + + exec "#{base_path} LOCATION=#{template}" end - desc "install vue-test-utils" + desc "setup Vue on Rails to be ready for Jest tests" task :test do - $stdout.puts "#{`yarn add @vue/test-utils`}" + template = File.expand_path("../install/test.rb", __dir__) + base_path = + if Rails::VERSION::MAJOR >= 5 + "#{RbConfig.ruby} #{bin_path}/rails app:template" + else + "#{RbConfig.ruby} #{bin_path}/rake rails:template" + end + + exec "#{base_path} LOCATION=#{template}" end - desc "install Vuex" + desc "install Vuex and vuex-rails-plugins" task :vuex do - $stdout.puts "#{`yarn add vuex`}" + template = File.expand_path("../install/vuex.rb", __dir__) + base_path = + if Rails::VERSION::MAJOR >= 5 + "#{RbConfig.ruby} #{bin_path}/rails app:template" + else + "#{RbConfig.ruby} #{bin_path}/rake rails:template" + end + + exec "#{base_path} LOCATION=#{template}" end desc "make this Rails project Vue-ui compatible" task :ui do - $stdout.puts "yarn add @vue/cli-service --dev" + template = File.expand_path("../install/ui.rb", __dir__) + base_path = + if Rails::VERSION::MAJOR >= 5 + "#{RbConfig.ruby} #{bin_path}/rails app:template" + else + "#{RbConfig.ruby} #{bin_path}/rake rails:template" + end + + exec "#{base_path} LOCATION=#{template}" end end