module Edge

Constants

CODENAME
VERSION

Public Class Methods

command_too_long() click to toggle source

Generic message for command that is too long

# File lib/edge_framework.rb, line 78
def self.command_too_long()
  puts "Passed parameters exceed limits. If your #{ log('project_name') } contains space, enclose it with double-quote (\")"
end
create(type, name) click to toggle source

Create project

# File lib/edge_framework.rb, line 19
def self.create(type, name)
  # If name is specified, create new directory
  if name
    FileUtils.mkdir( name )
    destination = File.join( Dir.pwd, name )
  # If type is specified, create new file in the current directory
  elsif type
    puts "[create] \t #{type} template"
    destination = Dir.pwd
  else
    puts message(:create_wrong_syntax)
    return false
  end

  # gem home directory
  home = File.expand_path( "..", File.dirname(__FILE__) )
  template = File.join( home, "template" )

  # get the target type
  template_type = File.join( template, type )
  
  # If directory doesn't exist
  if !File.directory?(template_type)
    puts "[error] \t Template not found"
    puts message(:available_template)
    return false
  end
  FileUtils.cp_r( Dir["#{template_type}/*"], destination )

  # Copy base files, except if email
  unless type == "email"
    base = File.join( template, "base" )
    source = Dir.entries("#{base}/").reject { |e|
      e == '.' || e == '..'
    }.map{ |e|
      "#{base}/#{e}"
    }
    FileUtils.cp_r( source, destination )
  end

  # Copy javascript files
  # js_source = File.join( home, "assets", "js" )
  # js_destination = File.join( destination, "assets", "js")
  # FileUtils.cp_r( Dir["#{js_source}/*"], js_destination )

  puts "[success] \t Run `compass watch` to generate the CSS"
end
help() click to toggle source

Help message

# File lib/edge_framework.rb, line 68
def self.help()
  puts message(:help)
end
message(key) click to toggle source
# File lib/edge_framework.rb, line 14
def self.message(key)
  return @message.get_message(key);
end
not_found(command) click to toggle source

Error message for non-existance command

# File lib/edge_framework.rb, line 73
def self.not_found(command)
  puts "The command '#{command}' does not exist. Run #{ log("edge -h") } for help" 
end