Class: TYCiCore::SpecODM

Inherits:
Object
  • Object
show all
Defined in:
lib/tuya/ci/core/spec/odm/spec_odm.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repo, repo_url, module_name, module_version) ⇒ SpecODM

Returns a new instance of SpecODM.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 6

def initialize(repo, repo_url, module_name, module_version)
	@repo = repo
	@repo_url = repo_url
	@module_name = module_name
	@module_version = module_version

	home = ENV["HOME"]
	# /Users/dong/.cocoapods/repos/TYSpecs/Specs/TestDemo/12.0.8
	@repo_path = "#{home}/.cocoapods/repos/#{@repo}"
	# @repo_module_path = "#{@repo_path}/Specs/#{@module_name}/#{module_version}/"
	@repo_module_path = "#{@repo_path}/#{@module_name}/#{module_version}/"
end

Instance Attribute Details

#module_nameObject

Returns the value of attribute module_name.



4
5
6
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 4

def module_name
  @module_name
end

#module_versionObject

Returns the value of attribute module_version.



4
5
6
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 4

def module_version
  @module_version
end

#repoObject

Returns the value of attribute repo.



4
5
6
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 4

def repo
  @repo
end

#repo_urlObject

Returns the value of attribute repo_url.



4
5
6
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 4

def repo_url
  @repo_url
end

Instance Method Details

#add_repoObject



25
26
27
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 25

def add_repo
	TYCiCore::EXE.exe 'pod', %W(repo add #{@repo} #{@repo_url})
end

#odm_configObject



19
20
21
22
23
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 19

def odm_config
	add_repo unless spec_exist?
	repo_update
	podspec_des
end

#podspec_desObject



29
30
31
32
33
34
35
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 29

def podspec_des
	podspec_path = "#{@repo_module_path}#{@module_name}.podspec"
	puts "ODM #{module_name}'s podspec path is #{podspec_path}".yellow

	podspec = TYCiCore::PodSpec.new podspec_path
	podspec.value_key 'summary'
end

#repo_updateObject



37
38
39
40
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 37

def repo_update
	puts "ODM pod repo update #{@repo}".yellow
	TYCiCore::EXE.exe 'pod', %W(repo update #{@repo})
end

#spec_exist?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
# File 'lib/tuya/ci/core/spec/odm/spec_odm.rb', line 42

def spec_exist?
	result = File.exist? @repo_path
	puts "ODM repo: #{@repo} exist? #{result}".yellow
	result
end