xcodeproj 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,12 +7,12 @@ module Xcodeproj
7
7
  # @param [Hash, File, String] xcconfig_hash_or_file Initial data.
8
8
  require 'set'
9
9
 
10
- attr_accessor :attributes, :frameworks ,:libraries
10
+ attr_accessor :attributes, :frameworks, :weak_frameworks ,:libraries
11
11
 
12
12
  def initialize(xcconfig_hash_or_file = {})
13
13
  @attributes = {}
14
14
  @includes = []
15
- @frameworks, @libraries = Set.new, Set.new
15
+ @frameworks, @weak_frameworks, @libraries = Set.new, Set.new, Set.new
16
16
  merge!(extract_hash(xcconfig_hash_or_file))
17
17
  end
18
18
 
@@ -23,6 +23,7 @@ module Xcodeproj
23
23
  flags = flags.dup.strip
24
24
  flags << libraries.to_a.sort.reduce('') {| memo, l | memo << " -l#{l}" }
25
25
  flags << frameworks.to_a.sort.reduce('') {| memo, f | memo << " -framework #{f}" }
26
+ flags << weak_frameworks.to_a.sort.reduce('') {| memo, f | memo << " -weak_framework #{f}" }
26
27
  hash['OTHER_LDFLAGS'] = flags.strip
27
28
  hash.delete('OTHER_LDFLAGS') if flags.strip.empty?
28
29
  hash
@@ -63,6 +64,7 @@ module Xcodeproj
63
64
  @attributes.merge!(xcconfig.attributes) { |key, v1, v2| "#{v1} #{v2}" }
64
65
  @libraries.merge xcconfig.libraries
65
66
  @frameworks.merge xcconfig.frameworks
67
+ @weak_frameworks.merge xcconfig.weak_frameworks
66
68
  else
67
69
  @attributes.merge!(xcconfig.to_hash) { |key, v1, v2| "#{v1} #{v2}" }
68
70
  # Parse frameworks and libraries. Then remove the from the linker flags
@@ -70,12 +72,15 @@ module Xcodeproj
70
72
  return unless flags
71
73
 
72
74
  frameworks = flags.scan(/-framework\s+([^\s]+)/).map { |m| m[0] }
75
+ weak_frameworks = flags.scan(/-weak_framework\s+([^\s]+)/).map { |m| m[0] }
73
76
  libraries = flags.scan(/-l ?([^\s]+)/).map { |m| m[0] }
74
77
  @frameworks.merge frameworks
78
+ @weak_frameworks.merge weak_frameworks
75
79
  @libraries.merge libraries
76
80
 
77
81
  new_flags = flags.dup
78
82
  frameworks.each {|f| new_flags.gsub!("-framework #{f}", "") }
83
+ weak_frameworks.each {|f| new_flags.gsub!("-weak_framework #{f}", "") }
79
84
  libraries.each {|l| new_flags.gsub!("-l#{l}", ""); new_flags.gsub!("-l #{l}", "") }
80
85
  @attributes['OTHER_LDFLAGS'] = new_flags.gsub("\w*", ' ').strip
81
86
  end
@@ -92,11 +92,31 @@ module Xcodeproj
92
92
  groups.new("name" => name)
93
93
  end
94
94
 
95
+ def version_groups
96
+ children.list_by_class(XCVersionGroup)
97
+ end
98
+
95
99
  def <<(child)
96
100
  children << child
97
101
  end
98
102
  end
99
103
 
104
+ class XCVersionGroup < PBXGroup
105
+
106
+ attribute :version_group_type
107
+ attribute :current_version
108
+
109
+ def self.new_xcdatamodel_group(project, xcdatamodel_path)
110
+ group = new(project, nil, 'versionGroupType' => 'wrapper.xcdatamodel')
111
+ file = group.files.new(
112
+ 'path' => xcdatamodel_path.sub(/xcdatamodeld$/, 'xcdatamodel'),
113
+ 'lastKnownFileType' => 'wrapper.xcdatamodel'
114
+ )
115
+ group.current_version = file.uuid
116
+ group
117
+ end
118
+ end
119
+
100
120
  end
101
121
  end
102
122
  end
data/lib/xcodeproj.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
- VERSION = '0.2.3'
2
+ VERSION = '0.3.0'
3
3
 
4
4
  autoload :Config, 'xcodeproj/config'
5
5
  autoload :Project, 'xcodeproj/project'
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease:
4
+ prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 2
9
7
  - 3
10
- version: 0.2.3
8
+ - 0
9
+ version: 0.3.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Eloy Duran
@@ -15,17 +14,16 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2012-07-06 00:00:00 Z
17
+ date: 2012-07-14 00:00:00 +02:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activesupport
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
24
  requirements:
26
25
  - - ~>
27
26
  - !ruby/object:Gem::Version
28
- hash: 3
29
27
  segments:
30
28
  - 3
31
29
  - 2
@@ -61,6 +59,7 @@ files:
61
59
  - ext/xcodeproj/xcodeproj_ext.c
62
60
  - README.md
63
61
  - LICENSE
62
+ has_rdoc: true
64
63
  homepage: https://github.com/cocoapods/xcodeproj
65
64
  licenses:
66
65
  - MIT
@@ -71,30 +70,25 @@ require_paths:
71
70
  - ext
72
71
  - lib
73
72
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
73
  requirements:
76
74
  - - ">="
77
75
  - !ruby/object:Gem::Version
78
- hash: 3
79
76
  segments:
80
77
  - 0
81
78
  version: "0"
82
79
  required_rubygems_version: !ruby/object:Gem::Requirement
83
- none: false
84
80
  requirements:
85
81
  - - ">="
86
82
  - !ruby/object:Gem::Version
87
- hash: 3
88
83
  segments:
89
84
  - 0
90
85
  version: "0"
91
86
  requirements: []
92
87
 
93
88
  rubyforge_project:
94
- rubygems_version: 1.8.24
89
+ rubygems_version: 1.3.6
95
90
  signing_key:
96
91
  specification_version: 3
97
92
  summary: Create and modify Xcode projects from Ruby.
98
93
  test_files: []
99
94
 
100
- has_rdoc: