Class: Integrity::Installer

Inherits:
Thor
  • Object
show all
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
# File 'lib/integrity/installer.rb', line 14

def install(path)
  @root = Pathname(path).expand_path

  if options[:heroku]
    cp_r Pathname(__FILE__).join("../../../config/heroku"), root
    puts post_heroku_install_message
  else
    create_dir_structure
    copy_template_files
    edit_template_files
    puts post_install_message
  end
end

#launchObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/integrity/installer.rb', line 41

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]}"

  DataMapper.auto_migrate!

  Thin::Server.start("0.0.0.0", options[:port], Integrity::App)
rescue LoadError => boom
  missing_dependency = boom.message.split("--").last.lstrip
  puts "Please install #{missing_dependency} to launch Integrity"
end

#migrate_db(config) ⇒ Object



31
32
33
34
35
36
# File 'lib/integrity/installer.rb', line 31

def migrate_db(config)
  Integrity.new(config)

  require "integrity/migrations"
  Integrity.migrate_db
end