Module: TimeTap
- Extended by:
- TimeTap
- Included in:
- TimeTap
- Defined in:
- lib/time_tap.rb,
lib/time_tap/server.rb,
lib/time_tap/editors.rb,
lib/time_tap/project.rb,
lib/time_tap/watcher.rb
Defined Under Namespace
Modules: Editors, Watcher Classes: Project, Server
Constant Summary collapse
- RUBY19 =
Are we on 1.9? FIXME: this is wrong! :)
RUBY_VERSION.to_f >= 1.9
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#install! ⇒ Object
Add a plist for OSX’s launchd and have TimeTap launched automatically at login.
- #reload! ⇒ Object
- #start(options = {}) ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
15 16 17 |
# File 'lib/time_tap.rb', line 15 def config @config end |
Instance Method Details
#install! ⇒ Object
Add a plist for OSX’s launchd and have TimeTap launched automatically at login.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/time_tap.rb', line 74 def install! load_plist_info! ruby = config[:ruby] || "/usr/bin/ruby" include_dir = '-I'+File.('../../lib', __FILE__) launcher = File.('../../bin/timetap', __FILE__) puts "\nCreating launchd plist in\n #{plist_path}" File.open(plist_path, 'w') do |file| file << <<-PLIST <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.eliaesocietas.TimeTap</string> <key>Program</key> <string>#{ruby}</string> <key>ProgramArguments</key> <array> <string>#{ruby}</string> <string>#{include_dir}</string> <string>#{launcher}</string> <string>-f</string> </array> <key>OnDemand</key> <false/> <key>RunAtLoad</key> <true/> </dict> </plist> PLIST end end |
#reload! ⇒ Object
113 114 115 116 117 |
# File 'lib/time_tap.rb', line 113 def reload! load_plist_info! command = "launchctl unload #{plist_path}; launchctl load #{plist_path}" exec command end |
#start(options = {}) ⇒ Object
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 66 67 68 69 70 71 |
# File 'lib/time_tap.rb', line 36 def start = {} # REQUIREMENTS require 'yaml' require 'active_support' require 'time_tap/project' require 'time_tap/editors' require 'time_tap/watcher' require 'time_tap/server' # SIGNAL HANDLING Signal.trap("INT") {exit} Signal.trap("TERM") {exit} # WEB SERVER Thread.abort_on_exception = true @server = Thread.new { Signal.trap("INT") {exit} Signal.trap("TERM") {exit} Server.run! :host => 'localhost', :port => TimeTap.config[:port] exit } # WATCHER include Editors Watcher.keep_watching(TextMate) end |