#!/usr/bin/env ruby -v=false -W0 # encoding: utf-8 ## $VERBOSE ## -W0 NO Warnings nil ## -W1 Quiet false ## -W2 Verbose true BEGIN { $VERBOSE = nil } # resolve bin path, ignoring symlinks require "pathname" bin_file = Pathname.new(__FILE__).realpath $:.unshift File.expand_path("../../lib", bin_file) require 'simon' require 'rubygems' require 'commander/import' simon_controller = Simon.new svn_path = "https://samcreate@evolveit.svn.beanstalkapp.com/project_boilerplate/trunk/default" svn_path_heroku = "https://samcreate@evolveit.svn.beanstalkapp.com/project_boilerplate/trunk/heroku" program :version, '0.3.1' program :description, 'CLI tool for Simon, a simple MVC boilerplate' command :create do |c| c.syntax = 'my-simon create, [options]' c.summary = '' c.description = '' c.example 'description', 'command example' c.option '--some-switch', 'Some switch that does something' c.action do |args, options| # Do something or c.when_called My-simon::Commands::Create, simon_controller.check_4_update simon_controller.msg ">>> simon's requesting the boilerplate <<<" cmd = "svn export #{svn_path} app --quiet" Kernel::system(cmd) cmd = "cd ./app/" Kernel::system(cmd) simon_controller.msg "Boilerplate added" simon_controller.setup end end command :add do |c| c.syntax = 'my-simon add, [options]' c.summary = '' c.description = '' c.example 'description', 'command example' c.option '--some-switch', 'Some switch that does something' c.action do |args, options| # Do something or c.when_called My-simon::Commands::Add, simon_controller.check_4_update case args[0] when 'js' simon_controller.add_js args[1] when 'heroku' simon_controller.check_hidden cmd = "svn export #{svn_path_heroku} ./ --quiet --force" Kernel::system(cmd) simon_controller.msg "installing heroku files" when 'section' simon_controller.add_section when 'test' end end end command :setup do |c| c.syntax = 'my-simon setup, [options]' c.summary = '' c.description = '' c.example 'description', 'command example' c.option '--some-switch', 'Some switch that does something' c.action do |args, options| simon_controller.check_4_update simon_controller.setup end end command :help do |c| c.syntax = 'my-simon help [options]' c.summary = '' c.description = '' c.example 'description', 'command example' c.option '--some-switch', 'Some switch that does something' c.action do |args, options| simon_controller.check_4_update # Do something or c.when_called My-simon::Commands::Help end end