Sha256: ea196d6f36119eda9148c1024caec1041a36f315a3ed043e4589cc45299ac4e1

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

require 'dply/jenkins'
module Dply
  class ConfigStruct

    attr_writer :revision, :build_url, :build_url_proc, 
                :revision_proc
    attr_accessor :dir, :name, :repo, :branch, 
                  :strategy, :target, :verify_checksum, 
                  :config_map, :dir_map, :shared_dirs, 
                  :config_download_url, :config_skip_download 

    def initialize(dir = nil)
      @dir = dir || Dir.pwd
      @target = :default
      @branch = :master
      @verify_checksum = true
      @shared_dirs = []
    end

    def revision
      if @revision == :latest
        @revision = instance_eval(&revision_proc)
      else
        @revision
      end
    end

    def build_url
      @build_url ||= instance_eval(&build_url_proc)
    end

    def revision_proc
      @revision_proc ||= Proc.new do
        jenkins = Jenkins.new(repo, name)
        jenkins.latest_successful_revision
      end
    end

    def build_url_proc
      @build_url_proc ||= Proc.new do
        "#{repo.chomp("/")}/job/#{name}/#{revision}/artifact/build/#{name}-#{revision}-#{branch}.tar.gz"
      end
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dply-0.1.13 lib/dply/config_struct.rb
dply-0.1.12 lib/dply/config_struct.rb
dply-0.1.11 lib/dply/config_struct.rb
dply-0.1.10 lib/dply/config_struct.rb
dply-0.1.9 lib/dply/config_struct.rb
dply-0.1.8 lib/dply/config_struct.rb
dply-0.1.7 lib/dply/config_struct.rb
dply-0.1.6 lib/dply/config_struct.rb
dply-0.1.5 lib/dply/config_struct.rb
dply-0.1.4 lib/dply/config_struct.rb