xcodeproj 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  module Xcodeproj
2
4
 
3
5
  # This class holds the data for a Xcode build settings file (xcconfig) and
@@ -136,12 +138,13 @@ module Xcodeproj
136
138
  #
137
139
  def merge!(xcconfig)
138
140
  if xcconfig.is_a? Config
139
- @attributes.merge!(xcconfig.attributes) { |key, v1, v2| "#{v1} #{v2}" }
141
+ merge_attributes!(xcconfig.attributes)
140
142
  @libraries.merge(xcconfig.libraries)
141
143
  @frameworks.merge(xcconfig.frameworks)
142
144
  @weak_frameworks.merge(xcconfig.weak_frameworks)
143
145
  else
144
- @attributes.merge!(xcconfig.to_hash) { |key, v1, v2| "#{v1} #{v2}" }
146
+ merge_attributes!(xcconfig.to_hash)
147
+
145
148
  # Parse frameworks and libraries. Then remove them from the linker
146
149
  # flags
147
150
  flags = @attributes['OTHER_LDFLAGS']
@@ -225,6 +228,21 @@ module Xcodeproj
225
228
  hash
226
229
  end
227
230
 
231
+ # Merges the given attributes hash while ensuring values are not duplicated.
232
+ #
233
+ # @param [Hash] attributes
234
+ # The attributes hash to merge into @attributes.
235
+ #
236
+ # @return [void]
237
+ #
238
+ def merge_attributes!(attributes)
239
+ @attributes.merge!(attributes) do |_, v1, v2|
240
+ v1, v2 = v1.strip, v2.strip
241
+ existing = v1.strip.shellsplit
242
+ existing.include?(v2) ? v1 : "#{v1} #{v2}"
243
+ end
244
+ end
245
+
228
246
  # Strips the comments from a line of an xcconfig string.
229
247
  #
230
248
  # @param [String] line
@@ -111,6 +111,8 @@ module Xcodeproj
111
111
  'GCC_SYMBOLS_PRIVATE_EXTERN' => 'NO',
112
112
  'GCC_OPTIMIZATION_LEVEL' => '0',
113
113
  'COPY_PHASE_STRIP' => 'NO',
114
+ # TODO: enable after Xcode 4
115
+ # 'ONLY_ACTIVE_ARCH' => 'YES',
114
116
  }.freeze,
115
117
  :release => {
116
118
  'OTHER_CFLAGS' => ['-DNS_BLOCK_ASSERTIONS=1', "$(inherited)"],
@@ -144,6 +146,17 @@ module Xcodeproj
144
146
  }.freeze,
145
147
  }.freeze
146
148
 
149
+ # @return [Hash] The default build settings for a new project.
150
+ #
151
+ PROJECT_DEFAULT_BUILD_SETTINGS = {
152
+ :release => {
153
+ }.freeze,
154
+ :debug => {
155
+ # TODO: enable after Xcode 4
156
+ # 'ONLY_ACTIVE_ARCH' => 'YES',
157
+ }.freeze,
158
+ }.freeze
159
+
147
160
  # @return [Hash] The corresponding numeric value of each copy build phase
148
161
  # destination.
149
162
  #
@@ -109,8 +109,12 @@ module Xcodeproj
109
109
  # Creates a new file reference with the given path and adds it to the
110
110
  # group or to an optional subpath.
111
111
  #
112
- # @note The subpath is created if needed, similar to the UNIX command
113
- # `mkdir -p`
112
+ # @note The subpath is created if needed, similar to the UNIX command
113
+ # `mkdir -p`
114
+ #
115
+ # @note To closely match the Xcode behaviour the name attribute of
116
+ # the file reference is set only if the path of the file is not
117
+ # equal to the path of the group.
114
118
  #
115
119
  # @param [#to_s] path
116
120
  # the file system path of the file.
@@ -128,6 +132,12 @@ module Xcodeproj
128
132
 
129
133
  target = find_subpath(sub_group_path, true)
130
134
  target.children << file
135
+
136
+ same_path_of_group = target.path == file.pathname.dirname.to_s
137
+ same_path_project = file.pathname.dirname.to_s == '.' && target.path.nil?
138
+ unless same_path_of_group || same_path_project
139
+ file.name = file.pathname.basename.to_s
140
+ end
131
141
  file
