Sha256: 01e838475afeb44cbd301c518cde2f8be296c5f7c8a6d990ca3babf7b97b17f3

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

require "milc/dsl"

module Milc::Dsl
  module Gcloud

    def gcloud(cmd, &block)
      execute(build_gcloud_command(cmd), returns: :none, logging: :both, &block)
    end

    def json_gcloud(cmd)
      r = execute(build_gcloud_command(cmd + " --format json"), returns: :stdout, logging: :stderr)
      res = r.nil? ? nil : JSON.parse(r)
      block_given? ? yield(res) : res
    end

    def build_gcloud_command(cmd)
      r = "gcloud #{cmd}"
      r << " --project #{project}" unless cmd =~ /\s\-\-project[\s\=]/
      r
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
milc-0.1.4 lib/milc/dsl/gcloud.rb