xcodeproj 0.2.2 → 0.2.3

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/lib/xcodeproj.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Xcodeproj
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
 
4
4
  autoload :Config, 'xcodeproj/config'
5
5
  autoload :Project, 'xcodeproj/project'
@@ -1,5 +1,3 @@
1
- require 'xcodeproj/inflector'
2
-
3
1
  module Xcodeproj
4
2
  class Project
5
3
  module Object
@@ -1,4 +1,4 @@
1
- require 'xcodeproj/inflector'
1
+ require 'active_support/inflector'
2
2
 
3
3
  module Xcodeproj
4
4
  class Project
metadata CHANGED
@@ -1,27 +1,48 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: xcodeproj
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 17
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 3
10
+ version: 0.2.3
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Eloy Duran
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Xcodeproj lets you create and modify Xcode projects from Ruby. Script
15
- boring management tasks or build Xcode-friendly libraries. Also includes support
16
- for Xcode workspaces (.xcworkspace) and configuration files (.xcconfig).
17
+
18
+ date: 2012-07-06 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activesupport
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 3
31
+ - 2
32
+ - 6
33
+ version: 3.2.6
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ 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).
17
37
  email: eloy.de.enige@gmail.com
18
38
  executables: []
19
- extensions:
39
+
40
+ extensions:
20
41
  - ext/xcodeproj/extconf.rb
21
42
  extra_rdoc_files: []
22
- files:
43
+
44
+ files:
23
45
  - lib/xcodeproj/config.rb
24
- - lib/xcodeproj/inflector.rb
25
46
  - lib/xcodeproj/project/association/has_many.rb
26
47
  - lib/xcodeproj/project/association/has_one.rb
27
48
  - lib/xcodeproj/project/association/reflection.rb
@@ -41,33 +62,39 @@ files:
41
62
  - README.md
42
63
  - LICENSE
43
64
  homepage: https://github.com/cocoapods/xcodeproj
44
- licenses:
65
+ licenses:
45
66
  - MIT
46
67
  post_install_message:
47
68
  rdoc_options: []
48
- require_paths:
69
+
70
+ require_paths:
49
71
  - ext
50
72
  - lib
51
- required_ruby_version: !ruby/object:Gem::Requirement
73
+ required_ruby_version: !ruby/object:Gem::Requirement
52
74
  none: false
53
- requirements:
54
- - - ! '>='
55
- - !ruby/object:Gem::Version
56
- version: '0'
57
- segments:
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ hash: 3
79
+ segments:
58
80
  - 0
59
- hash: -1098454866419318314
60
- required_rubygems_version: !ruby/object:Gem::Requirement
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
83
  none: false
62
- requirements:
63
- - - ! '>='
64
- - !ruby/object:Gem::Version
65
- version: '0'
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 3
88
+ segments:
89
+ - 0
90
+ version: "0"
66
91
  requirements: []
92
+
67
93
  rubyforge_project:
68
94
  rubygems_version: 1.8.24
69
95
  signing_key:
70
96
  specification_version: 3
71
97
  summary: Create and modify Xcode projects from Ruby.
72
98
  test_files: []
99
+
73
100
  has_rdoc:
