Class: Integrity::Installer
- Includes:
- FileUtils
- Defined in:
- lib/integrity/installer.rb
Instance Method Summary collapse
Instance Method Details
#install(path) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/integrity/installer.rb', line 14 def install(path) @root = Pathname(path). if [:heroku] cp_r Pathname(__FILE__).join("../../../config/heroku"), root puts <<EOF Your Integrity install is ready to be deployed onto Heroku. Next steps: 1. git init && git add . && git commit -am "Initial import" 2. heroku create 3. git push heroku master 4. heroku rake db:migrate EOF else create_dir_structure copy_template_files edit_template_files migrate_db(root.join("config.yml")) end end |
#launch ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/integrity/installer.rb', line 49 def launch require "thin" require "do_sqlite3" if File.file?([:config].to_s) Integrity.new([:config]) else DataMapper.setup(:default, "sqlite3::memory:") end DataMapper.auto_migrate! Thin::Server.start("0.0.0.0", [:port], Integrity::App) rescue LoadError => boom missing_dependency = boom..split("--").last.lstrip puts "Please install #{missing_dependency} to launch Integrity" end |
#migrate_db(config) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/integrity/installer.rb', line 39 def migrate_db(config) Integrity.new(config) require "integrity/migrations" Integrity.migrate_db end |