rake_fly 2.10.0.pre.2 → 2.10.0.pre.3

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: 5c566d99713b90e001612aefdec2465638d132a63f6fc134c46868be3a8a1707
4
- data.tar.gz: 47c30394915f404422f02b82eb4f14ceb39f70af939380f049cf291966cf982a
3
+ metadata.gz: 18edc1730fc579ae18a1676e8655366c803392ffa70e8b9b0b7df44825cd601c
4
+ data.tar.gz: 7f018eb6ff6c111238da6d7cf5faccd548aa5f57cbc5d543a15750bd63074681
5
5
  SHA512:
6
- metadata.gz: 33b29c9c4d6515d955b44c3661a214e72eba42d9fcf8544247f6ae12b08b810bf554739aa1e5e4a4bcfa9ec0fb107407a27f13996b6f56886b67b04e90dc3af4
7
- data.tar.gz: d50db0b70e3e51e27b108027c7da5ed49584245cb5d366d11ed95a3cf6a8e42fe37878b426c7dec45479a2b68fd9b8e0ccf1652b67a873c69a484838228e271d
6
+ metadata.gz: 3f89cdc837c90c872038a2f76b8a53f111e706ed4bdede06f1b07568da8bad9678a220f04fb047204605742ac60b9b675b3e8888dc12ac02d75a78abc07bcf75
7
+ data.tar.gz: 4074759a07ac784256f14772ecf6263547c008b0103f03dab5bffc0b5376ef3f8afcecd148bdc823d1716da0386a880c3c7c1da13acea23f944a986f149ba5a7
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.2)
4
+ rake_fly (2.10.0.pre.3)
5
5
  concourse.rb (>= 0.4)
6
6
  rake_dependencies (~> 3.1)
7
7
  rake_factory (~> 0.29)
@@ -18,6 +18,7 @@ GEM
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)
@@ -98,7 +99,11 @@ GEM
98
99
  sawyer (~> 0.8.0, >= 0.5.3)
99
100
  open4 (1.3.4)
100
101
  openssl (3.0.0)
102
+ parallel (1.22.1)
103
+ parser (3.1.1.0)
104
+ ast (~> 2.4.1)
101
105
  public_suffix (4.0.6)
106
+ rainbow (3.1.1)
102
107
  rake (13.0.6)
103
108
  rake_circle_ci (0.9.0)
104
109
  colored2 (~> 3.1)
@@ -125,6 +130,8 @@ GEM
125
130
  colored2 (~> 3.1)
126
131
  rake_factory (~> 0.23)
127
132
  sshkey (~> 2.0)
133
+ regexp_parser (2.2.1)
134
+ rexml (3.2.5)
128
135
  rspec (3.11.0)
129
136
  rspec-core (~> 3.11.0)
130
137
  rspec-expectations (~> 3.11.0)
@@ -138,6 +145,22 @@ GEM
138
145
  diff-lcs (>= 1.2.0, < 2.0)
139
146
  rspec-support (~> 3.11.0)
140
147
  rspec-support (3.11.0)
148
+ rubocop (1.26.1)
149
+ parallel (~> 1.10)
150
+ parser (>= 3.1.0.0)
151
+ rainbow (>= 2.2.2, < 4.0)
152
+ regexp_parser (>= 1.8, < 3.0)
153
+ rexml
154
+ rubocop-ast (>= 1.16.0, < 2.0)
155
+ ruby-progressbar (~> 1.7)
156
+ unicode-display_width (>= 1.4.0, < 3.0)
157
+ rubocop-ast (1.16.0)
158
+ parser (>= 3.1.1.0)
159
+ rubocop-rake (0.6.0)
160
+ rubocop (~> 1.0)
161
+ rubocop-rspec (2.9.0)
162
+ rubocop (~> 1.19)
163
+ ruby-progressbar (1.11.0)
141
164
  ruby2_keywords (0.0.5)
142
165
  ruby_fly (0.37.0)
143
166
  lino (~> 3.0)
@@ -157,6 +180,7 @@ GEM
157
180
  sshkey (2.0.0)
158
181
  tzinfo (2.0.4)
159
182
  concurrent-ruby (~> 1.0)
183
+ unicode-display_width (2.1.0)
160
184
 
161
185
  PLATFORMS
162
186
  ruby
@@ -177,7 +201,10 @@ DEPENDENCIES
177
201
  rake_gpg
178
202
  rake_ssh
179
203
  rspec
204
+ rubocop
205
+ rubocop-rake
206
+ rubocop-rspec
180
207
  simplecov
