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.170 lib/sprout/builder.rb
sprout-0.7.169 lib/sprout/builder.rb
sprout-0.7.170-darwin lib/sprout/builder.rb
sprout-0.7.171-darwin lib/sprout/builder.rb
sprout-0.7.171-x86-linux lib/sprout/builder.rb
sprout-0.7.183 lib/sprout/builder.rb
sprout-0.7.183-darwin lib/sprout/builder.rb
sprout-0.7.191-x86-linux lib/sprout/builder.rb
sprout-0.7.182-x86-linux lib/sprout/builder.rb
sprout-0.7.191-darwin lib/sprout/builder.rb
sprout-0.7.183-x86-linux lib/sprout/builder.rb
sprout-0.7.182 lib/sprout/builder.rb
sprout-0.7.192-x86-linux lib/sprout/builder.rb
sprout-0.7.192 lib/sprout/builder.rb
sprout-0.7.192-darwin lib/sprout/builder.rb
sprout-0.7.191 lib/sprout/builder.rb
sprout-0.7.196 lib/sprout/builder.rb
sprout-0.7.193 lib/sprout/builder.rb
sprout-0.7.193-x86-linux lib/sprout/builder.rb
sprout-0.7.196-darwin lib/sprout/builder.rb