Navigation Menu

Skip to content

Commit

Permalink
rename Theme#export! to export
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Fuchs committed Jul 20, 2008
1 parent 3364126 commit d0febc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Expand Up @@ -63,7 +63,7 @@ def import
end

def export
zip_path = @theme.export!
zip_path = @theme.export
send_file(zip_path.to_s, :stream => false) rescue raise "Error sending #{zip_path} file"
ensure
FileUtils.rm_r File.dirname(zip_path)
Expand Down
16 changes: 8 additions & 8 deletions vendor/engines/theme_support/app/models/theme.rb
Expand Up @@ -29,13 +29,6 @@ def import(file)
import_from_zip(file)
end

def make_tmp_dir
random = Time.now.to_i.to_s.split('').sort_by{rand}
returning Pathname.new(RAILS_ROOT + "/tmp/themes/tmp_#{random}/") do |dir|
FileUtils.mkdir_p dir unless dir.exist?
end
end

def to_id(str)
str.gsub(/[^\w\-_]/, '_').downcase
end
Expand All @@ -44,6 +37,13 @@ def base_dir
::File.join(root_dir, "themes")
end

def make_tmp_dir
random = Time.now.to_i.to_s.split('').sort_by{rand}
returning Pathname.new(RAILS_ROOT + "/tmp/themes/tmp_#{random}/") do |dir|
FileUtils.mkdir_p dir unless dir.exist?
end
end

protected

def themes(subdir = nil)
Expand Down Expand Up @@ -201,7 +201,7 @@ def validate
@validated = true
end

def export!(options = {})
def export(options = {})
options.reverse_merge! :as => :zip
send :"export_as_#{options[:as]}", Theme.make_tmp_dir
end
Expand Down

0 comments on commit d0febc3

Please sign in to comment.