Sha256: 0d7879467d6b0175da85d138b65ea0f86e935f6f22aa3aead7aae959b6a3f9bc

Contents?: true

Size: 847 Bytes

Versions: 19

Compression:

Stored size: 847 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

19 entries across 19 versions & 2 rubygems

Version Path
bluemark-smallcage-0.1.3 lib/smallcage/commands/manifest.rb
bluemark-smallcage-0.1.4 lib/smallcage/commands/manifest.rb
bluemark-smallcage-0.1.5 lib/smallcage/commands/manifest.rb
smallcage-0.2.4 lib/smallcage/commands/manifest.rb
smallcage-0.2.3 lib/smallcage/commands/manifest.rb
smallcage-0.2.2 lib/smallcage/commands/manifest.rb
smallcage-0.2.1 lib/smallcage/commands/manifest.rb
smallcage-0.2.0 lib/smallcage/commands/manifest.rb
smallcage-0.1.9 lib/smallcage/commands/manifest.rb
smallcage-0.1.8 lib/smallcage/commands/manifest.rb
smallcage-0.1.7 lib/smallcage/commands/manifest.rb
smallcage-0.1.6 lib/smallcage/commands/manifest.rb
smallcage-0.1.5 lib/smallcage/commands/manifest.rb
smallcage-0.1.4 lib/smallcage/commands/manifest.rb
smallcage-0.0.9 lib/smallcage/commands/manifest.rb
smallcage-0.1.3 lib/smallcage/commands/manifest.rb
smallcage-0.1.0 lib/smallcage/commands/manifest.rb
smallcage-0.1.1 lib/smallcage/commands/manifest.rb
smallcage-0.1.2 lib/smallcage/commands/manifest.rb