Sha256: 2aed956c5b4350c5ff39a30c72b2134beec3a3b503cefcd7e3e137332497d6a5

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
if !ENV['BACKGROUND'].nil?
  if RUBY_VERSION < "1.9"
    exit if fork
    Process.setsid
    exit if fork
    Dir.chdir "/"
    STDIN.reopen "/dev/null"
    STDOUT.reopen "/dev/null", "a"
    STDERR.reopen "/dev/null", "a"
  else
    Process.daemon
  end
end

Dir.chdir(File.join("/home", "ubuntu"))

require 'drb/drb'
require 'drb/acl'
require 'cucumber-chef'
require 'cucumber/chef/helpers'

class FrontObject
  attr_accessor :servers

  include Cucumber::Chef
  include Cucumber::Chef::Helpers

  def initialize
    knife_rb = Cucumber::Chef.locate(:file, ".chef", "knife.rb")
    Chef::Config.from_file(knife_rb)

    $logger = ZTK::Logger.new(Cucumber::Chef.log_file)
    Cucumber::Chef.is_rc? and ($logger.level = ZTK::Logger::DEBUG)

    puts("cc-server v#{Cucumber::Chef::VERSION}")
  end

  def shutdown
    DRb.stop_service
  end

end

hostname = %x( hostname -f ).chomp

list = %w( deny all allow 127.0.0.1 )
ARGV[0] and (list += [ 'allow', ARGV[0] ])
acl = ACL.new(list)

# This will break everything:
# $SAFE = 1

DRb.start_service("druby://:8787", FrontObject.new)
DRb.thread.join

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cucumber-chef-2.0.7 bin/cc-server
cucumber-chef-2.0.6 bin/cc-server