Class: Qricker::SpecBuilder
- Inherits:
-
Object
- Object
- Qricker::SpecBuilder
- Defined in:
- lib/qricker/spec_builder.rb
Instance Method Summary collapse
- #framework_path ⇒ Object
-
#initialize(spec, moduleCache) ⇒ SpecBuilder
constructor
A new instance of SpecBuilder.
- #spec_close ⇒ Object
- #spec_dependencies ⇒ Object
- #spec_metadata ⇒ Object
- #spec_origin_sources ⇒ Object
- #spec_platform(platform) ⇒ Object
- #transferValueToS(value) ⇒ Object
Constructor Details
#initialize(spec, moduleCache) ⇒ SpecBuilder
Returns a new instance of SpecBuilder.
7 8 9 10 |
# File 'lib/qricker/spec_builder.rb', line 7 def initialize(spec, moduleCache) @spec = spec @moduleCache = moduleCache end |
Instance Method Details
#framework_path ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/qricker/spec_builder.rb', line 12 def framework_path if @embedded @spec.name + '.embeddedframework' + '/' + @spec.name + '.framework' else @spec.name + '.framework' end end |
#spec_close ⇒ Object
45 46 47 |
# File 'lib/qricker/spec_builder.rb', line 45 def spec_close "end\n" end |
#spec_dependencies ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/qricker/spec_builder.rb', line 51 def spec_dependencies value = @spec.attributes_hash["dependencies"] return "" if value.nil? return "" if value.class == Array and value.length == 0 spec = "" value.each { |dep| spec += "\n s.dependency '#{dep[0]}' " if not @moduleCache.nil? depSpec = @moduleCache.moduleByName(dep[0]) if not depSpec.nil? and not depSpec.podSpecilication.nil? spec += ", '#{depSpec.podSpecilication.version}'" end else dep[1].each { |req| spec += ", '#{req}'" } end } spec end |
#spec_metadata ⇒ Object
39 40 41 42 43 |
# File 'lib/qricker/spec_builder.rb', line 39 def spec = spec_header spec += spec_dependencies spec end |
#spec_origin_sources ⇒ Object
73 74 75 76 77 |
# File 'lib/qricker/spec_builder.rb', line 73 def spec_origin_sources value = @spec.attributes_hash["source_files"] return "" if value.nil? " s.source_files = #{transferValueToS(value)}\n" end |
#spec_platform(platform) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/qricker/spec_builder.rb', line 20 def spec_platform(platform) fwk_base = platform.name.to_s + '/' + framework_path spec = <<RB s.#{platform.name}.deployment_target = '#{platform.deployment_target}' s.#{platform.name}.vendored_framework = '#{fwk_base}' RB %w(frameworks weak_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 |
#transferValueToS(value) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/qricker/spec_builder.rb', line 79 def transferValueToS(value) return "" if value.nil? valueStr = "" if value.class == String value = value.dump valueStr = "#{value}\n" elsif value.class == Array value.each_with_index {|each , index| if index != 0 valueStr += ", " end valueStr += "'#{each}'" } elsif value.class == Hash valueStr = "#{value}" end return valueStr end |