Sha256: 259258cfcd83028ac14ab79d41c7cf56cfa4dcef22d8905e0de23ed27baaf024

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module JBundle
  
  class Config
    
    attr_reader :bundles, :files, :filters, :after_write_blocks
    
    def initialize
      @bundles = []
      @files = []
      @filters = {:all => [], :min => [], :src => []}
      @after_write_blocks = []
    end
    
    def version(v = nil)
      @version = JBundle::Version.new(v) if v
      @version
    end
    
    def src_dir(dir = nil)
      @src_dir = dir if dir
      @src_dir
    end
    
    def target_dir(dir = nil)
      @target_dir = dir if dir
      @target_dir
    end
    
    def bundle(name, &block)
      name = name.to_sym
      if !b = @bundles.detect{|a| a.name == name}
        b = Bundle.new(name)
        @bundles << b
      end
      b.instance_eval &block
      b
    end
    
    def file(f)
      @files << JBundle::File.new(f)
    end
    
    def filter(mode = :all, &block)
      filters[mode.to_sym] << block
    end
    
    def after_write(&block)
      after_write_blocks << block
    end
    
    def bundles_and_files
      @bundles + @files
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jbundle-0.0.12 lib/jbundle/config.rb
jbundle-0.0.11 lib/jbundle/config.rb
jbundle-0.0.10 lib/jbundle/config.rb
jbundle-0.0.9 lib/jbundle/config.rb
jbundle-0.0.8 lib/jbundle/config.rb