mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2025-12-06 06:01:46 +00:00
Many more Rubocop-inspired code improvements
This commit is contained in:
@@ -105,12 +105,20 @@ module Console
|
||||
|
||||
# status output
|
||||
def echo_status(status)
|
||||
echoln (status) ? markup_style('OK', text: :green) : markup_style('FAIL', text: :red)
|
||||
if status
|
||||
echoln markup_style('OK', text: :green)
|
||||
else
|
||||
echoln markup_style('FAIL', text: :red)
|
||||
end
|
||||
end
|
||||
|
||||
# completion output
|
||||
def echo_done(status)
|
||||
echoln (status) ? markup_style('done', text: :green) : markup_style('error', text: :red)
|
||||
if status
|
||||
echoln markup_style('done', text: :green)
|
||||
else
|
||||
echoln markup_style('error', text: :red)
|
||||
end
|
||||
end
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@@ -240,8 +240,6 @@ module RTP
|
||||
yield ".".gsub(/[\/\\]/, "/").gsub(/[\/\\]$/, "") + "/"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def self.getSaveFileName(fileName)
|
||||
File.join(getSaveFolder, fileName)
|
||||
end
|
||||
@@ -260,15 +258,15 @@ end
|
||||
|
||||
|
||||
module FileTest
|
||||
Image_ext = ['.png', '.gif'] # '.jpg', '.jpeg', '.bmp',
|
||||
Audio_ext = ['.mid', '.midi', '.ogg', '.wav', '.wma'] # '.mp3'
|
||||
IMAGE_EXTENSIONS = ['.png', '.gif'] # '.jpg', '.jpeg', '.bmp',
|
||||
AUDIO_EXTENSIONS = ['.mid', '.midi', '.ogg', '.wav', '.wma'] # '.mp3'
|
||||
|
||||
def self.audio_exist?(filename)
|
||||
return RTP.exists?(filename, Audio_ext)
|
||||
return RTP.exists?(filename, AUDIO_EXTENSIONS)
|
||||
end
|
||||
|
||||
def self.image_exist?(filename)
|
||||
return RTP.exists?(filename, Image_ext)
|
||||
return RTP.exists?(filename, IMAGE_EXTENSIONS)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -485,8 +483,6 @@ class StringInput
|
||||
@pos += 1 if @pos == @string.size
|
||||
str
|
||||
end
|
||||
|
||||
def read_all; read(); end
|
||||
|
||||
alias read_all read
|
||||
alias sysread read
|
||||
end
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
def pbPostData(url, postdata, filename = nil, depth = 0)
|
||||
if url[/^http:\/\/([^\/]+)(.*)$/]
|
||||
host = $1
|
||||
path = $2
|
||||
path = "/" if path.length == 0
|
||||
# path = $2
|
||||
# path = "/" if path.length == 0
|
||||
userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14"
|
||||
body = postdata.map { |key, value|
|
||||
keyString = key.to_s
|
||||
|
||||
@@ -254,7 +254,7 @@ def pbGetText(infile)
|
||||
else
|
||||
intlhash = OrderedHash.new
|
||||
itemlength = 2
|
||||
if section.length % 2 != 0
|
||||
if section.length.odd?
|
||||
raise _INTL("Section {1} has an odd number of entries (section was recognized as a hash because its first line is not a number)", name)
|
||||
end
|
||||
end
|
||||
@@ -320,7 +320,7 @@ class OrderedHash < Hash
|
||||
return str
|
||||
end
|
||||
|
||||
alias :to_s :inspect
|
||||
alias to_s inspect
|
||||
|
||||
def []=(key, value)
|
||||
oldvalue = self[key]
|
||||
|
||||
@@ -279,7 +279,8 @@ module PluginManager
|
||||
msg = "Plugin '#{name}' requires plugin '#{dep_name}', if installed, to be version #{dep_version}"
|
||||
msg << " or higher" if !exact
|
||||
msg << ", but the installed version was #{self.version(dep_name)}."
|
||||
if dep_link = self.link(dep_name)
|
||||
dep_link = self.link(dep_name)
|
||||
if dep_link
|
||||
msg << "\r\nCheck #{dep_link} for an update to plugin '#{dep_name}'."
|
||||
end
|
||||
self.error(msg)
|
||||
@@ -289,16 +290,16 @@ module PluginManager
|
||||
msg = "Plugin '#{name}' requires plugin '#{dep_name}' to be version #{dep_version}"
|
||||
msg << " or later" if !exact
|
||||
msg << ", but the installed version was #{self.version(dep_name)}."
|
||||
if dep_link = self.link(dep_name)
|
||||
dep_link = self.link(dep_name)
|
||||
if dep_link
|
||||
msg << "\r\nCheck #{dep_link} for an update to plugin '#{dep_name}'."
|
||||
end
|
||||
self.error(msg)
|
||||
else # Don't have plugin
|
||||
msg = "Plugin '#{name}' requires plugin '#{dep_name}' version #{dep_version} "
|
||||
msg << "or later" if !exact
|
||||
msg << "or later " if !exact
|
||||
msg << "to be installed above it."
|
||||
self.error(msg)
|
||||
end
|
||||
self.error(msg)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user