class Preseason::Recipe::Database

Public Instance Methods

prepare() click to toggle source
# File lib/preseason/recipe/database.rb, line 7
def prepare
  config.database.sqlite? ? prepare_sqlite : prepare_default
  append_to_file '.gitignore', "\n#{db_yml}"
end
recipe_root() click to toggle source
# File lib/preseason/recipe/database.rb, line 2
def recipe_root
  # this is only used in the sqlite context
  "#{template_path}/sqlite"
end

Private Instance Methods

db_yml() click to toggle source
# File lib/preseason/recipe/database.rb, line 25
def db_yml
  'config/database.yml'
end
prepare_default() click to toggle source
# File lib/preseason/recipe/database.rb, line 13
def prepare_default
  remove_file db_yml
  create_file "#{db_yml}.dist", parse_template("database/#{db_yml}.dist.erb")
  create_file db_yml, parse_template("database/#{db_yml}.erb")
end
prepare_sqlite() click to toggle source
# File lib/preseason/recipe/database.rb, line 19
def prepare_sqlite
  mirror_file db_yml
  copy_file "#{recipe_root}/#{db_yml}", "#{db_yml}.dist"
  append_to_file '.gitignore', db_yml
end