Sha256: 3399726fd62faef06a64c0625e365f14875f05d7e494d4781e042cf1865c5eb5

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

#!/usr/bin/env ruby

require 'kiosk'
require 'json'

def gem_dir
  ServiceKiosk::Kiosk.gem_dir
end

def config
  file = File.read('Kioskfile.json')
  JSON.parse file
end

case ARGV[0] 
when 'plaza:init', 'init'
  boxes = `vagrant box list`
  if(/precise32/m.match boxes)
    puts 'plaza already initialized'
  else
    system 'vagrant init precise32 http://files.vagrantup.com/precise32.box'
  end

when 'plaza:up', 'up'
  system 'vagrant up'

when 'plaza:down', 'down'
  system 'vagrant destroy'

when 'plaza:ssh', 'ssh'
  system 'vagrant ssh'

when 'mall:open', 'open'
  exec "vagrant ssh -c 'cd /vagrant/mall; /usr/local/bin/rake kiosk:start'"

when 'mall:close', 'close'
  exec "vagrant ssh -c 'cd /vagrant/mall; /usr/local/bin/rake kiosk:stop'"

when 'mall:log', 'log'
  exec "vagrant ssh -c 'cd /vagrant/mall; /usr/local/bin/rake kiosk:log'"

when 'kiosk:run', 'run'
  env = config['kiosks'][ARGV[1]]['env']
  mall = gem_dir + "/lib/mall.rb"
  dir = Dir.pwd + '/kiosks/' + ARGV[1]
  puts "env: #{env.inspect}"
  puts "mall: #{mall}"
  puts "dir: #{dir}"
  jruby = `which jruby`.strip
  exec(env, "#{jruby} #{mall}", :chdir => dir, :unsetenv_others => true)

else
  puts "Usage: $0 {plaza:init|plaza:up|plaza:down|plaza:ssh|mall:open|mall:close|mall:log}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
service_kiosk-0.5.1 bin/kiosk
service_kiosk-0.5.0 bin/kiosk