Sha256: de2a3b0baab7822e6cff07b943d3e9825dc94d05ac0dfa75ab44d99483748ac6

Contents?: true

Size: 608 Bytes

Versions: 13

Compression:

Stored size: 608 Bytes

Contents

module Flutterby
  class Exporter
    def initialize(root)
      @root = root
    end

    def export!(into:)
      @root.paths.each do |path, node|
        if node.should_publish?
          path = ::File.expand_path(::File.join(into, node.url))

          if node.file?
            # Make sure directory exists
            FileUtils.mkdir_p(::File.dirname(path))

            # Write file
            ::File.write(path, node.render)
            logger.info "Exported #{node.url}"
          end
        end
      end
    end


    private

    def logger
      @logger ||= Flutterby.logger
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
flutterby-0.1.0 lib/flutterby/exporter.rb
flutterby-0.0.25 lib/flutterby/exporter.rb
flutterby-0.0.24 lib/flutterby/exporter.rb
flutterby-0.0.23 lib/flutterby/exporter.rb
flutterby-0.0.22 lib/flutterby/exporter.rb
flutterby-0.0.21 lib/flutterby/exporter.rb
flutterby-0.0.20 lib/flutterby/exporter.rb
flutterby-0.0.19 lib/flutterby/exporter.rb
flutterby-0.0.18 lib/flutterby/exporter.rb
flutterby-0.0.17 lib/flutterby/exporter.rb
flutterby-0.0.16 lib/flutterby/exporter.rb
flutterby-0.0.15 lib/flutterby/exporter.rb
flutterby-0.0.14 lib/flutterby/exporter.rb