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.197-darwin lib/sprout/builder.rb
sprout-0.7.196-x86-linux lib/sprout/builder.rb
sprout-0.7.193-darwin lib/sprout/builder.rb
sprout-0.7.198-darwin lib/sprout/builder.rb
sprout-0.7.201 lib/sprout/builder.rb
sprout-0.7.197 lib/sprout/builder.rb
sprout-0.7.197-x86-linux lib/sprout/builder.rb
sprout-0.7.201-darwin lib/sprout/builder.rb
sprout-0.7.198-x86-linux lib/sprout/builder.rb
sprout-0.7.198 lib/sprout/builder.rb
sprout-0.7.201-x86-linux lib/sprout/builder.rb
sprout-0.7.203 lib/sprout/builder.rb
sprout-0.7.204-darwin lib/sprout/builder.rb
sprout-0.7.203-x86-linux lib/sprout/builder.rb
sprout-0.7.203-darwin lib/sprout/builder.rb
sprout-0.7.204 lib/sprout/builder.rb
sprout-0.7.205-x86-linux lib/sprout/builder.rb
sprout-0.7.206-x86-linux lib/sprout/builder.rb
sprout-0.7.204-x86-linux lib/sprout/builder.rb
sprout-0.7.205-darwin lib/sprout/builder.rb