rake_fly 2.10.0.pre.1 → 2.10.0.pre.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f96d069b06b8dffc2e0e406f4a989092232bda81c5bf40e1e390d13c8d6752d0
4
- data.tar.gz: 4059e84bdd8c4e39cda00270cacd11ca096a047efdb4eb3bd3fb9b1e009c17f8
3
+ metadata.gz: ecd38dbc5a32859dbc5c79ed756d0b0d0633616b12ee671955f96c1a6a00ec86
4
+ data.tar.gz: 4ee91baf475caffce6c7f365646195a462f1573b0fa683f73def43b4215c1a7f
5
5
  SHA512:
6
- metadata.gz: 4b484d48ea1c3c795313a64daf31c8e8d746a96765041d8f113b01bfa2c0594dd4958cda1a2514e0e9ca4a40e72d8f52be3e691a12d0ce0ddf3f0712b0d251a6
7
- data.tar.gz: c99e52be37cfb43d12dfdea01ec3fc6b114b52b1c6b76fca6a27aced3f3a24756a6f5cd5fa1efc8be09689b818683429b3aa79c315eac854b9a7f0f2e0278cca
6
+ metadata.gz: 1bb952f89dd0119f849ed684afb2b45a907d5d6b79fd39891a25477c925957fc78b133ff7a5e71a362fd0ac9ef17c7e683896b27c1b9e79c49f79d9402d42ffb
7
+ data.tar.gz: cc8098eb1ab1f5e132e32ea882924b1bcea34fac0e121fccba65a6f38264e1610fadfd56fc7275fe175b9310ed7564c12259fbc39f3afc4ebea59c5c96c8d0c5
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in rake_fly.gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_fly (2.10.0.pre.1)
4
+ rake_fly (2.10.0.pre.4)
5
5
  concourse.rb (>= 0.4)
6
6
  rake_dependencies (~> 3.1)
7
7
  rake_factory (~> 0.29)
@@ -11,19 +11,20 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (7.0.2.3)
14
+ activesupport (7.0.3.1)
15
15
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
16
  i18n (>= 1.6, < 2)
17
17
  minitest (>= 5.1)
18
18
  tzinfo (~> 2.0)
19
19
  addressable (2.8.0)
20
20
  public_suffix (>= 2.0.2, < 5.0)
21
+ ast (2.4.2)
21
22
  colored2 (3.1.2)
22
23
  concourse.rb (0.4.0)
23
24
  dry-schema (~> 0.5)
24
25
  excon (~> 0.72)
25
26
  semantic (~> 1.5)
26
- concurrent-ruby (1.1.9)
27
+ concurrent-ruby (1.1.10)
27
28
  diff-lcs (1.5.0)
28
29
  docile (1.4.0)
29
30
  dry-configurable (0.14.0)
@@ -55,8 +56,8 @@ GEM
55
56
  dry-inflector (~> 0.1, >= 0.1.2)
56
57
  dry-logic (~> 1.0, >= 1.0.2)
57
58
  excon (0.92.0)
58
- fakefs (1.4.1)
59
- faker (2.20.0)
59
+ fakefs (1.8.0)
60
+ faker (2.23.0)
60
61
  i18n (>= 1.8.11, < 2)
61
62
  faraday (1.10.0)
62
63
  faraday-em_http (~> 1.0)
@@ -84,21 +85,26 @@ GEM
84
85
  gem-release (2.2.2)
85
86
  hamster (3.0.0)
86
87
  concurrent-ruby (~> 1.0)
87
- i18n (1.10.0)
88
+ i18n (1.12.0)
88
89
  concurrent-ruby (~> 1.0)
89
- jwt (2.3.0)
90
+ json (2.6.2)
91
+ jwt (2.5.0)
90
92
  lino (3.0.0)
91
93
  hamster (~> 3.0)
92
94
  open4 (~> 1.3)
93
95
  minitar (0.9)
94
- minitest (5.15.0)
96
+ minitest (5.16.2)
95
97
  multipart-post (2.1.1)
96
98
  octokit (4.22.0)
97
99
  faraday (>= 0.9)
98
100
  sawyer (~> 0.8.0, >= 0.5.3)
99
101
  open4 (1.3.4)
100
- openssl (3.0.0)
102
+ openssl (3.0.1)
103
+ parallel (1.22.1)
104
+ parser (3.1.2.1)
105
+ ast (~> 2.4.1)
101
106
  public_suffix (4.0.6)
107
+ rainbow (3.1.1)
102
108
  rake (13.0.6)
103
109
  rake_circle_ci (0.9.0)
104
110
  colored2 (~> 3.1)
@@ -125,6 +131,8 @@ GEM
125
131
  colored2 (~> 3.1)
126
132
  rake_factory (~> 0.23)
127
133
  sshkey (~> 2.0)
134
+ regexp_parser (2.5.0)
135
+ rexml (3.2.5)
128
136
  rspec (3.11.0)
129
137
  rspec-core (~> 3.11.0)
130
138
  rspec-expectations (~> 3.11.0)
@@ -138,6 +146,23 @@ GEM
138
146
  diff-lcs (>= 1.2.0, < 2.0)
139
147
  rspec-support (~> 3.11.0)
140
148
  rspec-support (3.11.0)
149
+ rubocop (1.36.0)
150
+ json (~> 2.3)
151
+ parallel (~> 1.10)
152
+ parser (>= 3.1.2.1)
153
+ rainbow (>= 2.2.2, < 4.0)
154
+ regexp_parser (>= 1.8, < 3.0)
155
+ rexml (>= 3.2.5, < 4.0)
156
+ rubocop-ast (>= 1.20.1, < 2.0)
157
+ ruby-progressbar (~> 1.7)
158
+ unicode-display_width (>= 1.4.0, < 3.0)
159
+ rubocop-ast (1.21.0)
160
+ parser (>= 3.1.1.0)
161
+ rubocop-rake (0.6.0)
162
+ rubocop (~> 1.0)
163
+ rubocop-rspec (2.12.1)
164
+ rubocop (~> 1.31)
165
+ ruby-progressbar (1.11.0)
141
166
  ruby2_keywords (0.0.5)
142
167
  ruby_fly (0.37.0)
143
168
  lino (~> 3.0)
@@ -157,6 +182,7 @@ GEM
157
182
  sshkey (2.0.0)
158
183
  tzinfo (2.0.4)
159
184
  concurrent-ruby (~> 1.0)
185
+ unicode-display_width (2.2.0)
160
186
 
161
187
  PLATFORMS
162
188
  ruby
@@ -177,7 +203,10 @@ DEPENDENCIES
177
203
  rake_gpg
178
204
  rake_ssh
179
205
  rspec
206
+ rubocop
207
+ rubocop-rake
208
+ rubocop-rspec
180
209
  simplecov
181
210
 
182
211
  BUNDLED WITH
183
- 2.3.9
212
+ 2.3.22
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'yaml'
2
4
  require 'rake_circle_ci'
3
5
  require 'rake_github'
@@ -5,17 +7,20 @@ require 'rake_ssh'
5
7
  require 'rake_gpg'
6
8
  require 'securerandom'
7
9
  require 'rspec/core/rake_task'
10
+ require 'rubocop/rake_task'
8
11
 
9
- task :default => :spec
10
-
11
- RSpec::Core::RakeTask.new(:spec)
12
+ task default: %i[
13
+ library:fix
14
+ test:unit
15
+ ]
12
16
 
13
17
  namespace :encryption do
14
18
  namespace :passphrase do
19
+ desc 'Generate encryption passphrase for CI GPG key'
15
20
  task :generate do
16
- File.open('config/secrets/ci/encryption.passphrase', 'w') do |f|
17
- f.write(SecureRandom.base64(36))
18
- end
21
+ FileUtils.mkdir_p('config/secrets/ci/')
22
+ File.write('config/secrets/ci/encryption.passphrase',
23
+ SecureRandom.base64(36))
19
24
  end
20
25
  end
21
26
  end
@@ -23,85 +28,102 @@ end
23
28
  namespace :keys do
24
29
  namespace :deploy do
25
30
  RakeSSH.define_key_tasks(
26
- path: 'config/secrets/ci/',
27
- comment: 'maintainers@infrablocks.io')
31
+ path: 'config/secrets/ci/',
32
+ comment: 'maintainers@infrablocks.io'
33
+ )
28
34
  end
29
35
 
30
36
  namespace :gpg do
31
37
  RakeGPG.define_generate_key_task(
32
- output_directory: 'config/secrets/ci',
33
- name_prefix: 'gpg',
34
- owner_name: 'InfraBlocks Maintainers',
35
- owner_email: 'maintainers@infrablocks.io',
36
- owner_comment: 'rake_fly CI Key')
38
+ output_directory: 'config/secrets/ci',
39
+ name_prefix: 'gpg',
40
+ owner_name: 'InfraBlocks Maintainers',
41
+ owner_email: 'maintainers@infrablocks.io',
42
+ owner_comment: 'rake_fly CI Key'
43
+ )
37
44
  end
38
45
  end
39
46
 
47
+ RuboCop::RakeTask.new
48
+
49
+ namespace :library do
50
+ desc 'Run all checks of the library'
51
+ task check: [:rubocop]
52
+
53
+ desc 'Attempt to automatically fix issues with the library'
54
+ task fix: [:'rubocop:auto_correct']
55
+ end
56
+
57
+ namespace :test do
58
+ RSpec::Core::RakeTask.new(:unit)
59
+ end
60
+
40
61
  RakeCircleCI.define_project_tasks(
41
- namespace: :circle_ci,
42
- project_slug: 'github/infrablocks/rake_fly'
62
+ namespace: :circle_ci,
63
+ project_slug: 'github/infrablocks/rake_fly'
43
64
  ) do |t|
44
65
  circle_ci_config =
45
- YAML.load_file('config/secrets/circle_ci/config.yaml')
66
+ YAML.load_file('config/secrets/circle_ci/config.yaml')
46
67
 
47
- t.api_token = circle_ci_config["circle_ci_api_token"]
68
+ t.api_token = circle_ci_config['circle_ci_api_token']
48
69
  t.environment_variables = {
49
- ENCRYPTION_PASSPHRASE:
50
- File.read('config/secrets/ci/encryption.passphrase')
51
- .chomp
70
+ ENCRYPTION_PASSPHRASE:
71
+ File.read('config/secrets/ci/encryption.passphrase')
72
+ .chomp
52
73
  }
53
74
  t.checkout_keys = []
54
75
  t.ssh_keys = [
55
- {
56
- hostname: "github.com",
57
- private_key: File.read('config/secrets/ci/ssh.private')
58
- }
76
+ {
77
+ hostname: 'github.com',
78
+ private_key: File.read('config/secrets/ci/ssh.private')
79
+ }
59
80
  ]
60
81
  end
61
82
 
62
83
  RakeGithub.define_repository_tasks(
63
- namespace: :github,
64
- repository: 'infrablocks/rake_fly',
84
+ namespace: :github,
85
+ repository: 'infrablocks/rake_fly'
65
86
  ) do |t, args|
66
87
  github_config =
67
- YAML.load_file('config/secrets/github/config.yaml')
88
+ YAML.load_file('config/secrets/github/config.yaml')
68
89
 
69
- t.access_token = github_config["github_personal_access_token"]
90
+ t.access_token = github_config['github_personal_access_token']
70
91
  t.deploy_keys = [
71
- {
72
- title: 'CircleCI',
73
- public_key: File.read('config/secrets/ci/ssh.public')
74
- }
92
+ {
93
+ title: 'CircleCI',
94
+ public_key: File.read('config/secrets/ci/ssh.public')
95
+ }
75
96
  ]
76
97
  t.branch_name = args.branch_name
77
98
  t.commit_message = args.commit_message
78
99
  end
79
100
 
80
101
  namespace :pipeline do
