transender 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 2
3
- :patch: 7
3
+ :patch: 8
4
4
  :major: 0
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib transender]))
4
+
5
+ $:.unshift File.join(File.dirname(__FILE__))
6
+
7
+ #arguments
8
+ transform = ARGV[0]
9
+ app_title = ARGV[1]
10
+ out_dir = ARGV[2]
11
+
12
+ def usage
13
+ puts "Transender #{Transender::VERSION} - the iPhoneSDK cloning/renaming gem"
14
+ puts "Usage:\n"
15
+ puts "~>transender myBadlyNamedProject/ myCoolProject /myCool/Path/To/Projects/Path/\n"
16
+ puts "~>transender <transform> <app_title> <out_dir>\n"
17
+ puts "transform - an XCode project \n"
18
+ puts "app_title - the renamed projects name\n"
19
+ puts "out_dir - where to put fresh app's files\n"
20
+ end
21
+
22
+ unless transform&&app_title&&out_dir
23
+ usage
24
+ exit
25
+ end
26
+
27
+ require 'benchmark'
28
+
29
+ time = Benchmark.realtime {Transender::Ji.xcode_rename({:transform => transform, :app_title => app_title, :ji_path => out_dir})}
30
+ puts "Realtime used : #{time}sec"
31
+
32
+ # EOF
@@ -0,0 +1,18 @@
1
+ {
2
+ "2D":"true",
3
+ "2D_scene":"SplashScene",
4
+ "wwwapp":"true",
5
+ "wifiapp":"true",
6
+ "program":"program",
7
+ "horizontal":"true",
8
+ "animated":"true",
9
+ "vibe":"3.83",
10
+ "direction_changes":"false",
11
+ "big_button":"false",
12
+ "button_on_left":"true",
13
+ "button_opens_not_controls":"true",
14
+ "save_current_spot":"false",
15
+ "save_current_program":"false",
16
+ "goldcut":-1,
17
+ "noise_url":"http://91.185.196.3:8020/"
18
+ }
@@ -1,9 +1,8 @@
1
1
  # a transender bowl
2
2
  # defines how transender should transform a MakeMoney cloned iPhone/iPod touch app into another
3
-
4
3
  app:
5
4
  APP_SERVER_URL: http://kitschmaster.com
6
- APP_TITLE: moonpreview
5
+ APP_TITLE: XappX
7
6
  APP_ID: 16
8
7
  PRICE: 0.99
9
8
  IRS: 0.7
@@ -17,14 +16,17 @@ store:
17
16
  Can have 700 chars.
18
17
 
19
18
  #list the files you want to keep, all else will be deleted
20
- #if you do not list any files, no files will be deleted
19
+ #each entry is a dir under XappX/Classes, except Views
20
+ #if you do not list any files, all files will be deleted
21
21
  files:
22
- Controllers:
23
- #- MessageViewController
24
- #- KopterViewController
22
+ 2D:
23
+ #all
24
+ Views:
25
+ #- MessageView
26
+ #- KopterView
25
27
  Filters:
26
28
  #- Filter_twitter
27
29
  #- Filter_koornk
28
- Views:
29
- #- MessageView
30
- #- KopterView
30
+ Controllers:
31
+ #- MessageViewController
32
+ #- KopterViewController
@@ -0,0 +1,2 @@
1
+ #12.09.2009 07:27:34
2
+
@@ -102,42 +102,26 @@ module Transender
102
102
  def transend
103
103
  if read_abowl
104
104
 
105
- # handle artwork if any
106
- files = Dir["#{abowl_path}/Artwork/*"]
107
- if files&&files.size>0
108
- #remove original artwork
109
- FileUtils.rm_rf "#{app_path}/Artwork"
110
- #copy this bowls artworks
111
- FileUtils.cp_r "#{abowl_path}/Artwork", "#{app_path}/"
112
- end
113
-
114
- # handle transends if any
115
- files = Dir["#{abowl_path}/Transends/*"]
116
- if files&&files.size>0
117
- #remove original transends
118
- FileUtils.rm_rf "#{app_path}/Transends"
119
- #copy this bowls transends
120
- FileUtils.cp_r "#{abowl_path}/Transends", "#{app_path}/"
121
- end
122
-
123
- # handle files
124
- ['Controllers', 'Filters'].each do |type|
125
- filenames = @abowl['files'][type]
126
- if filenames&&filenames.size>0
127
- Dir["#{app_path}/Classes/#{type}/*.{m,h}"].each do |file|
128
- name = Transender.extract_name(file)
129
- FileUtils.rm file unless filenames.member? name
105
+ # handle classes&views files
106
+ if @abowl['files']
107
+ dirz = @abowl['files'].keys
108
+ dirz.each do |type|
109
+ dir_string = "#{app_path}/Classes/#{type}/*.{m,h}"
110
+ dir_string = "#{app_path}/Views/*.{xib, nib}" if type == "Views"
111
+ filenames = @abowl['files'][type]
112
+ if filenames&&filenames.size>0
113
+ unless filenames.size == 1 && filenames[0] == "all"
114
+ Dir[dir_string].each do |file|
115
+ name = Transender.extract_name(file)
116
+ FileUtils.rm file unless filenames.member? name
117
+ end
118
+ end
119
+ else
120
+ FileUtils.rm_rf(Dir.glob(dir_string))
130
121
  end
