#!/usr/bin/env ruby $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) require 'rubygems' require 'optparse' require 'subduino' require 'faye' OptionParser.new { |op| op.on('-e env') { |val| set :environment, val.to_sym } op.on('-s server') { |val| set :server, val } op.on('-p port') { |val| set :port, val.to_i } }.parse!(ARGV.dup) # set :run, true if ARGV.empty? client = Faye::Client.new('http://localhost:8000/faye') EM.run do Subduino.start do |read| client.publish('/stats', 'data' => read) puts "[IO] #{read}" end end end require "subduino/scaffold/generator" dir = ARGV[0] puts "Subduing dir #{dir}" `mkdir #{dir}` unless File.exists?(dir) Subduino::Generator.copy_files(dir)