diff options
Diffstat (limited to 'lib/sisu/v3/options.rb')
-rw-r--r-- | lib/sisu/v3/options.rb | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index eeca31ec..ffd0da0f 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -192,6 +192,7 @@ module SiSU_commandline c,w='','' m,f,pth,z,lng,lngs=[],[],[],[],[],[] a=s.split(/\s+/) + r_l=Px[:lng_lst].join('|') a.uniq.each do |x| if x =~/^-[a-z0-5]+/i \ or x =~/^--\S+/ @@ -203,8 +204,51 @@ module SiSU_commandline end elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip))$/ if x =~/^(?:https?|file):\/\/\S+/ \ - or x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ \ - && FileTest.file?(x) + and x =~/\S+?\.ss[mt]$/ + r_url=/(http:\/\/\S+?\/\S+?\/src(?:\/(?:#{r_l}))?)\// + url_base = (x[r_url,1]) + url = x + y=x.gsub(/http:\/\/\S+?\/\S+?\/src\//,'') + t=/(#{r_l})\/[^\/]+?\.ss[tm]$/ + l_p = (y[t,1]) \ + ? y[t,1] + : nil + lng << l_p + lngs << if l_p + l_p + elsif x =~/~(#{r_l})\.ss[tm]/ + $1 + else lng_base + end + r_f=/(?:#{r_l})\/([^\/]+?\.ss[tm])$/ + fn = (y[r_f,1]) \ + ? y[r_f,1] + : y + fn.gsub!(/\.((?:ssm\.)?sst)/,'.-\1') + fullname=Dir.pwd + '/' + fn + pt=Pathname.new(fullname) + pth << Dir.pwd + r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ + lng_is =if l_p + l_p + elsif x =~/~(#{r_l})\.ss[tm]/ + $1 + else lng_base + end + f_pths << { + pth: pt.split[0].realpath.to_s, + f: pt.split[1].to_s, + pth_stub: pt.split[0].realpath.to_s[r_u,1], + lng: (pt.split[0].realpath.to_s[t,1]) \ + ? pt.split[0].realpath.to_s[t,1] + : nil, + lng_is: lng_is, + url_base: url_base, + url: url + } + f << fn + elsif x =~/^(?:https?|file):\/\/\S+/ \ + and x =~/\S+?\.ss[mt]\.(?:txz|zip)|sisupod\.(?:txz|zip)/ x=x.gsub(/^file:\/\//,'') f << x elsif FileTest.file?(x) @@ -212,34 +256,34 @@ module SiSU_commandline pt=Pathname.new(x) pth << pt.split[0].realpath.to_s #remove? f << pt.split[1].to_s #remove? - r=Px[:lng_lst].join('|') - u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/ - t=/.+\/(#{r})$/ + r_u=/.+?\/([^\/]+)(?:\/(?:#{r_l})$|$)/ + t=/.+\/(#{r_l})$/ l_p = (pt.split[0].realpath.to_s[t,1]) \ ? pt.split[0].realpath.to_s[t,1] : nil - #: '' lng << l_p lngs << if l_p l_p - elsif x =~/~(#{r})\.ss[tm]/ + elsif x =~/~(#{r_l})\.ss[tm]/ $1 else lng_base end lng_is =if l_p l_p - elsif x =~/~(#{r})\.ss[tm]/ + elsif x =~/~(#{r_l})\.ss[tm]/ $1 else lng_base end f_pths << { pth: pt.split[0].realpath.to_s, f: pt.split[1].to_s, - pth_stub: pt.split[0].realpath.to_s[u,1], + pth_stub: pt.split[0].realpath.to_s[r_u,1], lng: (pt.split[0].realpath.to_s[t,1]) \ ? pt.split[0].realpath.to_s[t,1] : nil, - lng_is: lng_is + lng_is: lng_is, + url_base: nil, + url: nil } # Dir.chdir(pt.split[0].realpath) else puts "file not found: #{x}" |