131
122
  end
132
123
  end
133
- filenames = @abowl['files']['Views']
134
- if filenames&&filenames.size>0
135
- Dir["#{app_path}/Views/*.{xib, nib}"].each do |file|
136
- name = Transender.extract_name(file)
137
- FileUtils.rm file unless filenames.member? name
138
- end
139
- end
140
-
124
+
141
125
  #handle app delegate defines
142
126
  defines = @abowl['app']
143
127
  appDelegate = "#{app_path}/Classes/Application/#{app_title}AppDelegate.h"
@@ -172,6 +156,92 @@ module Transender
172
156
  end
173
157
  end
174
158
 
159
+ #backdrop and dropback are used inconjunction, to form a form of mending the code back into the project, while maintaining transendability with the mothers source
160
+ #saves Clasess, Artwork, Transends and Views to abowl
161
+ #this will later be copied back to the project
162
+ def backdrop
163
+ #make sure there is abowl
164
+ make_abowl unless read_abowl
165
+
166
+ #if the app is already there
167
+ if File.exists?(app_path)
168
+
169
+ # handle artwork if any
170
+ files = Dir["#{app_path}/Artwork/*"]
171
+ if files&&files.size>0
172
+ #remove original artwork from abowl
173
+ FileUtils.rm_rf "#{abowl_path}/Artwork"
174
+ #copy this apps artworks to abowl
175
+ FileUtils.cp_r "#{app_path}/Artwork", "#{abowl_path}/"
176
+ end
177
+
178
+ # handle transends if any
179
+ files = Dir["#{app_path}/Transends/*"]
180
+ if files&&files.size>0
181
+ #remove original transends from abowl
182
+ FileUtils.rm_rf "#{abowl_path}/Transends"
183
+ #copy this bowls transends
184
+ FileUtils.cp_r "#{app_path}/Transends", "#{abowl_path}/"
185
+ end
186
+
187
+ # handle classes&views file
188
+ #FileUtils.rm_rf "#{abowl_path}/Classes"
189
+ #FileUtils.rm_rf "#{abowl_path}/Views"
190
+
191
+ if @abowl['files']
192
+ dirz = @abowl['files'].keys
193
+ dirz.each do |type|
194
+ FileUtils.cp_r "#{app_path}/Classes/#{type}", "#{abowl_path}/Classes/" unless type == "Views"
195
+ end
196
+ end
197
+ FileUtils.cp_r "#{app_path}/Views", "#{abowl_path}/"
198
+
199
+ end
200
+
201
+ #else do nothinf
202
+
203
+ end
204
+
205
+ #drops the diff between saved abowl files back into the app_path
206
+ #this way, you can write code without having to worry about .git and stuff
207
+ #the mother source can be your template
208
+ #you just write the difference
209
+ #if you transend with a new release of the mother source, just add existing files in XCode after transending
210
+ def dropback
211
+ #the abowl has Classes, and the app has classes
212
+ #get all abowl classes and copy them over if they do not exist in the app_path
213
+ #do the same for views...
214
+
215
+ # handle artwork if any
216
+ files = Dir["#{abowl_path}/Artwork/*"]
217
+ if files&&files.size>0
218
+ #remove original artwork
219
+ FileUtils.rm_rf "#{app_path}/Artwork"
220
+ #copy this bowls artworks
221
+ FileUtils.cp_r "#{abowl_path}/Artwork", "#{app_path}/"
222
+ end
223
+
224
+ # handle transends if any
225
+ files = Dir["#{abowl_path}/Transends/*"]
226
+ if files&&files.size>0
227
+ #remove original transends
228
+ FileUtils.rm_rf "#{app_path}/Transends"
229
+ #copy this bowls transends
230
+ FileUtils.cp_r "#{abowl_path}/Transends", "#{app_path}/"
231
+ end
232
+
233
+ #copy from abowl.classes to app.classes if abowl.classes.file not in app.classes
234
+ `cp -rn '#{abowl_path}/Classes' '#{app_path}/';cp -rn '#{abowl_path}/Views' '#{app_path}/'`
235
+
236
+ end
237
+
238
+ #copies from transform and renames
239
+ def copy_and_rename
240
+ #prepare destination without any warning
241
+ FileUtils.rm_rf @app_path #`rm -rf #{@app_path}`
242
+ `cp -r #{@transform} #{@app_path}`
243
+ end
244
+
175
245
  #clones from transform then removes git
