Sha256: c8d6cdf753d0bca738b039c8725aae866c00a8c5dc2d34e297431d496f4cd09c

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby

puts "Booting DangoServer..."
require File.dirname(__FILE__) + '/../config/boot'


# 環境によるコンフィグ読み込み
require "yaml"
env = ENV['RAILS_ENV'] || 'development'
config = YAML.load(open("dango/config/#{env}.yml", "rb"){|fh| fh.read})

# コマンドラインオプション取得とコンフィグの上書き
require 'getoptlong.rb'
opt_parser = GetoptLong.new

options_arr = ["dango"]
config["server"].each{|k, v| options_arr.push("server:#{k}") }
config["network"].each{|k, v| options_arr.push("network:#{k}") }
options_set_options = options_arr.uniq.collect{|o| ["--#{o}", GetoptLong::OPTIONAL_ARGUMENT]}
opt_parser.set_options(*options_set_options)

start_options = {}
opt_parser.each_option{|n,a| start_options[n] = a}

# rubygems
require 'rubygems'

# コマンドラインでdangoのバージョン指定があればそのバージョンを使う
if start_options['--dango'] && start_options['--dango'] != ""
  puts "loading dango version = #{start_options['--dango']}"
  gem 'dango', "= #{start_options['--dango']}"
end

require 'dango/script/dango_server'
ScriptDangoServer.new(config, start_options)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dango_generator-0.0.38 templates/script/dango_server
dango_generator-0.0.39 templates/script/dango_server
dango_generator-0.1.0 templates/script/dango_server