class Hux::Generator

Public Instance Methods

install() click to toggle source
# File lib/hux/generator.rb, line 14
def install
  if hux_files_already_exist?
    puts "Hux files already installed, doing nothing."
  else
    install_files
    puts "Hux files installed to #{install_path}/base"
  end
end
remove() click to toggle source
# File lib/hux/generator.rb, line 35
def remove
  if hux_files_already_exist?
    remove_hux_directory
    puts "Hux was successfully removed."
  else
    puts "No existing Hux installation. Doing nothing."
  end
end
reset() click to toggle source
# File lib/hux/generator.rb, line 24
def reset
  if hux_files_already_exist?
    remove_hux_directory
    install_files
    puts "Hux files updated."
  else
    puts "No existing Hux installation. Doing nothing."
  end
end
version() click to toggle source
# File lib/hux/generator.rb, line 45
def version
  say "Hux #{Hux::VERSION}"
end

Private Instance Methods

all_stylesheets() click to toggle source
# File lib/hux/generator.rb, line 68
def all_stylesheets
  Dir["#{stylesheets_directory}/*"]
end
hux_files_already_exist?() click to toggle source
# File lib/hux/generator.rb, line 51
def hux_files_already_exist?
  File.directory?(install_path)
end
install_files() click to toggle source
# File lib/hux/generator.rb, line 59
def install_files
  FileUtils.mkdir_p(install_path)
  FileUtils.cp_r(all_stylesheets, install_path)
end
install_path() click to toggle source
# File lib/hux/generator.rb, line 55
def install_path
  Pathname.new(options[:path].to_s).join('base')
end
remove_hux_directory() click to toggle source
# File lib/hux/generator.rb, line 64
def remove_hux_directory
  FileUtils.rm_rf("base")
end
stylesheets_directory() click to toggle source
# File lib/hux/generator.rb, line 72
def stylesheets_directory
  File.join(top_level_directory, "core")
end
top_level_directory() click to toggle source
# File lib/hux/generator.rb, line 76
def top_level_directory
  File.dirname(File.dirname(File.dirname(__FILE__)))
end