Sha256: 218738009db29f462d80b63bc38910463f5f48cfc23444f7f3c5eeb8444442ed

Contents?: true

Size: 633 Bytes

Versions: 4

Compression:

Stored size: 633 Bytes

Contents

class Terraspace::Cloud::Ci::Vcs
  class Base
    extend Memoist

    def initialize(vars)
      @vars = vars
    end

    def vars
      {
        commit_url: commit_url,  # implemented by subclass
        branch_url: branch_url,  # implemented by subclass
      }
    end

    def merged_vars
      @vars.merge(vars)
    end

    class << self
      def vars_methods(*names)
        names.each do |name|
          vars_method(name)
        end
      end

      def vars_method(name)
        define_method name do
          @vars[name]
        end
      end
    end

    vars_methods :host, :full_repo, :sha, :branch_name
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
terraspace-2.0.3 lib/terraspace/cloud/ci/vcs/base.rb
terraspace-2.0.2 lib/terraspace/cloud/ci/vcs/base.rb
terraspace-2.0.1 lib/terraspace/cloud/ci/vcs/base.rb
terraspace-2.0.0 lib/terraspace/cloud/ci/vcs/base.rb