Module: XRefreshServer

Defined in:
lib/xrefresh-server.rb,
lib/xrefresh-server/client.rb,
lib/xrefresh-server/server.rb,
lib/xrefresh-server/monitor.rb

Defined Under Namespace

Classes: Client, Monitor, Server

Constant Summary collapse

VERSION =
File.read(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'VERSION'))
AGENT =
"OSX xrefresh-server"
CONFIG_FILE =
".xrefresh-server.yml"
XREFRESH_MESSAGE_SEPARATOR =
"---XREFRESH-MESSAGE---"

Class Method Summary collapse

Class Method Details

.die(s) ⇒ Object



24
25
26
27
# File 'lib/xrefresh-server.rb', line 24

def self.die(s)
    $stderr.puts s
    exit 1
end

.generate_config(path) ⇒ Object



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
# File 'lib/xrefresh-server.rb', line 29

def self.generate_config(path)
    puts "Generating config in #{path}"
    File.open(path, "w") do |file|
        file.puts <<CONFIG\
# here specify list of paths to monitor
paths:
  - #{File.expand_path('~')} # by default watch user's home directory
# - /you/may/add/here/some/other/path
# - /you/may/add/here/some/another/path

# you can various filters (ruby regexp pattern)
# every file is split to dir and file part (for example /Users/mick/proj/coolapp and some_file.rb)
#   both include filters must be satisfied
#   both exclude filters must not be satisfied
# empty value means "apply no filtering"
dir_include:
dir_exclude: ^#{File.expand_path('~')}/Library|/\\.(svn|framework|app|pbproj|pbxproj|xcode(proj)?|bundle)/
file_include:
file_exclude: ^(CVS|SCCS|vssver.?.scc|\\.(cvsignore|git|svn|DS_Store)|_svn|Thumbs\\.db)$|~$|^(\\.(?!htaccess)[^/]*|\\.(tmproj|o|pyc)|svn-commit(\\.[2-9])?\\.tmp)$ # merged TextMate and Netbeans patterns

# xpert settings
host: #{GServer::DEFAULT_HOST}
port: 41258 # known port for clients to connect 
max_connections: 4 # max client connections
debug: false # run in debug mode?
audit: false # audit server activity
defer_time: 0.5 # aggregation time for events
sleep_time: 0.1 # don't hung cpu in main loop
CONFIG
    end
end