Sha256: f91a41711bab81dcd5a0df65a0c3eb3a0581d655344d6ccd7086d10de110a4cc

Contents?: true

Size: 850 Bytes

Versions: 5

Compression:

Stored size: 850 Bytes

Contents

module JBundle
  
  class Config
    
    attr_reader :bundles, :files, :src_dir, :filters
    
    def initialize
      @bundles = []
      @files = []
      @filters = []
    end
    
    def version(v = nil)
      @version = 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(&block)
      filters << 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.5 lib/jbundle/config.rb
jbundle-0.0.4 lib/jbundle/config.rb
jbundle-0.0.3 lib/jbundle/config.rb
jbundle-0.0.2 lib/jbundle/config.rb
jbundle-0.0.1 lib/jbundle/config.rb