81
- task :prepare => [
82
- :'circle_ci:project:follow',
83
- :'circle_ci:env_vars:ensure',
84
- :'circle_ci:checkout_keys:ensure',
85
- :'circle_ci:ssh_keys:ensure',
86
- :'github:deploy_keys:ensure'
102
+ desc 'Prepare CircleCI Pipeline'
103
+ task prepare: %i[
104
+ circle_ci:project:follow
105
+ circle_ci:env_vars:ensure
106
+ circle_ci:checkout_keys:ensure
107
+ circle_ci:ssh_keys:ensure
108
+ github:deploy_keys:ensure
87
109
  ]
88
110
  end
89
111
 
90
112
  namespace :version do
91
- desc "Bump version for specified type (pre, major, minor, patch)"
113
+ desc 'Bump version for specified type (pre, major, minor, patch)'
92
114
  task :bump, [:type] do |_, args|
93
115
  bump_version_for(args.type)
94
116
  end
95
117
  end
96
118
 
97
- desc "Release gem"
119
+ desc 'Release gem'
98
120
  task :release do
99
- sh "gem release --tag --push"
121
+ sh 'gem release --tag --push'
100
122
  end
101
123
 
102
124
  def bump_version_for(version_type)
103
- sh "gem bump --version #{version_type} " +
104
- "&& bundle install " +
105
- "&& export LAST_MESSAGE=\"$(git log -1 --pretty=%B)\" " +
106
- "&& git commit -a --amend -m \"${LAST_MESSAGE} [ci skip]\""
125
+ sh "gem bump --version #{version_type} " \
126
+ '&& bundle install ' \
127
+ '&& export LAST_MESSAGE="$(git log -1 --pretty=%B)" ' \
128
+ '&& git commit -a --amend -m "${LAST_MESSAGE} [ci skip]"'
107
129
  end
data/bin/console CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require "bundler/setup"
4
- require "rake_fly"
4
+ require 'bundler/setup'
5
+ require 'rake_fly'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +11,5 @@ require "rake_fly"
10
11
  # require "pry"
11
12
  # Pry.start
12
13
 
13
- require "irb"
14
+ require 'irb'
14
15
  IRB.start(__FILE__)
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory/kernel_extensions'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory'
2
4
 
3
5
  require_relative '../tasks/authentication/login'
@@ -14,12 +16,15 @@ module RakeFly
14
16
  parameter :concourse_url, required: true
15
17
  parameter :team, default: 'main'
16
18
 
17
- parameter :backend, default: RakeFly::Tasks::Authentication::Login::ApiBackend
19
+ parameter :backend,
20
+ default: RakeFly::Tasks::Authentication::Login::ApiBackend
18
21
  parameter :username
19
22
  parameter :password
20
23
 
21
24
  parameter :home_directory,
22
- default: RakeFactory::DynamicValue.new { |_| ENV['HOME'] }
25
+ default: RakeFactory::DynamicValue.new { |_|
26
+ Dir.home
27
+ }
23
28
 
24
29
  parameter :login_task_name, default: :login
25
30
  parameter :ensure_task_name, default: :ensure
@@ -27,13 +32,13 @@ module RakeFly
27
32
  parameter :fly_ensure_task_name, default: :'fly:ensure'
28
33
 
29
34
  task Tasks::Authentication::Login,
30
- name: RakeFactory::DynamicValue.new { |ts|
31
- ts.login_task_name
32
- }
35
+ name: RakeFactory::DynamicValue.new { |ts|
36
+ ts.login_task_name
37
+ }
33
38
  task Tasks::Authentication::Ensure,
34
- name: RakeFactory::DynamicValue.new { |ts|
35
- ts.ensure_task_name
36
- }
39
+ name: RakeFactory::DynamicValue.new { |ts|
40
+ ts.ensure_task_name
41
+ }
37
42
  end
38
43
  end
39
44
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory'
2
4
 
3
5
  require_relative '../tasks/pipeline/get'
@@ -22,7 +24,9 @@ module RakeFly
22
24
  parameter :non_interactive
23
25
 
24
26
  parameter :home_directory,
25
- default: RakeFactory::DynamicValue.new { |_| ENV['HOME'] }
27
+ default: RakeFactory::DynamicValue.new { |_|
28
+ Dir.home
29
+ }
26
30
 
27
31
  parameter :get_task_name, default: :get
28
32
  parameter :set_task_name, default: :set
@@ -33,25 +37,25 @@ module RakeFly
33
37
  parameter :fly_ensure_task_name, default: :'fly:ensure'
34
38
 
35
39
  task Tasks::Pipeline::Get,
36
- name: RakeFactory::DynamicValue.new { |ts|
37
- ts.get_task_name
38
- }
40
+ name: RakeFactory::DynamicValue.new { |ts|
41
+ ts.get_task_name
42
+ }
39
43
  task Tasks::Pipeline::Set,
40
- name: RakeFactory::DynamicValue.new { |ts|
41
- ts.set_task_name
42
- }
44
+ name: RakeFactory::DynamicValue.new { |ts|
45
+ ts.set_task_name
46
+ }
43
47
  task Tasks::Pipeline::Unpause,
44
- name: RakeFactory::DynamicValue.new { |ts|
45
- ts.unpause_task_name
46
- }
48
+ name: RakeFactory::DynamicValue.new { |ts|
49
+ ts.unpause_task_name
50
+ }
47
51
  task Tasks::Pipeline::Push,
48
- name: RakeFactory::DynamicValue.new { |ts|
49
- ts.push_task_name
50
- }
52
+ name: RakeFactory::DynamicValue.new { |ts|
53
+ ts.push_task_name
54
+ }
51
55
  task Tasks::Pipeline::Destroy,
52
- name: RakeFactory::DynamicValue.new { |ts|
53
- ts.destroy_task_name
54
- }
56
+ name: RakeFactory::DynamicValue.new { |ts|
57
+ ts.destroy_task_name
58
+ }
55
59
  end
56
60
  end
57
61
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake_factory'
2
4
 
3
5
  require_relative '../tasks/authentication/login'
@@ -9,6 +11,7 @@ require_relative '../tasks/pipeline/push'
9
11
 
10
12
  module RakeFly
11
13
  module TaskSets
14
+ # rubocop:disable Metrics/ClassLength
12
15
  class Project < RakeFactory::TaskSet
13
16
  prepend RakeFactory::Namespaceable
14
17
 
@@ -17,7 +20,8 @@ module RakeFly
17
20
  parameter :concourse_url, required: true
18
21
  parameter :team, default: 'main'
19
22
 
20
- parameter :backend, default: RakeFly::Tasks::Authentication::Login::ApiBackend
23
+ parameter :backend,
24
+ default: RakeFly::Tasks::Authentication::Login::ApiBackend
21
25
  parameter :username
22
26
  parameter :password
23
27
 
@@ -29,10 +33,12 @@ module RakeFly
29
33
  parameter :non_interactive
30
34
 
31
35
  parameter :target,
32
- default: RakeFactory::DynamicValue.new { |t| t.team }
36
+ default: RakeFactory::DynamicValue.new { |t| t.team }
33
37
 
34
38
  parameter :home_directory,
35
- default: RakeFactory::DynamicValue.new { |_| ENV['HOME'] }
39
+ default: RakeFactory::DynamicValue.new { |_|
40
+ Dir.home
41
+ }
36
42
 
37
43
  parameter :authentication_namespace, default: :authentication
38
44
  parameter :authentication_login_task_name, default: :login
@@ -48,89 +54,93 @@ module RakeFly
48
54
  parameter :fly_ensure_task_name, default: :'fly:ensure'
49
55
 
50
56
  task Tasks::Authentication::Login,
51
- name: RakeFactory::DynamicValue.new { |ts|
52
- ts.authentication_login_task_name
53
- }
57
+ name: RakeFactory::DynamicValue.new { |ts|
58
+ ts.authentication_login_task_name
59
+ }
54
60
  task Tasks::Authentication::Ensure,
55
- name: RakeFactory::DynamicValue.new { |ts|
56
- ts.authentication_ensure_task_name
57
- },
58
- login_task_name: RakeFactory::DynamicValue.new { |ts|
59
- ts.authentication_login_task_name
60
- }
61
+ name: RakeFactory::DynamicValue.new { |ts|
62
+ ts.authentication_ensure_task_name
63
+ },
64
+ login_task_name: RakeFactory::DynamicValue.new { |ts|
65
+ ts.authentication_login_task_name
66
+ }
61
67
 
62
68
  task Tasks::Pipeline::Get,
63
- name: RakeFactory::DynamicValue.new { |ts|
64
- ts.pipeline_get_task_name
65
- },
66
- authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
67
- (ts.authentication_namespace.to_s + ":" +
68
- ts.authentication_ensure_task_name.to_s)
69
- .to_sym
70
- }
69
+ name: RakeFactory::DynamicValue.new { |ts|
70
+ ts.pipeline_get_task_name
71
+ },
72
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
73
+ "#{ts.authentication_namespace}:" \
74
+ "#{ts.authentication_ensure_task_name}"
75
+ .to_sym
76
+ }
71
77
  task Tasks::Pipeline::Set,
