class Doggystyle::Generator

Public Instance Methods

install() click to toggle source
# File lib/doggystyle/generator.rb, line 12
def install
  if doggystyle_files_already_exist? && !options[:force]
    puts "Doggystyle files already installed, doing nothing."
  else
    install_files
    puts "Doggystyle files installed to #{install_path}/"
  end
end
update() click to toggle source
# File lib/doggystyle/generator.rb, line 23
def update
  if doggystyle_files_already_exist?
    remove_doggystyle_directory
    install_files
    puts "Doggystyle files updated."
  else
    puts "No existing doggystyle installation. Doing nothing."
  end
end
version() click to toggle source
# File lib/doggystyle/generator.rb, line 34
def version
  say "Doggystyle #{Doggystyle::VERSION}"
end

Private Instance Methods

all_stylesheets() click to toggle source
# File lib/doggystyle/generator.rb, line 69
def all_stylesheets
  Dir["#{stylesheets_directory}/*"]
end
copy_in_scss_files() click to toggle source
# File lib/doggystyle/generator.rb, line 65
def copy_in_scss_files
  FileUtils.cp_r(all_stylesheets, install_path)
end
doggystyle_files_already_exist?() click to toggle source
# File lib/doggystyle/generator.rb, line 40
def doggystyle_files_already_exist?
  install_path.exist?
end
install_files() click to toggle source
# File lib/doggystyle/generator.rb, line 52
def install_files
  make_install_directory
  copy_in_scss_files
end
install_path() click to toggle source
# File lib/doggystyle/generator.rb, line 44
def install_path
  @install_path ||= if options[:path]
      Pathname.new(File.join(options[:path], "doggystyle"))
    else
      Pathname.new("doggystyle")
    end
end
make_install_directory() click to toggle source
# File lib/doggystyle/generator.rb, line 61
def make_install_directory
  FileUtils.mkdir_p(install_path)
end
remove_doggystyle_directory() click to toggle source
# File lib/doggystyle/generator.rb, line 57
def remove_doggystyle_directory
  FileUtils.rm_rf("doggystyle")
end
stylesheets_directory() click to toggle source
# File lib/doggystyle/generator.rb, line 73
def stylesheets_directory
  File.join(top_level_directory, "core")
end
top_level_directory() click to toggle source
# File lib/doggystyle/generator.rb, line 77
def top_level_directory
  File.dirname(File.dirname(File.dirname(__FILE__)))
end