Sha256: 77ca84a7540b24590603b54ab1e2641dd833e30ebffca22c4e3db95c6beeaa0c
Contents?: true
Size: 1.65 KB
Versions: 2
Compression:
Stored size: 1.65 KB
Contents
module Padrino module Generators module Components module Orms module ActiverecordGen AR = (<<-AR).gsub(/^ {10}/, '') module ActiveRecordInitializer def self.registered(app) app.configure :development do ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => 'your_dev_db_here' ) end app.configure :production do ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => 'your_production_db_here' ) end app.configure :test do ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => 'your_test_db_here' ) end end end AR RAKE = (<<-RAKE).gsub(/^ {10}/, '') require 'sinatra/base' require 'active_record' namespace :db do desc "Migrate the database" task(:migrate) do load 'config/boot.rb' ActiveRecord::Base.logger = Logger.new(STDOUT) ActiveRecord::Migration.verbose = true ActiveRecord::Migrator.migrate("db/migrate") end end RAKE def setup_orm require_dependencies 'activerecord' create_file("config/initializers/active_record.rb", AR) create_file("Rakefile", RAKE) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
padrino-gen-0.1.1 | lib/generators/components/orms/activerecord_gen.rb |
padrino-gen-0.1.0 | lib/generators/components/orms/activerecord_gen.rb |