Created
February 1, 2011 16:23
-
-
Save MarkNijhof/806090 to your computer and use it in GitHub Desktop.
mongodb_initializer.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include MongoMapper | |
host = ENV['MONGODB_HOST'] | |
port = ENV['MONGODB_PORT'] | |
database = ENV['MONGODB_DATABASE'] | |
username = ENV['MONGODB_USER_NAME'] | |
password = ENV['MONGODB_PASSWORD'] | |
MongoMapper.connection = Mongo::Connection.new(host || 'localhost', | |
port || 27017, | |
:logger => Rails.logger) | |
MongoMapper.database = database | |
if username && password | |
MongoMapper.database.authenticate(username, password) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :run => [:set_development_environment] do | |
sh "rails server" | |
end | |
task :test => [:set_test_environment] do | |
sh "bundle exec watchr" | |
end | |
task :set_development_environment do | |
ENV['RACK_ENV'] = 'production' | |
ENV['MONGODB_PORT'] = "27038" | |
ENV['MONGODB_HOST'] = "localhost" | |
ENV['MONGODB_DATABASE'] = "itjobs-development" | |
ENV['MONGODB_USER_NAME'] = "username" | |
ENV['MONGODB_PASSWORD'] = "password" | |
end | |
task :set_test_environment do | |
ENV['AUTOFEATURE'] = "true" | |
ENV['RSPEC'] = "true" | |
ENV['MONGODB_PORT'] = "27039" | |
ENV['MONGODB_HOST'] = "localhost" | |
ENV['MONGODB_DATABASE'] = "itjobs-test" | |
ENV['MONGODB_USER_NAME'] = "username" | |
ENV['MONGODB_PASSWORD'] = "password" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :set_heroku_production_environment do | |
sh "heroku config:add RACK_ENV=production --app your_app" | |
sh "heroku config:add MONGODB_PORT=27036 --app your_app" | |
sh "heroku config:add MONGODB_HOST=your_server --app your_app" | |
sh "heroku config:add MONGODB_DATABASE=itjobs-production --app your_app" | |
sh "heroku config:add MONGODB_USER_NAME=username --app your_app" | |
sh "heroku config:add MONGODB_PASSWORD=password --app your_app" | |
sh "heroku config:add BUNDLE_WITHOUT='test development' --app your_app" | |
sh "heroku config --app your_app" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require '../secret_stuff/project_name/rakefile' if FileTest.exists?('../secret_stuff/project_name/rakefile.rb') | |
task :run => [:set_development_environment] do | |
sh "rails server" | |
end | |
task :test => [:set_test_environment] do | |
sh "bundle exec watchr" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :set_development_environment do | |
ENV['RACK_ENV'] = 'production' | |
ENV['MONGODB_PORT'] = "27038" | |
ENV['MONGODB_HOST'] = "localhost" | |
ENV['MONGODB_DATABASE'] = "itjobs-development" | |
ENV['MONGODB_USER_NAME'] = "username" | |
ENV['MONGODB_PASSWORD'] = "password" | |
end | |
task :set_test_environment do | |
ENV['AUTOFEATURE'] = "true" | |
ENV['RSPEC'] = "true" | |
ENV['MONGODB_PORT'] = "27039" | |
ENV['MONGODB_HOST'] = "localhost" | |
ENV['MONGODB_DATABASE'] = "itjobs-test" | |
ENV['MONGODB_USER_NAME'] = "username" | |
ENV['MONGODB_PASSWORD'] = "password" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment