firespring_dev_commands 1.5.4 → 2.0.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/lib/firespring_dev_commands/audit/report.rb +1 -1
  3. data/lib/firespring_dev_commands/aws/account.rb +9 -21
  4. data/lib/firespring_dev_commands/aws/cloudformation.rb +7 -7
  5. data/lib/firespring_dev_commands/aws/codepipeline.rb +1 -1
  6. data/lib/firespring_dev_commands/aws/credentials.rb +5 -9
  7. data/lib/firespring_dev_commands/aws/login.rb +12 -14
  8. data/lib/firespring_dev_commands/aws/parameter.rb +2 -2
  9. data/lib/firespring_dev_commands/aws/s3.rb +1 -1
  10. data/lib/firespring_dev_commands/docker/compose.rb +16 -7
  11. data/lib/firespring_dev_commands/docker.rb +3 -8
  12. data/lib/firespring_dev_commands/git.rb +3 -3
  13. data/lib/firespring_dev_commands/jira/user.rb +1 -1
  14. data/lib/firespring_dev_commands/jira.rb +5 -5
  15. data/lib/firespring_dev_commands/node/audit.rb +1 -1
  16. data/lib/firespring_dev_commands/templates/aws.rb +1 -1
  17. data/lib/firespring_dev_commands/templates/base_interface.rb +1 -1
  18. data/lib/firespring_dev_commands/templates/ci.rb +2 -2
  19. data/lib/firespring_dev_commands/templates/docker/node/application.rb +5 -5
  20. data/lib/firespring_dev_commands/templates/docker/php/application.rb +5 -5
  21. data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +5 -5
  22. data/lib/firespring_dev_commands/templates/eol.rb +1 -1
  23. data/lib/firespring_dev_commands/templates/git.rb +1 -1
  24. data/lib/firespring_dev_commands/version.rb +1 -1
  25. data/lib/firespring_dev_commands.rb +2 -0
  26. metadata +31 -187
  27. data/lib/firespring_dev_commands/slack/global.rb +0 -32
  28. data/lib/firespring_dev_commands/slack.rb +0 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78decb68edca360ca267232996476a6a1d4e1c2e02ed415bf6efc8c72c1df729
4
- data.tar.gz: 90c624acb2d76ccb53b61c264d652771f5ae90b8f93bc18df3a0d7f46ee52095
3
+ metadata.gz: 0b0b0b93719ba8c6b8ddb34f39777bf1f2e4ee5eb95e85c1a1eb0f45e78a9441
4
+ data.tar.gz: '08d558e6e2b846d266b158ebf8b6b8eba3e620e3e2002ab77a7876dec65189ec'
5
5
  SHA512:
6
- metadata.gz: 1f8ccdbcb9994d2be9c7140c083711f28f40f2451e2d1adfb3ca17feefd93896014d991b8870d5d88bb2a775fac6900fc24977cf7077aa343a366761844612e1
7
- data.tar.gz: f61c95e4317077e6a3384e9e6fbdc850a57e0e99739f17cfd6e1d7145376b4c837318c7e861f559b1c779de782d1fd0bec95f7179afd7c4cdf855c93aeb0da4c
6
+ metadata.gz: 5065bf94f9f4f0492794b4b944a01c017f31eab27d659827fa82c1512bec2c91b9da331e3fa114a49ba9afab75bcce94375955a55d4f00d0066a6149b960beb5
7
+ data.tar.gz: 3accee26e593d454a1c87f2cdcb865a723ab5cd12be8b3da1960b86fc5aa12eff6303f2fcc1f8f69e280e14487be132f2b2b27c879d33699ed92e193900a38e9
@@ -31,7 +31,7 @@ module Dev
31
31
  # Output the text of the filtered report items
32
32
  # Exit with a non-zero status if any vulnerabilities were found
33
33
  def check
34
- puts(to_s)
34
+ puts(self)
35
35
  return if filtered_items.empty?
36
36
 
37
37
  at_exit { exit(1) }
@@ -23,10 +23,6 @@ module Dev
23
23
  # The name of the file containing the Aws settings
24
24
  CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/config".freeze
25
25
 
26
- def self.config_ini
27
- IniFile.new(filename: CONFIG_FILE, default: 'default')
28
- end
29
-
30
26
  # TODO: registry is deprecated and should be removed on the next major release
31
27
  attr_accessor :root, :children, :default, :registry, :ecr_registry_ids
32
28
 
@@ -79,7 +75,7 @@ module Dev
79
75
  puts 'Configuring default login values'
80
76
 
81
77
  # Write region and mfa serial to config file
82
- cfgini = self.class.config_ini
78
+ cfgini = IniFile.new(filename: "#{Dev::Aws::CONFIG_DIR}/config", default: 'default')
83
79
  defaultini = cfgini['default']
84
80
 
85
81
  region_default = defaultini['region'] || ENV['AWS_DEFAULT_REGION'] || Dev::Aws::DEFAULT_REGION
@@ -105,7 +101,7 @@ module Dev
105
101
  # Setup Aws account specific settings
106
102
  def setup!(account)
107
103
  # Run base setup if it doesn't exist
108
- Rake::Task['aws:configure:default'].invoke unless File.exist?(CONFIG_FILE) && self.class.config_ini.has_section?('default')
104
+ Rake::Task['aws:configure:default'].invoke unless File.exist?(CONFIG_FILE)
109
105
 
110
106
  puts
111
107
  puts "Configuring #{account} login values"
@@ -119,7 +115,7 @@ module Dev
119
115
  raise 'Configure default account settings first (rake aws:configure:default)' unless File.exist?(CONFIG_FILE)
120
116
 
121
117
  # Parse the ini file and load values
122
- cfgini = self.class.config_ini
118
+ cfgini = IniFile.new(filename: CONFIG_FILE, default: 'default')
123
119
  defaultini = cfgini['default']
124
120
  profileini = cfgini["profile #{account}"]
125
121
 
@@ -128,21 +124,13 @@ module Dev
128
124
  region_default = profileini['region'] || defaultini['region'] || ENV['AWS_DEFAULT_REGION'] || Dev::Aws::DEFAULT_REGION
129
125
  profileini['region'] = Dev::Common.new.ask('Default region name', region_default)
130
126
 
131
- # NOTE: Turns out the role_arn is needed by the aws cli so we are changing directions here. Eventually we should remove the role_name
132
- # from the ini files and only store the role arn. However we need to still keep the functinoality so that the user is only asked
133
- # for the role name - not the entire arn
134
- role_name_default = if profileini['role_name']
135
- profileini['role_name']
136
- elsif profileini['role_arn']
137
- profileini['role_arn']&.split(%r{role/})&.last
138
- else
139
- self.class.config.default_login_role_name
140
- end
141
- role_name = Dev::Common.new.ask('Default role name', role_name_default)
142
- profileini['role_arn'] = "arn:aws:iam::#{account}:role/#{role_name}"
143
- # TODO: role_name is deprecated. Eventually, we should delete the role_name entry from the config. Leaving it for now
127
+ # NOTE: We had an old config for "role_arn" which included the entire arn. We deprecated that config since
128
+ # it made it much more difficult to switch between different accounts.
129
+ role_name_default = profileini['role_name'] || profileini['role_arn']&.split(%r{role/})&.last || self.class.config.default_login_role_name
130
+ profileini['role_name'] = Dev::Common.new.ask('Default role name', role_name_default)
131
+ # TODO: role_arn is deprecated. Eventually, we should delete the role_arn entry from the config. Leaving it for now
144
132
  # because some projects may be using older versions of the dev_commands library
145
- # profileini.delete('role_name')
133
+ # profileini.delete('role_arn')
146
134
 
147
135
  cfgini.write
148
136
  end
@@ -49,9 +49,9 @@ module Dev
49
49
  # Create the cloudformation stack
50
50
  client.create_stack(
51
51
  stack_name: name,
52
- template_url: template_url,
52
+ template_url:,
53
53
  parameters: parameters.default,
54
- capabilities: capabilities,
54
+ capabilities:,
55
55
  on_failure: failure_behavior
56
56
  )
57
57
  @state = STARTED
@@ -77,9 +77,9 @@ module Dev
77
77
  # Update the cloudformation stack
78
78
  client.update_stack(
79
79
  stack_name: name,
80
- template_url: template_url,
80
+ template_url:,
81
81
  parameters: parameters.preserve,
82
- capabilities: capabilities
82
+ capabilities:
83
83
  )
84
84
  @state = STARTED
85
85
  LOG.info "#{name} stack update started at #{Time.now.to_s.light_yellow}"
@@ -144,8 +144,8 @@ module Dev
144
144
 
145
145
  client.wait_until(
146
146
  :"stack_#{type}",
147
- {stack_name: stack_name},
148
- {max_attempts: max_attempts, delay: delay}
147
+ {stack_name:},
148
+ {max_attempts:, delay:}
149
149
  )
150
150
  rescue ::Aws::Waiters::Errors::WaiterFailed => e
151
151
  raise "Action failed to complete: #{e.message}"
@@ -181,7 +181,7 @@ module Dev
181
181
  s3 = Dev::Aws::S3.new
182
182
  template_bucket = s3.cf_bucket.name
183
183
  key = "#{File.basename(filename)}/#{SecureRandom.uuid}"
184
- s3.put(bucket: template_bucket, key: key, filename: filename)
184
+ s3.put(bucket: template_bucket, key:, filename:)
185
185
  end
186
186
  end
187
187
  end
@@ -39,7 +39,7 @@ module Dev
39
39
 
40
40
  # Find all pipelines matching the regex_match and find the status for each of them
41
41
  def status(name)
42
- pipeline = client.get_pipeline_state(name: name)
42
+ pipeline = client.get_pipeline_state(name:)
43
43
  print_pipeline_information(pipeline)
44
44
  rescue ::Aws::CodePipeline::Errors::PipelineNotFoundException
45
45
  LOG.error "No pipeline found with name #{name}".light_yellow
@@ -11,10 +11,6 @@ module Dev
11
11
  # The local file where temporary credentials are stored
12
12
  CONFIG_FILE = "#{Dev::Aws::CONFIG_DIR}/credentials".freeze
13
13
 
14
- def self.config_ini
15
- IniFile.new(filename: CONFIG_FILE, default: 'default')
16
- end
17
-
18
14
  # The account the profile is currently logged in to
19
15
  def logged_in_account
20
16
  ::Aws::STS::Client.new.get_caller_identity.account
@@ -49,7 +45,7 @@ module Dev
49
45
 
50
46
  # Check for expired credentials
51
47
  begin
52
- ::Aws::STS::Client.new(profile: profile).get_caller_identity
48
+ ::Aws::STS::Client.new(profile:).get_caller_identity
53
49
  rescue
54
50
  return false
55
51
  end
@@ -57,7 +53,7 @@ module Dev
57
53
  # Check for invalid credentials
58
54
  begin
59
55
  # TODO: Is there a better check we can do here?
60
- ::Aws::SSM::Client.new(profile: profile).describe_parameters(max_results: 1)
56
+ ::Aws::SSM::Client.new(profile:).describe_parameters(max_results: 1)
61
57
  rescue
62
58
  return false
63
59
  end
@@ -76,7 +72,7 @@ module Dev
76
72
  puts 'Configuring default credential values'
77
73
 
78
74
  # Write access key / secret key in the credentials file
79
- credini = self.class.config_ini
75
+ credini = IniFile.new(filename: "#{Dev::Aws::CONFIG_DIR}/credentials", default: 'default')
80
76
  defaultini = credini['default']
81
77
 
82
78
  access_key_default = defaultini['aws_access_key_id']
@@ -91,7 +87,7 @@ module Dev
91
87
  # Write Aws account specific settings to the credentials file
92
88
  def write!(account, creds)
93
89
  # Write access key / secret key / session token in the credentials file
94
- credini = self.class.config_ini
90
+ credini = IniFile.new(filename: CONFIG_FILE, default: 'default')
95
91
  defaultini = credini[account]
96
92
 
97
93
  defaultini['aws_access_key_id'] = creds.access_key_id
@@ -136,7 +132,7 @@ module Dev
136
132
  return unless File.exist?(CONFIG_FILE)
137
133
 
138
134
  # Otherwise load access key / secret key / session token from the credentials file into the environment
139
- credini = self.class.config_ini
135
+ credini = IniFile.new(filename: CONFIG_FILE, default: 'default')
140
136
  profile_credentials = credini[Dev::Aws::Profile.new.current]
141
137
  return unless profile_credentials
142
138
 
@@ -42,11 +42,9 @@ module Dev
42
42
  serial = "arn:aws:iam::#{Dev::Aws::Account.new.root.id}:mfa/#{serial}" if serial
43
43
  serial ||= profileini['mfa_serial'] || defaultini['mfa_serial']
44
44
 
45
- role = profileini['role_arn'] || defaultini['role_arn']
46
- # NOTE: We supported role name for a period of time but we are switching back to role_arn.
47
- # Leaving this here for a period of time until it can be deprecated
48
- role ||= "arn:aws:iam::#{account}:role/#{profileini['role_name'] || defaultini['role_name']}"
49
- # TODO: role_name is deprecated. Eventually, we should remove the above line
45
+ role = profileini['role_name'] || defaultini['role_name']
46
+ role = "arn:aws:iam::#{account}:role/#{role}" if role
47
+ role ||= profileini['role_arn'] || defaultini['role_arn']
50
48
 
51
49
  session_name = profileini['role_session_name'] || defaultini['role_session_name']
52
50
  session_duration = profileini['session_duration'] || defaultini['session_duration']
@@ -58,7 +56,7 @@ module Dev
58
56
  code = ENV['AWS_TOKEN_CODE'] || Dev::Common.new.ask("Enter the MFA code for the #{ENV.fetch('USERNAME', '')} user serial #{serial}")
59
57
  raise 'MFA is required' unless code.to_s.strip
60
58
 
61
- sts = ::Aws::STS::Client.new(profile: 'default', region: region)
59
+ sts = ::Aws::STS::Client.new(profile: 'default', region:)
62
60
  creds = sts.assume_role(
63
61
  serial_number: serial,
64
62
  role_arn: role,
@@ -74,10 +72,10 @@ module Dev
74
72
  # Returns the config ini file
75
73
  # Runs the setup for our current account if it's not already setup
76
74
  def setup_cfgini(account)
77
- cfgini = Dev::Aws::Account.config_ini
75
+ cfgini = IniFile.new(filename: "#{Dev::Aws::CONFIG_DIR}/config", default: 'default')
78
76
  unless cfgini.has_section?("profile #{account}")
79
77
  Dev::Aws::Account.new.write!(account)
80
- cfgini = Dev::Aws::Account.config_ini
78
+ cfgini = IniFile.new(filename: "#{Dev::Aws::CONFIG_DIR}/config", default: 'default')
81
79
  end
82
80
  cfgini
83
81
  end
@@ -90,7 +88,7 @@ module Dev
90
88
  return if registry_ids.empty?
91
89
 
92
90
  puts
93
- registry_ids.each { |id| registry_login!(registry_id: id, region: region) }
91
+ registry_ids.each { |id| registry_login!(registry_id: id, region:) }
94
92
  puts
95
93
  end
96
94
 
@@ -103,8 +101,8 @@ module Dev
103
101
  raise 'region is required' if region.to_s.strip.empty?
104
102
 
105
103
  registry = "#{registry_id}.dkr.ecr.#{region}.amazonaws.com"
106
- docker_cli_login!(registry: registry, region: region)
107
- docker_lib_login!(registry_id: registry_id, region: region)
104
+ docker_cli_login!(registry:, region:)
105
+ docker_lib_login!(registry_id:, region:)
108
106
 
109
107
  ENV['ECR_REGISTRY_ID'] ||= registry_id
110
108
  ENV['ECR_REGISTRY'] ||= registry
@@ -117,7 +115,7 @@ module Dev
117
115
  registry_id ||= Dev::Aws::Account.new.ecr_registry_ids.first
118
116
  region ||= Dev::Aws::Credentials.new.logged_in_region || Dev::Aws::DEFAULT_REGION
119
117
  warn '[DEPRECATION] `Dev::Aws::Login#docker_login!` is deprecated. Please use `Dev::Aws::Login#registry_login!` instead.'
120
- docker_cli_login!(registry: "#{registry_id}.dkr.ecr.#{region}.amazonaws.com", region: region)
118
+ docker_cli_login!(registry: "#{registry_id}.dkr.ecr.#{region}.amazonaws.com", region:)
121
119
  puts
122
120
  end
123
121
 
@@ -137,13 +135,13 @@ module Dev
137
135
  registry_id ||= Dev::Aws::Account.new.ecr_registry_ids.first
138
136
  region ||= Dev::Aws::Credentials.new.logged_in_region || Dev::Aws::DEFAULT_REGION
139
137
  warn '[DEPRECATION] `Dev::Aws::Login#ecr_login!` is deprecated. Please use `Dev::Aws::Login#registry_login!` instead.'
140
- docker_lib_login!(registry_id: registry_id, region: region)
138
+ docker_lib_login!(registry_id:, region:)
141
139
  end
142
140
 
143
141
  # Authroizes the docker ruby library to pull/push images from the Aws container registry
144
142
  private def docker_lib_login!(registry_id:, region:)
145
143
  # Grab your authentication token from AWS ECR
146
- ecr_client = ::Aws::ECR::Client.new(region: region)
144
+ ecr_client = ::Aws::ECR::Client.new(region:)
147
145
  tokens = ecr_client.get_authorization_token(registry_ids: Array(registry_id)).authorization_data
148
146
  tokens.each do |token|
149
147
  # Remove the https:// to authenticate
@@ -18,12 +18,12 @@ module Dev
18
18
 
19
19
  # Get the value of the given parameter name
20
20
  def get_value(name, with_decryption: true)
21
- get(name, with_decryption: with_decryption)&.value
21
+ get(name, with_decryption:)&.value
22
22
  end
23
23
 
24
24
  # Retrieve the ssm parameter object with the given name
25
25
  def get(name, with_decryption: true)
26
- client.get_parameter(name: name, with_decryption: with_decryption)&.parameter
26
+ client.get_parameter(name:, with_decryption:)&.parameter
27
27
  rescue ::Aws::SSM::Errors::ParameterNotFound
28
28
  raise "parameter #{name} does not exist in #{Dev::Aws::Profile.new.current}"
29
29
  end
@@ -22,7 +22,7 @@ module Dev
22
22
  def put(bucket:, key:, filename:, acl: 'private')
23
23
  begin
24
24
  File.open(filename, 'rb') do |file|
25
- client.put_object(bucket: bucket, key: key, body: file, acl: acl)
25
+ client.put_object(bucket:, key:, body: file, acl:)
26
26
  end
27
27
  rescue => e
28
28
  raise "s3 file upload failed: #{e.message}"
@@ -8,8 +8,9 @@ module Dev
8
8
  # Class containing methods for interfacing with the docker compose cli
9
9
  class Compose
10
10
  # Config object for setting top level docker compose config options
11
- Config = Struct.new(:project_dir, :project_name, :compose_files, :min_version, :max_version) do
11
+ Config = Struct.new(:executable_name, :project_dir, :project_name, :compose_files, :min_version, :max_version) do
12
12
  def initialize
13
+ self.executable_name = EXECUTABLE_NAME
13
14
  self.project_dir = DEV_COMMANDS_ROOT_DIR
14
15
  self.project_name = DEV_COMMANDS_PROJECT_NAME
15
16
  self.compose_files = ["#{DEV_COMMANDS_ROOT_DIR}/docker-compose.yml"]
@@ -69,12 +70,12 @@ module Dev
69
70
  # Checks the min and max version against the current docker version if they have been configured
70
71
  def check_version
71
72
  min_version = self.class.config.min_version
72
- raise "requires #{EXECUTABLE_NAME} version >= #{min_version} (found #{self.class.version})" if min_version &&
73
- !Dev::Common.new.version_greater_than(min_version, self.class.version)
73
+ version_too_low = min_version && !Dev::Common.new.version_greater_than(min_version, self.class.version)
74
+ raise "requires #{self.class.config.executable_name} version >= #{min_version} (found #{self.class.version})" if version_too_low
74
75
 
75
76
  max_version = self.class.config.max_version
76
- raise "requires #{EXECUTABLE_NAME} version < #{max_version} (found #{self.class.version})" if max_version &&
77
- Dev::Common.new.version_greater_than(max_version, self.class.version)
77
+ version_too_high = max_version && Dev::Common.new.version_greater_than(max_version, self.class.version)
78
+ raise "requires #{self.class.config.executable_name} version < #{max_version} (found #{self.class.version})" if version_too_high
78
79
  end
79
80
 
80
81
  # Pull in supported env settings and call build
@@ -83,6 +84,7 @@ module Dev
83
84
  def build
84
85
  merge_options('--parallel')
85
86
  merge_env_pull_option
87
+ merge_env_push_option
86
88
  merge_env_cache_option
87
89
  execute_command(build_command('build'))
88
90
  end
@@ -181,6 +183,13 @@ module Dev
181
183
  merge_options('--pull') if ENV['PULL'].to_s.strip == 'true'
182
184
  end
183
185
 
186
+ # Merge --push option if PUSH is set to true and no existing push options are present
187
+ private def merge_env_push_option
188
+ return if @options.any? { |it| it.include?('push') }
189
+
190
+ merge_options('--push') if ENV['PUSH'].to_s.strip == 'true'
191
+ end
192
+
184
193
  # Merge --no-build option unless BUILD is set to true and no existing build options are present
185
194
  private def merge_env_build_option
186
195
  return if @options.any? { |it| it.include?('build') }
@@ -230,7 +239,7 @@ module Dev
230
239
 
231
240
  # Build the compose command with the given inputs
232
241
  private def build_command(action, *cmd)
233
- command = [EXECUTABLE_NAME]
242
+ command = self.class.config.executable_name.split(/\s+/)
234
243
  command << '--project-directory' << project_dir
235
244
  command << '-p' << project_name if project_name
236
245
  Array(compose_files).compact.each { |file| command << '-f' << file }
@@ -264,7 +273,7 @@ module Dev
264
273
  # Print the compose command that will be executed and then execute it
265
274
  private def execute_command(command)
266
275
  LOG.debug " > #{command.join(' ')}"
267
- ::Dev::Common.new.run_command(command, capture: capture)
276
+ ::Dev::Common.new.run_command(command, capture:)
268
277
  end
269
278
  end
270
279
  end
@@ -74,7 +74,7 @@ module Dev
74
74
  def prune_volumes
75
75
  opts = {}
76
76
  opts[:filters] = {all: ['true']}.to_json if Dev::Common.new.version_greater_than('22.9999.0', self.class.version) && ENV['ALL_VOLUMES'].to_s.strip != 'false'
77
- _prune('volumes', opts: opts)
77
+ _prune('volumes', opts:)
78
78
  end
79
79
 
80
80
  # Prunes/removes all unused images
@@ -88,7 +88,7 @@ module Dev
88
88
  format_prune(type, response)
89
89
  rescue ::Docker::Error::ServerError => e
90
90
  # Specifically check for 'prune already running' error and retry if found
91
- if /already running/.match?(e.to_s)
91
+ if e.to_s.include?('already running')
92
92
  sleep 2
93
93
  retry
94
94
  end
@@ -201,8 +201,6 @@ module Dev
201
201
  private def image_info(image)
202
202
  [].tap do |ary|
203
203
  arch = image.json&.dig('Architecture')
204
- variant = image.json&.dig('Variant')
205
- arch = "#{arch}/#{variant}" if variant
206
204
  id = image.info&.dig('id')&.split(':')&.last&.slice(0..11)
207
205
  created = timesince(Time.at(image.info&.dig('Created')))
208
206
  size = filesize(image.info&.dig('Size'))
@@ -255,10 +253,7 @@ module Dev
255
253
  private def container_info(container)
256
254
  id = container.id&.slice(0..11)
257
255
  image = container.info&.dig('Image')
258
- image_json = ::Docker::Image.get(image).json
259
- arch = image_json&.dig('Architecture')
260
- variant = image_json&.dig('Variant')
261
- arch = "#{arch}/#{variant}" if variant
256
+ arch = ::Docker::Image.get(image).json&.dig('Architecture')
262
257
  command = container.info&.dig('Command')
263
258
  created = timesince(Time.at(container.info&.dig('Created')))
264
259
  status = container.info&.dig('Status')
@@ -289,7 +289,7 @@ module Dev
289
289
  raise 'branch does not exist' unless branch_exists?(dir, branch)
290
290
 
291
291
  # No need to merge into ourself
292
- current_branch = branch_name(dir: dir)
292
+ current_branch = branch_name(dir:)
293
293
  return true if current_branch == branch
294
294
 
295
295
  indent "Merging #{branch} into #{current_branch}"
@@ -326,7 +326,7 @@ module Dev
326
326
  g = ::Git.open(dir)
327
327
  g.fetch('origin', prune: true)
328
328
 
329
- branch = branch_name(dir: dir)
329
+ branch = branch_name(dir:)
330
330
  indent "Pulling branch #{branch} from origin"
331
331
  indent g.pull('origin', branch)
332
332
  true
@@ -361,7 +361,7 @@ module Dev
361
361
  g = ::Git.open(dir)
362
362
  g.fetch('origin', prune: true)
363
363
 
364
- branch = branch_name(dir: dir)
364
+ branch = branch_name(dir:)
365
365
  indent "Pushing branch #{branch} to origin"
366
366
  indent g.push('origin', branch)
367
367
  true
@@ -23,7 +23,7 @@ module Dev
23
23
  # If none is found, it returns a Jira user object with only the id set
24
24
  def self.lookup(id)
25
25
  user = Dev::Jira.config.user_lookup_list&.find { |it| it.id == id }
26
- user ||= new(name: '', email: '', id: id)
26
+ user ||= new(name: '', email: '', id:)
27
27
  user
28
28
  end
29
29
  end
@@ -59,19 +59,19 @@ module Dev
59
59
  end
60
60
 
61
61
  # Query jira using the given jql and yield each matching result
62
- def issues(jql, &block)
62
+ def issues(jql, &)
63
63
  start_at = 0
64
64
  max_results = 100
65
65
 
66
66
  # Query Jira and yield all issues it returns
67
- issues = @client.Issue.jql(jql, start_at: start_at, max_results: max_results)
68
- issues.map { |data| Issue.new(data) }.each(&block)
67
+ issues = @client.Issue.jql(jql, start_at:, max_results:)
68
+ issues.map { |data| Issue.new(data) }.each(&)
69
69
 
70
70
  # If we returned the max_results then there may be more - add the max results to where we start at and query again
71
71
  while issues.length >= max_results
72
72
  start_at += max_results
73
- issues = @client.Issue.jql(jql, start_at: start_at, max_results: max_results)
74
- issues.map { |data| Issue.new(data) }.each(&block)
73
+ issues = @client.Issue.jql(jql, start_at:, max_results:)
74
+ issues.map { |data| Issue.new(data) }.each(&)
75
75
  end
76
76
  end
77
77
  end
@@ -23,7 +23,7 @@ module Dev
23
23
 
24
24
  ids << id
25
25
  Dev::Audit::Report::Item.new(
26
- id: id,
26
+ id:,
27
27
  name: vulnerability['name'],
28
28
  title: it['title'],
29
29
  url: it['url'],
@@ -1,4 +1,4 @@
1
- require_relative './base_interface'
1
+ require_relative 'base_interface'
2
2
 
3
3
  module Dev
4
4
  module Template
@@ -38,7 +38,7 @@ module Dev
38
38
 
39
39
  def initialize(name, exclude: [])
40
40
  @name = name
41
- super(exclude: exclude)
41
+ super(exclude:)
42
42
  end
43
43
  end
44
44
  end
@@ -1,4 +1,4 @@
1
- require_relative './base_interface'
1
+ require_relative 'base_interface'
2
2
 
3
3
  module Dev
4
4
  module Template
@@ -12,7 +12,7 @@ module Dev
12
12
  @cloudformations = Array(cloudformation).sort_by(&:name)
13
13
  raise 'must specify an arry of cloudformation objects' unless @cloudformations.all?(Dev::Aws::Cloudformation)
14
14
 
15
- super(exclude: exclude)
15
+ super(exclude:)
16
16
  end
17
17
 
18
18
  # Create the rake task for creating the codepipeline
@@ -11,8 +11,8 @@ module Dev
11
11
 
12
12
  # Allow for custom container path for the application
13
13
  def initialize(application, container_path: nil, local_path: nil, exclude: [])
14
- @node = Dev::Node.new(container_path: container_path, local_path: local_path)
15
- super(application, exclude: exclude)
14
+ @node = Dev::Node.new(container_path:, local_path:)
15
+ super(application, exclude:)
16
16
  end
17
17
 
18
18
  # Create the rake task which runs linting for the application name
@@ -36,7 +36,7 @@ module Dev
36
36
 
37
37
  options = []
38
38
  options << '-T' if Dev::Common.new.running_codebuild?
39
- Dev::Docker::Compose.new(services: application, options: options).exec(*node.lint_command)
39
+ Dev::Docker::Compose.new(services: application, options:).exec(*node.lint_command)
40
40
  end
41
41
 
42
42
  namespace :lint do
@@ -46,7 +46,7 @@ module Dev
46
46
 
47
47
  options = []
48
48
  options << '-T' if Dev::Common.new.running_codebuild?
49
- Dev::Docker::Compose.new(services: application, options: options).exec(*node.lint_fix_command)
49
+ Dev::Docker::Compose.new(services: application, options:).exec(*node.lint_fix_command)
50
50
  end
51
51
  end
52
52
  end
@@ -75,7 +75,7 @@ module Dev
75
75
 
76
76
  options = []
77
77
  options << '-T' if Dev::Common.new.running_codebuild?
78
- Dev::Docker::Compose.new(services: application, options: options).exec(*node.test_command)
78
+ Dev::Docker::Compose.new(services: application, options:).exec(*node.test_command)
79
79
  end
80
80
  end
81
81
  end
@@ -11,8 +11,8 @@ module Dev
11
11
 
12
12
  # Allow for custom container path for the application
13
13
  def initialize(application, container_path: nil, local_path: nil, exclude: [])
14
- @php = Dev::Php.new(container_path: container_path, local_path: local_path)
15
- super(application, exclude: exclude)
14
+ @php = Dev::Php.new(container_path:, local_path:)
15
+ super(application, exclude:)
16
16
  end
17
17
 
18
18
  # Create the rake task which downloads the vendor directory to your local system for the given application name
@@ -80,7 +80,7 @@ module Dev
80
80
 
81
81
  options = []
82
82
  options << '-T' if Dev::Common.new.running_codebuild?
83
- Dev::Docker::Compose.new(services: application, options: options).exec(*php.lint_command)
83
+ Dev::Docker::Compose.new(services: application, options:).exec(*php.lint_command)
84
84
  end
85
85
 
86
86
  namespace :lint do
@@ -90,7 +90,7 @@ module Dev
90
90
 
91
91
  options = []
92
92
  options << '-T' if Dev::Common.new.running_codebuild?
93
- Dev::Docker::Compose.new(services: application, options: options).exec(*php.lint_fix_command)
93
+ Dev::Docker::Compose.new(services: application, options:).exec(*php.lint_fix_command)
94
94
  end
95
95
  end
96
96
  end
@@ -119,7 +119,7 @@ module Dev
119
119
 
120
120
  options = []
121
121
  options << '-T' if Dev::Common.new.running_codebuild?
122
- Dev::Docker::Compose.new(services: application, options: options).exec(*php.test_command)
122
+ Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
123
123
  end
124
124
  end
125
125
  end
@@ -11,8 +11,8 @@ module Dev
11
11
 
12
12
  # Allow for custom container path for the application
13
13
  def initialize(application, container_path: nil, local_path: nil, exclude: [])
14
- @ruby = Dev::Ruby.new(container_path: container_path, local_path: local_path)
15
- super(application, exclude: exclude)
14
+ @ruby = Dev::Ruby.new(container_path:, local_path:)
15
+ super(application, exclude:)
16
16
  end
17
17
 
18
18
  # Create the rake task which runs linting for the application name
@@ -36,7 +36,7 @@ module Dev
36
36
 
37
37
  options = []
38
38
  options << '-T' if Dev::Common.new.running_codebuild?
39
- Dev::Docker::Compose.new(services: application, options: options).exec(*ruby.lint_command)
39
+ Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_command)
40
40
  end
41
41
 
42
42
  namespace :lint do
@@ -46,7 +46,7 @@ module Dev
46
46
 
47
47
  options = []
48
48
  options << '-T' if Dev::Common.new.running_codebuild?
49
- Dev::Docker::Compose.new(services: application, options: options).exec(*ruby.lint_fix_command)
49
+ Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_fix_command)
50
50
  end
51
51
  end
52
52
  end
@@ -75,7 +75,7 @@ module Dev
75
75
 
76
76
  options = []
77
77
  options << '-T' if Dev::Common.new.running_codebuild?
78
- Dev::Docker::Compose.new(services: application, options: options).exec(*ruby.test_command)
78
+ Dev::Docker::Compose.new(services: application, options:).exec(*ruby.test_command)
79
79
  end
80
80
  end
81
81
  end
@@ -1,4 +1,4 @@
1
- require_relative './base_interface'
1
+ require_relative 'base_interface'
2
2
 
3
3
  module Dev
4
4
  module Template
@@ -1,4 +1,4 @@
1
- require_relative './base_interface'
1
+ require_relative 'base_interface'
2
2
 
3
3
  module Dev
4
4
  module Template
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '1.5.4'.freeze
9
+ VERSION = '2.0.0.pre.alpha.1'.freeze
10
10
  end
11
11
  end
@@ -18,4 +18,6 @@ rootdir = File.realpath(File.dirname(libdir))
18
18
  $LOAD_PATH.unshift rootdir
19
19
 
20
20
  # Load all ruby files
21
+ # rubocop:disable Lint/RedundantDirGlobSort
21
22
  Dir.glob("#{libdir}/**/*.rb").sort.each { |file| require file }
23
+ # rubocop:enable Lint/RedundantDirGlobSort
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 2.0.0.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-15 00:00:00.000000000 Z
11
+ date: 2023-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,112 +16,112 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.0.4.0
19
+ version: 7.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.0.4.0
26
+ version: 7.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: aws-sdk-cloudformation
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.73.0
33
+ version: 1.83.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.73.0
40
+ version: 1.83.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: aws-sdk-codepipeline
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.54.0
47
+ version: 1.59.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.54.0
54
+ version: 1.59.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: aws-sdk-ecr
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.56.0
61
+ version: 1.61.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.56.0
68
+ version: 1.61.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aws-sdk-s3
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.117.0
75
+ version: 1.127.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.117.0
82
+ version: 1.127.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: aws-sdk-ssm
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 1.141.0
89
+ version: 1.154.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 1.141.0
96
+ version: 1.154.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: aws-sdk-sts
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 1.7.0
103
+ version: 1.10.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 1.7.0
110
+ version: 1.10.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: colorize
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.8.0
117
+ version: 1.1.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.8.0
124
+ version: 1.1.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: docker-api
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 2.8.0
145
+ version: 2.8.1
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 2.8.0
152
+ version: 2.8.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: git
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.13.1
159
+ version: 1.18.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.13.1
166
+ version: 1.18.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: inifile
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -198,98 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - '='
200
200
  - !ruby/object:Gem::Version
201
- version: 3.2.1
201
+ version: 4.1.1
202
202
  type: :runtime
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 3.2.1
208
+ version: 4.1.1
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: public_suffix
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 5.0.0
215
+ version: 5.0.1
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - '='
221
221
  - !ruby/object:Gem::Version
222
- version: 5.0.0
223
- - !ruby/object:Gem::Dependency
224
- name: rake
225
- requirement: !ruby/object:Gem::Requirement
226
- requirements:
227
- - - "~>"
228
- - !ruby/object:Gem::Version
229
- version: 13.0.0
230
- type: :runtime
231
- prerelease: false
232
- version_requirements: !ruby/object:Gem::Requirement
233
- requirements:
234
- - - "~>"
235
- - !ruby/object:Gem::Version
236
- version: 13.0.0
237
- - !ruby/object:Gem::Dependency
238
- name: slack-ruby-client
239
- requirement: !ruby/object:Gem::Requirement
240
- requirements:
241
- - - "~>"
242
- - !ruby/object:Gem::Version
243
- version: 2.1.0
244
- type: :runtime
245
- prerelease: false
246
- version_requirements: !ruby/object:Gem::Requirement
247
- requirements:
248
- - - "~>"
249
- - !ruby/object:Gem::Version
250
- version: 2.1.0
251
- - !ruby/object:Gem::Dependency
252
- name: builder
253
- requirement: !ruby/object:Gem::Requirement
254
- requirements:
255
- - - "~>"
256
- - !ruby/object:Gem::Version
257
- version: 3.2.4
258
- type: :development
259
- prerelease: false
260
- version_requirements: !ruby/object:Gem::Requirement
261
- requirements:
262
- - - "~>"
263
- - !ruby/object:Gem::Version
264
- version: 3.2.4
265
- - !ruby/object:Gem::Dependency
266
- name: bundler-audit
267
- requirement: !ruby/object:Gem::Requirement
268
- requirements:
269
- - - "~>"
270
- - !ruby/object:Gem::Version
271
- version: 0.9.0
272
- type: :development
273
- prerelease: false
274
- version_requirements: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: 0.9.0
279
- - !ruby/object:Gem::Dependency
280
- name: launchy
281
- requirement: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - "~>"
284
- - !ruby/object:Gem::Version
285
- version: 2.5.2
286
- type: :development
287
- prerelease: false
288
- version_requirements: !ruby/object:Gem::Requirement
289
- requirements:
290
- - - "~>"
291
- - !ruby/object:Gem::Version
292
- version: 2.5.2
222
+ version: 5.0.1
293
223
  - !ruby/object:Gem::Dependency
294
224
  name: rake
295
225
  requirement: !ruby/object:Gem::Requirement
@@ -297,97 +227,13 @@ dependencies:
297
227
  - - "~>"
298
228
  - !ruby/object:Gem::Version
299
229
  version: 13.0.6
300
- type: :development
230
+ type: :runtime
301
231
  prerelease: false
302
232
  version_requirements: !ruby/object:Gem::Requirement
303
233
  requirements:
304
234
  - - "~>"
305
235
  - !ruby/object:Gem::Version
306
236
  version: 13.0.6
