exe/solargraph-rails-init in solargraph-rails-init-0.2.1 vs exe/solargraph-rails-init in solargraph-rails-init-0.2.2

- old
+ new

@@ -6,10 +6,16 @@ SOLARGRAPH_YML = ".solargraph.yml" DEFINITIONS_RB = "config/definitions.rb" def run parse_options + + unless is_rails? + puts "Must run from a Rails app folder. Aborting." + exit 1 + end + exec_cmd "gem install solargraph", title: "Installing Solargraph gem..." exec_cmd "solargraph download-core", title: "Installing documentation. This might take a while..." exec_cmd "yard gems" exec_cmd "solargraph bundle" @@ -26,9 +32,13 @@ end install_sgr if install_sgr? puts "Done!" +end + +def is_rails? + File.exist?(File.join(Dir.pwd, './bin/rails')) end def exec_cmd(cmd, title: nil) puts title if title out = `#{cmd}`