Sha256: dfd05370282950ee7c89115cde05c7769e822c3a3e7692280fc09db0c30683ec

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'gondler/package'

module Gondler
  class Gomfile
    def initialize(path)
      @packages = []

      load(path)
    end
    attr_reader :packages

    def load(path)
      instance_eval(File.read(path))
    end

    def gom(name, options = {})
      options[:group] = @now_group if @now_group
      options[:os] = @now_os if @now_os

      package = Gondler::Package.new(name, options)
      @packages.push(package) if package.installable?
    end
    alias_method :package, :gom

    def group(*groups)
      @now_group = groups
      yield if block_given?
    ensure
      @now_group = nil
    end

    def os(*oss)
      @now_os = oss
      yield if block_given?
    ensure
      @now_os = nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gondler-0.0.2 lib/gondler/gomfile.rb
gondler-0.0.1 lib/gondler/gomfile.rb