176
246
  def clone_and_remove_git
177
247
  #prepare destination without any warning
@@ -189,6 +259,10 @@ module Transender
189
259
  FileUtils.rm_rf File.join(@app_path, 'build') #`rm -rf #{File.join(@app_path, 'build')}`
190
260
  FileUtils.rm_rf File.join(@app_path, '.git') #`rm -rf #{File.join(@app_path, '.git')}`
191
261
 
262
+ #cleanup Transends and Artwork, so it is empty
263
+ FileUtils.rm_rf Dir.glob("#{@app_path}/Artwork/**/*")
264
+ FileUtils.rm_rf Dir.glob("#{@app_path}/Transends/**/*")
265
+
192
266
  puts "Cloned from #{@transform} into #{@app_path}."
193
267
  end
194
268
 
@@ -226,12 +300,19 @@ module Transender
226
300
  end
227
301
 
228
302
  def transendize
303
+ backdrop
229
304
  clone_and_remove_git
230
305
  rename
231
306
  transend
307
+ dropback
232
308
  zip
233
309
  end
234
310
 
311
+ #Use maybe like this: Transender::Ji.xcode_rename(ahash)
312
+ def self.xcode_rename(t={})
313
+ Ji.new(t).copy_and_rename
314
+ end
315
+
235
316
  #Use maybe like this: Transender::Ji.transform_and_zip(ahash) {|zip| render :text => zip}
236
317
  def self.transform_and_zip(t={}, &block)
237
318
  zip = Ji.new(t).transformize
@@ -248,9 +329,11 @@ module Transender
248
329
  #if there is abowl, it will be used for transending
249
330
  def self.transend(t={})
250
331
  ji = Ji.new(t)
332
+ ji.backdrop
251
333
  ji.clone_and_remove_git
252
334
  ji.rename
253
335
  ji.transend
336
+ ji.dropback
254
337
  end
255
338
 
256
339
  private
@@ -301,15 +384,17 @@ module Transender
301
384
  def make_abowl
302
385
  unless File.exists? @abowl_yml #do not overwrite
303
386
  FileUtils.cp_r File.join(LIBPATH, "abowl"), @ji_path
387
+ Transender.replace_strings_in_file('XappX', @app_title, @abowl_yml)
388
+ read_abowl
304
389
  end
305
390
  rescue
306
- puts "Could not make abowl."
391
+ puts "Could not make abowl. #{$!}"
307
392
  end
308
393
 
309
394
  def read_abowl
310
395
  @abowl = YAML.load_file @abowl_yml
311
396
  rescue
312
- puts "Could not read abowl."
397
+ puts "Could not read abowl. #{$!}" if File.exists? @app_path
313
398
  nil
314
399
  end
315
400
 
@@ -1,15 +1,17 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{transender}
5
- s.version = "0.2.7"
8
+ s.version = "0.2.8"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["Mihael"]
9
- s.date = %q{2009-08-03}
10
- s.default_executable = %q{transender}
12
+ s.date = %q{2010-01-21}
11
13
  s.email = %q{kitschmaster@gmail.com}
12
- s.executables = ["transender"]
14
+ s.executables = ["transender", "transender-rename"]
13
15
  s.extra_rdoc_files = [
14
16
  "LICENSE",
15
17
  "README.rdoc",
@@ -26,7 +28,11 @@ Gem::Specification.new do |s|
26
28
  "Rakefile",
27
29
  "VERSION.yml",
28
30
  "bin/transender",
31
+ "bin/transender-rename",
32
+ "lib/abowl/Transends/program.json",
33
+ "lib/abowl/Transends/stage.json",
29
34
  "lib/abowl/abowl.yml",
35
+ "lib/abowl/devlog.markdown",
30
36
  "lib/tasks/pushup.rake",
31
37
  "lib/transender.rb",
32
38
  "spec/spec_helper.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mihael
@@ -9,14 +9,15 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-03 00:00:00 +02:00
13
- default_executable: transender
12
+ date: 2010-01-21 00:00:00 +01:00
13
+ default_executable:
14
14
  dependencies: []
15
15
 
16
16
  description:
17
17
  email: kitschmaster@gmail.com
18
18
  executables:
19
19
  - transender
20
+ - transender-rename
20
21
  extensions: []
21
22
 
22
23
  extra_rdoc_files:
@@ -34,7 +35,11 @@ files:
34
35
  - Rakefile
35
36
  - VERSION.yml
36
37
  - bin/transender
38
+ - bin/transender-rename
39
+ - lib/abowl/Transends/program.json
40
+ - lib/abowl/Transends/stage.json
37
41
  - lib/abowl/abowl.yml
42
+ - lib/abowl/devlog.markdown
38
43
  - lib/tasks/pushup.rake
39
44
  - lib/transender.rb
40
45
  - spec/spec_helper.rb