Class: Fir::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/fir-cli-batch/version.rb,
lib/fir-cli-commands/batpub.rb,
lib/fir-cli-commands/batres.rb

Defined Under Namespace

Classes: Batch

Instance Method Summary collapse

Instance Method Details

#batpub(*dirs) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fir-cli-commands/batpub.rb', line 9

def batpub(*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

#batres(*dirs) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fir-cli-commands/batres.rb', line 9

def batres(*dirs)
  _puts "! #{ Paint['至少需要输入提供一个文件夹', :red] }" if dirs.length == 0
  dirs.each do |dir|
    Dir.foreach(dir) do |f|
      extname = File.extname f
      basename = File.basename f, extname
      if _is_ipa(f) || _is_apk(f)
        _puts "> 正在处理 #{ f }"
        begin
          resign File.join(dir, f).to_s, File.join(dir, "#{ options[:prefix] }basename#{ options[:suffix] }#{ extname }").to_s
        rescue Exception => e
          _puts "! #{ f } 失败:#{ e.to_s }"
        end
      end
    end
  end
end