Module: Hyhyhy
- Defined in:
- lib/hyhyhy.rb,
lib/hyhyhy/config.rb,
lib/hyhyhy/frames.rb,
lib/hyhyhy/logger.rb,
lib/hyhyhy/parser.rb,
lib/hyhyhy/version.rb
Defined Under Namespace
Modules: Config, Frames, Logger, Parser
Constant Summary collapse
- VERSION =
"1.0.0"
- SUMMARY =
%q{Pure & Professional presentations}
- DESCRIPTION =
%q{A tool for creating nice looking HTML5 presentations.}
Class Method Summary collapse
- .build(args, options) ⇒ Object
- .initialize ⇒ Object
- .new(args, options) ⇒ Object
- .serve(args, options) ⇒ Object
Class Method Details
.build(args, options) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/hyhyhy.rb', line 54 def self.build(args, ) if .source == './' && .destination == './_build' Logger.spit("The current folder will be generated into ./_build", :output) elsif .source == './' && .destination != './_build' Logger.spit("The current folder will be generated into " + .destination, :output) else .source != './' Logger.spit("The " + .source + " folder will be generated into " + .destination, :output) end if .watch == true Logger.spit(", watched for changes, and regenerated automatically.", :echo) end Logger.ahoy() # To inform you about what we do... Frames.save(.source, .destination) if .serve == true Thread.new() do self.serve(args, ) end end if .watch == true listener = Listen.to(.source, :ignore => /_build/) do |modified, added, removed| Logger.spit("Regeneration.... #{modified} #{added} #{removed}", :output) Logger.ahoy() Frames.save(.source, .destination) end listener.start sleep end end |
.initialize ⇒ Object
20 21 22 |
# File 'lib/hyhyhy.rb', line 20 def self.initialize trap('INT') { Process.exit!(true) } end |
.new(args, options) ⇒ Object
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 |
# File 'lib/hyhyhy.rb', line 24 def self.new(args, ) if .title == nil .title = Logger.hear("Title: ") end if .description == nil .description = Logger.hear("Description: ") end if . == nil . = Logger.hear("Author: ") end if args[0] == nil args[0] = './' + .title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') end FileUtils.copy_entry File.dirname(__FILE__) + '/hyhyhy/structure', args[0] Config.load(args[0] + '/.hyhyhy') Config['title'] = .title Config['description'] = .description Config['author'] = . # Informing about the success! Logger.spit("Default structure will be generated into " + args[0], :output) Logger.ahoy() end |
.serve(args, options) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/hyhyhy.rb', line 89 def self.serve(args, ) if args[0] == nil || args[0] = '.' args[0] = './_build' end if .open == true Launchy.open(args[0] + '/index.html') end Logger.spit("Now browse to http://localhost:4000", :output) Logger.ahoy() server = WEBrick::HTTPServer.new :Port => 4000 server.mount "/", WEBrick::HTTPServlet::FileHandler, args[0] trap('INT') { server.stop; Process.exit!(true) } server.start end |