181
208
 
182
209
  BUNDLED WITH
183
- 2.3.9
210
+ 2.3.11
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,13 @@ 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 { |_| ENV['HOME'] }
23
26
 
24
27
  parameter :login_task_name, default: :login
25
28
  parameter :ensure_task_name, default: :ensure
@@ -27,13 +30,13 @@ module RakeFly
27
30
  parameter :fly_ensure_task_name, default: :'fly:ensure'
28
31
 
29
32
  task Tasks::Authentication::Login,
30
- name: RakeFactory::DynamicValue.new { |ts|
31
- ts.login_task_name
32
- }
33
+ name: RakeFactory::DynamicValue.new { |ts|
34
+ ts.login_task_name
35
+ }
33
36
  task Tasks::Authentication::Ensure,
34
- name: RakeFactory::DynamicValue.new { |ts|
35
- ts.ensure_task_name
36
- }
37
+ name: RakeFactory::DynamicValue.new { |ts|
38
+ ts.ensure_task_name
39
+ }
37
40
  end
38
41
  end
39
42
  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,7 @@ 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 { |_| ENV['HOME'] }
26
28
 
27
29
  parameter :get_task_name, default: :get
28
30
  parameter :set_task_name, default: :set
@@ -33,25 +35,25 @@ module RakeFly
33
35
  parameter :fly_ensure_task_name, default: :'fly:ensure'
34
36
 
35
37
  task Tasks::Pipeline::Get,
36
- name: RakeFactory::DynamicValue.new { |ts|
37
- ts.get_task_name
38
- }
38
+ name: RakeFactory::DynamicValue.new { |ts|
39
+ ts.get_task_name
40
+ }
39
41
  task Tasks::Pipeline::Set,
40
- name: RakeFactory::DynamicValue.new { |ts|
41
- ts.set_task_name
42
- }
42
+ name: RakeFactory::DynamicValue.new { |ts|
43
+ ts.set_task_name
44
+ }
43
45
  task Tasks::Pipeline::Unpause,
44
- name: RakeFactory::DynamicValue.new { |ts|
45
- ts.unpause_task_name
46
- }
46
+ name: RakeFactory::DynamicValue.new { |ts|
47
+ ts.unpause_task_name
48
+ }
47
49
  task Tasks::Pipeline::Push,
48
- name: RakeFactory::DynamicValue.new { |ts|
49
- ts.push_task_name
50
- }
50
+ name: RakeFactory::DynamicValue.new { |ts|
51
+ ts.push_task_name
52
+ }
51
53
  task Tasks::Pipeline::Destroy,
52
- name: RakeFactory::DynamicValue.new { |ts|
53
- ts.destroy_task_name
54
- }
54
+ name: RakeFactory::DynamicValue.new { |ts|
55
+ ts.destroy_task_name
56
+ }
55
57
  end
56
58
  end
57
59
  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,10 @@ 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 { |_| ENV['HOME'] }
36
40
 
37
41
  parameter :authentication_namespace, default: :authentication
38
42
  parameter :authentication_login_task_name, default: :login
@@ -48,89 +52,93 @@ module RakeFly
48
52
  parameter :fly_ensure_task_name, default: :'fly:ensure'
49
53
 
50
54
  task Tasks::Authentication::Login,
51
- name: RakeFactory::DynamicValue.new { |ts|
52
- ts.authentication_login_task_name
53
- }
55
+ name: RakeFactory::DynamicValue.new { |ts|
56
+ ts.authentication_login_task_name
57
+ }
54
58
  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
- }
59
+ name: RakeFactory::DynamicValue.new { |ts|
60
+ ts.authentication_ensure_task_name
61
+ },
62
+ login_task_name: RakeFactory::DynamicValue.new { |ts|
63
+ ts.authentication_login_task_name
64
+ }
61
65
 
62
66
  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
- }
67
+ name: RakeFactory::DynamicValue.new { |ts|
68
+ ts.pipeline_get_task_name
69
+ },
70
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
71
+ "#{ts.authentication_namespace}:"\
72
+ "#{ts.authentication_ensure_task_name}"
73
+ .to_sym
74
+ }
71
75
  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
- }
76
+ name: RakeFactory::DynamicValue.new { |ts|
77
+ ts.pipeline_set_task_name
78
+ },
79
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
80
+ "#{ts.authentication_namespace}:"\
81
+ "#{ts.authentication_ensure_task_name}"
82
+ .to_sym
83
+ }
80
84
  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
