slackbuilds/system/betty/fix-slackware.patch

97 lines
2.9 KiB
Diff

diff -Naur betty-0.1.7a/lib/user.rb betty-0.1.7b/lib/user.rb
--- betty-0.1.7a/lib/user.rb 2014-09-21 20:23:43.000000000 -0600
+++ betty-0.1.7b/lib/user.rb 2017-03-12 16:20:56.147749890 -0600
@@ -1,19 +1,19 @@
-module User
+module User
def self.has_command?(command)
- response = `which #{ command }`
+ response = `which #{ command } 2> /dev/null`
response != ""
end
def self.interpret(command)
responses = []
-
+
if command.match(/^who\s+am\si$/i) || command.match(/^what\'?s?(\s+is)?\s+my\s(user)?name\??$/i)
responses << {
:command => "whoami",
:explanation => "Gets your system username."
}
end
-
+
if command.match(/^who\s+am\si$/i) || command.match(/^what\'?s?(\s+is)?\s+my\s((real|full|actual)\s+)?name\??$/i)
responses << {
:command => "finger $(whoami) | sed 's/.*: *//;q'",
@@ -23,7 +23,7 @@
if command.match(/^what\'?s?(\s+is)?(\s+my)?\s?(public|external|internal|private|local)?(\s+ip)?\s?(address)?\??$/i)
responses << {
- :command => "ifconfig",
+ :command => "/sbin/ifconfig",
:explanation => "Gets your internal ip address."
} if not command.match(/(public|external)/)
responses << {
@@ -31,7 +31,7 @@
:explanation => "Gets your external ip address."
} if not command.match(/(internal|private|local)/)
end
-
+
if command.match(/^who\'?s?(\s+else)?(\s+is)?\s(logged|signed|connected)\s+?in\??$/i)
responses << {
:command => "who | cut -f 1 -d ' ' | uniq",
@@ -45,11 +45,11 @@
:explanation => "Shows you your current directory."
}
end
-
-
+
+
if command.match(/^what\'?s?(?:\s+is)?(?:\s+(?:the|my))?\s+version(?:\s+of)?(\s[a-zA-Z\-_]+)+\??$/i)
program = $1.strip
-
+
command_to_use = ""
case program
when "go"
@@ -61,7 +61,7 @@
else
command_to_use = "#{ program } --version"
end
-
+
responses << {
:command => command_to_use,
:explanation => "Gets the version of #{ program }."
diff -Naur betty-0.1.7a/main.rb betty-0.1.7b/main.rb
--- betty-0.1.7a/main.rb 2014-09-21 20:23:43.000000000 -0600
+++ betty-0.1.7b/main.rb 2017-03-12 16:13:11.337693583 -0600
@@ -135,7 +135,7 @@
if Internet.connection_enable?
- if has_afplay || has_mpg123
+ if has_afplay
require 'open-uri'
text = sanitize(text)
speech_path = '/tmp/betty_speech.mp3'
@@ -156,12 +156,12 @@
end
else
if has_spd_say
- system("spd-say -t female2 -m some -r 5 -p -25 -s #{text}")
+ system("spd-say -t female2 -m some -r 5 -p -25 -s \"#{text}\"")
end
end
else
if has_spd_say
- system("spd-say -t female2 -m some -r 5 -p -25 -s #{text}")
+ system("spd-say -t female2 -m some -r 5 -p -25 -s \"#{text}\"")
end
end
end