Class: Pod::SpecBuilder
- Inherits:
-
Object
- Object
- Pod::SpecBuilder
- Defined in:
- lib/cocoapods-packager/spec_builder.rb
Instance Method Summary collapse
- #framework_path ⇒ Object
-
#initialize(spec, source, embedded) ⇒ SpecBuilder
constructor
A new instance of SpecBuilder.
- #spec_close ⇒ Object
- #spec_header ⇒ Object
- #spec_metadata ⇒ Object
- #spec_platform(platform) ⇒ Object
- #spec_single_platform_fix ⇒ Object
Constructor Details
#initialize(spec, source, embedded) ⇒ SpecBuilder
Returns a new instance of SpecBuilder.
3 4 5 6 7 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 3 def initialize(spec, source, ) @spec = spec @source = source.nil? ? '{}' : source @embedded = end |
Instance Method Details
#framework_path ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 9 def framework_path if @embedded @spec.name + '.embeddedframework' + '/' + @spec.name + '.framework' else @spec.name + '.framework' end end |
#spec_close ⇒ Object
46 47 48 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 46 def spec_close "end\n" end |
#spec_header ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 52 def spec_header spec = "Pod::Spec.new do |s|\n" %w(name version summary license authors homepage description social_media_url docset_url documentation_url screenshots frameworks libraries requires_arc deployment_target xcconfig).each do |attribute| value = @spec.attributes_hash[attribute] next if value.nil? value = "'#{value}'" if value.class == String spec += " s.#{attribute} = #{value}\n" end spec + " s.source = #{@source}\n\n" end |
#spec_metadata ⇒ Object
40 41 42 43 44 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 40 def spec = spec_header spec += spec_single_platform_fix spec end |
#spec_platform(platform) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 17 def spec_platform(platform) fwk_base = platform.name.to_s + '/' + framework_path spec = <<SPEC s.#{platform.name}.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}' s.#{platform.name}.preserve_paths = '#{fwk_base}' s.#{platform.name}.public_header_files = '#{fwk_base}/Versions/A/Headers/*.h' s.#{platform.name}.resource = '#{fwk_base}/Versions/A/Resources/**/*' s.#{platform.name}.vendored_frameworks = '#{fwk_base}' SPEC %w(frameworks libraries requires_arc xcconfig).each do |attribute| attributes_hash = @spec.attributes_hash[platform.name.to_s] next if attributes_hash.nil? value = attributes_hash[attribute] next if value.nil? value = "'#{value}'" if value.class == String spec += " s.#{platform.name}.#{attribute} = #{value}\n" end spec end |
#spec_single_platform_fix ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/cocoapods-packager/spec_builder.rb', line 68 def spec_single_platform_fix return '' if @spec.available_platforms.length > 1 platform = @spec.available_platforms.first <<SPEC s.platform = :#{platform.symbolic_name}, '#{platform.deployment_target}' SPEC end |