Sha256: 45ed6d0caa13e4c397f04a73291d4aafcf3133df2013d732e344a8ed1a5885e8

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module Pieces
  class Listener
    attr_reader :path
    attr_reader :build_method

    def initialize(config = {})
      @path = config[:path] || Dir.pwd
      @build_method = config[:build_method] || :build
      build_pieces
    end

    def listen
      Listen.to("#{path}/config/", "#{path}/app/") do
        print "Rebuilding #{path}... "
        build_pieces
        puts 'done.'
      end.tap(&:start)
    end

    private

    def build_pieces
      Pieces::Builder.new(path: path).send(build_method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pieces-0.4.1 lib/pieces/listener.rb