Class: Specjour::RsyncDaemon
- Inherits:
-
Object
- Object
- Specjour::RsyncDaemon
- Defined in:
- lib/specjour/rsync_daemon.rb
Instance Attribute Summary collapse
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#project_path ⇒ Object
readonly
Returns the value of attribute project_path.
Instance Method Summary collapse
- #config_file ⇒ Object
-
#initialize(project_path, project_name) ⇒ RsyncDaemon
constructor
A new instance of RsyncDaemon.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(project_path, project_name) ⇒ RsyncDaemon
Returns a new instance of RsyncDaemon.
6 7 8 9 |
# File 'lib/specjour/rsync_daemon.rb', line 6 def initialize(project_path, project_name) @project_path = project_path @project_name = project_name end |
Instance Attribute Details
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name.
5 6 7 |
# File 'lib/specjour/rsync_daemon.rb', line 5 def project_name @project_name end |
#project_path ⇒ Object (readonly)
Returns the value of attribute project_path.
5 6 7 |
# File 'lib/specjour/rsync_daemon.rb', line 5 def project_path @project_path end |
Instance Method Details
#config_file ⇒ Object
11 12 13 |
# File 'lib/specjour/rsync_daemon.rb', line 11 def config_file File.join("/tmp", "rsyncd.conf") end |
#start ⇒ Object
15 16 17 18 19 |
# File 'lib/specjour/rsync_daemon.rb', line 15 def start write_config system("rsync", "--daemon", "--config=#{config_file}", "--port=8989") at_exit { puts 'shutting down rsync'; stop } end |
#stop ⇒ Object
21 22 23 24 25 26 |
# File 'lib/specjour/rsync_daemon.rb', line 21 def stop if pid Process.kill("TERM", pid) FileUtils.rm(pid_file) end end |