Class: Luna::Binary::Refresh

Inherits:
Object
  • Object
show all
Defined in:
lib/luna/binary/refresh.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#binary_pathObject

Returns the value of attribute binary_path.



8
9
10
# File 'lib/luna/binary/refresh.rb', line 8

def binary_path
  @binary_path
end

#request_result_hashObject

Returns the value of attribute request_result_hash.



9
10
11
# File 'lib/luna/binary/refresh.rb', line 9

def request_result_hash
  @request_result_hash
end

Instance Method Details

#createNeedFrameworkMapperObject



58
59
60
# File 'lib/luna/binary/refresh.rb', line 58

def createNeedFrameworkMapper
    return Luna::Binary::Common.instance.createNeedFrameworkMapper
end

#lockfileObject



47
48
49
# File 'lib/luna/binary/refresh.rb', line 47

def lockfile 
    return Luna::Binary::Common.instance.lockfile
end

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/luna/binary/refresh.rb', line 11

def run 
    spec_repo_binary = createNeedFrameworkMapper
    rootPath = "#{Luna::Binary::Common.instance.tempLunaUploaderPath}/refresh"
    Luna::Binary::Common.instance.deleteDirectory("#{rootPath}")
    system "mkdir -p #{rootPath};"
    failList = []
    spec_repo_binary.each { |k,v|
        if request_result_hash[k] != nil && request_result_hash[k].include?(v)
            begin
                pathArr = Dir.glob("#{binary_path}/**/#{k.sub("-","_")}.framework")
                if pathArr != nil
                    Pod::UserInterface.puts "#{pathArr.first} #{k}".yellow
                    srcPath = File.dirname(pathArr.first)
                    system "cp -r #{srcPath} #{rootPath};"
                    File.rename("#{rootPath}/#{File.basename(srcPath)}", "#{rootPath}/#{k}")
                    zipCommand = "cd #{rootPath};zip -r #{k}.zip #{k}"
                    p zipCommand
                    system zipCommand
                    Luna::Binary::Delete.new(k,v).deleteBinaryFramework
                    command = "cd #{rootPath};curl #{CBin.config.binary_upload_url} -F \"name=#{k}\" -F \"version=#{v}\" -F \"annotate=#{k}_#{v}_log\" -F \"file=@#{k}.zip\""
                    p command 
                    system command
                end 
            rescue => exception
                p exception
                failList << "#{k} #{exception}"
            else
                
            end
        else   
          failList << "name: #{k}"
        end 
    } 
    p "exception:#{failList}"
end