Sha256: eb61f58779809249b0b5d7d61a924237975566468525d6b8e4ea9e0c0ce40347
Contents?: true
Size: 1.84 KB
Versions: 240
Compression:
Stored size: 1.84 KB
Contents
# This code is borrowed shamelessly from Bourbon require 'smock/version' require "fileutils" require 'thor' module Smock class Generator < Thor map ['-v', '--version'] => :versions desc 'install', 'Install Smock into your project' method_options :path => :string, :force => :boolean def install if smock_files_already_exist? && !options[:force] puts "Smock files already installed, doing nothing." else install_files puts "Smock files installed to #{install_path}/" end end desc 'update', 'Update Smock' method_options :path => :string def update if smock_files_already_exist? remove_smock_directory install_files puts "Smock files updated." else puts "No existing Smock installation. Doing nothing." end end desc 'version', 'Show Smock version' def version say "Smock #{Smock::VERSION}" end private def smock_files_already_exist? install_path.exist? end def install_path @install_path ||= if options[:path] Pathname.new(File.join(options[:path], 'smock')) else Pathname.new('smock') end end def install_files make_install_directory copy_in_scss_files end def remove_smock_directory FileUtils.rm_rf("smock") end def make_install_directory FileUtils.mkdir_p(install_path) end def copy_in_scss_files FileUtils.cp_r(all_stylesheets, install_path) end def all_stylesheets Dir["#{stylesheets_directory}/*"] end def stylesheets_directory File.join(top_level_directory, "app", "assets", "stylesheets") end def top_level_directory File.dirname(File.dirname(File.dirname(__FILE__))) end end end
Version data entries
240 entries across 240 versions & 1 rubygems