Module: Edge
- Defined in:
- lib/edge/console.rb,
lib/edge/message.rb,
lib/edge/version.rb,
lib/edge_framework.rb
Defined Under Namespace
Classes: Console
Constant Summary collapse
- AVAILABLE_TEMPLATE =
" Currently these are the available templates:\n html - Static HTML template\n php - Standard PHP template\n".lines.each {|line| line.strip!}
- SYNTAX_CREATE =
" \#{ @console.cyan('edge create <project_type> <project_name>') }\n \#{ @console.yellow('project_type') }\n \#{ AVAILABLE_TEMPLATE }\n \#{ @console.magenta('project_name') }\n (Optional) If not specified, current directory will be used\n".lines.each {|line| line.strip!}
- HELP =
"--------------------------------------------------------\nWelcome to Edge Framework v-\#{ Edge::VERSION } (\#{ Edge::CODENAME })\n--------------------------------------------------------\nCREATE TEMPLATE\n\#{ SYNTAX_CREATE }\n".lines.each {|line| line.strip!}
- CREATE_WRONG_SYNTAX =
"\nWRONG SYNTAX\nThe correct syntax is:\n\#{ SYNTAX_CREATE }\n".lines.each {|line| line.strip!}
- VERSION =
"0.6.1"- CODENAME =
"Barathrum"
Class Method Summary collapse
-
.command_too_long ⇒ Object
Generic message for command that is too long.
-
.create(type, name) ⇒ Object
Create project.
-
.help ⇒ Object
Help message.
-
.not_found(command) ⇒ Object
Error message for non-existance command.
Class Method Details
.command_too_long ⇒ Object
Generic message for command that is too long
76 77 78 |
# File 'lib/edge_framework.rb', line 76 def self.command_too_long() puts "Passed parameters exceed limits. If your #{ @console.cyan("project_name") } contains space, enclose it with double-quote (\")" end |
.create(type, name) ⇒ Object
Create project
14 15 16 17 18 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 |
# File 'lib/edge_framework.rb', line 14 def self.create(type, name) # If name is specified, create new directory if name puts "Creating #{ @console.magenta(name) } as #{ @console.yellow(type) } project..." FileUtils.mkdir( name ) destination = File.join( Dir.pwd, name ) # If type is specified, create new file in the current directory elsif type puts "Generating #{ @console.yellow(type) } template..." destination = Dir.pwd else puts CREATE_WRONG_SYNTAX return false end # Gem home directory home = File.( "..", File.dirname(__FILE__) ) template = File.join( home, "template" ) # Copy template files template_type = File.join( template, type ) # If directory doesn't exist if !File.directory?(template_type) puts "#{ @console.red('Template not found') }" puts AVAILABLE_TEMPLATE return false end FileUtils.cp_r( Dir["#{template_type}/*"], destination ) # Copy base files base = File.join( template, "base" ) FileUtils.cp_r( Dir["#{base}/*"], destination ) # 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 ) if name.nil? compass_command = "#{ @console.cyan('compass watch') }" elsif name.match(/\s/) compass_command = "#{ @console.cyan('compass watch') } #{ @console.cyan('"'+name+'"') }" elsif name compass_command = "#{ @console.cyan('compass watch') } #{ @console.cyan(name) }" else compass_command = "#{ @console.cyan('compass watch') }" end puts "#{ @console.green('Done!') } For starter, you can run #{ @console.cyan(compass_command) } to generate the CSS" end |
.help ⇒ Object
Help message
66 67 68 |
# File 'lib/edge_framework.rb', line 66 def self.help() puts HELP end |
.not_found(command) ⇒ Object
Error message for non-existance command
71 72 73 |
# File 'lib/edge_framework.rb', line 71 def self.not_found(command) puts "The command '#{command}' does not exist. Run #{ @console.cyan("edge -h") } for available commands." end |