Sha256: a9b239447ec7a5f04ecedd1cef2069a05309c7917d3df4e3d83b3422ad76df78
Contents?: true
Size: 921 Bytes
Versions: 1
Compression:
Stored size: 921 Bytes
Contents
require 'rake_factory' require 'octokit' module RakeGithub module Tasks module DeployKey class Destroy < RakeFactory::Task default_name :destroy default_description RakeFactory::DynamicValue.new { |t| "Destroys deploy key from the #{t.repository} repository" } parameter :repository, required: true parameter :access_token, required: true parameter :title, required: true action do |t| client = Octokit::Client.new(access_token: access_token) print "Removing deploy key '#{t.title}' from the " + "'#{t.repository}' repository... " deploy_keys = client.list_deploy_keys(t.repository) deploy_key = deploy_keys.find { |k| k[:title] == t.title } client.remove_deploy_key(t.repository, deploy_key[:id]) if deploy_key puts "Done." end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rake_github-0.2.0.pre.6 | lib/rake_github/tasks/deploy_key/destroy.rb |