Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

script/bootstrap

  • Loading branch information...
commit 4cb8d0a28c74ac496da59e121ab8e08d0e2abcb8 1 parent e2a6560
@mislav authored
Showing with 29 additions and 3 deletions.
  1. +10 −2 Rakefile
  2. +1 −1  app.rb
  3. +18 −0 script/bootstrap
View
12 Rakefile
@@ -4,7 +4,7 @@ task :environment do
require_relative 'app'
end
-task :bootstrap => [:'db:rebuild', :import_index, :import_popular]
+task :bootstrap => [:'db:bootstrap', :import_index, :import_popular]
namespace :db do
task :rebuild => :environment do
@@ -14,6 +14,14 @@ namespace :db do
task :migrate => :environment do
DataMapper.auto_upgrade!
end
+
+ task :bootstrap => :environment do
+ if RfcEntry.storage_exists?
+ Rake::Task[:'db:migrate'].invoke
+ else
+ Rake::Task[:'db:rebuild'].invoke
+ end
+ end
end
task :import_index => ['tmp/rfc-index.xml', :environment] do |task|
@@ -21,7 +29,7 @@ task :import_index => ['tmp/rfc-index.xml', :environment] do |task|
require 'active_support/core_ext/object/try'
require 'date'
- DataMapper.logger.set_log($stderr, :debug)
+ DataMapper.logger.set_log($stderr, :warn)
index = Nokogiri File.open(task.prerequisites.first)
num = 0
View
2  app.rb
@@ -33,7 +33,7 @@
require 'dm-core'
configure :development do
- DataMapper::Logger.new($stderr, :debug)
+ DataMapper::Logger.new($stderr, :info)
end
configure do
View
18 script/bootstrap
@@ -0,0 +1,18 @@
+#!/bin/bash
+set -e
+
+if [[ -n $DATABASE_URL ]]; then
+ dbname=$(basename "$DATABASE_URL")
+else
+ dbname=rfc
+fi
+
+git submodule update --init
+
+bundle install --without production
+
+# check if database exists; otherwise create it
+psql -tAl | grep -E "^$dbname\|" >/dev/null || \
+ createdb --no-password $dbname
+
+rake bootstrap
Please sign in to comment.
Something went wrong with that request. Please try again.