Sha256: dbd2d2851a5a4bd2782cc93515dc267fb24421b044be474645a83e935d1f00ba

Contents?: true

Size: 883 Bytes

Versions: 83

Compression:

Stored size: 883 Bytes

Contents

module Sprout

  # accepts a destination path and a sprout specification
  # and will download and unpack the platform-specific
  # archives that are identified in the spec
  class Builder # :nodoc:
    
    class BuilderError < StandardError #:nodoc:
    end

    def self.build(file_targets_yaml, destination)
      data = nil
      
      File.open(file_targets_yaml, 'r') do |f|
        data = f.read
      end
      
      usr = User.new
      platform = usr.platform.to_s
      
      targets = YAML.load(data)
      targets.each do |target|
        if(target.platform == 'universal' || target.platform == platform)
          target.install_path = FileUtils.mkdir_p(destination)
          target.resolve
          return target
        end
      end
      raise BuilderError.new("Sprout::Builder.build failed, unsupported platform or unexpected yaml")
    end
    
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
sprout-0.7.206-darwin lib/sprout/builder.rb
sprout-0.7.205 lib/sprout/builder.rb
sprout-0.7.206 lib/sprout/builder.rb