Skip to content

Instantly share code, notes, and snippets.

@jbarnette
Created December 21, 2009 17:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jbarnette/261102 to your computer and use it in GitHub Desktop.
Save jbarnette/261102 to your computer and use it in GitHub Desktop.
bin_path "vendor/bundled/bin"
bundle_path "vendor/bundled"
disable_system_gems
gem "aasm", "= 2.1.1" # stateful models
gem "acts_as_reportable" # CSV downloads
gem "flacinfo-rb", "= 0.4.0" # read/write FLAC metadata
gem "haml" # ugh
gem "intercession", "= 2.0.0" # session as model
gem "pg", "= 0.8.0" # our database!
gem "rails", "= 2.3.4" # duh
gem "right_aws", "= 1.10.0" # talking to S3, EC2, etc
gem "ruby-mp3info", "= 0.6.13" # read/write MP3 metadata
gem "rubyzip", "= 0.9.1" # playlist archives
gem "ruport" # acts_as_reportable
gem "ruport-util" # acts_as_reportable
gem "sunspot_rails", "= 0.11.2" # searchin'
gem "websolr-rails", "= 2.3.2" # searchin' in the CLOUD
only :development, :test do
gem "deeby", "~> 1.0"
gem "mocha", "~> 0.9.8"
gem "modelizer", "= 1.3.1"
end
def newb!; @newb = true end
def newb?; defined?(@newb) && @newb end
fundamentals = []
fundamentals << "config/database.yml"
fundamentals << "config/initializers/secrets.rb"
fundamentals << "vendor/bundled/environment.rb"
fundamentals << "newb"
Rake::Task["default"].prerequisites.replace fundamentals +
Rake::Task["default"].prerequisites
file "config/database.yml" do |t|
newb!
cp "config/database.yml.example", t.name
end
file "config/initializers/secrets.rb" do |t|
newb!
cp "config/initializers/secrets.rb.example", t.name
end
file "vendor/bundled/environment.rb" do |t|
newb! unless File.exist? task.name
unless /bundle/ =~ `gem help commands`
puts "This app needs Bundler! I'll try to install it for you."
sh "sudo gem install bundler"
end
sh "gem bundle -u"
end
task :newb do
next unless newb?
# We're all bundled now, so let's make sure we load the env.
load "config/preinitializer.rb"
%w(db:create:all db:reset db:test:clone_structure test).each do |t|
Rake::Task[t].invoke
end
puts IO.read("#{Rails.root}/doc/newb.txt")
exit 0
end
FINISHED. What I did for you:
* Installed gems for development and testing
* Generated RDoc in doc/app
* Made a default config/database.yml (PostgreSQL)
* Created your databases
* Reset them with db/schema.rb
* Ran the tests
What you should do next:
* Edit config/initializers/secrets.rb
* Look at doc/app/index.html
* Install Phusion Passenger
* Configure http://something.local to hit this app
* Rock like your life depends on it.
# Don't require the bundled environment if it's not there. This is for
# first-time dev environment runs and Heroku (which currently doesn't
# support Bundler).
if File.exist? "vendor/bundled/environment.rb"
require "vendor/bundled/environment"
end
require "config/boot"
require "rake"
require "rake/rdoctask"
require "rake/testtask"
require "tasks/rails"
# These requires pull in helpful Rake stuff from some dependent
# gems. We ignore LoadErrors so that bootstrapping a new development
# environment will work. Useless errors when you run 'rake' for the
# first time are lame.
%w(deeby sunspot/rails/tasks).each do |lib|
begin; require lib; rescue LoadError; end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment