class StartMeUp::Generator

Public Instance Methods

install() click to toggle source
# File lib/startmeup/generator.rb, line 14
    def install
      if startmeup_files_already_exist?
        puts "StartMeUp files already installed, doing nothing."
      else
        install_files
        print <<-postinstall
*************************************************

STYLES
StartMeUp files installed to #{install_path}/base

DEBUG
_debug.haml partial added to views/shared
(add it after the body tag in your application layout)

*************************************************
        postinstall
      end
    end
remove() click to toggle source
# File lib/startmeup/generator.rb, line 46
def remove
  if startmeup_files_already_exist?
    remove_startmeup_directory
    puts "StartMeUp was successfully removed."
  else
    puts "No existing StartMeUp installation. Doing nothing."
  end
end
reset() click to toggle source
# File lib/startmeup/generator.rb, line 35
def reset
  if startmeup_files_already_exist?
    remove_startmeup_directory
    install_files
    puts "StartMeUp files updated."
  else
    puts "No existing StartMeUp installation. Doing nothing."
  end
end
version() click to toggle source
# File lib/startmeup/generator.rb, line 56
def version
  say "StartMeUp #{StartMeUp::VERSION}"
end

Private Instance Methods

all_stylesheets() click to toggle source
# File lib/startmeup/generator.rb, line 86
def all_stylesheets
  Dir["#{stylesheets_directory}/*"]
end
all_views() click to toggle source
# File lib/startmeup/generator.rb, line 90
def all_views
  Dir["#{views_directory}/*"]
end
install_files() click to toggle source
# File lib/startmeup/generator.rb, line 75
def install_files
  FileUtils.mkdir_p(install_path)
  FileUtils.mkdir_p(views_install_path)
  FileUtils.cp_r(all_stylesheets, install_path)
  FileUtils.cp_r(all_views, views_install_path)
end
install_path() click to toggle source
# File lib/startmeup/generator.rb, line 66
def install_path
  Pathname.new(options[:path].to_s).join('base')
end
remove_startmeup_directory() click to toggle source
# File lib/startmeup/generator.rb, line 82
def remove_startmeup_directory
  FileUtils.rm_rf("base")
end
startmeup_files_already_exist?() click to toggle source
# File lib/startmeup/generator.rb, line 62
def startmeup_files_already_exist?
  File.directory?(install_path)
end
stylesheets_directory() click to toggle source
# File lib/startmeup/generator.rb, line 94
def stylesheets_directory
  File.join(top_level_directory, "app", "assets", "stylesheets")
end
top_level_directory() click to toggle source
# File lib/startmeup/generator.rb, line 102
def top_level_directory
  File.dirname(File.dirname(File.dirname(__FILE__)))
end
views_directory() click to toggle source
# File lib/startmeup/generator.rb, line 98
def views_directory
  File.join(top_level_directory, "app", "views")
end
views_install_path() click to toggle source
# File lib/startmeup/generator.rb, line 70
def views_install_path
  pn = Pathname.new(options[:path].to_s).join('base')
  pn.parent.parent.parent + 'views'
end