72
- name: RakeFactory::DynamicValue.new { |ts|
73
- ts.pipeline_set_task_name
74
- },
75
- authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
76
- (ts.authentication_namespace.to_s + ":" +
77
- ts.authentication_ensure_task_name.to_s)
78
- .to_sym
79
- }
78
+ name: RakeFactory::DynamicValue.new { |ts|
79
+ ts.pipeline_set_task_name
80
+ },
81
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
82
+ "#{ts.authentication_namespace}:" \
83
+ "#{ts.authentication_ensure_task_name}"
84
+ .to_sym
85
+ }
80
86
  task Tasks::Pipeline::Unpause,
81
- name: RakeFactory::DynamicValue.new { |ts|
82
- ts.pipeline_unpause_task_name
83
- },
84
- authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
85
- (ts.authentication_namespace.to_s + ":" +
86
- ts.authentication_ensure_task_name.to_s)
87
- .to_sym
88
- }
87
+ name: RakeFactory::DynamicValue.new { |ts|
88
+ ts.pipeline_unpause_task_name
89
+ },
90
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
91
+ "#{ts.authentication_namespace}:" \
92
+ "#{ts.authentication_ensure_task_name}"
93
+ .to_sym
94
+ }
89
95
  task Tasks::Pipeline::Push,