- }
85
+ name: RakeFactory::DynamicValue.new { |ts|
86
+ ts.pipeline_unpause_task_name
87
+ },
88
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
89
+ "#{ts.authentication_namespace}:"\
90
+ "#{ts.authentication_ensure_task_name}"
91
+ .to_sym
92
+ }
89
93
  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
- }
94
+ name: RakeFactory::DynamicValue.new { |ts|
95
+ ts.pipeline_push_task_name
96
+ },
97
+ get_task_name: RakeFactory::DynamicValue.new { |ts|
98
+ ts.pipeline_get_task_name
99
+ },
100
+ set_task_name: RakeFactory::DynamicValue.new { |ts|
101
+ ts.pipeline_set_task_name
102
+ },
103
+ unpause_task_name: RakeFactory::DynamicValue.new { |ts|
104
+ ts.pipeline_unpause_task_name
105
+ }
102
106
  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
- }
107
+ name: RakeFactory::DynamicValue.new { |ts|
108
+ ts.pipeline_destroy_task_name
109
+ },
110
+ authentication_ensure_task_name: RakeFactory::DynamicValue.new { |ts|
111
+ "#{ts.authentication_namespace}:"\
112
+ "#{ts.authentication_ensure_task_name}"
113
+ .to_sym
114
+ }
111
115
 
112
116
  def define_on(application)
113
117
  around_define(application) do
114
118
  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
119
+ namespace = resolve_namespace(task_definition)
125
120
 
126
- application.in_namespace(ns) do
121
+ application.in_namespace(namespace) do
127
122
  task_definition
128
- .for_task_set(self)
129
- .define_on(application)
123
+ .for_task_set(self)
124
+ .define_on(application)
130
125
  end
131
126
  end
132
127
  end
133
128
  end
129
+
130
+ private
131
+
132
+ def resolve_namespace(task_definition)
133
+ case task_definition.klass.to_s
134
+ when /Pipeline/ then pipeline_namespace
135
+ when /Authentication/ then authentication_namespace
136
+ else
137
+ raise StandardError,
138
+ "Unexpected task definition: #{task_definition.klass}."
139
+ end
140
+ end
134
141
  end
142
+ # rubocop:enable Metrics/ClassLength
135
143
  end
136
144
  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'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'ruby_fly'
2
4
  require 'rake_factory'
3
5
  require 'concourse'
@@ -7,39 +9,40 @@ module RakeFly
7
9
  module Authentication
8
10
  class Ensure < RakeFactory::Task
9
11
  default_name :ensure
10
- default_prerequisites RakeFactory::DynamicValue.new { |t|
12
+ default_prerequisites(RakeFactory::DynamicValue.new do |t|
11
13
  [t.fly_ensure_task_name]
12
- }
13
- default_description RakeFactory::DynamicValue.new { |t|
14
+ end)
15
+ default_description(RakeFactory::DynamicValue.new do |t|
14
16
  target = t.target || '<derived>'
15
17
 
16
18
  "Ensure logged in for target #{target}"
17
- }
19
+ end)
18
20
 
19
21
  parameter :target, required: true
20
22
 
21
23
  parameter :home_directory,
22
- default: RakeFactory::DynamicValue.new { |_| ENV['HOME'] }
24
+ default: RakeFactory::DynamicValue.new { |_| ENV['HOME'] }
23
25
 
24
- parameter :login_task_name, :default => :login
26
+ parameter :login_task_name, default: :login
25
27
 
26
- parameter :fly_ensure_task_name, :default => :'fly:ensure'
28
+ parameter :fly_ensure_task_name, default: :'fly:ensure'
27
29
 
28
30
  action do |t, args|
29
- puts "Ensuring target #{t.target} is logged in..."
31
+ $stdout.puts("Ensuring target #{t.target} is logged in...")
30
32
  status = RubyFly.status(
31
- target: t.target,
32
- environment: {
33
- "HOME" => t.home_directory
34
- })
33
+ target: t.target,
34
+ environment: {
35
+ 'HOME' => t.home_directory
36
+ }
37
+ )
35
38
  if status == :logged_in
36
- puts "Already logged in. Continuing..."
39
+ $stdout.puts('Already logged in. Continuing...')
37
40
  else
38
- puts "Not logged in. Logging in..."
41
+ $stdout.puts('Not logged in. Logging in...')
39
42
  t.application[t.login_task_name, t.scope].invoke(*args)
40
43
  end
41
44
  end
42
45
  end
43
46
  end
44
47
  end
45
- end
48
+ end