Class: TYCiCore::TYDependencies
- Inherits:
-
Object
- Object
- TYCiCore::TYDependencies
- Defined in:
- lib/tuya/ci/core/dependencies.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #analysis ⇒ Object
-
#initialize(path) ⇒ TYDependencies
constructor
A new instance of TYDependencies.
- #sort_pods(pods) ⇒ Object
Constructor Details
#initialize(path) ⇒ TYDependencies
Returns a new instance of TYDependencies.
6 7 8 9 |
# File 'lib/tuya/ci/core/dependencies.rb', line 6 def initialize(path) @path = path @content = '' end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/tuya/ci/core/dependencies.rb', line 4 def content @content end |
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/tuya/ci/core/dependencies.rb', line 4 def path @path end |
Instance Method Details
#analysis ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/tuya/ci/core/dependencies.rb', line 31 def analysis content = File.read @path podfile_lock = TYPodFileLock.new content analysis = TYPodAnalyse.new podfile_lock analysis.sorted_pods end |
#sort_pods(pods) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/tuya/ci/core/dependencies.rb', line 11 def sort_pods(pods) if File.exist? @path lock_pods = analysis pods_hash = Hash.new pods.each do |pod| pods_hash[pod["name"]] = pod end result = [] lock_pods.each do |lock_pod| if pods_hash.keys.include? lock_pod result.push pods_hash[lock_pod] end end result else puts "Can not find file: #{@path}".red pods end end |