xcodeproj 0.2.0.rc2 → 0.2.0.rc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Xcodeproj
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/CocoaPods/Xcodeproj.png)](https://secure.travis-ci.org/CocoaPods/Xcodeproj)
3
+ [![Master Build Status](https://secure.travis-ci.org/CocoaPods/Xcodeproj.png?branch=master)](https://secure.travis-ci.org/CocoaPods/Xcodeproj)
4
+ [![Develop Build Status](https://secure.travis-ci.org/CocoaPods/Xcodeproj.png?branch=develop)](https://secure.travis-ci.org/CocoaPods/Xcodeproj)
4
5
 
5
6
  Xcodeproj lets you create and modify Xcode projects from [Ruby][ruby].
6
7
  Script boring management tasks or build Xcode-friendly libraries. Also includes
data/lib/xcodeproj.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
- VERSION = '0.2.0.rc2'
2
+ VERSION = '0.2.0.rc3'
3
3
 
4
4
  autoload :Config, 'xcodeproj/config'
5
5
  autoload :Project, 'xcodeproj/project'
@@ -102,25 +102,57 @@ module Xcodeproj
102
102
  build_phases.list_by_class(PBXShellScriptBuildPhase)
103
103
  end
104
104
 
105
- # Finds an existing file reference or creates a new one.
106
- def add_source_file(path, copy_header_phase = nil, compiler_flags = nil)
107
- file = @project.files.find { |file| file.path == path.to_s } || @project.files.new('path' => path.to_s)
108
- build_file = file.build_files.new
109
- if path.extname == '.h'
110
- build_file.settings = { 'ATTRIBUTES' => ["Public"] }
111
- # Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed:
112
- # https://github.com/alloy/cocoapods/issues/13
113
- #phase = copy_header_phase || headers_build_phases.first
114
- phase = copy_header_phase || copy_files_build_phases.first
115
- phase.build_files << build_file
116
- else
117
- build_file.settings = { 'COMPILER_FLAGS' => compiler_flags } if compiler_flags
118
- source_build_phases.first.build_files << build_file
105
+ # Adds source files to the target.
106
+ #
107
+ # @note
108
+ # It finds an existing file reference or creates a new one.
109
+ #
110
+ # @param source_file_descriptions [Array<SourceFileDescription>] The
111
+ # description of the source files to add.
112
+ #
113
+ # @return [Array<PBXFileReference>]
114
+ #
115
+ def add_source_files(source_file_descriptions)
116
+ # Cache the files for performance.
117
+ files = @project.files.to_a
118
+ new_files = []
119
+ source_file_descriptions.each do |source_file_description|
120
+ path = source_file_description.path
121
+ copy_header_phase = source_file_description.copy_header_phase
122
+ compiler_flags = source_file_description.compiler_flags
123
+
124
+ file = (files + new_files).find { |file| file.path == path.to_s } || @project.files.new('path' => path.to_s)
125
+ build_file = file.build_files.new
126
+ if path.extname == '.h'
127
+ build_file.settings = { 'ATTRIBUTES' => ["Public"] }
128
+ # Working around a bug in Xcode 4.2 betas, remove this once the Xcode bug is fixed:
129
+ # https://github.com/alloy/cocoapods/issues/13
130
+ #phase = copy_header_phase || headers_build_phases.first
131
+ phase = copy_header_phase || copy_files_build_phases.first
132
+ phase.build_files << build_file
133
+ else
134
+ build_file.settings = { 'COMPILER_FLAGS' => compiler_flags } if compiler_flags && !compiler_flags.empty?
135
+ source_build_phases.first.build_files << build_file
136
+ end
137
+ new_files << file
119
138
  end
120
- file
139
+ new_files
121
140
  end
122
- end
123
141
 
142
+ # Struct representing the description needed to add a source file to
143
+ # the target.
144
+ #
145
+ # @!attribute path
146
+ # @return [Pathname] The path of the file.
147
+ #
148
+ # @!attribute compiler_flags
149
+ # @return [String] Any compiler flag.
150
+ #
151
+ # @!attribute copy_header_phase
152
+ # @return [PBXCopyFilesBuildPhase].
153
+ #
154
+ SourceFileDescription = Struct.new(:path, :compiler_flags, :copy_header_phase)
155
+ end
124
156
  end
125
157
  end
126
158
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.rc2
4
+ version: 0.2.0.rc3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-05 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
15
15
  boring management tasks or build Xcode-friendly libraries. Also includes support
@@ -54,6 +54,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
54
  - - ! '>='
55
55
  - !ruby/object:Gem::Version
56
56
  version: '0'
57
+ segments:
58
+ - 0
59
+ hash: 2502042793205996939
57
60
  required_rubygems_version: !ruby/object:Gem::Requirement
58
61
  none: false
59
62
  requirements:
@@ -62,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
65
  version: '0'
63
66
  requirements: []
64
67
  rubyforge_project:
65
- rubygems_version: 1.8.23
68
+ rubygems_version: 1.8.24
66
69
  signing_key:
67
70
  specification_version: 3
68
71
  summary: Create and modify Xcode projects from Ruby.