#!/usr/bin/env ruby require 'colorize' require 'optparse' require 'nephos-server/bin-helpers' GEMFILE = < err puts "Warning: git repository not initialized" rescue => err puts "Error: #{err.message}" end exec("bundle install") end end def self.main opt case opt[0] when "c", "controller" if opt[1].to_s.match(/[\w\-\.]+/) Controller.generate!(opt[1]) else puts "error" end when "a", "appli", "application" if not opt[1].to_s.empty? Application.create_application_dir(opt[1]) puts "Application #{opt[1]} created" Application.move_to_application_dir(opt[1]) end Application.initialize! puts "Application initialized" when "r", "route" Route.generate!(*(opt[1..4])) else puts "\"#{opt[0]}\" not recognized has a command" end end end end begin opt = OptionParser.new do |opts| opts.banner = "Usage: nephos-generator [controller name] [appli [name]]" opts.on("--rm") do $remove = true end opts.on("--debug") do $debug = true end end.parse! Nephos::Generator.main(opt) rescue => err puts "Error:".red + " #{err.message}" puts err.backtrace end