class Vueport::InstallGenerator
Public Instance Methods
add_to_gitignore()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 12 def add_to_gitignore append_to_file '.gitignore' do <<-EOF.strip_heredoc # Added by vueport /node_modules /public/webpack /npm-debug.log /renderer/node_modules /renderer/npm-debug.log /renderer/bundle.server.js EOF end end
add_webpack_rails()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 7 def add_webpack_rails gem 'webpack-rails' gem 'foreman' end
copy_config_files()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 36 def copy_config_files directory 'vueport', 'config/vueport' end
copy_eslint()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 31 def copy_eslint copy_file '.eslintrc.js' copy_file '.eslintignore' end
copy_package_json()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 27 def copy_package_json copy_file 'package.json' end
copy_renderer_files()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 40 def copy_renderer_files directory 'renderer' end
create_setup_files()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 49 def create_setup_files directory 'webpack' copy_file '.babelrc' empty_directory 'app/components' end
run_bundle_install()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 65 def run_bundle_install run 'bundle install' if yes?("Would you like me to run 'bundle install' for you? [y/N]") end
run_npm_install()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 55 def run_npm_install if yarn? && yes?("Would you like me to run 'yarn' for you? [y/N]") run 'yarn' run 'cd renderer && yarn' elsif !yarn? && yes?("Would you like me to run 'npm install' for you? [y/N]") run 'npm i' run 'cd renderer && npm i' end end
update_procfile()
click to toggle source
# File lib/generators/vueport/install_generator.rb, line 44 def update_procfile copy_file 'Procfile.dev' copy_file 'Procfile' end
whats_next()
click to toggle source
rubocop:disable Metrics/MethodLength
# File lib/generators/vueport/install_generator.rb, line 70 def whats_next say '' say 'All done!', :green say '' say "I've added a few things here and there to set you up using Vue in your Rails app." say "Now you're already to create your first Vue component in app/components." say '' say 'To run the webpack-dev-server and rails server:' say 'foreman start -f Procfile.dev', :yellow say '' say 'For more info, see the README.md for this gem at:' say 'https://github.com/samtgarson/vueport', :blue say '' say 'Thanks for using Vueport!' end
Private Instance Methods
yarn?()
click to toggle source
rubocop:enable Metrics/MethodLength
# File lib/generators/vueport/install_generator.rb, line 93 def yarn? @yarn ||= `yarn -V`.present? end