rake_github 0.2.0.pre.6 → 0.2.0.pre.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rake_github/task_sets/{deploy_key.rb → deploy_keys.rb} +5 -6
- data/lib/rake_github/task_sets.rb +1 -1
- data/lib/rake_github/tasks/deploy_keys/destroy.rb +36 -0
- data/lib/rake_github/tasks/{deploy_key → deploy_keys}/ensure.rb +2 -3
- data/lib/rake_github/tasks/deploy_keys/provision.rb +35 -0
- data/lib/rake_github/tasks/deploy_keys.rb +3 -0
- data/lib/rake_github/tasks.rb +1 -1
- data/lib/rake_github/version.rb +1 -1
- data/lib/rake_github.rb +2 -2
- metadata +7 -7
- data/lib/rake_github/tasks/deploy_key/destroy.rb +0 -30
- data/lib/rake_github/tasks/deploy_key/provision.rb +0 -34
- data/lib/rake_github/tasks/deploy_key.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbd266032759ede378725418625961901693bae80cb1b500edb238529fed26dd
|
4
|
+
data.tar.gz: 64b1d98742748556180c5b8bcfe6619f6c22f609b7be1b86206813a6facd8021
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf65aecbd3001768c38156a3cf0ceccfa152fef818fc670695c5cc90a077b2bb2e0cd44907cd71eef627faebc0d780a00911f1064b4deec06f5f49ee94448214
|
7
|
+
data.tar.gz: 2324fb85ed1ed9446cfa382bb80a49813590a834c9910cc413bdbc09c7d1e74bf3d4077d8f4cb754e48df32f714c55d1c5a84131e11114d7d919741e70216490
|
data/Gemfile.lock
CHANGED
@@ -4,27 +4,26 @@ require_relative '../tasks'
|
|
4
4
|
|
5
5
|
module RakeGithub
|
6
6
|
module TaskSets
|
7
|
-
class
|
7
|
+
class DeployKeys < RakeFactory::TaskSet
|
8
8
|
prepend RakeFactory::Namespaceable
|
9
9
|
|
10
10
|
parameter :repository, required: true
|
11
|
-
parameter :title, required: true
|
12
11
|
parameter :access_token, required: true
|
13
|
-
parameter :
|
12
|
+
parameter :deploy_keys, default: []
|
14
13
|
|
15
14
|
parameter :destroy_task_name, default: :destroy
|
16
15
|
parameter :provision_task_name, default: :provision
|
17
16
|
parameter :ensure_task_name, default: :ensure
|
18
17
|
|
19
|
-
task Tasks::
|
18
|
+
task Tasks::DeployKeys::Provision,
|
20
19
|
name: RakeFactory::DynamicValue.new { |ts|
|
21
20
|
ts.provision_task_name
|
22
21
|
}
|
23
|
-
task Tasks::
|
22
|
+
task Tasks::DeployKeys::Destroy,
|
24
23
|
name: RakeFactory::DynamicValue.new { |ts|
|
25
24
|
ts.destroy_task_name
|
26
25
|
}
|
27
|
-
task Tasks::
|
26
|
+
task Tasks::DeployKeys::Ensure,
|
28
27
|
name: RakeFactory::DynamicValue.new { |ts|
|
29
28
|
ts.ensure_task_name
|
30
29
|
}
|
@@ -1 +1 @@
|
|
1
|
-
require_relative 'task_sets/
|
1
|
+
require_relative 'task_sets/deploy_keys'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'rake_factory'
|
2
|
+
require 'octokit'
|
3
|
+
|
4
|
+
module RakeGithub
|
5
|
+
module Tasks
|
6
|
+
module DeployKeys
|
7
|
+
class Destroy < RakeFactory::Task
|
8
|
+
default_name :destroy
|
9
|
+
default_description RakeFactory::DynamicValue.new { |t|
|
10
|
+
"Destroys deploy keys from the #{t.repository} repository"
|
11
|
+
}
|
12
|
+
|
13
|
+
parameter :repository, required: true
|
14
|
+
parameter :access_token, required: true
|
15
|
+
parameter :deploy_keys, default: []
|
16
|
+
|
17
|
+
action do |t|
|
18
|
+
client = Octokit::Client.new(access_token: access_token)
|
19
|
+
|
20
|
+
puts "Removing specified deploy keys from the " +
|
21
|
+
"'#{t.repository}' repository... "
|
22
|
+
all_deploy_keys = client.list_deploy_keys(t.repository)
|
23
|
+
t.deploy_keys.each do |deploy_key|
|
24
|
+
print "Removing '#{deploy_key[:title]}' key... "
|
25
|
+
matching_deploy_key =
|
26
|
+
all_deploy_keys.find { |k| k[:title] == deploy_key[:title] }
|
27
|
+
if matching_deploy_key
|
28
|
+
client.remove_deploy_key(t.repository, matching_deploy_key[:id])
|
29
|
+
end
|
30
|
+
puts "Done."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -2,16 +2,15 @@ require 'rake_factory'
|
|
2
2
|
|
3
3
|
module RakeGithub
|
4
4
|
module Tasks
|
5
|
-
module
|
5
|
+
module DeployKeys
|
6
6
|
class Ensure < RakeFactory::Task
|
7
7
|
default_name :ensure
|
8
8
|
default_description RakeFactory::DynamicValue.new { |t|
|
9
|
-
"Ensure deploy
|
9
|
+
"Ensure deploy keys are configured on the " +
|
10
10
|
"#{t.repository} repository"
|
11
11
|
}
|
12
12
|
|
13
13
|
parameter :repository, required: true
|
14
|
-
parameter :title, required: true
|
15
14
|
|
16
15
|
parameter :provision_task_name, default: :provision
|
17
16
|
parameter :destroy_task_name, default: :destroy
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'rake_factory'
|
2
|
+
require 'octokit'
|
3
|
+
|
4
|
+
module RakeGithub
|
5
|
+
module Tasks
|
6
|
+
module DeployKeys
|
7
|
+
class Provision < RakeFactory::Task
|
8
|
+
default_name :provision
|
9
|
+
default_description RakeFactory::DynamicValue.new { |t|
|
10
|
+
"Provision deploy keys to the #{t.repository} repository"
|
11
|
+
}
|
12
|
+
|
13
|
+
parameter :repository, required: true
|
14
|
+
parameter :access_token, required: true
|
15
|
+
parameter :deploy_keys, default: []
|
16
|
+
|
17
|
+
action do |t|
|
18
|
+
client = Octokit::Client.new(access_token: access_token)
|
19
|
+
|
20
|
+
puts "Adding specified deploy keys to the " +
|
21
|
+
"'#{t.repository}' repository... "
|
22
|
+
t.deploy_keys.each do |deploy_key|
|
23
|
+
print "Adding '#{deploy_key[:title]}'... "
|
24
|
+
client.add_deploy_key(
|
25
|
+
t.repository,
|
26
|
+
deploy_key[:title],
|
27
|
+
deploy_key[:public_key],
|
28
|
+
read_only: !!deploy_key[:read_only])
|
29
|
+
puts "Done."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/rake_github/tasks.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require_relative 'tasks/
|
1
|
+
require_relative 'tasks/deploy_keys'
|
data/lib/rake_github/version.rb
CHANGED
data/lib/rake_github.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rake_github/tasks'
|
|
3
3
|
require 'rake_github/task_sets'
|
4
4
|
|
5
5
|
module RakeGithub
|
6
|
-
def self.
|
7
|
-
RakeGithub::TaskSets::
|
6
|
+
def self.define_deploy_keys_tasks(opts = {}, &block)
|
7
|
+
RakeGithub::TaskSets::DeployKeys.define(opts, &block)
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake_github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.pre.
|
4
|
+
version: 0.2.0.pre.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toby Clemson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake_factory
|
@@ -198,12 +198,12 @@ files:
|
|
198
198
|
- go
|
199
199
|
- lib/rake_github.rb
|
200
200
|
- lib/rake_github/task_sets.rb
|
201
|
-
- lib/rake_github/task_sets/
|
201
|
+
- lib/rake_github/task_sets/deploy_keys.rb
|
202
202
|
- lib/rake_github/tasks.rb
|
203
|
-
- lib/rake_github/tasks/
|
204
|
-
- lib/rake_github/tasks/
|
205
|
-
- lib/rake_github/tasks/
|
206
|
-
- lib/rake_github/tasks/
|
203
|
+
- lib/rake_github/tasks/deploy_keys.rb
|
204
|
+
- lib/rake_github/tasks/deploy_keys/destroy.rb
|
205
|
+
- lib/rake_github/tasks/deploy_keys/ensure.rb
|
206
|
+
- lib/rake_github/tasks/deploy_keys/provision.rb
|
207
207
|
- lib/rake_github/version.rb
|
208
208
|
- rake_github.gemspec
|
209
209
|
- scripts/ci/common/configure-git.sh
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'rake_factory'
|
2
|
-
require 'octokit'
|
3
|
-
|
4
|
-
module RakeGithub
|
5
|
-
module Tasks
|
6
|
-
module DeployKey
|
7
|
-
class Destroy < RakeFactory::Task
|
8
|
-
default_name :destroy
|
9
|
-
default_description RakeFactory::DynamicValue.new { |t|
|
10
|
-
"Destroys deploy key from the #{t.repository} repository"
|
11
|
-
}
|
12
|
-
|
13
|
-
parameter :repository, required: true
|
14
|
-
parameter :access_token, required: true
|
15
|
-
parameter :title, required: true
|
16
|
-
|
17
|
-
action do |t|
|
18
|
-
client = Octokit::Client.new(access_token: access_token)
|
19
|
-
|
20
|
-
print "Removing deploy key '#{t.title}' from the " +
|
21
|
-
"'#{t.repository}' repository... "
|
22
|
-
deploy_keys = client.list_deploy_keys(t.repository)
|
23
|
-
deploy_key = deploy_keys.find { |k| k[:title] == t.title }
|
24
|
-
client.remove_deploy_key(t.repository, deploy_key[:id]) if deploy_key
|
25
|
-
puts "Done."
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'rake_factory'
|
2
|
-
require 'octokit'
|
3
|
-
|
4
|
-
module RakeGithub
|
5
|
-
module Tasks
|
6
|
-
module DeployKey
|
7
|
-
class Provision < RakeFactory::Task
|
8
|
-
default_name :provision
|
9
|
-
default_description RakeFactory::DynamicValue.new { |t|
|
10
|
-
"Provision deploy key to the #{t.repository} repository"
|
11
|
-
}
|
12
|
-
|
13
|
-
parameter :repository, required: true
|
14
|
-
parameter :access_token, required: true
|
15
|
-
parameter :title, required: true
|
16
|
-
parameter :public_key, required: true
|
17
|
-
parameter :read_only, default: false
|
18
|
-
|
19
|
-
action do |t|
|
20
|
-
client = Octokit::Client.new(access_token: access_token)
|
21
|
-
|
22
|
-
print "Adding deploy key '#{t.title}' to the " +
|
23
|
-
"'#{t.repository}' repository... "
|
24
|
-
client.add_deploy_key(
|
25
|
-
t.repository,
|
26
|
-
t.title,
|
27
|
-
t.public_key,
|
28
|
-
read_only: t.read_only)
|
29
|
-
puts "Done."
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|