132
142
  end
133
143
 
@@ -118,7 +118,7 @@ module Xcodeproj
118
118
  %w| Release Debug |.each do |name|
119
119
  build_configuration = new(XCBuildConfiguration)
120
120
  build_configuration.name = name
121
- build_configuration.build_settings = {}
121
+ build_configuration.build_settings = Constants::PROJECT_DEFAULT_BUILD_SETTINGS[name.downcase.to_sym].dup
122
122
  config_list.build_configurations << build_configuration
123
123
  end
124
124
 
data/lib/xcodeproj.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
- VERSION = '0.8.0' unless defined? Xcodeproj::VERSION
2
+ VERSION = '0.8.1' unless defined? Xcodeproj::VERSION
3
3
 
4
4
  class PlainInformative < StandardError
5
5
  end
metadata CHANGED
@@ -1,53 +1,62 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
- version: !ruby/object:Gem::Version
4
- version: 0.8.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 61
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 1
10
+ version: 0.8.1
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - Eloy Duran
8
14
  autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
- date: 2013-07-03 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-07-10 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
14
21
  name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: 3.2.13
20
- type: :runtime
21
22
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
24
26
  - - ~>
25
- - !ruby/object:Gem::Version
27
+ - !ruby/object:Gem::Version
28
+ hash: 21
29
+ segments:
30
+ - 3
31
+ - 2
32
+ - 13
26
33
  version: 3.2.13
27
- - !ruby/object:Gem::Dependency
28
- name: colored
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '1.2'
34
34
  type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: colored
35
38
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
38
42
  - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.2'
41
- description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
42
- boring management tasks or build Xcode-friendly libraries. Also includes support
43
- for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
43
+ - !ruby/object:Gem::Version
44
+ hash: 11
45
+ segments:
46
+ - 1
47
+ - 2
48
+ version: "1.2"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script boring management tasks or build Xcode-friendly libraries. Also includes support for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
44
52
  email: eloy.de.enige@gmail.com
45
- executables:
53
+ executables:
46
54
  - xcodeproj
47
- extensions:
55
+ extensions:
48
56
  - ext/xcodeproj/extconf.rb
49
57
  extra_rdoc_files: []
50
- files:
58
+
59
+ files:
51
60
  - lib/xcodeproj/command/project_diff.rb
52
61
  - lib/xcodeproj/command/show.rb
53
62
  - lib/xcodeproj/command/target_diff.rb
@@ -83,29 +92,39 @@ files:
83
92
  - LICENSE
84
93
  - bin/xcodeproj
85
94
  homepage: https://github.com/cocoapods/xcodeproj
86
- licenses:
95
+ licenses:
87
96
  - MIT
88
- metadata: {}
89
97
  post_install_message:
90
98
  rdoc_options: []
91
- require_paths:
99
+
100
+ require_paths:
92
101
  - ext
93
102
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
99
- required_rubygems_version: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ none: false
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ hash: 3
109
+ segments:
110
+ - 0
111
+ version: "0"
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ hash: 3
118
+ segments:
119
+ - 0
120
+ version: "0"
104
121
  requirements: []
122
+
105
123
  rubyforge_project:
106
- rubygems_version: 2.0.3
124
+ rubygems_version: 1.8.24
107
125
  signing_key:
108
126
  specification_version: 3
109
127
  summary: Create and modify Xcode projects from Ruby.
110
128
  test_files: []
129
+
111
130
  has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 97d8e4a22727dedcf6fdb5519a3e6fd750f460cd
4
- data.tar.gz: 58f5c265c6296a779af208542a4b653a1d1b2a5e
5
- SHA512:
6
- metadata.gz: 7413a13df962717a8563f8e5c5fd1247d159afd52cb8ae96e268f93a74e1baf22e0250741f7434c8619181ff4263aed1724139d642fe70c171990fcf7ad6e732
7
- data.tar.gz: 8eb8612c99b268da6da7aab894719b1feabdae35d647a970cf67b52df74dfa3f3bcc611716df54416af0fd272a64609a3a407a3f7e889d3fbf59da50b7c7ba72