Sha256: 2f0e3503209d4318e343f6630059ebf3dbaf55bf6d4fa3871f020ee0d9f94d9f

Contents?: true

Size: 1.7 KB

Versions: 4

Compression:

Stored size: 1.7 KB

Contents

#!/usr/bin/env ruby

if Object.const_defined?("Bundler")
  puts "detected bundler environment from a different app!"
  puts "trying to shell out of bundler's environment..."

  ENV["RUBYOPT"] = ENV["RUBYOPT"].gsub("-rbundler/setup", "")
  Kernel.exec(__FILE__)
end

require File.expand_path("../../bundler_version", __FILE__)

require "rubygems"
gem "bundler", SCREW_SERVER_BUNDLER_VERSION
require "bundler"
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile.run", __FILE__)
Bundler.require
require 'yaml'

options = {
  :port => 3210,
  :spec_base_dir => "spec/javascripts",
  :code_base_dir => "public"
}

begin
  YAML.load_file('.screw_server.yml').each do |key, value|
    options[key.to_sym] = value
  end
rescue Errno::ENOENT
end

require 'optparse'

OptionParser.new do |opt|
  opt.on('--port -p ', Integer, 'port to start screw_server on (default is 3210)') do |port|
    options[:port] = port
  end
  opt.on(
    "--spec spec_base_dir",
    "directory that contains the javascript specs (default is ./#{options[:spec_base_dir]})"
  ) do |spec_base_dir|
    options[:spec_base_dir] = spec_base_dir
  end
  opt.on(
    '--code code_base_dir',
    "directory that contains the javascript code (default is ./#{options[:code_base_dir]})"
  ) do |code_base_dir|
    options[:code_base_dir] = code_base_dir
  end
end.parse!

puts "Starting Screw Server on port #{options[:port]} " +
    "with spec_base_dir '#{options[:spec_base_dir]}' and code_base_dir '#{options[:code_base_dir]}'"

ScrewServer::Base.spec_base_dir = File.expand_path(options[:spec_base_dir])
ScrewServer::Base.code_base_dir = File.expand_path(options[:code_base_dir])
ScrewServer::App.run!(:host => 'localhost', :port => options[:port], :environment => "production")

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
screw_server-0.1.14 bin/screw_server
screw_server-0.1.13 bin/screw_server
screw_server-0.1.12 bin/screw_server
screw_server-0.1.11 bin/screw_server