%w{settings coffeescript compass-sass incloudr tools}.each {|lib| require "#{lib}.rb"} module Capucine class Main attr_accessor :settings attr_accessor :coffee attr_accessor :sass attr_accessor :incloudr attr_accessor :tools def initialize self.settings = Capucine::Settings.new self.tools = Capucine::Tools.new(self) self.sass = Capucine::CompassSass.new(self) self.coffee = Capucine::CoffeeScript.new(self) self.incloudr = Capucine::Incloudr.new(self) return self end def run_command(command) # command = ['c', '/path/to/file.yaml'] # command = ['c:sass', '/path/to/file.yaml'] # ... run = command[0].to_s.split(':') # Rake like capucine compile:sass config_or_name = command[1] # second part (the capucine.yaml file or template name/url) main = run[0] # c, w, compile, watch, new, init run.shift # all, coffee, sass or incloudr | sinatra, wordpress, etc ... scope = run # all, coffee, sass or incloudr | sinatra, wordpress, etc ... if %w{i init}.include?(main) self.tools.init(scope[0], config_or_name) elsif %w{n new}.include?(main) self.tools.new_project(scope[0], config_or_name) self.tools.compile elsif %w{c compile}.include?(main) self.settings.set_user_config_file(config_or_name) self.tools.compile(scope[0]) elsif %w{j js}.include?(main) self.settings.set_user_config_file(config_or_name) self.tools.js(scope, config_or_name) elsif %w{w watch}.include?(main) self.settings.set_user_config_file(config_or_name) self.tools.watch(scope[0]) elsif %w{cl clean}.include?(main) self.settings.set_user_config_file(config_or_name) self.tools.clean elsif %w{u update}.include?(main) self.settings.set_user_config_file(config_or_name) self.tools.update else self.help end return self end def help puts " Capucine on Github : http://github.com/damln/Capucine - Create cd my_current_project/ # Or capucine new my_app_name cd my_app_name/ - Initialize # Edit the capucine.yaml file. # Or : capucine init capucine init:django - Compile Once capucine compile capucine compile:sass capucine compile:coffee capucine compile:incloudr - Or Watch (Stop with Ctrl + C) capucine watch capucine watch:sass capucine watch:coffee - Search libs : capucine js:list capucine js:list:npm # (comming) capucine js:search jquery capucine js:search:npm jquery # (comming) " end end end