Class: Build::RepoCocoapods

Inherits:
Repo
  • Object
show all
Defined in:
lib/core_blur/repo_cocoapods.rb

Instance Attribute Summary collapse

Attributes inherited from Repo

#branch, #gitlab_helper, #http_url, #last_commit, #page_url, #path, #pusher, #repo_path, #size, #size_format, #ssh_url, #user_email, #user_name

Instance Method Summary collapse

Methods inherited from Repo

#clear, #discard_pull, #git_add_stag, #git_checkout, #git_clone, #git_fetch, #git_pull, #git_push, #git_push_f, #git_push_tags, #git_reset_hard, #git_status, #git_tag_delete_local, #git_tag_delete_origin, #git_tag_local, #git_tag_origin, #initialize, #push_code

Constructor Details

This class inherits a constructor from Build::Repo

Instance Attribute Details

#repo_moduleObject

Returns the value of attribute repo_module.



6
7
8
# File 'lib/core_blur/repo_cocoapods.rb', line 6

def repo_module
  @repo_module
end

Instance Method Details

#copy_podspec(repo_module) ⇒ Object



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
# File 'lib/core_blur/repo_cocoapods.rb', line 15

def copy_podspec(repo_module)
  @repo_module = repo_module
  puts "\n⏩ 拷贝podspec文件到cocoapods中(#{File.basename(self.path)}):"
  pod_name = repo_module.pod_name
  pod_version_final = repo_module.pod_version_final
  pod_name_path = "#{self.path}/#{pod_name}"
  unless File.directory?(pod_name_path)
    Dir.mkdir(pod_name_path)
  end
  pod_version_path = "#{pod_name_path}/#{pod_version_final}"
  if File.directory?(pod_version_path)
    if not repo_module.build_item.snapshot and not repo_module.third
      error = "#{pod_name}已发布相同版本#{pod_version_final},请更换更高的版本号"
      pusher.push("❌ 打包失败", error)
      Process.exit(-1)
    end
  else
    Dir.mkdir(pod_version_path)
  end
  FileUtils.cp(repo_module.podspec_json_path, pod_version_path)
  podspec_path = "#{pod_version_path}/#{pod_name}.podspec"
  if File.exist?(podspec_path)
    FileUtils.rm(podspec_path)
  end
  puts "拷贝完毕"
end

#git_commit(commit_msg = nil) ⇒ Object



41
42
43
44
# File 'lib/core_blur/repo_cocoapods.rb', line 41

def git_commit(commit_msg = nil)
  commit_msg = repo_module.get_commit_msg
  super commit_msg
end

#pod_name_versions(pod_name) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/core_blur/repo_cocoapods.rb', line 7

def pod_name_versions(pod_name)
  pod_name_path = "#{self.path}/#{pod_name}"
  unless File.directory?(pod_name_path)
    return nil
  end
  entries = Dir.entries(pod_name_path)
  entries.select { |entry| entry != '.' && entry != '..' }
end