class Poxy::Generator

Public Class Methods

new(arguments) click to toggle source
# File lib/poxy/generator.rb, line 5
def initialize(arguments)
  @subcommand = arguments.first
end

Public Instance Methods

install() click to toggle source
# File lib/poxy/generator.rb, line 29
def install
  if poxy_files_already_exist?
    puts "Poxy files already installed, doing nothing."
  else
    install_files
    puts "Poxy files installed to poxy/"
  end
end
remove() click to toggle source
# File lib/poxy/generator.rb, line 38
def remove
  if poxy_files_already_exist?
    remove_poxy_directory
    puts "Poxy was successfully removed."
  else
    puts "No existing poxy installation. Doing nothing."
  end
end
run() click to toggle source
# File lib/poxy/generator.rb, line 9
def run
  if @subcommand == "install"
   install
  elsif @subcommand == "update"
    update
  elsif @subcommand == "remove"
    remove
  end
end
update() click to toggle source
# File lib/poxy/generator.rb, line 19
def update
  if poxy_files_already_exist?
    remove_poxy_directory
    install_files
    puts "Poxy files updated."
  else
    puts "No existing poxy installation. Doing nothing."
  end
end

Private Instance Methods

all_stylesheets() click to toggle source
# File lib/poxy/generator.rb, line 62
def all_stylesheets
  Dir["#{stylesheets_directory}/*"]
end
install_files() click to toggle source
# File lib/poxy/generator.rb, line 53
def install_files
  FileUtils.mkdir_p("poxy")
  FileUtils.cp_r(all_stylesheets, "poxy/")
end
poxy_files_already_exist?() click to toggle source
# File lib/poxy/generator.rb, line 49
def poxy_files_already_exist?
  File.directory?("poxy")
end
remove_poxy_directory() click to toggle source
# File lib/poxy/generator.rb, line 58
def remove_poxy_directory
  FileUtils.rm_rf("poxy")
end
stylesheets_directory() click to toggle source
# File lib/poxy/generator.rb, line 66
def stylesheets_directory
  File.join(top_level_directory, "app", "assets", "stylesheets")
end
top_level_directory() click to toggle source
# File lib/poxy/generator.rb, line 70
def top_level_directory
  File.dirname(File.dirname(File.dirname(__FILE__)))
end