Sha256: 00f82b721b7af169c7eccc768f90db37eb299dbcb9d80339a03d51f76515f592

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

# $stdout, $stderr = # File or String in Memory (any cleanup measures?)
#require 'RubyGems'

module SixUpdaterWeb
  DEFAULT_PORT = 16333
  DEFAULT_IP = '127.0.0.1'

  OPEN_BROWSER = true
  SIX_PORT = if ARGV.to_s[/--port=([0-9]*)|-p/]
    $1
  else
    ARGV << "--port=#{DEFAULT_PORT}"
    DEFAULT_PORT
  end

  unless ARGV.to_s[/--binding=|-b/]
    # TODO: SIX_HOST?
    ARGV << "--binding=#{DEFAULT_IP}"
  end

  module_function
  def prepare_data_path
    # Arrange appdata!
    lf = File.join(DATA_PATH, "logs")
    FileUtils.mkdir_p(lf) unless File.directory?(lf)
    df = File.join(DATA_PATH, "db")
    FileUtils.mkdir_p(df) unless File.directory?(df)
    db = File.join(DATA_PATH, "db", "production.sqlite3")

    unless File.exists?(db)
      puts "Database Missing, creating and loading default schema and system data..."
      File.open(db, 'w') {|f| }
      Dir.chdir(File.dirname(__FILE__)) do
        system "ruby -rubygems \"_rake.rb\" db:schema:load sync:system"
      end
      #FileUtils.cp(File.join(BASE_PATH, "db", "production.sqlite3"), db)
    end
  end
end

require 'common'

puts ""
SixUpdaterWeb.print_info
puts "This window needs to remain running during GUI operations"
puts ""

#if defined?(SixUpdaterWeb::OLDLOCATION)
SixUpdaterWeb.prepare_data_path
#end

puts "Checking for required Database migrations..."
Dir.chdir(File.dirname(__FILE__)) do
  system "ruby -rubygems \"_rake.rb\" db:migrate" #  goldberg:migrate
end

puts ""
puts "Starting the web client..."

# Kick off Rails
load 'script/server'	

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
six-updater-web-0.13.2 lib/init.rb