Skip to content

Commit

Permalink
Gemfile script asserts that RAILS_ENV or development env are defined,…
Browse files Browse the repository at this point in the history
… which is false in a production only environment. Enhance error message and protect against nil values
  • Loading branch information
ook committed May 6, 2012
1 parent e9c893f commit b63ec3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ unless File.exists?(dbfile)
raise "You need to configure config/database.yml first"
else
conf = YAML.load(File.read(dbfile))
adapter = conf[env]['adapter']
raise "You need define an adapter in your database.yml" if adapter == '' || adapter.nil?
environment = conf[env]
adapter = environment['adapter'] if environment
raise "You need define an adapter in your database.yml or set your RAILS_ENV variable" if adapter == '' || adapter.nil?
case adapter
when 'sqlite3'
gem 'sqlite3'
Expand Down

0 comments on commit b63ec3a

Please sign in to comment.