Class: Pod::Command::Module::Publish

Inherits:
Pod::Command::Module show all
Includes:
ProjectDirectory
Defined in:
lib/cocoapods-module/command/module/publish.rb

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Publish

Returns a new instance of Publish.



17
18
19
20
21
# File 'lib/cocoapods-module/command/module/publish.rb', line 17

def initialize(argv)
	@project_name = argv.shift_argument
  @tag_version = argv.shift_argument
  super
end

Instance Method Details

#runObject



45
46
47
48
49
50
# File 'lib/cocoapods-module/command/module/publish.rb', line 45

def run
  UI.puts "Start execute pod module publish command..."
	git! ['tag', '-a', @tag_version, '-m', "#{@tag_version}"]
	git! ['push', '--tags']
	exec("pod repo push gitee-giraffex-dcspecs #{@project_name}.podspec --verbose --allow-warnings --use-libraries")
end

#validate!Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods-module/command/module/publish.rb', line 23

def validate!
  super

  # 判断是否存在.podspec文件
  podspecs = Pathname.glob('*.podspec')
  @podspec_path = podspecs.first if podspecs.size == 1
  help! "you should cd to pod path. check #{Pathname.getwd}" unless @podspec_path

  # 判断是否存在.git文件
  @gits_path = Pathname.getwd + ".git"
  help! ".git dir is requred. check #{Pathname.getwd}" unless @gits_path.exist?

	unless @project_name
		help! 'project name is required.'
	end

  # 判断是否存填写版本号
  unless @tag_version
  	help! 'commit infomation is required.'
  end
end