Sha256: a63d4f1233bec114a2aafd4c1d0f471a9f8fbeb4153b48608fda2ef2aaa68d15
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'fastfood/version' require "fileutils" require 'thor' module FastFood class Generator < Thor map ['-v', '--version'] => :version desc 'install', 'Install FastFood into your project' method_options :path => :string, :force => :boolean def install if fastfood_files_already_exist? && !options[:force] puts "FastFood files already installed, doing nothing." else install_files puts "FastFood files installed to #{install_path}/" end end desc 'update', 'Update FastFood' method_options :path => :string def update if fastfood_files_already_exist? remove_fastfood_directory install_files puts "FastFood files updated." else puts "No existing fastfood installation. Doing nothing." end end desc 'version', 'Show FastFood version' def version say "FastFood #{FastFood::VERSION}" end private def fastfood_files_already_exist? install_path.exist? end def install_path @install_path ||= if options[:path] Pathname.new(File.join(options[:path], 'fastfood')) else Pathname.new('fastfood') end end def install_files make_install_directory copy_in_scss_files end def remove_fastfood_directory FileUtils.rm_rf("fastfood") 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fastfood-0.1.0 | lib/fastfood/generator.rb |