Sha256: e9a5b3b682909d2ebb09fa59a99700a7e86c7354a4b2bdd2b17d549306e5b38c

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

require 'rake_factory'

require_relative '../../client'

module RakeCircleCI
  module Tasks
    module CheckoutKeys
      class Provision < RakeFactory::Task
        default_name :provision
        default_description RakeFactory::DynamicValue.new { |t|
          "Provision checkout keys on the #{t.project_slug} project"
        }

        parameter :project_slug, required: true
        parameter :api_token, required: true
        parameter :base_url, default: 'https://circleci.com/api'
        parameter :checkout_keys, default: []

        action do |t|
          client = Client.new(
              base_url: t.base_url,
              api_token: t.api_token,
              project_slug: t.project_slug)

          puts "Provisioning all checkout keys to the '#{t.project_slug}' " +
              "project... "

          t.checkout_keys.each do |checkout_key|
            type = checkout_key[:type]

            print "Adding checkout key of type: '#{type}'..."
            client.create_checkout_key(type)
            puts "Done."
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rake_circle_ci-0.10.0.pre.6 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.10.0.pre.5 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.10.0.pre.4 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.10.0.pre.3 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.10.0.pre.2 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.10.0.pre.1 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.9.0 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.8.0.pre.4 lib/rake_circle_ci/tasks/checkout_keys/provision.rb
rake_circle_ci-0.8.0.pre.3 lib/rake_circle_ci/tasks/checkout_keys/provision.rb