Sha256: ede538d8482300528464da7462ac4b40dc60b2d896e911ec7d215f6936b5bb27

Contents?: true

Size: 800 Bytes

Versions: 6

Compression:

Stored size: 800 Bytes

Contents

module SmallCage::Commands
  class Manifest
    def self.execute(opts)
      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
        f = f + '/' if path.directory?
        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

6 entries across 6 versions & 1 rubygems

Version Path
smallcage-0.3.2 lib/smallcage/commands/manifest.rb
smallcage-0.3.1 lib/smallcage/commands/manifest.rb
smallcage-0.3.0 lib/smallcage/commands/manifest.rb
smallcage-0.2.9 lib/smallcage/commands/manifest.rb
smallcage-0.2.8 lib/smallcage/commands/manifest.rb
smallcage-0.2.7 lib/smallcage/commands/manifest.rb