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-mswin32 lib/sprout/builder.rb
sprout-0.7.205-mswin32 lib/sprout/builder.rb
sprout-0.7.204-mswin32 lib/sprout/builder.rb
sprout-0.7.203-mswin32 lib/sprout/builder.rb
sprout-0.7.201-mswin32 lib/sprout/builder.rb
sprout-0.7.198-mswin32 lib/sprout/builder.rb
sprout-0.7.197-mswin32 lib/sprout/builder.rb
sprout-0.7.196-mswin32 lib/sprout/builder.rb
sprout-0.7.193-mswin32 lib/sprout/builder.rb
sprout-0.7.192-mswin32 lib/sprout/builder.rb
sprout-0.7.191-mswin32 lib/sprout/builder.rb
sprout-0.7.153-darwin lib/sprout/builder.rb
sprout-0.7.156-x86-linux lib/sprout/builder.rb
sprout-0.7.153 lib/sprout/builder.rb
sprout-0.7.157-darwin lib/sprout/builder.rb
sprout-0.7.157-x86-linux lib/sprout/builder.rb
sprout-0.7.153-x86-linux lib/sprout/builder.rb
sprout-0.7.156 lib/sprout/builder.rb
sprout-0.7.159-darwin lib/sprout/builder.rb
sprout-0.7.157 lib/sprout/builder.rb