Class: Luna::Binary::Common

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/luna/binary/common/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommon



18
19
# File 'lib/luna/binary/common/common.rb', line 18

def initialize()
end

Instance Attribute Details

#lockfileObject

Returns the value of attribute lockfile.



16
17
18
# File 'lib/luna/binary/common/common.rb', line 16

def lockfile
  @lockfile
end

#podFilePathObject

Returns the value of attribute podFilePath.



15
16
17
# File 'lib/luna/binary/common/common.rb', line 15

def podFilePath
  @podFilePath
end

#stateObject

Returns the value of attribute state.



14
15
16
# File 'lib/luna/binary/common/common.rb', line 14

def state
  @state
end

#versionObject

Returns the value of attribute version.



14
15
16
# File 'lib/luna/binary/common/common.rb', line 14

def version
  @version
end

Instance Method Details

#binary_path_armObject



60
61
62
# File 'lib/luna/binary/common/common.rb', line 60

def binary_path_arm
    return tempLunaUploaderPath + "/arm64"
end

#binary_path_mergedObject



56
57
58
# File 'lib/luna/binary/common/common.rb', line 56

def binary_path_merged
  return tempLunaUploaderPath + "/merged"
end

#binary_path_x86Object



64
65
66
# File 'lib/luna/binary/common/common.rb', line 64

def binary_path_x86
    return tempLunaUploaderPath + "/x86"
end

#command(c) ⇒ Object



73
74
75
76
# File 'lib/luna/binary/common/common.rb', line 73

def command(c)
  p c
  return system c
end

#deleteDirectory(dirPath) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/luna/binary/common/common.rb', line 35

def deleteDirectory(dirPath)
    if File.directory?(dirPath)
      Dir.foreach(dirPath) do |subFile|
        if subFile != '.' and subFile != '..' 
          deleteDirectory(File.join(dirPath, subFile));
        end
      end
      Dir.rmdir(dirPath);
    else
      if File.exist?(dirPath)
        File.delete(dirPath);
      end
    end
end

#findLintPodspec(moduleName) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/luna/binary/common/common.rb', line 78

def findLintPodspec(moduleName)
  sets = Pod::Config.instance.sources_manager.search_by_name(moduleName)
  # p sets
  if sets.count == 1
      set = sets.first
  elsif sets.map(&:name).include?(moduleName)
      set = sets.find { |s| s.name == moduleName }
  else
      names = sets.map(&:name) * ', '
      # raise Informative, "More than one spec found for '#{moduleName}':\n#{names}"
  end  
  return set  
end

#repoPathObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/luna/binary/common/common.rb', line 21

def repoPath
    sources = Pod::Config.instance.sources_manager.all
    repoPath = nil
    sources.each { |item|
      if item.url == CBin.config.binary_repo_url
        repoPath = item.repo
      end
    }
    if repoPath == nil
      raise '没找到repo路径'  
    end
    return repoPath
end

#tempLunaUploaderPathObject



50
51
52
53
54
# File 'lib/luna/binary/common/common.rb', line 50

def tempLunaUploaderPath
  result = `pwd`
  rootName = result.strip! + "/temp-luna-uploader"
  return rootName
end

#use_framework_listObject



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/luna/binary/common/common.rb', line 97

def use_framework_list
  list = []
  File.open(Dir.pwd+"/Podfile", 'r:utf-8') do  |f|
      f.each_line do |item|
          if item[":dev_env_use_binary"]
              matchs = item.match(/pod \'([\u4E00-\u9FA5A-Za-z0-9_-]+)\'/)
              if matchs != nil
                  list << matchs[1]
              end
          end
      end
    end
  return list
end