lib/transender.rb in mihael-transender-0.1.0 vs lib/transender.rb in mihael-transender-0.2.3
- old
+ new
@@ -60,11 +60,11 @@
def self.zip_dir(dir, out_file)
`tar cvfz '#{out_file}' '#{dir}'`
out_file
end
-
+
def self.extract_app_title(giturl)
giturl.split('/').last.split('.').first
end
#Transender - Ji
@@ -88,12 +88,12 @@
#clones from transform then removes git
def clone_and_remove_git
#prepare destination without any warning
`rm -rf #{@app_path}`
- #clone that git repo and rename at the same time
- `git clone #{@transform} #{@app_path}`
+ #clone that git repo and rename at the same time, use --work-tree, otherwise rake spec fails miserably
+ `git --work-tree=#{@app_path} clone --no-hardlinks #{@transform} #{@app_path}`
#remove any past life remains from the fresh project
`rm -rf #{File.join(@app_path, 'build')}`
`rm -rf #{File.join(@app_path, '.git')}`
puts "Cloned from #{@transform} into #{@app_path}."
end
@@ -114,23 +114,23 @@
end
def zip
z = File.join(ji_path, "#{app_title}.zip")
`rm -rf #{z}` #remove any previous zips without any warnings
- Transender.zip_dir(File.join(ji_path, app_title), z)
+ `cd #{ji_path}; tar cvfz #{app_title}.zip #{app_title}/`
puts "Zipped #{app_title} into #{z}" if File.exists?(z)
z
end
- def transform
+ def transformize
clone_and_remove_git
rename
zip
end
#Use maybe like this: Transender::Ji.transform_and_zip(ahash) {|zip| render :text => zip}
def self.transform_and_zip(t={}, &block)
- zip = Ji.new(t).transform
+ zip = Ji.new(t).transformize
yield zip if block
end
private