class Grund::Generator

Constants

BUNDLE_NAME
PACKAGE_NAME

Public Class Methods

new(args) click to toggle source
# File lib/grund/generator.rb, line 9
def initialize(args)
  @url = 'https://github.com/johanbrook/grund.css/zipball/master'
  @command = args.first
end

Public Instance Methods

clean() click to toggle source
# File lib/grund/generator.rb, line 52
def clean
  system "rm -rf #{PACKAGE_NAME}"
  system "rm -rf johanbrook-grund*"
end
help() click to toggle source
# File lib/grund/generator.rb, line 24
    def help
      puts <<-h

  GRUND. A SCSS foundation for Compass. 
  I use this as a starting point for new projects.

  Usage:

    \x1B[0;1m grund install \x1B[0m

  Download the latest Grund files and put them in the current directory.

    \x1B[0;1m compass compile \x1B[0m

  Compiles the master file (master.scss) into CSS with Compass (http://compass-style.org).

  Explore the file structure and make it your own. Pure SCSS stuff like 
  variables and mixins should be put in '_settings.scss' and 'lib/_mixins.scss'.

  Main site styles go in '_main.scss' and in other imported files.
  Includes Necolas' Normalize reset (https://github.com/necolas/normalize.css)

  --
  Project:  https://github.com/johanbrook/grund
  Author:   Johan Brook (http://johanbrook.com)
  h
    end
run() click to toggle source
# File lib/grund/generator.rb, line 14
def run
  if @command == "install"  
    get_zip @url
  elsif @command == "-v" or @command == "--version"
    puts "Grund #{Grund::VERSION}"
  else
    help
  end
end

Private Instance Methods

directory_already_exist?() click to toggle source
# File lib/grund/generator.rb, line 67
def directory_already_exist?
  File.directory?(BUNDLE_NAME)
end
get_zip(url) click to toggle source
# File lib/grund/generator.rb, line 71
def get_zip(url)
  
  open(PACKAGE_NAME, 'wb') do |fo|
    status "Downloading grund package from #{url}..."
    fo.print open(url).read
    status "Unpackaging ..."
    system "unzip -o -q #{PACKAGE_NAME}"

    system "cp -R johanbrook-grund*/ ."
    log "Done!\n\x1B[0mBegin with checking out the stylesheet structure and set things up.\nType 'grund help' for more info.\n"
    clean
  end
  
end
log(msg) click to toggle source
# File lib/grund/generator.rb, line 63
def log(msg)
  puts "\x1B[0;32m#{msg}\x1B[0m"
end
status(msg) click to toggle source
# File lib/grund/generator.rb, line 59
def status(msg)
  puts "\x1B[0;1m#{msg}\x1B[0m"
end