Class: Masquito::Installer
- Inherits:
-
Object
- Object
- Masquito::Installer
- Defined in:
- lib/masquito/installer.rb
Constant Summary collapse
- SERVICE_NAME =
'com.evrone.masquito'
- SERVICE_PLIST =
"#{SERVICE_NAME}.plist"
- SERVICE_TEMPLATE_PATH =
File.join(GEM_PATH, 'config', "#{SERVICE_PLIST}.erb")
Instance Method Summary collapse
-
#initialize ⇒ Installer
constructor
A new instance of Installer.
- #install ⇒ Object
- #remove ⇒ Object
Constructor Details
Instance Method Details
#install ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/masquito/installer.rb', line 41 def install switch_privileges { FileUtils.mkdir_p(CONFIG_PATH) } plist = ERB.new File.read(SERVICE_TEMPLATE_PATH) template = plist.result(binding) filename = File.join(Dir.tmpdir, SERVICE_PLIST) File.open(filename, 'w') { |f| f.write(template) } @lunchy.install([filename]) @lunchy.start([SERVICE_NAME]) File.unlink(filename) puts "Daemon was successfully installed." end |
#remove ⇒ Object
58 59 60 61 62 |
# File 'lib/masquito/installer.rb', line 58 def remove @lunchy.stop([SERVICE_NAME]) @lunchy.uninstall([SERVICE_PLIST]) puts "You can remove #{CONFIG_PATH} if you don't need these settings" end |