Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Fix for empty flag when creating launchd file
Browse files Browse the repository at this point in the history
  • Loading branch information
ttscoff committed Mar 18, 2014
1 parent 2fb2a64 commit 3e33993
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

if File.exists?(dir+"/slogger")
flags = ""
opts = []
puts "By default, Slogger runs once a day at 11:50PM."
puts "If your computer is not always on, you can have"
puts "Slogger fetch data back to the time of the last"
Expand All @@ -36,7 +36,12 @@
puts "Is your Mac routinely offline at 11:50PM?"
print "(Y/n)"
ans = gets.chomp
flags += "-s" unless ans.downcase == "n"
opts.push("-s") unless ans.downcase == "n"

flags = ""
opts.each {|flag|
flags += "\n\t\t<string>#{flag}</string>"
}

print "Setting up launchd... "
xml=<<LAUNCHCTLPLIST
Expand All @@ -49,8 +54,7 @@
<key>ProgramArguments</key>
<array>
<string>/usr/bin/ruby</string>
<string>#{dir}/slogger</string>
<string>#{flags}</string>
<string>#{dir}/slogger</string>#{flags}
</array>
<key>StartCalendarInterval</key>
<dict>
Expand Down

0 comments on commit 3e33993

Please sign in to comment.