dtripper 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/dtripper +16 -1
- data/lib/DTRipperProjectCreator.rb +28 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31173fc674d332089dc7dbca74f30ec9309b4a0c
|
4
|
+
data.tar.gz: 490c9d65f5452cea8edf5893ac7a44ca45b199e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0361146454ead1640447e755f8568d7678db4c6ff612dd368cbc5b9b74a52ce63b9a4949a262cc04bc354aff03a38ef42bd3d3ab222c537c6349e49bfb6a6e5f
|
7
|
+
data.tar.gz: 03ca5b0b4ec754d5956ef61685b1cf05402bdf6c0bc3efa4f96bf96eacf80e5f6705bc303dff2465391531a11453875924bd3f561188ee964744d23d1b635944
|
data/bin/dtripper
CHANGED
@@ -1,4 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'DTRipperProjectCreator'
|
3
3
|
|
4
|
-
|
4
|
+
module_generator = nil
|
5
|
+
if ARGV[0] == "create"
|
6
|
+
if ARGV[1] == nil || ARGV[2] == nil
|
7
|
+
puts "Arguments error:create modulename,moduledir[,mainprojectname[,mainprojectdir]]"
|
8
|
+
return
|
9
|
+
end
|
10
|
+
module_generator = DTRipperProjectCreator::DTModuleGenerator.new(ARGV[1], ARGV[2], ARGV[3], ARGV[4])
|
11
|
+
module_generator.create
|
12
|
+
elsif ARGV[0] == "config"
|
13
|
+
if ARGV[1] == nil || ARGV[2] == nil
|
14
|
+
puts "Arguments error: config modulename,moduledir[,mainprojectname[,mainprojectdir]]"
|
15
|
+
return
|
16
|
+
end
|
17
|
+
module_generator = DTRipperProjectCreator::DTModuleGenerator.new(ARGV[1], ARGV[2], ARGV[3], ARGV[4])
|
18
|
+
module_generator.config
|
19
|
+
end
|
@@ -27,15 +27,22 @@ require 'xcodeproj'
|
|
27
27
|
@replace_rex = replace_rex
|
28
28
|
end
|
29
29
|
def replace
|
30
|
+
if File.exists?(File.join(@proj_dir,@proj_name))
|
31
|
+
puts "Already have project named '#{@proj_name}',If you want to create new one,delete old one please"
|
32
|
+
return
|
33
|
+
end
|
34
|
+
|
35
|
+
|
30
36
|
unzip_file_path = File.join(@proj_dir,@zip_file_name)
|
31
37
|
if File.exists?(unzip_file_path)
|
32
38
|
puts "templete project zip file is already exist"
|
33
|
-
|
34
|
-
puts "Downloading templete project...."
|
35
|
-
File.open(unzip_file_path, 'wb') {|f| f.write(open(@down_load_url) {|f1| f1.read})}
|
36
|
-
puts "Templete project download success!!"
|
39
|
+
File.delete(unzip_file_path)
|
37
40
|
end
|
38
41
|
|
42
|
+
puts "Downloading templete project...."
|
43
|
+
File.open(unzip_file_path, 'wb') {|f| f.write(open(@down_load_url) {|f1| f1.read})}
|
44
|
+
puts "Templete project download success!!"
|
45
|
+
|
39
46
|
puts "Start unzip templete project...."
|
40
47
|
|
41
48
|
unzip(unzip_file_path)
|
@@ -135,7 +142,6 @@ require 'xcodeproj'
|
|
135
142
|
|
136
143
|
def self.create_workspace(proj_dir,proj_name)
|
137
144
|
proj_path = File.join(proj_dir,proj_name,"#{proj_name}.xcodeproj")
|
138
|
-
|
139
145
|
proj_file_ref = Xcodeproj::Workspace::FileReference.new("#{proj_name}.xcodeproj")
|
140
146
|
workspace = nil
|
141
147
|
workspace_path = File.join(proj_dir,proj_name,"#{proj_name}.xcworkspace")
|
@@ -152,12 +158,14 @@ require 'xcodeproj'
|
|
152
158
|
end
|
153
159
|
|
154
160
|
class DTModuleGenerator
|
155
|
-
def initialize(module_name,module_dir=File.dirname(__FILE__),main_proj_name="MainProject", main_proj_dir=
|
161
|
+
def initialize(module_name,module_dir=File.dirname(__FILE__),main_proj_name="MainProject", main_proj_dir=nil)
|
156
162
|
@module_dir = module_dir
|
157
163
|
@module_name = module_name
|
158
164
|
@main_proj_dir = main_proj_dir
|
159
165
|
@main_proj_name = main_proj_name
|
160
|
-
|
166
|
+
if main_proj_dir == nil
|
167
|
+
@main_proj_dir = module_dir
|
168
|
+
end
|
161
169
|
end
|
162
170
|
|
163
171
|
def config
|
@@ -165,6 +173,13 @@ require 'xcodeproj'
|
|
165
173
|
main_proj_file_dir = File.join @main_proj_dir ,@main_proj_name , "#{@main_proj_name}.xcodeproj"
|
166
174
|
module_proj_file_dir = File.join(@module_dir,@module_name,"#{@module_name}.xcodeproj")
|
167
175
|
podfile_dir = File.join @main_proj_dir ,@main_proj_name , "Podfile"
|
176
|
+
|
177
|
+
if !File.exists?(main_proj_file_dir)
|
178
|
+
puts "Did not found main project.Path:'#{main_proj_file_dir}'"
|
179
|
+
return
|
180
|
+
end
|
181
|
+
|
182
|
+
|
168
183
|
File.open(podfile_dir,"r:utf-8") do |fr|
|
169
184
|
buffer = fr.read
|
170
185
|
if !buffer.include?("#{@module_name}")
|
@@ -175,7 +190,6 @@ require 'xcodeproj'
|
|
175
190
|
fw.write(buffer)
|
176
191
|
}
|
177
192
|
end
|
178
|
-
|
179
193
|
end
|
180
194
|
workspace = DTMainProjectGenerator.create_workspace(@main_proj_dir,@main_proj_name)
|
181
195
|
workspace << module_proj_file_dir
|
@@ -184,6 +198,10 @@ require 'xcodeproj'
|
|
184
198
|
end
|
185
199
|
|
186
200
|
def create
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
187
205
|
main_proj_file_dir = File.join @main_proj_dir ,@main_proj_name , "#{@main_proj_name}.xcodeproj"
|
188
206
|
if !File.exists? main_proj_file_dir
|
189
207
|
#create main project
|
@@ -199,6 +217,8 @@ require 'xcodeproj'
|
|
199
217
|
config
|
200
218
|
end
|
201
219
|
|
220
|
+
|
221
|
+
|
202
222
|
end
|
203
223
|
|
204
224
|
end
|