# encoding: utf-8 module ClassyAssets class CLI < Thor include Thor::Actions source_root File.expand_path('../../../bin/.files', __FILE__) desc "init", "Initializes ClassyAssets for your application" method_option :root, default: File.expand_path('../../../', __FILE__), desc: 'Path to the root of your application' def init puts "Initializing ClassyAssets for your application..." empty_directory(File.join(options[:root], 'assets')) empty_directory(File.join(options[:root], 'assets', 'images')) empty_directory(File.join(options[:root], 'assets', 'javascripts')) empty_directory(File.join(options[:root], 'assets', 'stylesheets')) puts "Done!" end desc "install_hook", "Installs the optional git pre-commit hook, which will automatically precompile changed assets when you commit changed assets" method_option :root, default: File.expand_path('../../../', __FILE__), desc: 'Path to the root of your application' def install_hook puts "Installing ClassyAssets git pre-commit hook..." copy_file 'pre-commit.hook', File.join(options[:root], '.git', 'hooks', 'pre-commit') end end end