lib/rubyfox/server/cli.rb in rubyfox-server-2.8.0.0 vs lib/rubyfox/server/cli.rb in rubyfox-server-2.8.0.1
- old
+ new
@@ -30,15 +30,14 @@
Dir["#{template_dir}/**/*"].each do |file|
if File.file?(file)
part = file.partition(template_dir).last
target_file = "#{target_dir}/#{part}"
- binary = MIME::Types.type_for(file).any?(&:binary?)
- if binary
- copy_file file, target_file
- else
+ if file_plain?(file)
template file, target_file
+ else
+ copy_file file, target_file
end
end
end
end
map "config" => :configure
@@ -57,9 +56,16 @@
no_tasks do
def env
@env ||= Environment.new(ENV)
end
+ end
+
+ private
+
+ def file_plain?(file)
+ types = MIME::Types.type_for(file)
+ types.empty? || types.any? { |type| type.media_type == "text" }
end
end
end
end