Sha256: a59840066c17af1d4c6fddeb40bdcdb0c86532266b13806353194748827dacee
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
#!/usr/bin/env ruby require_relative 'common' ver = ENV['RAILS_VERSION'] abort('RAILS_VERSION not found!') if ver.blank? versions = `gem list -r -a -e rails`.scan(/\b((\d+\.)+\d+)\b/).map { |m| m[0] } ver = versions.find { |v| v.start_with? ver } abort("Version #{ver} not found!") if ver.blank? run("gem install rails -v #{ver}") RAILS_NEW_SCRIPT = { '5' => { args: %w[ database=sqlite3 skip-yarn skip-git skip-keeps skip-sprockets skip-spring skip-listen skip-turbolinks skip-javascript skip-test skip-bundle ], keep_gems: /^\s*gem\s+['"](rails|puma|bootsnap)/, append: <<~RUBY gem 'sqlite3', '~> 1.3.10' RUBY }, } require 'pathname' require 'fileutils' scirpt = RAILS_NEW_SCRIPT[ver[0]] run "rails new test_vcr #{scirpt[:args].map { |a| "--#{a}" }.join(' ')}" FileUtils.chdir 'test_vcr' root = Pathname.new(FileUtils.pwd) gemfile = root.join('Gemfile').read.split("\n") .reject(&:empty?).reject { |s| s =~ /^\s*#/ } .reject { |s| s =~ /^\s*gem/ && s !~ scirpt[:keep_gems] } root.join('Gemfile').write("#{(gemfile + [scirpt[:append]]).join("\n")}\n") run 'bundle install' # rails new test_vcr --database=sqlite3 --skip-yarn --skip-git --skip-sprockets --skip-spring --skip-listen --skip-turbolinks --skip-javascript --skip-test --skip-bundle
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vue_cli-rails-0.1.6 | lib/helpers/scripts/install_rails.rb |