lib/railsthemes/utils.rb in railsthemes-1.0.3 vs lib/railsthemes/utils.rb in railsthemes-1.0.4
- old
+ new
@@ -15,9 +15,13 @@
def self.copy_ensuring_directory_exists src, dest
FileUtils.mkdir_p(File.dirname(dest)) # create directory if necessary
FileUtils.cp src, dest
end
+ def self.read_file filepath
+ File.exists?(filepath) ? File.read(filepath) : ''
+ end
+
# would be nice to put download status in the output (speed, progress, etc.)
def self.download_file_to url, save_to
File.open(save_to, "wb") do |saved_file|
# the following "open" is provided by open-uri
open(url) do |read_file|