./lib/shenzhen/xcodebuild.rb in shenzhen-0.8.2 vs ./lib/shenzhen/xcodebuild.rb in shenzhen-0.9.0
- old
+ new
@@ -20,21 +20,23 @@
end
self
end
end
-
+
class Error < StandardError; end
class NilOutputError < Error; end
class << self
def info(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
output = `xcodebuild -list #{(args + args_from_options(options)).join(" ")} 2>&1`
+
raise Error.new $1 if /^xcodebuild\: error\: (.+)$/ === output
- raise NilOutputError unless /\S/ === output
+ return nil unless /\S/ === output
+
lines = output.split(/\n/)
info, group = {}, nil
info[:project] = lines.shift.match(/\"(.+)\"\:/)[1] rescue nil
@@ -50,20 +52,22 @@
end
end
info.each do |group, values|
next unless Array === values
- values.delete("") and values.uniq!
+ values.delete("") and values.uniq!
end
Info.new(info)
end
def settings(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
output = `xcodebuild #{(args + args_from_options(options)).join(" ")} -showBuildSettings 2> /dev/null`
+
+ return nil unless /\S/ === output
+
raise Error.new $1 if /^xcodebuild\: error\: (.+)$/ === output
- raise NilOutputError unless /\S/ === output
lines = output.split(/\n/)
settings, target = {}, nil
lines.each do |line|