307
- - !ruby/object:Gem::Dependency
308
- name: rspec
309
- requirement: !ruby/object:Gem::Requirement
310
- requirements:
311
- - - "~>"
312
- - !ruby/object:Gem::Version
313
- version: 3.11.0
314
- type: :development
315
- prerelease: false
316
- version_requirements: !ruby/object:Gem::Requirement
317
- requirements:
318
- - - "~>"
319
- - !ruby/object:Gem::Version
320
- version: 3.11.0
321
- - !ruby/object:Gem::Dependency
322
- name: rubocop
323
- requirement: !ruby/object:Gem::Requirement
324
- requirements:
325
- - - "~>"
326
- - !ruby/object:Gem::Version
327
- version: 1.36.0
328
- type: :development
329
- prerelease: false
330
- version_requirements: !ruby/object:Gem::Requirement
331
- requirements:
332
- - - "~>"
333
- - !ruby/object:Gem::Version
334
- version: 1.36.0
335
- - !ruby/object:Gem::Dependency
336
- name: rubocop-performance
337
- requirement: !ruby/object:Gem::Requirement
338
- requirements:
339
- - - "~>"
340
- - !ruby/object:Gem::Version
341
- version: 1.15.0
342
- type: :development
343
- prerelease: false
344
- version_requirements: !ruby/object:Gem::Requirement
345
- requirements:
346
- - - "~>"
347
- - !ruby/object:Gem::Version
348
- version: 1.15.0
349
- - !ruby/object:Gem::Dependency
350
- name: rubocop-rake
351
- requirement: !ruby/object:Gem::Requirement
352
- requirements:
353
- - - "~>"
354
- - !ruby/object:Gem::Version
355
- version: 0.6.0
356
- type: :development
357
- prerelease: false
358
- version_requirements: !ruby/object:Gem::Requirement
359
- requirements:
360
- - - "~>"
361
- - !ruby/object:Gem::Version
362
- version: 0.6.0
363
- - !ruby/object:Gem::Dependency
364
- name: simplecov
365
- requirement: !ruby/object:Gem::Requirement
366
- requirements:
367
- - - "~>"
368
- - !ruby/object:Gem::Version
369
- version: 0.21.0
370
- type: :development
371
- prerelease: false
372
- version_requirements: !ruby/object:Gem::Requirement
373
- requirements:
374
- - - "~>"
375
- - !ruby/object:Gem::Version
376
- version: 0.21.0
377
- - !ruby/object:Gem::Dependency
378
- name: yard
379
- requirement: !ruby/object:Gem::Requirement
380
- requirements:
381
- - - "~>"
382
- - !ruby/object:Gem::Version
383
- version: 0.9.28
384
- type: :development
385
- prerelease: false
386
- version_requirements: !ruby/object:Gem::Requirement
387
- requirements:
388
- - - "~>"
389
- - !ruby/object:Gem::Version
390
- version: 0.9.28
391
237
  description: Ruby library for creating/maintaining your development environment
392
238
  email: opensource@firespring.com
393
239
  executables: []
@@ -437,8 +283,6 @@ files:
437
283
  - lib/firespring_dev_commands/ruby.rb
438
284
  - lib/firespring_dev_commands/ruby/audit.rb
439
285
  - lib/firespring_dev_commands/second.rb
440
- - lib/firespring_dev_commands/slack.rb
441
- - lib/firespring_dev_commands/slack/global.rb
442
286
  - lib/firespring_dev_commands/tar.rb
443
287
  - lib/firespring_dev_commands/tar/pax_header.rb
444
288
  - lib/firespring_dev_commands/tar/type_flag.rb
@@ -466,14 +310,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
466
310
  requirements:
467
311
  - - ">="
468
312
  - !ruby/object:Gem::Version
469
- version: '2.7'
313
+ version: '3.2'
470
314
  required_rubygems_version: !ruby/object:Gem::Requirement
471
315
  requirements:
472
- - - ">="
316
+ - - ">"
473
317
  - !ruby/object:Gem::Version
474
- version: '0'
318
+ version: 1.3.1
475
319
  requirements: []
476
- rubygems_version: 3.1.6
320
+ rubygems_version: 3.4.10
477
321
  signing_key:
478
322
  specification_version: 4
479
323
  summary: Development environment maintenance command library
@@ -1,32 +0,0 @@
1
- # Load any existing slack auth if we haven't set one in the environment
2
- require 'dotenv'
3
-
4
- module Dev
5
- class Slack
6
- class Global
7
- # The filename where we store the local auth information
8
- CONFIG_FILE = "#{Dir.home}/.env.slack".freeze
9
-
10
- SLACK_API_TOKEN = 'SLACK_API_TOKEN'.freeze
11
-
12
- def configure
13
- # Always load the env slack auth
14
- Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
15
-
16
- ::Slack.configure do |c|
17
- c.token = ENV.fetch('SLACK_API_TOKEN', nil)
18
- c.logger = LOG if ENV['ENABLE_SLACK_DEBUG'].to_s.strip == 'true'
19
- end
20
- end
21
- new.configure
22
-
23
- # Write the new slack auth value to the env file
24
- def write!(api_token)
25
- override = Dev::Env.new(CONFIG_FILE)
26
- override.set(SLACK_API_TOKEN, api_token)
27
- override.write
28
- configure
29
- end
30
- end
31
- end
32
- end
@@ -1,23 +0,0 @@
1
- require 'slack'
2
-
3
- module Dev
4
- class Slack
5
- attr_accessor :client
6
-
7
- def initialize
8
- @client = ::Slack::Web::Client.new
9
- @client.auth_test
10
- end
11
-
12
- def post(channel:, text:)
13
- client.chat_postMessage(channel: channel, text: text)
14
- end
15
-
16
- def upload_text(channel:, text:, title: 'Text File', filename: 'file.txt')
17
- raise 'text should be a string' unless text.is_a?(String)
18
-
19
- file = Faraday::UploadIO.new(StringIO.new(text), 'text/plain')
20
- client.files_upload(channels: channel, title: title, file: file, filename: filename, filetype: 'text')
21
- end
22
- end
23
- end