lib/scaffoldhub/helper.rb in scaffoldhub-0.1.1 vs lib/scaffoldhub/helper.rb in scaffoldhub-0.1.2
- old
+ new
@@ -16,10 +16,11 @@
def each_template_file(type)
begin
scaffold_spec.select_files(type).each do |template_file|
yield template_file.download!
+ template_file.close
end
rescue Errno::ENOENT => e
say_status :error, e.message, :red
raise e
rescue Scaffoldhub::NotFoundException => e
@@ -32,10 +33,13 @@
end
def find_template_file(type)
begin
template_file = scaffold_spec.find_file(type)
- template_file.download! unless template_file.nil?
+ if template_file
+ yield template_file.download!
+ template_file.close
+ end
rescue Errno::ENOENT => e
say_status :error, e.message, :red
raise e
rescue Scaffoldhub::NotFoundException => e
say_status :error, "HTTP 404 error - did you misspell \"#{scaffold_name}\"?", :red