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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4efc78ee47a3cd56be66dfb4daa39000c963fc8c9010a58e34edd229a47b0f27
4
- data.tar.gz: 6ac9a19b288f01aa6ef40dfde5e67bda8984697ddb3fc3b644cd71a359006f76
3
+ metadata.gz: fbd266032759ede378725418625961901693bae80cb1b500edb238529fed26dd
4
+ data.tar.gz: 64b1d98742748556180c5b8bcfe6619f6c22f609b7be1b86206813a6facd8021
5
5
  SHA512:
6
- metadata.gz: febf561bbe0352737c3929dabebca6830226044aa0a439c7ddf9036a4380dd8e83ad3d66b5f74d51dfe5a55668af36a6468ed30f315a992492e8ec09969b45b3
7
- data.tar.gz: 6fb132b6cb7482e3a9d1345ce9aba287b1bc9b18b1b98bc34cb44bc41da84def3aa2a2c82fd2e64c7d65e8764fe614a35e999c21a9f549e2347fb4d28fe297f5
6
+ metadata.gz: bf65aecbd3001768c38156a3cf0ceccfa152fef818fc670695c5cc90a077b2bb2e0cd44907cd71eef627faebc0d780a00911f1064b4deec06f5f49ee94448214
7
+ data.tar.gz: 2324fb85ed1ed9446cfa382bb80a49813590a834c9910cc413bdbc09c7d1e74bf3d4077d8f4cb754e48df32f714c55d1c5a84131e11114d7d919741e70216490
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_github (0.2.0.pre.6)
4
+ rake_github (0.2.0.pre.7)
5
5
  colored2 (~> 3.1)
6
6
  octokit (~> 4.16)
7
7
  rake_factory (~> 0.23)
@@ -4,27 +4,26 @@ require_relative '../tasks'
4
4
 
5
5
  module RakeGithub
6
6
  module TaskSets
7
- class DeployKey < RakeFactory::TaskSet
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 :public_key, required: true
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::DeployKey::Provision,
18
+ task Tasks::DeployKeys::Provision,
20
19
  name: RakeFactory::DynamicValue.new { |ts|
21
20
  ts.provision_task_name
22
21
  }
23
- task Tasks::DeployKey::Destroy,
22
+ task Tasks::DeployKeys::Destroy,
24
23
  name: RakeFactory::DynamicValue.new { |ts|
25
24
  ts.destroy_task_name
26
25
  }
27
- task Tasks::DeployKey::Ensure,
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/deploy_key'
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 DeployKey
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 key #{t.title} is configured on the " +
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
@@ -0,0 +1,3 @@
1
+ require_relative 'deploy_keys/provision'
2
+ require_relative 'deploy_keys/destroy'
3
+ require_relative 'deploy_keys/ensure'
@@ -1 +1 @@
1
- require_relative 'tasks/deploy_key'
1
+ require_relative 'tasks/deploy_keys'
@@ -1,3 +1,3 @@
1
1
  module RakeGithub
2
- VERSION = '0.2.0.pre.6'
2
+ VERSION = '0.2.0.pre.7'
3
3
  end
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.define_deploy_key_tasks(opts = {}, &block)
7
- RakeGithub::TaskSets::DeployKey.define(opts, &block)
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.6
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-10 00:00:00.000000000 Z
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/deploy_key.rb
201
+ - lib/rake_github/task_sets/deploy_keys.rb
202
202
  - lib/rake_github/tasks.rb
203
- - lib/rake_github/tasks/deploy_key.rb
204
- - lib/rake_github/tasks/deploy_key/destroy.rb
205
- - lib/rake_github/tasks/deploy_key/ensure.rb
206
- - lib/rake_github/tasks/deploy_key/provision.rb
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
@@ -1,3 +0,0 @@
1
- require_relative 'deploy_key/provision'
2
- require_relative 'deploy_key/destroy'
3
- require_relative 'deploy_key/ensure'