Class: QuoraNotify::Install
- Inherits:
-
Object
- Object
- QuoraNotify::Install
- Defined in:
- lib/quora_notify/install.rb
Constant Summary collapse
- INSTALL_PATH =
File.join(ENV["HOME"], "Library", "LaunchAgents")
- LAUNCHD_PROCESS_NAME =
"com.joeycarmello.quora_notify"
- LAUNCHD_FILE_NAME =
"#{LAUNCHD_PROCESS_NAME}.plist"
- LAUNCHD_FILE_PATH =
File.join("lib", "quora_notify", "config", LAUNCHD_FILE_NAME)
Class Method Summary collapse
Class Method Details
.run! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/quora_notify/install.rb', line 11 def run! uninstall! # Used with the ERB binding gem_path = ENV['GEM_HOME'] ruby_path = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name']).sub(/.*\s.*/m, '"\&"') bin_path = `which quora_notify`.chomp template = ERB.new File.read(erb_path) File.write(install_file_path, template.result(binding)) start end |
.uninstall! ⇒ Object
24 25 26 27 28 29 |
# File 'lib/quora_notify/install.rb', line 24 def uninstall! if File.exists?(install_file_path) stop File.delete install_file_path end end |