cocoaseeds 0.6.1 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 41e6d9a834427b838d21d2ca857c0c6933f5da4d
4
- data.tar.gz: 15ac0913f812185465faf744a516690e0bce6e92
3
+ metadata.gz: 6974ed3a3a029f088504399048c7e0eaf371f37f
4
+ data.tar.gz: 247acd2b39bba6a82b1c73cba5ec0ab0069747f9
5
5
  SHA512:
6
- metadata.gz: 23833083862e852475995ff3f78ba9b8bfbc18b24dad36abfb62342c15941f9c80078cbd88bc844255cbc3acfbfa2a9fc75e126b6c9a79cab95b975646778aa1
7
- data.tar.gz: 8967fd0a76b2b02cf253e89df1324759b660652a398a7a8a35e3d88d0877b22ffb03e57d32ab8dd44bf1221e6faa4d8fce664574f82d70cda4229c66c5efc4a3
6
+ metadata.gz: a5a9f67a3537c0ead3ac292eada8254937681a8d4618c4778edb3e5b82aee4664e54cae61245531222dbe8f9d96259743c89e97dbfe9e1c6c617de243dccc940
7
+ data.tar.gz: dcff45bc12c2c6154aebc6e6e1dbefc2f6368788562649ad3f9b5b0e3836ea345bbdaff1df4ded9f00e95653895a3e9ecb812e76dbf4e3a2c844b91589d27b59
data/README.md CHANGED
@@ -113,23 +113,36 @@ Then, all the source files will be automatically downloaded and added to a group
113
113
 
114
114
  ### 3. Enjoy
115
115
 
116
- Build your project and enjoy!
116
+ Build your project and enjoy coding!
117
117
 
118
118
 
119
- Beta Features
120
- -------------
119
+ Tips and Tricks
120
+ ---------------
121
121
 
