Module: Cuba::Bin

Extended by:
Bin
Included in:
Bin
Defined in:
lib/cuba/bin/daemon.rb,
lib/cuba/bin.rb

Defined Under Namespace

Classes: Daemon

Constant Summary collapse

VERSION =
'0.3.0'

Instance Method Summary collapse

Instance Method Details

#argvObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/cuba/bin.rb', line 33

def argv
  @args ||= begin
    ARGV.shift
    ARGV
  end

  @args.each_with_index do |arg, i|
    if arg[/\s/]
      @args[i] = "\"#{arg}\""
    else
      @args[i] = arg
    end
  end

  @args
end

#deployObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cuba/bin.rb', line 15

def deploy
  if ENV['CUBA_BIN_DEPLOY_PATH']
    require ENV['CUBA_BIN_DEPLOY_PATH']
  else
    %w(config/deploy deploy).each do |file|
      path = Dir.pwd + "/#{file}.rb"

      if File.file? path
        break require path
      end
    end
  end

  if defined? Deploy
    Deploy.new.run
  end
end

#serverObject



11
12
13
# File 'lib/cuba/bin.rb', line 11

def server
  Daemon.new.run
end