Class: BigKeeper::PodOperator

Inherits:
Object
  • Object
show all
Defined in:
lib/big_keeper/util/pod_operator.rb

Class Method Summary collapse

Class Method Details

.cmd(cmd) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/big_keeper/util/pod_operator.rb', line 61

def self.cmd(cmd)
  Open3.popen3(cmd) do |stdin , stdout , stderr, wait_thr|
    while line = stdout.gets
      puts line
    end
  end
end

.pod_install(path, repo_update) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/big_keeper/util/pod_operator.rb', line 6

def self.pod_install(path, repo_update)
  # pod install
  if repo_update
    PodOperator.pod_update_private_repos(true)
  end
  Logger.highlight('Start pod install, waiting...')
  cmd = "pod install --project-directory='#{path}'"
  Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
    while line = stdout.gets
      p line
    end
  end
  Logger.highlight('Finish pod install.')
end

.pod_repo_push(path, module_name, source, version) ⇒ Object



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
46
# File 'lib/big_keeper/util/pod_operator.rb', line 21

def self.pod_repo_push(path, module_name, source, version)
  Logger.highlight(%Q(Start Pod repo push #{module_name}))
  Dir.chdir(path) do
    command = ""
    p BigkeeperParser.source_spec_name(module_name)
    if source.length > 0
      command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --sources=#{source} --verbose --use-libraries"
    else
      command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --verbose --use-libraries"
    end

    IO.popen(command) do |io|
      is_success = false
      error_info = Array.new
      io.each do |line|
        error_info.push(line)
        is_success = true if line.include? "Updating spec repo"
      end
      unless is_success
        puts error_info
        Logger.error("Fail: '#{module_name}' Pod repo fail")
      end
      Logger.highlight(%Q(Success release #{module_name} V#{version}))
    end
  end
end

.pod_update_private_repos(update_private) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/big_keeper/util/pod_operator.rb', line 48

def self.pod_update_private_repos(update_private)
  if update_private
    BigkeeperParser.sources.map { |spec|
      Logger.highlight('Start pod repo update, waiting...')
      cmd = "pod repo update #{spec}"
      cmd(cmd)
    }
  else
    cmd = "pod repo update"
    cmd(cmd)
  end
end