Class: PodBuilder::Podspec

Inherits:
Object
  • Object
show all
Defined in:
lib/pod_builder/podspec.rb

Class Method Summary collapse

Class Method Details

.generate(analyzer) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/pod_builder/podspec.rb', line 32

def self.generate(analyzer)  
  puts "Generating PodBuilder's local podspec".yellow
  
  buildable_items = Podfile.podfile_items_at(PodBuilder::basepath("Podfile")).sort_by { |x| x.name }
        
  podspec_items = podspec_items_from(buildable_items)

  platform = analyzer.instance_variable_get("@result").targets.first.platform
  generate_podspec_from(podspec_items, platform)
end

.include?(pod_name) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/pod_builder/podspec.rb', line 43

def self.include?(pod_name)
  podspec_path = PodBuilder::basepath("PodBuilder.podspec")
  unless File.exist?(podspec_path)
    return false
  end

  if Configuration.subspecs_to_split.include?(pod_name)
    pod_name = pod_name.gsub("/", "_")
  else
    pod_name = pod_name.split("/").first
  end

  podspec_content = File.read(podspec_path)

  # (_.*) will include prebuild podnames like s.subspec 'Podname_Subspec' do |p|
  subspec_regex = "s.subspec '#{pod_name}(_.*)?' do |p|" 
  return (podspec_content.match(/#{subspec_regex}/) != nil)
end