Class: SiSU_Hub_Loops::OptionLoopFiles
- Inherits:
-
Object
- Object
- SiSU_Hub_Loops::OptionLoopFiles
- Defined in:
- lib/sisu/hub_loop_markup_files.rb
Instance Attribute Summary collapse
-
#opt ⇒ Object
readonly
Returns the value of attribute opt.
Instance Method Summary collapse
-
#initialize(opt) ⇒ OptionLoopFiles
constructor
A new instance of OptionLoopFiles.
- #loop_files_on_given_option ⇒ Object
- #loop_files_on_given_option_bundle ⇒ Object
- #manifest_on_files_translated ⇒ Object
Constructor Details
#initialize(opt) ⇒ OptionLoopFiles
Returns a new instance of OptionLoopFiles.
73 74 75 76 |
# File 'lib/sisu/hub_loop_markup_files.rb', line 73 def initialize(opt) @opt=opt @r=Px[:lng_lst_rgx] end |
Instance Attribute Details
#opt ⇒ Object (readonly)
Returns the value of attribute opt.
72 73 74 |
# File 'lib/sisu/hub_loop_markup_files.rb', line 72 def opt @opt end |
Instance Method Details
#loop_files_on_given_option ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/sisu/hub_loop_markup_files.rb', line 77 def loop_files_on_given_option @opt.files.each_with_index do |fno,i| @opt.fno,@opt.fns=fno,fno @opt.f_pth=@opt.f_pths[i] if fno !~/\.-sst$/ @opt.pth=@opt.paths[i] @opt.lng=@opt.lngs[i] end @@pwd=@opt.pth @opt.pth=@opt.f_pths[i][:pth] @opt.lng=@opt.f_pths[i][:lng] Dir.chdir(@opt.f_pth[:pth]) #watch SiSU_Env::FilenameLanguageCodeInsert.new(@opt,@opt.lng).language_code_insert # ... track @env=SiSU_Env::InfoEnv.new(fno) yield end end |
#loop_files_on_given_option_bundle ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/sisu/hub_loop_markup_files.rb', line 94 def loop_files_on_given_option_bundle @files_bundle={} @opt.files.each_with_index do |fno,i| fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') unless @files_bundle[fn_base_bundle] @files_bundle[fn_base_bundle]={ status: :todo } end end @opt.files.each_with_index do |fno,i| fn_base_bundle=fno.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') unless @files_bundle[fn_base_bundle][:status] == :done @files_bundle[fn_base_bundle][:status] = :done @opt.fns=fno @opt.fno=fno @opt.f_pth=@opt.f_pths[i] if fno !~/\.-sst$/ @opt.pth=@opt.paths[i] @opt.lng=@opt.lngs[i] end @@pwd=@opt.pth @opt.pth=@opt.f_pths[i][:pth] @opt.lng=@opt.f_pths[i][:lng] Dir.chdir(@opt.f_pth[:pth]) #watch @env=SiSU_Env::InfoEnv.new(fno) yield else next end end end |
#manifest_on_files_translated ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/sisu/hub_loop_markup_files.rb', line 123 def manifest_on_files_translated number_of_files={} @opt.files.each_with_index do |fns,i| fn=fns.gsub(/(?:~(?:#{@r}))?\.ss[tm]$/,'') (number_of_files[fn].is_a?(Array)) \ ? (number_of_files[fn] << i) : (number_of_files.store(fn,[i])) end files_translated_idx=[] number_of_files.each do |x| if x[1].length > 1 files_translated_idx << x[1] end end #files_translated_idx=number_of_files.select do |x| # x[1] if x[1].length > 1 #end if files_translated_idx.flatten.length > 1 SiSU_Screen::Ansi.new( @opt.act[:color_state][:set], 'Manifest re-run on (currently generated) translated files', '' ).grey_title_hi unless @opt.act[:quiet][:set] ==:on files_translated_idx.flatten.each do |i| @opt.fns=@opt.files[i] @opt.f_pth=@opt.f_pths[i] if @opt.fns =~/\.-sst$/ @opt.pth=Dir.pwd @opt.lng='en' elsif @opt.fno =~/\.txz$/ @opt.pth=@opt.f_pths[i][:pth] @opt.lng=@opt.f_pths[i][:lng] else @opt.pth=@opt.f_pths[i][:pth] @opt.lng=@opt.f_pths[i][:lng] end @@pwd=@opt.pth Dir.chdir(@opt.pth) #watch @env=SiSU_Env::InfoEnv.new(@opt.fns) yield end end end |