Class: Pod::Command::Tag::Auto

Inherits:
Pod::Command::Tag show all
Includes:
Pod
Defined in:
lib/cocoapods-tag/command/tag/auto.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Auto

Returns a new instance of Auto.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/cocoapods-tag/command/tag/auto.rb', line 53

def initialize(argv)
  @version = argv.shift_argument
  @commit_msg = argv.shift_argument
  @tag_msg = argv.shift_argument
  @quick = argv.flag?('quick', false)
  @skip_push_commit = argv.flag?('skip-push-commit', false)
  @remote = argv.option('remote', false)
  @spec_repo = argv.option('spec-repo', nil)
  @work_dir = argv.option('work-dir', nil)
  @prefix = argv.option('prefix', nil)
  @suffix = argv.option('suffix', nil)
  @tag = @version
  unless @prefix.nil?
    @tag = "#{@prefix}-#{@tag}"
  end
  unless @suffix.nil?
    @tag = "#{@tag}-#{@suffix}"
  end
  super
end

Class Method Details

.optionsObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cocoapods-tag/command/tag/auto.rb', line 41

def self.options
  [
    ['--quick', '跳过一些耗时校验,如:远端仓库是否已经有该tag'],
    ['--skip-push-commit', '跳过推送commit到对应分支'],
    ['--remote=REMOTE', '指定tag推送到的远端仓库,可以通过`git remote -v`查看'],
    ['--spec-repo=SPECREPO', 'podspec推送到的repo,可以通过`pod repo list`查看'],
    ['--work-dir=WORKDIR', '执行命令的工作区'],
    ['--prefix=PREFIX', 'tag前缀'],
    ['--suffix=SUFFIX', 'tag后缀']
  ].concat(super)
end

Instance Method Details

#runObject



74
75
76
77
78
79
80
81
82
# File 'lib/cocoapods-tag/command/tag/auto.rb', line 74

def run
  # 传入了工作目录
  unless @work_dir.nil?
    raise Informative, "不存在工作目录`#{@work_dir}`" unless File.exist?(@work_dir)
    Dir.chdir(@work_dir)
  end
  tag = Pod::Tag.new(@version, @tag, @commit_msg, @tag_msg, @spec_repo, @quick, @remote, @skip_push_commit)
  tag.create
end