Sha256: cc670bbe6aafdc0068a1e3f2453de6f9fd083def59ba162bf7b8ba236e700c7b

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 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

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

2 entries across 2 versions & 1 rubygems

Version Path
screw_server-0.1.10 bin/screw_server
screw_server-0.1.9 bin/screw_server