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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdca4106547d01a31f8840cba07dd48a506e7abd
4
- data.tar.gz: 907b3897e9275df89f54d9c27d7e23622a9e0b27
3
+ metadata.gz: 31173fc674d332089dc7dbca74f30ec9309b4a0c
4
+ data.tar.gz: 490c9d65f5452cea8edf5893ac7a44ca45b199e1
5
5
  SHA512:
6
- metadata.gz: 7da8deaac558d95f6724f0ee9644e1eee6a78d5d85f9e1b6ce505d5555900536b2f3d360aa70879606b121ce1e1b87879dbb48270bd5e85890587c98d9bc4d45
7
- data.tar.gz: 369689ea99ede7d5aca5421b6dd87aec37e5fd216779d4fc8647c92efbab881883d62832026f279de8371be564e4317d51611a770da93d975ec9a43ee5ff5ca9
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
- DTRipperProjectCreator::DTModuleGenerator.new(ARGV[0],ARGV[1],ARGV[2],ARGV[3]).create
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
- else
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=File.dirname(__FILE__))
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dtripper
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - DreamTracer