lib/integrity/installer.rb in integrity-0.1.9.3 vs lib/integrity/installer.rb in integrity-0.1.10

- old
+ new

@@ -3,10 +3,15 @@ module Integrity class Installer < Thor include FileUtils + def self.database_path + File.join(ENV["HOME"], ".integrity.sqlite3") + end + private_class_method :database_path + desc "install [PATH]", "Copy template files to PATH for desired deployement strategy (either Thin, Passenger or Heroku). Next, go there and edit them." method_options :passenger => :boolean, :thin => :boolean, @@ -34,26 +39,29 @@ require "integrity/migrations" Integrity.migrate_db end desc "launch [CONFIG]", - "Launch Integrity real quick." - method_options :config => :optional, :port => 4567 + "Launch Integrity real quick. Database is saved in #{database_path}." + method_options :config => :optional, :port => :optional def launch require "thin" require "do_sqlite3" - File.file?(options[:config].to_s) ? - Integrity.new(options[:config]) : Integrity.new - Integrity.config[:base_uri] = "http://0.0.0.0:#{options[:port]}" + port = options[:port] || 4567 - DataMapper.auto_migrate! + config = { :database_uri => "sqlite3://#{ENV["HOME"]}/.integrity.db", + :base_uri => "http://0.0.0.0:#{options[:port]}", + :export_directory => "/tmp/integrity-exports" } + config.merge!(YAML.load_file(options[:config])) if options[:config] - Thin::Server.start("0.0.0.0", options[:port], Integrity::App) + migrate_db(config) + + Thin::Server.start("0.0.0.0", port, Integrity::App) rescue LoadError => boom - missing_dependency = boom.message.split("--").last.lstrip - puts "Please install #{missing_dependency} to launch Integrity" + $stderr << "Make sure thin and do_sqlite3 are insatalled\n\n" + raise end private attr_reader :root @@ -98,11 +106,12 @@ <<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 + 3. Add heroku-given domain as :base_uri in integrity-config.rb + 4. git push heroku master + 5. heroku rake db:migrate EOF end def post_install_message <<EOF