Class: BigKeeper::PodspecOperator
- Inherits:
-
Object
- Object
- BigKeeper::PodspecOperator
- Includes:
- Singleton
- Defined in:
- lib/big_keeper/util/podspec_operator.rb
Overview
Operator for podspec file
Instance Attribute Summary collapse
-
#main_path ⇒ Object
Returns the value of attribute main_path.
-
#module_list ⇒ Object
Returns the value of attribute module_list.
-
#pod_list ⇒ Object
Returns the value of attribute pod_list.
Instance Method Summary collapse
- #deal_podfile_line(sentence) ⇒ Object
- #get_pod_name(sentence) ⇒ Object
-
#initialize ⇒ PodspecOperator
constructor
A new instance of PodspecOperator.
- #parse(path, module_name) ⇒ Object
Constructor Details
#initialize ⇒ PodspecOperator
Returns a new instance of PodspecOperator.
14 15 16 17 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 14 def initialize @module_list = BigkeeperParser.module_names @pod_list = [] end |
Instance Attribute Details
#main_path ⇒ Object
Returns the value of attribute main_path.
10 11 12 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 10 def main_path @main_path end |
#module_list ⇒ Object
Returns the value of attribute module_list.
10 11 12 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 10 def module_list @module_list end |
#pod_list ⇒ Object
Returns the value of attribute pod_list.
10 11 12 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 10 def pod_list @pod_list end |
Instance Method Details
#deal_podfile_line(sentence) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 38 def deal_podfile_line(sentence) pod_name = '' if sentence.strip.include?('dependency ') pod_dep = sentence.split('dependency ') if pod_dep.size > 1 pod_names = pod_dep[1].split(',') if pod_names.size > 1 pod_name = pod_names[0] else pod_name = pod_dep[1] end end pod_name end end |
#get_pod_name(sentence) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 31 def get_pod_name(sentence) pod_model = deal_podfile_line(sentence) if pod_model != nil return pod_model.chomp.gsub("'", "") end end |
#parse(path, module_name) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/big_keeper/util/podspec_operator.rb', line 19 def parse(path, module_name) @main_path = path podspec_lines = File.readlines("#{@main_path}/#{module_name}.podspec", :encoding => 'UTF-8') Logger.highlight("Analyzing Podspec...") unless podspec_lines.size.zero? podspec_lines.collect do |sentence| if /dependency / =~ sentence pod_name = get_pod_name(sentence) @pod_list << pod_name end end end |