Sha256: 4b6611e421ce24e581650e0da6b26e9e3ae799eede78974d0b8c4f0b5669b336

Contents?: true

Size: 1.74 KB

Versions: 4

Compression:

Stored size: 1.74 KB

Contents

# encoding: utf-8
# $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

  argvs = ARGV.to_s

  SIX_HOST = if argvs[/--bindi?n?g?=([0-9\.]+)/] || argvs[/-b *([0-9\.]+)/]
    $1
  else
    ARGV << "--binding=#{DEFAULT_IP}"
    DEFAULT_IP
  end

  SIX_PORT = if argvs[/--port=([0-9]+)/] || argvs[/-p *([0-9]+)/]
    $1
  else
    ARGV << "--port=#{DEFAULT_PORT}"
    DEFAULT_PORT
  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_relative '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

# Check for required data updates?

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

# Kick off Rails
load File.join(File.dirname(__FILE__), 'script/server')	

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
six-updater-web-0.14.7 lib/six-updater-web/init.rb
six-updater-web-0.14.6 lib/six-updater-web/init.rb
six-updater-web-0.14.5 lib/six-updater-web/init.rb
six-updater-web-0.14.4 lib/six-updater-web/init.rb