Class: Pod::Tag

Inherits:
Object
  • Object
show all
Includes:
Pod
Defined in:
lib/cocoapods-tag/tag.rb

Constant Summary collapse

GITHUB_DOMAIN =
"github.com".freeze
GIT_REPO =
".git".freeze
PODSPEC_EXT =
%w[podspec podspec.json].freeze

Instance Method Summary collapse

Constructor Details

#initialize(version, tag, commit_msg, tag_msg, spec_repo = nil, quick = false, remote_name = nil, skip_push_commit = false) ⇒ Tag

Returns a new instance of Tag.



11
12
13
14
15
16
17
18
19
20
# File 'lib/cocoapods-tag/tag.rb', line 11

def initialize(version, tag, commit_msg, tag_msg, spec_repo = nil, quick = false, remote_name = nil, skip_push_commit = false )
  @version = version || raise(Informative, "缺少必填参数`version`")
  @tag = tag || raise(Informative, "缺少必填参数`tag`")
  @commit_msg = commit_msg || raise(Informative, "缺少必填参数`commit_msg`")
  @tag_msg = tag_msg || "v#{@tag}"
  @spec_repo = spec_repo
  @quick = quick
  @remote = remote_name
  @skip_push_commit = skip_push_commit
end

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cocoapods-tag/tag.rb', line 24

def create
  require 'cocoapods-tag/native/validator'

  # 欢迎语
  welcome_message
  # 正则校验版本号
  check_version
  # 检查本地是否有 spec_repo
  # check_spec_repo if @spec_repo
  # 检查 git repo
  check_git_repo
  # 加载 podspec
  load_podspec
  # 修改前校验 podspec
  lint_podspec("\n修改前校验`#{podspec}`\n")
  # 修改 podspec
  modify_podspec
  # 修改后校验 podspec
  lint_podspec("\n修改后校验`#{podspec}`\n")
  # 推送 commit 到远端
  git_commit_push
  # 推送 tag 到远端
  git_tag_push
  # 推送 podspec 到 spec repo
  push_podspec_to_repo if @spec_repo
  # 结束语
  done_message
end