Sha256: acbc4e2983639d3a3a3e13af97f11c827c9e7ee3c68fb174cb0cbaf977f11f7e

Contents?: true

Size: 1022 Bytes

Versions: 9

Compression:

Stored size: 1022 Bytes

Contents

require 'rake_factory'
require 'octokit'

module RakeGithub
  module Tasks
    module DeployKeys
      class Provision < RakeFactory::Task
        default_name :provision
        default_description RakeFactory::DynamicValue.new { |t|
          "Provision deploy keys to the #{t.repository} repository"
        }

        parameter :repository, required: true
        parameter :access_token, required: true
        parameter :deploy_keys, default: []

        action do |t|
          client = Octokit::Client.new(access_token: access_token)

          puts "Adding specified deploy keys to the " +
              "'#{t.repository}' repository... "
          t.deploy_keys.each do |deploy_key|
            print "Adding '#{deploy_key[:title]}'... "
            client.add_deploy_key(
                t.repository,
                deploy_key[:title],
                deploy_key[:public_key],
                read_only: !!deploy_key[:read_only])
            puts "Done."
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rake_github-0.8.0.pre.1 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.7.0 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.6.0.pre.2 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.6.0.pre.1 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.5.0 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.4.0.pre.1 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.3.0 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.2.0.pre.8 lib/rake_github/tasks/deploy_keys/provision.rb
rake_github-0.2.0.pre.7 lib/rake_github/tasks/deploy_keys/provision.rb