cocoaseeds 0.0.12 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -0
- data/lib/cocoaseeds/core.rb +43 -1
- data/lib/cocoaseeds/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d9cfde5f682efaad416bc63b110348fc5ab3b29
|
4
|
+
data.tar.gz: 0d0d7d528cf901e936c88e5632ccdcdd264fdc7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d3dde27844f52b607a3ab7dbc22823f35bce5fcc31f9d3acdc693b47efae38734f71d2a870f55d3a1d0a2db7cacecf0ccd9a7fcfecde75521a77f1d72ea894
|
7
|
+
data.tar.gz: 169a2941a8aef9a71e947349bd6156af40ec3cb578506e0b7bcd0c3ed375df16706b7239e420358e5c858dfee559a5e58ee8dd8c733e5337db0f1ed5a6a47c9f
|
data/README.md
CHANGED
@@ -70,6 +70,29 @@ Then all the source files will be automatically added to your Xcode project with
|
|
70
70
|
![Seeds-in-Xcode](https://cloud.githubusercontent.com/assets/931655/7502414/cbe45ecc-f476-11e4-9564-450e8887a054.png)
|
71
71
|
|
72
72
|
|
73
|
+
Resolving Filename Conflicts
|
74
|
+
----------------------------
|
75
|
+
|
76
|
+
Since CocoaSeeds uses including source files directly than linking dynamic frameworks, it is important to make sure that all source file names are different. CocoaSeeds provides a way to do this:
|
77
|
+
|
78
|
+
**Seedfile**
|
79
|
+
|
80
|
+
<pre>
|
81
|
+
<b>swift_seedname_prefix!</b> # add this line
|
82
|
+
|
83
|
+
github "thoughtbot/Argo", "v1.0.3", :files => "Argo/*/*.swift"
|
84
|
+
github "thoughtbot/Runes", "v2.0.0", :files => "Source/*.swift"
|
85
|
+
</pre>
|
86
|
+
|
87
|
+
Then all of source files installed via CocoasSeeds will have file names with seed name as prefix.
|
88
|
+
|
89
|
+
| Before (filename) | After (seedname_filename) |
|
90
|
+
|---|---|
|
91
|
+
| `Seeds/Alamofire/Alamofire.swift` | `Seeds/Alamofire/Alamofire_Alamofire.swift` |
|
92
|
+
| `Seeds/Argo/Operators/Operators.swift` | `Seeds/Argo/Operators/Argo_Operators.swift` |
|
93
|
+
| `Seeds/Runes/Operators.swift` | `Seeds/Runes/Runes_Operators.swift` |
|
94
|
+
|
95
|
+
|
73
96
|
FAQ
|
74
97
|
---
|
75
98
|
|
data/lib/cocoaseeds/core.rb
CHANGED
@@ -70,6 +70,12 @@ module Seeds
|
|
70
70
|
#
|
71
71
|
attr_reader :file_references
|
72
72
|
|
73
|
+
# @return [Boolean] whether append seed name as a prefix to swift files
|
74
|
+
#
|
75
|
+
# @!visibility private
|
76
|
+
#
|
77
|
+
attr_accessor :swift_seedname_prefix
|
78
|
+
|
73
79
|
# @param [String] root_path
|
74
80
|
# The path provided will be used for detecting Xcode project and
|
75
81
|
# Seedfile.
|
@@ -107,6 +113,7 @@ module Seeds
|
|
107
113
|
@targets = {}
|
108
114
|
@source_files = {}
|
109
115
|
@file_references = []
|
116
|
+
@swift_seedname_prefix = false
|
110
117
|
end
|
111
118
|
|
112
119
|
# Read Xcode project, Seedfile and lockfile. An exception will be raised if
|
@@ -166,6 +173,15 @@ module Seeds
|
|
166
173
|
def execute_seedfile
|
167
174
|
@current_target_name = nil
|
168
175
|
|
176
|
+
# Sets `@swift_seedname_prefix` as `true`.
|
177
|
+
#
|
178
|
+
# @!scope method
|
179
|
+
# @!visibility private
|
180
|
+
#
|
181
|
+
def swift_seedname_prefix!()
|
182
|
+
@swift_seedname_prefix = true
|
183
|
+
end
|
184
|
+
|
169
185
|
# Sets `@current_target_name` and executes code block.
|
170
186
|
#
|
171
187
|
# @param [String] names The name of target.
|
@@ -271,12 +287,38 @@ module Seeds
|
|
271
287
|
if seed.files
|
272
288
|
self.source_files[name] = []
|
273
289
|
seed.files.each do |file|
|
274
|
-
|
290
|
+
paths = Dir.glob(File.join(dirname, file))
|
291
|
+
paths.each do |path|
|
292
|
+
path = self.path_with_prefix(seed.name, path)
|
293
|
+
self.source_files[name].push(path)
|
294
|
+
end
|
275
295
|
end
|
276
296
|
end
|
277
297
|
end
|
278
298
|
end
|
279
299
|
|
300
|
+
# Append seed name as a prefix to file name and returns the path.
|
301
|
+
#
|
302
|
+
# @!visibility private
|
303
|
+
#
|
304
|
+
def path_with_prefix(seedname, path)
|
305
|
+
if @swift_seedname_prefix
|
306
|
+
components = path.split("/")
|
307
|
+
prefix = seedname + "_" # Alamofire_
|
308
|
+
filename = components[-1] # Alamofire.swift
|
309
|
+
extension = File.extname(filename) # .swift
|
310
|
+
|
311
|
+
# only swift files can have prefix in filename
|
312
|
+
if extension == '.swift' and not filename.start_with? prefix
|
313
|
+
filename = prefix + filename # Alamofire_Alamofire.swift
|
314
|
+
newpath = components[0...-1].join('/') + '/' + filename
|
315
|
+
File.rename(path, newpath) # rename real files
|
316
|
+
path = newpath
|
317
|
+
end
|
318
|
+
end
|
319
|
+
path
|
320
|
+
end
|
321
|
+
|
280
322
|
# Adds source files to the group 'Seeds' and save its reference to
|
281
323
|
# {#file_references} and removes disused sources files,
|
282
324
|
#
|
data/lib/cocoaseeds/version.rb
CHANGED
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.0
|
4
|
+
version: 0.1.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-07-
|
11
|
+
date: 2015-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|