cocoaseeds 0.0.4 → 0.0.5
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 +4 -4
- data/lib/cocoaseeds/core.rb +32 -14
- data/lib/cocoaseeds/version.rb +1 -1
- data/lib/cocoaseeds/xcodehelper.rb +61 -0
- data/lib/cocoaseeds.rb +1 -0
- 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: 3f3433a51f3e7393a8d018c462d0d62839830334
|
4
|
+
data.tar.gz: 5a4264434da64f6c04376056c8733ef61f3efe33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7090d075190b340e8c71db3d5cec71a330f81000e9de3e562a1a2d1a653b5a405a458c580146e9be1f3bba4238bdab8ca2bc5aa972ed817a4ed6a0d6a3a71620
|
7
|
+
data.tar.gz: ebd2667fc734c4b2192aac7b67d824ff4725765b95e892d59d989809020d647be69a1dfaac2f615958b087eedf739e7116c7ff2add7155746a528509a106f6d8
|
data/lib/cocoaseeds/core.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Seeds
|
2
2
|
class Core
|
3
|
+
attr_accessor :mute
|
4
|
+
|
3
5
|
attr_reader :root_path, :seedfile_path, :lockfile_path
|
4
6
|
attr_accessor :project, :seedfile, :lockfile
|
5
7
|
attr_reader :seeds, :locks, :targets
|
@@ -28,6 +30,7 @@ module Seeds
|
|
28
30
|
self.build_lockfile
|
29
31
|
@seeds = {}
|
30
32
|
@locks = {}
|
33
|
+
@targets = {}
|
31
34
|
@source_files = {}
|
32
35
|
@file_references = []
|
33
36
|
end
|
@@ -55,7 +58,7 @@ module Seeds
|
|
55
58
|
end
|
56
59
|
|
57
60
|
def analyze_dependencies
|
58
|
-
|
61
|
+
say "Anaylizing dependencies"
|
59
62
|
|
60
63
|
# Seedfile.lock
|
61
64
|
if self.lockfile
|
@@ -113,22 +116,22 @@ module Seeds
|
|
113
116
|
def remove_seeds
|
114
117
|
removings = self.locks.keys - self.seeds.keys
|
115
118
|
removings.each do |name|
|
116
|
-
|
119
|
+
say "Removing #{name} (#{self.locks[name].version})".red
|
117
120
|
dirname = File.join(self.root_path, "Seeds", name)
|
118
121
|
FileUtils.rm_rf(dirname)
|
119
122
|
end
|
120
123
|
end
|
121
124
|
|
122
125
|
def install_seeds
|
123
|
-
self.seeds.each do |name, seed|
|
126
|
+
self.seeds.sort.each do |name, seed|
|
124
127
|
dirname = File.join(self.root_path, "Seeds", name)
|
125
128
|
if File.exist?(dirname)
|
126
129
|
tag = `cd #{dirname} && git describe --tags --abbrev=0 2>&1`
|
127
130
|
tag.strip!
|
128
131
|
if tag == seed.version
|
129
|
-
|
132
|
+
say "Using #{name} (#{seed.version})"
|
130
133
|
else
|
131
|
-
|
134
|
+
say "Installing #{name} #{seed.version} (was #{tag})".green
|
132
135
|
`cd #{dirname} 2>&1 &&\
|
133
136
|
git reset HEAD --hard 2>&1 &&\
|
134
137
|
git checkout . 2>&1 &&\
|
@@ -137,13 +140,13 @@ module Seeds
|
|
137
140
|
git checkout #{seed.version} 2>&1`
|
138
141
|
end
|
139
142
|
else
|
140
|
-
|
143
|
+
say "Installing #{name} (#{seed.version})".green
|
141
144
|
output = `git clone #{seed.url} -b #{seed.version} #{dirname} 2>&1`
|
142
145
|
if output.include?("not found")
|
143
146
|
if output.include?("repository")
|
144
|
-
|
147
|
+
say "[!] #{name}: Couldn't find the repository.".red
|
145
148
|
elsif output.include?("upstream")
|
146
|
-
|
149
|
+
say "[!] #{name}: Couldn't find the tag `#{seed.version}`.".red
|
147
150
|
end
|
148
151
|
end
|
149
152
|
end
|
@@ -157,9 +160,15 @@ module Seeds
|
|
157
160
|
end
|
158
161
|
|
159
162
|
def configure_project
|
160
|
-
|
161
|
-
|
162
|
-
group = self.project[
|
163
|
+
say "Configuring #{self.project.path.basename}"
|
164
|
+
|
165
|
+
group = self.project["Seeds"]
|
166
|
+
if group
|
167
|
+
group.clear
|
168
|
+
else
|
169
|
+
uuid = Digest::MD5.hexdigest("Seeds").upcase
|
170
|
+
group = self.project.new_group_with_uuid("Seeds", uuid)
|
171
|
+
end
|
163
172
|
|
164
173
|
# remove existing group that doesn't have any file references
|
165
174
|
group.groups.each do |seedgroup|
|
@@ -172,10 +181,14 @@ module Seeds
|
|
172
181
|
end
|
173
182
|
|
174
183
|
self.source_files.each do |seedname, filepaths|
|
175
|
-
|
184
|
+
uuid = Digest::MD5.hexdigest("Seeds/#{seedname}").upcase
|
185
|
+
seedgroup = group[seedname] ||
|
186
|
+
group.new_group_with_uuid(seedname, uuid)
|
176
187
|
filepaths.each do |path|
|
177
188
|
filename = path.split('/')[-1]
|
178
|
-
|
189
|
+
uuid = Digest::MD5.hexdigest(path).upcase
|
190
|
+
file_reference = seedgroup[filename] ||
|
191
|
+
seedgroup.new_reference_with_uuid(path, uuid)
|
179
192
|
self.file_references << file_reference
|
180
193
|
end
|
181
194
|
|
@@ -206,7 +219,8 @@ module Seeds
|
|
206
219
|
seed_names = seeds.map { |seed| seed.name }
|
207
220
|
self.file_references.each do |file|
|
208
221
|
if not phase.include?(file) and seed_names.include?(file.parent.name)
|
209
|
-
|
222
|
+
uuid = Digest::MD5.hexdigest("#{target_name}:#{file.name}").upcase
|
223
|
+
phase.add_file_reference_with_uuid(file, uuid, true)
|
210
224
|
end
|
211
225
|
end
|
212
226
|
end
|
@@ -222,5 +236,9 @@ module Seeds
|
|
222
236
|
end
|
223
237
|
end
|
224
238
|
|
239
|
+
def say(*strings)
|
240
|
+
puts strings.join(" ") if not @mute
|
241
|
+
end
|
242
|
+
|
225
243
|
end
|
226
244
|
end
|
data/lib/cocoaseeds/version.rb
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
module Xcodeproj
|
2
|
+
|
2
3
|
class Project
|
4
|
+
|
5
|
+
def new_with_uuid(klass, uuid)
|
6
|
+
if klass.is_a?(String)
|
7
|
+
klass = Object.const_get(klass)
|
8
|
+
end
|
9
|
+
object = klass.new(self, uuid)
|
10
|
+
object.initialize_defaults
|
11
|
+
object
|
12
|
+
end
|
13
|
+
|
14
|
+
def new_group_with_uuid(name, uuid, path = nil, source_tree = :group)
|
15
|
+
main_group.new_group_with_uuid(name, uuid, path, source_tree)
|
16
|
+
end
|
17
|
+
|
3
18
|
def target_named(name)
|
4
19
|
self.targets.each do |target|
|
5
20
|
if target.name == name.to_s
|
@@ -8,10 +23,44 @@ module Xcodeproj
|
|
8
23
|
end
|
9
24
|
nil
|
10
25
|
end
|
26
|
+
|
11
27
|
end
|
12
28
|
end
|
13
29
|
|
30
|
+
|
14
31
|
module Xcodeproj::Project::Object
|
32
|
+
|
33
|
+
class PBXGroup
|
34
|
+
def new_group_with_uuid(name, uuid, path = nil, source_tree = :group)
|
35
|
+
group = project.new_with_uuid(PBXGroup, uuid)
|
36
|
+
children << group
|
37
|
+
group.name = name
|
38
|
+
group.set_source_tree(source_tree)
|
39
|
+
group.set_path(path)
|
40
|
+
group
|
41
|
+
end
|
42
|
+
|
43
|
+
def new_reference_with_uuid(path, uuid, source_tree = :group)
|
44
|
+
# customize `FileReferencesFactory.new_file_reference`
|
45
|
+
path = Pathname.new(path)
|
46
|
+
ref = self.project.new_with_uuid(PBXFileReference, uuid)
|
47
|
+
self.children << ref
|
48
|
+
GroupableHelper.set_path_with_source_tree(ref, path, source_tree)
|
49
|
+
ref.set_last_known_file_type
|
50
|
+
|
51
|
+
# customize `FileReferencesFactory.configure_defaults_for_file_reference`
|
52
|
+
if ref.path.include?('/')
|
53
|
+
ref.name = ref.path.split('/').last
|
54
|
+
end
|
55
|
+
if File.extname(ref.path).downcase == '.framework'
|
56
|
+
ref.include_in_index = nil
|
57
|
+
end
|
58
|
+
|
59
|
+
ref
|
60
|
+
end
|
61
|
+
alias_method :new_file_with_uuid, :new_reference_with_uuid
|
62
|
+
end
|
63
|
+
|
15
64
|
class PBXNativeTarget
|
16
65
|
def sources_build_phase()
|
17
66
|
self.build_phases.each do |phase|
|
@@ -24,6 +73,17 @@ module Xcodeproj::Project::Object
|
|
24
73
|
end
|
25
74
|
|
26
75
|
class PBXSourcesBuildPhase
|
76
|
+
def add_file_reference_with_uuid(file_ref, uuid, avoid_duplicates = false)
|
77
|
+
if avoid_duplicates && existing = build_file(file_ref)
|
78
|
+
existing
|
79
|
+
else
|
80
|
+
build_file = project.new_with_uuid(PBXBuildFile, uuid)
|
81
|
+
build_file.file_ref = file_ref
|
82
|
+
files << build_file
|
83
|
+
build_file
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
27
87
|
def include_filename?(pattern)
|
28
88
|
filenames = self.file_display_names
|
29
89
|
if filenames.length == 0 and pattern
|
@@ -37,4 +97,5 @@ module Xcodeproj::Project::Object
|
|
37
97
|
return true
|
38
98
|
end
|
39
99
|
end
|
100
|
+
|
40
101
|
end
|
data/lib/cocoaseeds.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.0.5
|
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-05-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcodeproj
|