122
- There are some beta features that seem to work but are not fully tested in the real world. Please keep that in mind if you want to use those features. (Don't worry too much. I'm using them for my company's projects.)
122
+ #### Using branches
123
123
 
124
+ You can specify a branch name instead of the tag. What you need to do is just replacing the tag with the branch name.
124
125
 
125
- #### Branch support
126
+ ```ruby
127
+ github 'devxoul/SwiftyImage', 'swift-2.0', :files => 'SwiftyImage/SwiftyImage.swift'
128
+ ```
129
+
130
+
131
+ #### Excluding files
126
132
 
127
- Previously, you could specify a library only with a tag. However, depending on your situation, such as using an experimental branch like `swift-2.0`, you can specify them with a branch name instead of the tag. What you need to do is just replacing the tag with the branch name.
133
+ Use `exclude_files` to exclude files from `files` pattern.
128
134
 
129
135
  ```ruby
130
- github 'devxoul/SwiftyImage', 'swift-2.0', :files => 'SwiftyImage/SwiftyImage.swift'
136
+ github 'devxoul/Carte', '0.2.2', :files => 'Carte/*', :exclude_files => "Carte/Carte.h"
131
137
  ```
132
138
 
139
+ #### Using resources
140
+
141
+ If the resource files are sprecified in `files`, they will be added to *Copy Bundle Resource* build phase instead of *Compile Source* build phase.
142
+
143
+ ```ruby
144
+ github 'author/Repository', 'x.y.z', :files => ['Source/*', 'Images/*']
145
+ ```
133
146
 
134
147
  #### Resolving filename conflicts
135
148
 
@@ -157,7 +170,7 @@ FAQ
157
170
  ---
158
171
 
159
172
  * Are you using this in real-world projects? (Does Apple allow apps to use CocoaSeeds?)
160
- * Of course I am. I'm developing a social media service that has about 1.6 million users. The app is on AppStore without any complaints from Apple.
173
+ * Of course I am. I'm developing a social media service that has about 2 million users. The app is on AppStore without any complaints from Apple.
161
174
 
162
175
  * Can I ignore **Seeds** folder in VCS *(version control system)*?
163
176
  * Yes, you can ignore the **Seeds** folder (by adding it to `.gitignore` if you use Git).
@@ -249,8 +249,9 @@ module Seeds
249
249
  seed.files = options[:files] || '**/*.{h,m,mm,swift}'
250
250
  seed.exclude_files = options[:exclude_files] || []
251
251
  elsif tag.is_a?(Hash)
252
- seed.commit = tag[:commit][0..6]
253
- seed.files = tag[:files] || '**/*.{h,m,mm,swift}'
252
+ options.merge!(tag)
253
+ seed.commit = options[:commit][0..6]
254
+ seed.files = options[:files] || '**/*.{h,m,mm,swift}'
254
255
  seed.exclude_files = options[:exclude_files] || []
255
256
  end
256
257
  if seed.files.kind_of?(String)
@@ -294,14 +295,15 @@ module Seeds
294
295
  end
295
296
  seed.version = tag
296
297
  seed.files = options[:files] || '**/*.{h,m,mm,swift}'
298
+ seed.exclude_files = options[:exclude_files] || []
297
299
  elsif tag.is_a?(Hash)
298
- seed.commit = tag[:commit][0..6]
299
- seed.files = tag[:files] || '**/*.{h,m,mm,swift}'
300
+ options.merge!(tag)
301
+ seed.commit = options[:commit][0..6]
302
+ seed.files = options[:files] || '**/*.{h,m,mm,swift}'
300
303
  seed.exclude_files = options[:exclude_files] || []
301
304
  end
302
305
  if seed.files.kind_of?(String)
303
306
  seed.files = [seed.files]
304
- seed.exclude_files = options[:exclude_files] || []
305
307
  end
306
308
  if seed.exclude_files.kind_of?(String)
307
309
  seed.exclude_files = [seed.exclude_files]
@@ -528,6 +530,8 @@ module Seeds
528
530
  self.project.targets.each do |target|
529
531
  begin
530
532
  phase = target.sources_build_phase
533
+ # support resources phase
534
+ resource_phase = target.resources_build_phase
531
535
  next unless phase
532
536
  rescue NoMethodError
533
537
  next
@@ -544,6 +548,17 @@ module Seeds
544
548
  end
545
549
  end
546
550
 
551
+ resource_phase.files_references.each do |file|
552
+ begin
553
+ file.real_path
554
+ rescue
555
+ resource_phase.files.each do |build_file|
556
+ resource_phase.files.delete(build_file) if build_file.file_ref == file
557
+ end
558
+ end
559
+ end
560
+
561
+
547
562
  removings = [] # name of seeds going to be removed from the target
548
563
  addings = [] # name of seeds going to be added to the target
549
564
 
@@ -562,18 +577,39 @@ module Seeds
562
577
  phase.files.each do |build_file|
563
578
  phase.files.delete(build_file) if build_file.file_ref == file
564
579
  end
580
+ resource_phase.files.each do |build_file|
581
+ resource_phase.files.delete(build_file) if build_file.file_ref == file
582
+ end
565
583
  end
566
584
 
567
585
  addings.each do |seed_names|
568
586
  next if file.name.end_with? ".h"
569
587
  next if not seed_names.include?(file.parent.name)
570
588
  uuid = Xcodeproj::uuid_with_name "#{target.name}:#{file.name}"
571
- phase.add_file_reference_with_uuid(file, uuid, true)
589
+ # Treat a file as resource file unless confirm it can be compiled.
590
+ if self.valid_source_file?(file)
591
+ phase.add_file_reference_with_uuid(file, uuid, true)
592
+ else
593
+ resource_phase.add_file_reference_with_uuid(file, uuid, true)
594
+ end
595
+
572
596
  end
573
597
  end
574
598
  end
575
599
  end
576
600
 
601
+ # Determines whether there's a source file.
602
+ #
603
+ # @!visibility private
604
+ #
605
+ def valid_source_file? filename
606
+ suffixs = [".h", ".c", ".m", ".mm", ".swift", ".cpp"]
607
+ suffixs.each do |suffix|
608
+ return true if filename.name.end_with? suffix
609
+ end
610
+ return false
611
+ end
612
+
577
613
  # Writes Seedfile.lock file.
578
614
  #
579
615
  # @!visibility private
@@ -1,3 +1,3 @@
1
1
  module Seeds
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -114,7 +114,7 @@ module Xcodeproj::Project::Object
114
114
  end
115
115
  end
116
116
 
117
- class PBXSourcesBuildPhase
117
+ class AbstractBuildPhase
118
118
 
119
119
  # Adds the file reference with given UUID.
120
120
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoaseeds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Suyeol Jeon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-28 00:00:00.000000000 Z
11
+ date: 2016-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcodeproj