Module: Edge

Defined in:
lib/edge/engine.rb,
lib/edge/message.rb,
lib/edge/version.rb,
lib/edge_framework.rb,
lib/edge/install_generator.rb

Defined Under Namespace

Modules: Generators Classes: Engine, Message

Constant Summary collapse

VERSION =
"1.3.5"
CODENAME =
"Furion"

Class Method Summary collapse

Class Method Details

.command_too_longObject

Generic message for command that is too long



78
79
80
# 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) ⇒ Object

Create project



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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

.helpObject

Help message



68
69
70
# File 'lib/edge_framework.rb', line 68

def self.help()
  puts message(:help)
end

.message(key) ⇒ Object



14
15
16
# File 'lib/edge_framework.rb', line 14

def self.message(key)
  return @message.get_message(key);
end

.not_found(command) ⇒ Object

Error message for non-existance command



73
74
75
# 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