class Neat::Generator

Public Instance Methods

install() click to toggle source
# File lib/neat/generator.rb, line 11
def install
  if neat_files_already_exist? && !options[:force]
    puts "Neat files already installed, doing nothing."
  else
    install_files
    puts "Neat files installed to #{install_path}/"
  end
end
remove() click to toggle source
# File lib/neat/generator.rb, line 34
def remove
  if neat_files_already_exist?
    remove_neat_directory
    puts "Neat was successfully removed."
  else
    puts "No existing neat installation. Doing nothing."
  end
end
update() click to toggle source
# File lib/neat/generator.rb, line 22
def update
  if neat_files_already_exist?
    remove_neat_directory
    install_files
    puts "Neat files updated."
  else
    puts "No existing neat installation. Doing nothing."
  end
end
version() click to toggle source
# File lib/neat/generator.rb, line 44
def version
  say "Neat #{Neat::VERSION}"
end

Private Instance Methods

all_stylesheets() click to toggle source
# File lib/neat/generator.rb, line 79
def all_stylesheets
  Dir["#{stylesheets_directory}/*"]
end
copy_in_scss_files() click to toggle source
# File lib/neat/generator.rb, line 75
def copy_in_scss_files
  FileUtils.cp_r(all_stylesheets, install_path)
end
install_files() click to toggle source
# File lib/neat/generator.rb, line 66
def install_files
  make_install_directory
  copy_in_scss_files
end
install_path() click to toggle source
# File lib/neat/generator.rb, line 54
def install_path
  @install_path ||= if options[:path]
      Pathname.new(File.join(options[:path], "neat"))
    else
      Pathname.new("neat")
    end
end
make_install_directory() click to toggle source
# File lib/neat/generator.rb, line 71
def make_install_directory
  FileUtils.mkdir_p(install_path)
end
neat_files_already_exist?() click to toggle source
# File lib/neat/generator.rb, line 50
def neat_files_already_exist?
  install_path.exist?
end
remove_neat_directory() click to toggle source
# File lib/neat/generator.rb, line 62
def remove_neat_directory
  FileUtils.rm_rf(install_path)
end
stylesheets_directory() click to toggle source
# File lib/neat/generator.rb, line 83
def stylesheets_directory
  File.join(top_level_directory, "core")
end
top_level_directory() click to toggle source
# File lib/neat/generator.rb, line 87
def top_level_directory
  File.dirname(File.dirname(File.dirname(__FILE__)))
end