diff --git a/bin/img-index b/bin/img-index new file mode 100755 index 0000000..315d611 --- /dev/null +++ b/bin/img-index @@ -0,0 +1,49 @@ +#!/usr/bin/env ruby + +require "pathname" +require "erb" + +dir = ARGV[0] || Dir.pwd +dir = Pathname(dir) + +images = dir.children.select { |f| %w(.png .jpg .jpeg .gif).include? f.extname }.map { |f| f.basename } + +template = ERB.new(DATA.read) +puts template.result(binding) + +__END__ + + + + + Index of <%= dir.basename %> + + + + <% images.each do |image| %> +
+ <%= image %> +
<%= image %>
+
+ <% end %> + +