Sha256: d66c16912dfdb5c6c4259b70a4237398960ea173e6394ea901d25bc224a4fe1e

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

module SmallCage::Commands
  class Manifest
    def self.execute(opts)
      self.new(opts).execute
    end

    def initialize(opts)
      @opts = opts
    end

    def execute
      entries = []
      root = Pathname.new(@opts[:path])
      Dir.chdir(root) do
        Dir.glob("**/*") do |f|
          entries << f
        end
      end

      tmp = []
      entries.each do |f|
        path = root + f
        f = "./" + f
        if path.directory?
          f = f + "/"
        end
        next if path.basename.to_s == "Manifest.html"
        tmp << f
      end
      entries = tmp

      template = File.dirname(__FILE__) + "/../resources/Manifest.erb"
      source = ERB.new(File.read(template), nil, "-").result(binding)
      open(root + "Manifest.html", "w") do |io|
        io << source
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smallcage-0.2.6 lib/smallcage/commands/manifest.rb
smallcage-0.2.5 lib/smallcage/commands/manifest.rb