Sha256: 03c4441025e7cb25f932043caaa72ac22901bf244d445392a5f5df07565bfb6a

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

require 'securerandom'

module Buildbox
  class Artifact
    autoload :Poster,    "buildbox/artifact/poster"
    autoload :Collector, "buildbox/artifact/collector"
    autoload :Uploader,  "buildbox/artifact/uploader"

    attr_reader :id, :name, :path
    attr_accessor :remote_id, :upload_instructions

    def self.create(glob_path, name, path, original_path)
      new(SecureRandom.uuid, glob_path, name, path, original_path)
    end

    def initialize(id, glob_path, name, path, original_path)
      @id            = id
      @glob_path     = glob_path
      @name          = name
      @path          = path
      @original_path = original_path
    end

    def basename
      File.basename(@path)
    end

    def as_json
      { :id            => @id,
        :glob_path     => @glob_path,
        :name          => @name,
        :path          => @path,
        :original_path => @original_path,
        :file_size     => File.size(@path) }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
buildbox-0.6.2 lib/buildbox/artifact.rb
buildbox-0.6.1 lib/buildbox/artifact.rb
buildbox-0.7.beta1 lib/buildbox/artifact.rb
buildbox-0.6 lib/buildbox/artifact.rb