lib/fir-cli.utils.ext.rb in fir-cli-0.1.9 vs lib/fir-cli.utils.ext.rb in fir-cli-0.2.0

- old
+ new

@@ -69,10 +69,16 @@ path.end_with? '.ipa' end def _is_apk(path) path.end_with? '.apk' end + def _is_workspace(path) + path.end_with? '.xcworkspace' + end + def _is_xcodeproject(path) + path.end_with? '.xcodeproj' + end def _is_identifier(str) /^(?:(?:[a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*(?:[A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$/.match str end def _is_email(str) /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.(?:[A-Z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)$/i.match str @@ -173,11 +179,11 @@ :release_type => app.release_type, :distribution_name => app.distribution_name } if more if app.icons - info[:icons] = app.icons.reverse.map do |icon| + info[:icons] = app.icons.sort { |a,b| -(a[:width] <=> b[:width]) }.map do |icon| tfile = Tempfile.new ["icon-#{SecureRandom.hex}", '.png'] @tmpfiles.push tfile FileUtils.cp icon[:path], tfile.path { :name => File.basename(icon[:path]), @@ -218,9 +224,24 @@ def _convert_settings(*settings) settings.reduce({}) do |hash, setting| key,val = setting.split('=', 2).map(&:strip) hash[key.to_sym] = val hash + end + end + def _batch_publish(*dirs) + _puts "! #{ Paint['至少需要提供一个文件夹', :red] }" if dirs.length == 0 + dirs.each do |dir| + Dir.foreach(dir) do |_f| + if _is_ipa(_f) || _is_apk(_f) + _puts "> 正在发布 #{ _f }" + begin + publish File.join dir, _f + rescue Exception => e + _puts "! #{ _f } 失败:#{ e.to_s }" + end + end + end end end end end