90
- name: RakeFactory::DynamicValue.new { |ts|
91
- ts.pipeline_push_task_name
92
- },
93
- get_task_name: RakeFactory::DynamicValue.new { |ts|
94
- ts.pipeline_get_task_name
95
- },
96
- set_task_name: RakeFactory::DynamicValue.new { |ts|
97
- ts.pipeline_set_task_name
98
- },
99
- unpause_task_name: RakeFactory::DynamicValue.new { |ts|
100
- ts.pipeline_unpause_task_name
101
- }
96
+ name: RakeFactory::DynamicValue.new { |ts|
97
+ ts.pipeline_push_task_name
98
+ },
99
+ get_task_name: RakeFactory::DynamicValue.new { |ts|
100
+ ts.pipeline_get_task_name
101
+ },
102
+ set_task_name: RakeFactory::DynamicValue.new { |ts|
103
+ ts.pipeline_set_task_name
104
+ },
105
+ unpause_task_name: RakeFactory::DynamicValue.new { |ts|
106
+ ts.pipeline_unpause_task_name
107
+ }
102
108
  task Tasks::Pipeline::Destroy,
103
- name: RakeFactory::DynamicValue.new { |ts|
104
- ts.pipeline_destroy_task_name
105
- },
106
- authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
107
- (ts.authentication_namespace.to_s + ":" +
108
- ts.authentication_ensure_task_name.to_s)
109
- .to_sym
110
- }
109
+ name: RakeFactory::DynamicValue.new { |ts|
110
+ ts.pipeline_destroy_task_name
111
+ },
112
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
113
+ "#{ts.authentication_namespace}:" \
114
+ "#{ts.authentication_ensure_task_name}"
115
+ .to_sym
116
+ }
111
117
 
112
118
  def define_on(application)
113
119
  around_define(application) do
114
120
  self.class.tasks.each do |task_definition|
115
- task_class = task_definition.klass.to_s
116
- ns = case task_class
117
- when /Pipeline/
118
- pipeline_namespace
119
- when /Authentication/
120
- authentication_namespace
121
- else
122
- raise StandardError.new(
123
- "Unexpected task definition: #{task_class}.")
124
- end
121
+ namespace = resolve_namespace(task_definition)
125
122
 
126
- application.in_namespace(ns) do
123
+ application.in_namespace(namespace) do
127
124
  task_definition
128
- .for_task_set(self)
129
- .define_on(application)
125
+ .for_task_set(self)
126
+ .define_on(application)
130
127
  end
131
128
  end
132
129
  end
133
130
  end
131
+
132
+ private
133
+
134
+ def resolve_namespace(task_definition)
135
+ case task_definition.klass.to_s
136
+ when /Pipeline/ then pipeline_namespace
137
+ when /Authentication/ then authentication_namespace
138
+ else
139
+ raise StandardError,
140
+ "Unexpected task definition: #{task_definition.klass}."
141
+ end
142
+ end
134
143
  end
144
+ # rubocop:enable Metrics/ClassLength
135
145
  end
136
146
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'task_sets/authentication'
2
4
  require_relative 'task_sets/pipeline'
3
5
  require_relative 'task_sets/project'