@@ -1,453 +0,0 @@
1
- # encoding: utf-8
2
-
3
- # This is part of ActiveSupport, which is available under the MIT license>
4
- #
5
- # Copyright (c) 2005-2010 David Heinemeier Hansson
6
- #
7
- # From files:
8
- # * https://raw.github.com/rails/rails/2-3-stable/activesupport/lib/active_support/inflector.rb
9
- # * https://raw.github.com/rails/rails/2-3-stable/activesupport/lib/active_support/inflections.rb
10
- # * https://raw.github.com/rails/rails/2-3-stable/activesupport/lib/active_support/core_ext/string/inflections.rb
11
-
12
- require 'singleton'
13
-
14
- module Xcodeproj
15
- module ActiveSupport
16
- # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without,
17
- # and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept
18
- # in inflections.rb.
19
- #
20
- # The Rails core team has stated patches for the inflections library will not be accepted
21
- # in order to avoid breaking legacy applications which may be relying on errant inflections.
22
- # If you discover an incorrect inflection and require it for your application, you'll need
23
- # to correct it yourself (explained below).
24
- module Inflector
25
- extend self
26
-
27
- # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
28
- # inflection rules. Examples:
29
- #
30
- # ActiveSupport::Inflector.inflections do |inflect|
31
- # inflect.plural /^(ox)$/i, '\1\2en'
32
- # inflect.singular /^(ox)en/i, '\1'
33
- #
34
- # inflect.irregular 'octopus', 'octopi'
35
- #
36
- # inflect.uncountable "equipment"
37
- # end
38
- #
39
- # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the
40
- # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may
41
- # already have been loaded.
42
- class Inflections
43
- include Singleton
44
-
45
- attr_reader :plurals, :singulars, :uncountables, :humans
46
-
47
- def initialize
48
- @plurals, @singulars, @uncountables, @humans = [], [], [], []
49
- end
50
-
51
- # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
52
- # The replacement should always be a string that may include references to the matched data from the rule.
53
- def plural(rule, replacement)
54
- @uncountables.delete(rule) if rule.is_a?(String)
55
- @uncountables.delete(replacement)
56
- @plurals.insert(0, [rule, replacement])
57
- end
58
-
59
- # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression.
60
- # The replacement should always be a string that may include references to the matched data from the rule.
61
- def singular(rule, replacement)
62
- @uncountables.delete(rule) if rule.is_a?(String)
63
- @uncountables.delete(replacement)
64
- @singulars.insert(0, [rule, replacement])
65
- end
66
-
67
- # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used
68
- # for strings, not regular expressions. You simply pass the irregular in singular and plural form.
69
- #
70
- # Examples:
71
- # irregular 'octopus', 'octopi'
72
- # irregular 'person', 'people'
73
- def irregular(singular, plural)
74
- @uncountables.delete(singular)
75
- @uncountables.delete(plural)
76
- if singular[0,1].upcase == plural[0,1].upcase
77
- plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1])
78
- singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1])
79
- else
80
- plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
81
- plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
82
- singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1])
83
- singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1])
84
- end
85
- end
86
-
87
- # Add uncountable words that shouldn't be attempted inflected.
88
- #
89
- # Examples:
90
- # uncountable "money"
91
- # uncountable "money", "information"
92
- # uncountable %w( money information rice )
93
- def uncountable(*words)
94
- (@uncountables << words).flatten!
95
- end
96
-
97
- # Specifies a humanized form of a string by a regular expression rule or by a string mapping.
98
- # When using a regular expression based replacement, the normal humanize formatting is called after the replacement.
99
- # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name')
100
- #
101
- # Examples:
102
- # human /_cnt$/i, '\1_count'
103
- # human "legacy_col_person_name", "Name"
104
- def human(rule, replacement)
105
- @humans.insert(0, [rule, replacement])
106
- end
107
-
108
- # Clears the loaded inflections within a given scope (default is <tt>:all</tt>).
109
- # Give the scope as a symbol of the inflection type, the options are: <tt>:plurals</tt>,
110
- # <tt>:singulars</tt>, <tt>:uncountables</tt>, <tt>:humans</tt>.
111
- #
112
- # Examples:
113
- # clear :all
114
- # clear :plurals
115
- def clear(scope = :all)
116
- case scope
117
- when :all
118
- @plurals, @singulars, @uncountables = [], [], []
119
- else
120
- instance_variable_set "@#{scope}", []
121
- end
122
- end
123
- end
124
-
125
- # Yields a singleton instance of Inflector::Inflections so you can specify additional
126
- # inflector rules.
127
- #
128
- # Example:
129
- # ActiveSupport::Inflector.inflections do |inflect|
130
- # inflect.uncountable "rails"
131
- # end
132
- def inflections
133
- if block_given?
134
- yield Inflections.instance
135
- else
136
- Inflections.instance
137
- end
138
- end
139
-
140
- # Returns the plural form of the word in the string.
141
- #
142
- # Examples:
143
- # "post".pluralize # => "posts"
144
- # "octopus".pluralize # => "octopi"
145
- # "sheep".pluralize # => "sheep"
146
- # "words".pluralize # => "words"
147
- # "CamelOctopus".pluralize # => "CamelOctopi"
148
- def pluralize(word)
149
- result = word.to_s.dup
150
-
151
- if word.empty? || inflections.uncountables.include?(result.downcase)
152
- result
153
- else
154
- inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
155
- result
156
- end
157
- end
158
-
159
- # The reverse of +pluralize+, returns the singular form of a word in a string.
160
- #
161
- # Examples:
162
- # "posts".singularize # => "post"
163
- # "octopi".singularize # => "octopus"
164
- # "sheep".singluarize # => "sheep"
165
- # "word".singularize # => "word"
166
- # "CamelOctopi".singularize # => "CamelOctopus"
167
- def singularize(word)
168
- result = word.to_s.dup
169
-
170
- if inflections.uncountables.any? { |inflection| result =~ /#{inflection}\Z/i }
171
- result
172
- else
173
- inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
174
- result
175
- end
176
- end
177
-
178
- # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+
179
- # is set to <tt>:lower</tt> then +camelize+ produces lowerCamelCase.
180
- #
181
- # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
182
- #
183
- # Examples:
184
- # "active_record".camelize # => "ActiveRecord"
185
- # "active_record".camelize(:lower) # => "activeRecord"
186
- # "active_record/errors".camelize # => "ActiveRecord::Errors"
187
- # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
188
- def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
189
- if first_letter_in_uppercase
190
- lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
191
- else
192
- lower_case_and_underscored_word[0,1].downcase + camelize(lower_case_and_underscored_word)[1..-1]
193
- end
194
- end
195
-
196
- # Capitalizes all the words and replaces some characters in the string to create
197
- # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
198
- # used in the Rails internals.
199
- #
200
- # +titleize+ is also aliased as as +titlecase+.
201
- #
202
- # Examples:
203
- # "man from the boondocks".titleize # => "Man From The Boondocks"
204
- # "x-men: the last stand".titleize # => "X Men: The Last Stand"
205
- def titleize(word)
206
- humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize }
207
- end
208
-
209
- # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
210
- #
211
- # Changes '::' to '/' to convert namespaces to paths.
212
- #
213
- # Examples:
214
- # "ActiveRecord".underscore # => "active_record"
215
- # "ActiveRecord::Errors".underscore # => active_record/errors
216
- def underscore(camel_cased_word)
217
- camel_cased_word.to_s.gsub(/::/, '/').
218
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
219
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
220
- tr("-", "_").
221
- downcase
222
- end
223
-
224
- # Replaces underscores with dashes in the string.
225
- #
226
- # Example:
227
- # "puni_puni" # => "puni-puni"
228
- def dasherize(underscored_word)
229
- underscored_word.gsub(/_/, '-')
230
- end
231
-
232
- # Capitalizes the first word and turns underscores into spaces and strips a
233
- # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output.
234
- #
235
- # Examples:
236
- # "employee_salary" # => "Employee salary"
237
- # "author_id" # => "Author"
238
- def humanize(lower_case_and_underscored_word)
239
- result = lower_case_and_underscored_word.to_s.dup
240
-
241
- inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
242
- result.gsub(/_id$/, "").gsub(/_/, " ").capitalize
243
- end
244
-
245
- # Removes the module part from the expression in the string.
246
- #
247
- # Examples:
248
- # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
249
- # "Inflections".demodulize # => "Inflections"
250
- def demodulize(class_name_in_module)
251
- class_name_in_module.to_s.gsub(/^.*::/, '')
252
- end
253
-
254
- # Create a class name from a plural table name like Rails does for table names to models.
255
- # Note that this returns a string and not a Class. (To convert to an actual class
256
- # follow +classify+ with +constantize+.)
257
- #
258
- # Examples:
259
- # "egg_and_hams".classify # => "EggAndHam"
260
- # "posts".classify # => "Post"
261
- #
262
- # Singular names are not handled correctly:
263
- # "business".classify # => "Busines"
264
- def classify(table_name)
265
- # strip out any leading schema name
266
- camelize(singularize(table_name.to_s.sub(/.*\./, '')))
267
- end
268
-
269
- # Turns a number into an ordinal string used to denote the position in an
270
- # ordered sequence such as 1st, 2nd, 3rd, 4th.
271
- #
272
- # Examples:
273
- # ordinalize(1) # => "1st"
274
- # ordinalize(2) # => "2nd"
275
- # ordinalize(1002) # => "1002nd"
276
- # ordinalize(1003) # => "1003rd"
277
- def ordinalize(number)
278
- if (11..13).include?(number.to_i % 100)
279
- "#{number}th"
280
- else
281
- case number.to_i % 10
282
- when 1; "#{number}st"
283
- when 2; "#{number}nd"
284
- when 3; "#{number}rd"
285
- else "#{number}th"
286
- end
287
- end
288
- end
289
- end
290
-
291
- Inflector.inflections do |inflect|
292
- inflect.plural(/$/, 's')
293
- inflect.plural(/s$/i, 's')
294
- inflect.plural(/(ax|test)is$/i, '\1es')
295
- inflect.plural(/(octop|vir)us$/i, '\1i')
296
- inflect.plural(/(alias|status)$/i, '\1es')
297
- inflect.plural(/(bu)s$/i, '\1ses')
298
- inflect.plural(/(buffal|tomat)o$/i, '\1oes')
299
- inflect.plural(/([ti])um$/i, '\1a')
300
- inflect.plural(/sis$/i, 'ses')
301
- inflect.plural(/(?:([^f])fe|([lr])f)$/i, '\1\2ves')
302
- inflect.plural(/(hive)$/i, '\1s')
303
- inflect.plural(/([^aeiouy]|qu)y$/i, '\1ies')
304
- inflect.plural(/(x|ch|ss|sh)$/i, '\1es')
305
- inflect.plural(/(matr|vert|ind)(?:ix|ex)$/i, '\1ices')
306
- inflect.plural(/([m|l])ouse$/i, '\1ice')
307
- inflect.plural(/^(ox)$/i, '\1en')
308
- inflect.plural(/(quiz)$/i, '\1zes')
309
-
310
- inflect.singular(/s$/i, '')
311
- inflect.singular(/(n)ews$/i, '\1ews')
312
- inflect.singular(/([ti])a$/i, '\1um')
313
- inflect.singular(/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis')
314
- inflect.singular(/(^analy)ses$/i, '\1sis')
315
- inflect.singular(/([^f])ves$/i, '\1fe')
316
- inflect.singular(/(hive)s$/i, '\1')
317
- inflect.singular(/(tive)s$/i, '\1')
318
- inflect.singular(/([lr])ves$/i, '\1f')
319
- inflect.singular(/([^aeiouy]|qu)ies$/i, '\1y')
320
- inflect.singular(/(s)eries$/i, '\1eries')
321
- inflect.singular(/(m)ovies$/i, '\1ovie')
322
- inflect.singular(/(x|ch|ss|sh)es$/i, '\1')
323
- inflect.singular(/([m|l])ice$/i, '\1ouse')
324
- inflect.singular(/(bus)es$/i, '\1')
325
- inflect.singular(/(o)es$/i, '\1')
326
- inflect.singular(/(shoe)s$/i, '\1')
327
- inflect.singular(/(cris|ax|test)es$/i, '\1is')
328
- inflect.singular(/(octop|vir)i$/i, '\1us')
329
- inflect.singular(/(alias|status)es$/i, '\1')
330
- inflect.singular(/^(ox)en/i, '\1')
331
- inflect.singular(/(vert|ind)ices$/i, '\1ex')
332
- inflect.singular(/(matr)ices$/i, '\1ix')
333
- inflect.singular(/(quiz)zes$/i, '\1')
334
- inflect.singular(/(database)s$/i, '\1')
335
-
336
- inflect.irregular('person', 'people')
337
- inflect.irregular('man', 'men')
338
- inflect.irregular('child', 'children')
339
- inflect.irregular('sex', 'sexes')
340
- inflect.irregular('move', 'moves')
341
- inflect.irregular('cow', 'kine')
342
-
343
- inflect.uncountable(%w(equipment information rice money species series fish sheep jeans))
344
- end
345
- end
346
- end
347
-
348
- # String inflections define new methods on the String class to transform names for different purposes.
349
- class String
350
- include Xcodeproj::ActiveSupport
351
-
352
- # Returns the plural form of the word in the string.
353
- #
354
- # "post".pluralize # => "posts"
355
- # "octopus".pluralize # => "octopi"
356
- # "sheep".pluralize # => "sheep"
357
- # "words".pluralize # => "words"
358
- # "the blue mailman".pluralize # => "the blue mailmen"
359
- # "CamelOctopus".pluralize # => "CamelOctopi"
360
- def pluralize
361
- Inflector.pluralize(self)
362
- end
363
-
364
- # The reverse of +pluralize+, returns the singular form of a word in a string.
365
- #
366
- # "posts".singularize # => "post"
367
- # "octopi".singularize # => "octopus"
368
- # "sheep".singularize # => "sheep"
369
- # "word".singularize # => "word"
370
- # "the blue mailmen".singularize # => "the blue mailman"
371
- # "CamelOctopi".singularize # => "CamelOctopus"
372
- def singularize
373
- Inflector.singularize(self)
374
- end
375
-
376
- # By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
377
- # is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
378
- #
379
- # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
380
- #
381
- # "active_record".camelize # => "ActiveRecord"
382
- # "active_record".camelize(:lower) # => "activeRecord"
383
- # "active_record/errors".camelize # => "ActiveRecord::Errors"
384
- # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
385
- def camelize(first_letter = :upper)
386
- case first_letter
387
- when :upper then Inflector.camelize(self, true)
388
- when :lower then Inflector.camelize(self, false)
389
- end
390
- end
391
- alias_method :camelcase, :camelize
392
-
393
- # Capitalizes all the words and replaces some characters in the string to create
394
- # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
395
- # used in the Rails internals.
396
- #
397
- # +titleize+ is also aliased as +titlecase+.
398
- #
399
- # "man from the boondocks".titleize # => "Man From The Boondocks"
400
- # "x-men: the last stand".titleize # => "X Men: The Last Stand"
401
- def titleize
402
- Inflector.titleize(self)
403
- end
404
- alias_method :titlecase, :titleize
405
-
406
- # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
407
- #
408
- # +underscore+ will also change '::' to '/' to convert namespaces to paths.
409
- #
410
- # "ActiveRecord".underscore # => "active_record"
411
- # "ActiveRecord::Errors".underscore # => active_record/errors
412
- def underscore
413
- Inflector.underscore(self)
414
- end
415
-
416
- # Replaces underscores with dashes in the string.
417
- #
418
- # "puni_puni" # => "puni-puni"
419
- def dasherize
420
- Inflector.dasherize(self)
421
- end
422
-
423
- # Removes the module part from the constant expression in the string.
424
- #
425
- # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
426
- # "Inflections".demodulize # => "Inflections"
427
- def demodulize
428
- Inflector.demodulize(self)
429
- end
430
-
431
- # Create a class name from a plural table name like Rails does for table names to models.
432
- # Note that this returns a string and not a class. (To convert to an actual class
433
- # follow +classify+ with +constantize+.)
434
- #
435
- # "egg_and_hams".classify # => "EggAndHam"
436
- # "posts".classify # => "Post"
437
- #
438
- # Singular names are not handled correctly.
439
- #
440
- # "business".classify # => "Busines"
441
- def classify
442
- Inflector.classify(self)
443
- end
444
-
445
- # Capitalizes the first word, turns underscores into spaces, and strips '_id'.
446
- # Like +titleize+, this is meant for creating pretty output.
447
- #
448
- # "employee_salary" # => "Employee salary"
449
- # "author_id" # => "Author"
450
- def humanize
451
- Inflector.humanize(self)
452
- end
453
- end