solargraph-rails
install solargraph rails support
Used 62 times
J
Julian Rubisch
Usage
Run this command in your Rails app directory in the terminal:
rails app:template LOCATION="https://railsbytes.com/script/zr4skp"
Template Source
Review the code before running this template on your machine.
require "open-uri"
def ask_with_default(prompt, default)
value = ask("#{prompt} (default: #{default})")
value.present? ? value : default
end
Bundler.with_unbundled_env do
run "solargraph bundle"
run "solargraph config"
end
definitions_destination = ask_with_default("Where do you want to store the definitions file?", "config/definitions.rb")
URI.open "https://gist.githubusercontent.com/castwide/28b349566a223dfb439a337aea29713e/raw/715473535f11cf3eeb9216d64d01feac2ea37ac0/rails.rb" do |gist|
File.open(Rails.root.join(definitions_destination), "w") do |file|
file.write(gist.read)
end
end
if yes?("Do you want to install the solargraph-rails gem?")
gem_group :development do
gem "solargraph-rails", "0.3.0"
end
gsub_file ".solargraph.yml", %r{^plugins: \[\]\n}, "plugins:\n - solargraph-rails\n"
Bundler.with_unbundled_env do
run "bundle install"
end
end