Skip to content

Instantly share code, notes, and snippets.

@johndel
Created March 9, 2013 11:22
Show Gist options
  • Save johndel/5123892 to your computer and use it in GitHub Desktop.
Save johndel/5123892 to your computer and use it in GitHub Desktop.
Check if a project is a rails project.
def check_if_rails_project
abort = 0
unless File.exists?("Gemfile")
say "Missing Gemfile! Is this a rails project? If yes, something went really wrong, create your Gemfile and retry", :red
abort = 1
end
unless File.exists?(Rails.root.join("config/routes.rb"))
say "Missing routes.rb! Is this a rails project? If yes, something went really wrong, create your routes.rb and retry", :red
abort = 1
end
abort("Exit...") if abort == 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment