firespring_dev_commands 2.1.34 → 2.5.0.pre.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/firespring_dev_commands/audit/report.rb +2 -9
  4. data/lib/firespring_dev_commands/aws/cloudformation.rb +3 -10
  5. data/lib/firespring_dev_commands/common.rb +2 -22
  6. data/lib/firespring_dev_commands/docker/status.rb +0 -20
  7. data/lib/firespring_dev_commands/docker.rb +16 -86
  8. data/lib/firespring_dev_commands/eol/aws.rb +2 -10
  9. data/lib/firespring_dev_commands/eol.rb +2 -12
  10. data/lib/firespring_dev_commands/git.rb +22 -17
  11. data/lib/firespring_dev_commands/jira/issue.rb +1 -3
  12. data/lib/firespring_dev_commands/node.rb +1 -1
  13. data/lib/firespring_dev_commands/php.rb +12 -28
  14. data/lib/firespring_dev_commands/platform.rb +31 -38
  15. data/lib/firespring_dev_commands/ruby.rb +3 -6
  16. data/lib/firespring_dev_commands/target_process/query.rb +4 -30
  17. data/lib/firespring_dev_commands/target_process/release.rb +1 -1
  18. data/lib/firespring_dev_commands/target_process/team_assignment.rb +1 -1
  19. data/lib/firespring_dev_commands/target_process/user.rb +1 -13
  20. data/lib/firespring_dev_commands/target_process/user_story.rb +1 -1
  21. data/lib/firespring_dev_commands/target_process/user_story_history.rb +1 -1
  22. data/lib/firespring_dev_commands/target_process.rb +7 -24
  23. data/lib/firespring_dev_commands/templates/aws.rb +6 -14
  24. data/lib/firespring_dev_commands/templates/docker/application.rb +2 -2
  25. data/lib/firespring_dev_commands/templates/docker/node/application.rb +5 -28
  26. data/lib/firespring_dev_commands/templates/docker/php/application.rb +16 -31
  27. data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +5 -27
  28. data/lib/firespring_dev_commands/templates/eol.rb +2 -3
  29. data/lib/firespring_dev_commands/templates/git.rb +0 -17
  30. data/lib/firespring_dev_commands/version.rb +1 -1
  31. data/lib/firespring_dev_commands.rb +1 -1
  32. metadata +37 -67
  33. data/lib/firespring_dev_commands/aws/route53.rb +0 -107
  34. data/lib/firespring_dev_commands/bloom_growth/rock.rb +0 -34
  35. data/lib/firespring_dev_commands/bloom_growth/seat.rb +0 -16
  36. data/lib/firespring_dev_commands/bloom_growth/user.rb +0 -43
  37. data/lib/firespring_dev_commands/bloom_growth.rb +0 -132
  38. data/lib/firespring_dev_commands/certificate.rb +0 -59
  39. data/lib/firespring_dev_commands/coverage/base.rb +0 -16
  40. data/lib/firespring_dev_commands/coverage/cobertura.rb +0 -86
  41. data/lib/firespring_dev_commands/coverage/none.rb +0 -21
  42. data/lib/firespring_dev_commands/docker/desktop.rb +0 -59
  43. data/lib/firespring_dev_commands/jira/parent.rb +0 -19
  44. data/lib/firespring_dev_commands/os.rb +0 -35
  45. data/lib/firespring_dev_commands/port.rb +0 -24
  46. data/lib/firespring_dev_commands/target_process/time.rb +0 -32
  47. data/lib/firespring_dev_commands/templates/aws/services/route53.rb +0 -106
  48. data/lib/firespring_dev_commands/templates/certificate.rb +0 -41
@@ -1,46 +1,39 @@
1
1
  module Dev
2
- # Class which returns information about the current platform
3
- class Platform
4
- # Constant containing all supported architectures
5
- ALLOWED_ARCHITECTURES = %w(linux/arm64 linux/amd64).freeze
6
-
7
- # If an architecture was specified in the ENV, use that. Otherwise auto-deted based of the OS reported architecture
8
- def architecture
9
- arch = env_architecture || os_architecture
10
- raise "Invalid DOCKER_ARCHITECTURE: #{arch} (allowed are #{ALLOWED_ARCHITECTURES.join(', ')})" unless ALLOWED_ARCHITECTURES.include?(arch)
11
-
12
- arch
13
- end
14
-
15
- # Check to see if a docker architecture has been specified in the ENV
16
- # If it has, verify the format and the value
17
- private def env_architecture
18
- arch = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
19
- return nil if arch.empty?
2
+ class Common
3
+ # Class which returns information about the current platform
4
+ class Platform
5
+ # Constant containing all supported architectures
6
+ ALLOWED_ARCHITECTURES = %w(arm64 amd64).freeze
20
7
 
21
- "linux/#{arch}" unless arch.start_with?('linux/')
22
- arch
23
- end
8
+ # Normalize the ruby platform to return a docker platform architecture format
9
+ def determine_compute_architecture
10
+ case RUBY_PLATFORM
11
+ when /x86_64|amd64/
12
+ 'linux/amd64' # 64-bit Intel/AMD architecture
13
+ when /arm|aarch64/
14
+ 'linux/arm64' # ARM architecture
15
+ else
16
+ raise 'Unknown or unsupported architecture'
17
+ end
18
+ end
24
19
 
25
- # Returns a valid docker architecture based off the RUBY_PLATFORM
26
- private def os_architecture
27
- return 'linux/amd64' if RUBY_PLATFORM.match?(/x86_64|amd64|x64-mingw/)
28
- return 'linux/arm64' if RUBY_PLATFORM.match?(/arm|aarch64/)
20
+ # Determine the platform architecture
21
+ # If one was specified in the DOCKER_ARCHITECTURE variable, use it
22
+ # Otherwise, use the RUBY_PLATFORM built-in to auto-detect and architecture
23
+ def architecture
24
+ docker_architecture = ENV['DOCKER_ARCHITECTURE'].to_s.strip.downcase
25
+ if docker_architecture.empty?
26
+ determine_compute_architecture
27
+ else
28
+ raise "Missing 'linux/' prefix in DOCKER_ARCHITECTURE: #{docker_architecture}" unless docker_architecture.start_with?('linux/')
29
29
 
30
- raise 'Unknown or unsupported architecture'
31
- end
32
- end
33
- end
30
+ architecture_name = docker_architecture.split('/')[1]
31
+ unless ALLOWED_ARCHITECTURES.include?(architecture_name)
32
+ raise "Invalid DOCKER_ARCHITECTURE: #{architecture_name}. Allowed architectures are #{ALLOWED_ARCHITECTURES.join(', ')}"
33
+ end
34
34
 
35
- module Dev
36
- class Common
37
- # Class which returns information about the current platform
38
- class Platform < Platform
39
- # Initializer for the deprecated class
40
- # @deprecated Please use {Dev::Platform#new} instead
41
- def initialize
42
- warn '[DEPRECATION] `Dev::Common::Platform#new` is deprecated. Please use `Dev::Platform#new` instead.'
43
- super
35
+ docker_architecture
36
+ end
44
37
  end
45
38
  end
46
39
  end
@@ -90,16 +90,14 @@ module Dev
90
90
 
91
91
  # Build the bundle lint command
92
92
  def lint_command
93
- lint = base_command
94
- lint << 'exec' << 'rubocop'
93
+ lint = ['rubocop']
95
94
  lint.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
96
95
  lint
97
96
  end
98
97
 
99
98
  # Build the bundle lint fix command
100
99
  def lint_fix_command
101
- lint_fix = base_command
102
- lint_fix << 'exec' << 'rubocop'
100
+ lint_fix = ['rubocop']
103
101
  lint_fix << '-A'
104
102
  lint_fix.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
105
103
  lint_fix
@@ -107,8 +105,7 @@ module Dev
107
105
 
108
106
  # Build the bundle test command
109
107
  def test_command
110
- test = base_command
111
- test << 'exec' << 'rspec'
108
+ test = ['rspec']
112
109
  test.concat(Dev::Common.new.tokenize(ENV['OPTS'].to_s))
113
110
  test
114
111
  end
@@ -2,13 +2,12 @@ module Dev
2
2
  class TargetProcess
3
3
  # Class for writing target process query statements
4
4
  class Query
5
- attr_accessor :where, :incl, :take, :empty
5
+ attr_accessor :where, :incl, :take
6
6
 
7
7
  def initialize
8
8
  @where = []
9
9
  @incl = []
10
10
  @take = 250
11
- @empty = false
12
11
  end
13
12
 
14
13
  # Add a new query clause
@@ -34,11 +33,6 @@ module Dev
34
33
  end
35
34
  end
36
35
 
37
- # Check if any of the "in" statements were empty. If so then we don't want to actually run the query
38
- def empty?
39
- @empty == true
40
- end
41
-
42
36
  # Generate the string representation for this query
43
37
  def generate
44
38
  {}.tap do |clause|
@@ -56,38 +50,22 @@ module Dev
56
50
  # TODO: Do these need moved to their associated entities?
57
51
  # Add a filter that looks for stories whose id is contained in the list of ids given
58
52
  def filter_by_user_story_ids(user_story_ids)
59
- if user_story_ids.nil? || user_story_ids.empty?
60
- @empty = true
61
- return
62
- end
63
53
  self << "(Id in ('#{user_story_ids.join("', '")}'))"
64
54
  end
65
55
 
66
56
  # Add a filter that looks for stories whose team id is contained in the list of ids given
67
57
  def filter_by_team_ids(team_ids)
68
- if team_ids.nil? || team_ids.empty?
69
- @empty = true
70
- return
71
- end
72
- self << "(Team.Id in ('#{team_ids.join("', '")}'))"
58
+ self << "(Team.Id in ('#{team_ids.join("', '")}'))" unless team_ids.nil? || team_ids.empty?
73
59
  end
74
60
 
75
61
  # Add a filter that looks for stories whose project id is contained in the list of ids given
76
62
  def filter_by_project(projects)
77
- if projects.nil? || projects.empty?
78
- @empty = true
79
- return
80
- end
81
63
  self << "(Project.Name in ('#{projects.join("', '")}'))"
82
64
  end
83
65
 
84
66
  # Add a filter that looks for stories whose state is contained in the list of states given
85
67
  def filter_by_states(states)
86
- if states.nil? || states.empty?
87
- @empty = true
88
- return
89
- end
90
- self << "(EntityState.Name in ('#{states.join("', '")}'))"
68
+ self << "(EntityState.Name in ('#{states.join("', '")}'))" unless states.nil? || states.empty?
91
69
  end
92
70
 
93
71
  # Add a filter that looks for stories whose state is set to final
@@ -136,11 +114,7 @@ module Dev
136
114
 
137
115
  # Add a filter that looks for assignable ids which are included in the given array
138
116
  def filter_by_entity_ids(entity_ids)
139
- if entity_ids.nil? || entity_ids.empty?
140
- @empty = true
141
- return
142
- end
143
- self << "(Assignable.Id in ('#{entity_ids.join("', '")}'))"
117
+ self << "(Assignable.Id in ('#{entity_ids.join("', '")}'))" unless entity_ids.nil? || entity_ids.empty?
144
118
  end
145
119
 
146
120
  # Add a filter that looks for a custom deploy date between the given dates`
@@ -24,7 +24,7 @@ module Dev
24
24
  def parse_time(string)
25
25
  return nil unless string && !string.empty?
26
26
 
27
- ::Time.at(string.slice(6, 10).to_i)
27
+ Time.at(string.slice(6, 10).to_i)
28
28
  end
29
29
  end
30
30
  end
@@ -24,7 +24,7 @@ module Dev
24
24
  def parse_time(string)
25
25
  return nil unless string && !string.empty?
26
26
 
27
- ::Time.at(string.slice(6, 10).to_i)
27
+ Time.at(string.slice(6, 10).to_i)
28
28
  end
29
29
 
30
30
  # Calculate the cycle time as the amount of time the story was open
@@ -2,13 +2,7 @@ module Dev
2
2
  class TargetProcess
3
3
  # Class containing user information
4
4
  class User
5
- # The resource type for the api endpoint
6
- RESOURCE_TYPE = 'User'.freeze
7
-
8
- # The api path for user requests
9
- PATH = '/User'.freeze
10
-
11
- attr_accessor :data, :id, :type, :name, :login, :email
5
+ attr_accessor :data, :id, :type, :name, :login
12
6
 
13
7
  def initialize(data)
14
8
  @data = data
@@ -16,12 +10,6 @@ module Dev
16
10
  @type = data['ResourceType']
17
11
  @name = data['FullName']
18
12
  @login = data['Login']
19
- @email = data['Email']
20
- end
21
-
22
- # Get the user with the given id and return that object
23
- def self.get(id)
24
- new(TargetProcess.new.get("#{User::PATH}/#{id}", Query.new))
25
13
  end
26
14
  end
27
15
  end
@@ -37,7 +37,7 @@ module Dev
37
37
  def parse_time(string)
38
38
  return nil unless string && !string.empty?
39
39
 
40
- ::Time.at(string.slice(6, 10).to_i)
40
+ Time.at(string.slice(6, 10).to_i)
41
41
  end
42
42
 
43
43
  # Calculate the cycle time as the amount of time the story was open
@@ -38,7 +38,7 @@ module Dev
38
38
  def parse_time(string)
39
39
  return nil unless string && !string.empty?
40
40
 
41
- ::Time.at(string.slice(6, 10).to_i)
41
+ Time.at(string.slice(6, 10).to_i)
42
42
  end
43
43
  end
44
44
  end
@@ -15,7 +15,7 @@ module Dev
15
15
  # The text of the url variable key
16
16
  TP_URL = 'TP_URL'.freeze
17
17
 
18
- # Config object for setting top level target process config options
18
+ # Config object for setting top level jira config options
19
19
  Config = Struct.new(:username, :password, :url, :http_debug) do
20
20
  def initialize
21
21
  Dotenv.load(CONFIG_FILE) if File.exist?(CONFIG_FILE)
@@ -72,8 +72,8 @@ module Dev
72
72
  [].tap do |ary|
73
73
  get(Release::PATH, query) do |result|
74
74
  ary << Release.new(result)
75
- yield ary.last if block_given?
76
75
  end
76
+ ary.each(&)
77
77
  end
78
78
  end
79
79
 
@@ -84,8 +84,8 @@ module Dev
84
84
  [].tap do |ary|
85
85
  get(UserStory::PATH, query) do |result|
86
86
  ary << UserStory.new(result)
87
- yield ary.last if block_given?
88
87
  end
88
+ ary.each(&)
89
89
  end
90
90
  end
91
91
 
@@ -96,8 +96,8 @@ module Dev
96
96
  [].tap do |ary|
97
97
  get(UserStoryHistory::PATH, query) do |result|
98
98
  ary << UserStoryHistory.new(result)
99
- yield ary.last if block_given?
100
99
  end
100
+ ary.each(&)
101
101
  end
102
102
  end
103
103
 
@@ -108,20 +108,8 @@ module Dev
108
108
  [].tap do |ary|
109
109
  get(TeamAssignment::PATH, query) do |result|
110
110
  ary << TeamAssignment.new(result)
111
- yield ary.last if block_given?
112
- end
113
- end
114
- end
115
-
116
- # Perform a query to the time api path
117
- # Call the given block (if present) with each time
118
- # Return all times
119
- def times(query, &)
120
- [].tap do |ary|
121
- get(Time::PATH, query) do |result|
122
- ary << Time.new(result)
123
- yield ary.last if block_given?
124
111
  end
112
+ ary.each(&)
125
113
  end
126
114
  end
127
115
 
@@ -129,8 +117,6 @@ module Dev
129
117
  # Call the given block (if present) with each piece of data
130
118
  # Return all pieces of data
131
119
  def get(path, query, &)
132
- return [] if query.empty?
133
-
134
120
  query_string = query.generate
135
121
  url = "/api/v1/#{path}"
136
122
  url << "?#{URI.encode_www_form(query_string)}" unless query_string.empty?
@@ -144,11 +130,8 @@ module Dev
144
130
  parsed_response['Items'].each(&)
145
131
 
146
132
  while parsed_response['Next']
147
- next_query_string = URI(parsed_response['Next']).query
148
- next_url = "/api/v1/#{path}"
149
- next_url << "?#{next_query_string}" unless query_string.empty?
150
- response = client.request_get(next_url, headers)
151
- raise "Error querying #{next_url} [#{next_query_string}]: #{response.inspect}" unless response.response.is_a?(Net::HTTPSuccess)
133
+ response = client.request_get(parsed_response['Next'], headers)
134
+ raise "Error querying #{parsed_response['Next']} [#{query_string}]: #{response.inspect}" unless response.response.is_a?(Net::HTTPSuccess)
152
135
 
153
136
  parsed_response = JSON.parse(response.body)
154
137
  return parsed_response unless parsed_response.key?('Items')
@@ -101,22 +101,14 @@ module Dev
101
101
 
102
102
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
103
103
  return if exclude.include?(:eol)
104
- return if ENV.fetch('CHECK_AWS', nil).to_s.strip == 'false'
105
104
 
106
- task eol: [:'eol:aws'] do
107
- # This is just a placeholder to execute the dependencies
108
- end
105
+ desc 'Compares the current date to the EOL date for supported resources'
106
+ task eol: %w(init ensure_aws_credentials) do
107
+ account_id = Dev::Aws::Profile.new.current
108
+ account_name = Dev::Aws::Account.new.name_by_account(account_id)
109
+ LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
109
110
 
110
- namespace :eol do
111
- desc 'Compares the current date to the EOL date for supported aws resources'
112
- task aws: %w(init ensure_aws_credentials) do
113
- account_id = Dev::Aws::Profile.new.current
114
- account_name = Dev::Aws::Account.new.name_by_account(account_id)
115
- LOG.info " Current AWS Account is #{account_name} (#{account_id})".light_yellow
116
- puts
117
- Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).status
118
- puts
119
- end
111
+ Dev::EndOfLife.new(product_versions: Dev::EndOfLife::Aws.new.default_products).check
120
112
  end
121
113
  end
122
114
  end
@@ -72,7 +72,7 @@ module Dev
72
72
  return if exclude.include?(:sh)
73
73
 
74
74
  desc "Open a shell into a running #{application} container"
75
- task sh: %W(init_docker #{application}:up_no_deps _pre_sh_hooks) do
75
+ task sh: %W(init_docker #{application}:up _pre_sh_hooks) do
76
76
  Dev::Docker::Compose.new(services: [application]).sh
77
77
  Rake::Task[:_post_sh_hooks].execute
78
78
  end
@@ -154,7 +154,7 @@ module Dev
154
154
  return if exclude.include?(:reload)
155
155
 
156
156
  desc "Reloads the #{application} container"
157
- task reload: %w(init_docker _pre_reload_hooks down up_no_deps) do
157
+ task reload: %w(init_docker _pre_reload_hooks down up) do
158
158
  Rake::Task[:_post_reload_hooks].execute
159
159
  end
160
160
  end
@@ -7,29 +7,15 @@ module Dev
7
7
  module Node
8
8
  # Class for default rake tasks associated with a node project
9
9
  class Application < Dev::Template::ApplicationInterface
10
- attr_reader :node, :start_container_dependencies_on_test
11
-
12
- # Create the templated rake tasks for the node application
13
- #
14
- # @param application [String] The name of the application
15
- # @param container_path [String] The path to the application inside of the container
16
- # @param local_path [String] The path to the application on your local system
17
- # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
18
- # @param exclude [Array<Symbol>] An array of default template tasks to exclude
19
- def initialize(
20
- application,
21
- container_path: nil,
22
- local_path: nil,
23
- start_container_dependencies_on_test: true,
24
- exclude: []
25
- )
10
+ attr_reader :node
11
+
12
+ # Allow for custom container path for the application
13
+ def initialize(application, container_path: nil, local_path: nil, exclude: [])
26
14
  @node = Dev::Node.new(container_path:, local_path:)
27
- @start_container_dependencies_on_test = start_container_dependencies_on_test
28
15
  super(application, exclude:)
29
16
  end
30
17
 
31
18
  # Create the rake task which runs linting for the application name
32
- # rubocop:disable Metrics/MethodLength
33
19
  def create_lint_task!
34
20
  application = @name
35
21
  node = @node
@@ -43,13 +29,6 @@ module Dev
43
29
  # This is just a placeholder to execute the dependencies
44
30
  end
45
31
 
46
- namespace :lint do
47
- desc 'Run all linting software and apply all available fixes'
48
- task fix: %w(node:lint:fix) do
49
- # This is just a placeholder to execute the dependencies
50
- end
51
- end
52
-
53
32
  namespace :node do
54
33
  desc "Run the node linting software against the #{application}'s codebase"
55
34
  task lint: %w(init_docker up_no_deps) do
@@ -74,14 +53,12 @@ module Dev
74
53
  end
75
54
  end
76
55
  end
77
- # rubocop:enable Metrics/MethodLength
78
56
 
79
57
  # Create the rake task which runs all tests for the application name
80
58
  def create_test_task!
81
59
  application = @name
82
60
  node = @node
83
61
  exclude = @exclude
84
- up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
85
62
  return if exclude.include?(:test)
86
63
 
87
64
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
@@ -93,7 +70,7 @@ module Dev
93
70
 
94
71
  namespace :node do
95
72
  desc "Run all node tests against the #{application}'s codebase"
96
- task test: %W(init_docker #{up_cmd}) do
73
+ task test: %w(init_docker up) do
97
74
  LOG.debug("Running all node tests in the #{application} codebase")
98
75
 
99
76
  options = []
@@ -1,4 +1,5 @@
1
1
  require_relative '../../base_interface'
2
+ require 'securerandom'
2
3
 
3
4
  module Dev
4
5
  module Template
@@ -7,24 +8,14 @@ module Dev
7
8
  module Php
8
9
  # Class for default rake tasks associated with a php project
9
10
  class Application < Dev::Template::ApplicationInterface
10
- attr_reader :php, :start_container_dependencies_on_test
11
-
12
- # Create the templated rake tasks for the php application
13
- #
14
- # @param application [String] The name of the application
15
- # @param container_path [String] The path to the application inside of the container
16
- # @param local_path [String] The path to the application on your local system
17
- # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
18
- def initialize(
19
- application,
20
- container_path: nil,
21
- local_path: nil,
22
- start_container_dependencies_on_test: true,
23
- coverage: nil,
24
- exclude: []
25
- )
26
- @php = Dev::Php.new(container_path:, local_path:, coverage:)
27
- @start_container_dependencies_on_test = start_container_dependencies_on_test
11
+ attr_reader :php, :siloed_tests
12
+
13
+ # Allow for custom container path for the application
14
+ def initialize(application, container_path: nil, local_path: nil, siloed_tests: nil, exclude: [])
15
+ @php = Dev::Php.new(container_path:, local_path:)
16
+ # TODO: Better name
17
+ # TODO: Should this apply to all or just tests?
18
+ @siloed_tests = siloed_tests
28
19
 
29
20
  super(application, exclude:)
30
21
  end
@@ -74,7 +65,6 @@ module Dev
74
65
  end
75
66
 
76
67
  # Create the rake task which runs linting for the application name
77
- # rubocop:disable Metrics/MethodLength
78
68
  def create_lint_task!
79
69
  application = @name
80
70
  php = @php
@@ -88,13 +78,6 @@ module Dev
88
78
  # This is just a placeholder to execute the dependencies
89
79
  end
90
80
 
91
- namespace :lint do
92
- desc 'Run all linting software and apply all available fixes'
93
- task fix: %w(php:lint:fix) do
94
- # This is just a placeholder to execute the dependencies
95
- end
96
- end
97
-
98
81
  namespace :php do
99
82
  desc "Run the php linting software against the #{application}'s codebase"
100
83
  task lint: %w(init_docker up_no_deps) do
@@ -119,14 +102,13 @@ module Dev
119
102
  end
120
103
  end
121
104
  end
122
- # rubocop:enable Metrics/MethodLength
123
105
 
124
106
  # Create the rake task which runs all tests for the application name
125
107
  def create_test_task!
126
108
  application = @name
127
109
  php = @php
110
+ siloed_tests = @siloed_tests
128
111
  exclude = @exclude
129
- up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
130
112
  return if exclude.include?(:test)
131
113
 
132
114
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
@@ -138,13 +120,16 @@ module Dev
138
120
 
139
121
  namespace :php do
140
122
  desc "Run all php tests against the #{application}'s codebase"
141
- task test: %W(init_docker #{up_cmd}) do
123
+ task test: %w(init_docker up) do
142
124
  LOG.debug("Running all php tests in the #{application} codebase")
143
125
 
126
+ project_name = nil
127
+ project_name = SecureRandom.hex if siloed_tests
128
+
144
129
  options = []
145
130
  options << '-T' if Dev::Common.new.running_codebuild?
146
- Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
147
- php.check_test_coverage(application:)
131
+ Dev::Docker::Compose.new(project_name:, services: application, options:).exec(*php.test_command)
132
+ # TODO: Add clean if we are siloed
148
133
  end
149
134
  end
150
135
  end
@@ -7,28 +7,15 @@ module Dev
7
7
  module Ruby
8
8
  # Class for default rake tasks associated with a ruby project
9
9
  class Application < Dev::Template::ApplicationInterface
10
- attr_reader :ruby, :start_container_dependencies_on_test
11
-
12
- # Create the templated rake tasks for the ruby application
13
- #
14
- # @param application [String] The name of the application
15
- # @param container_path [String] The path to the application inside of the container
16
- # @param local_path [String] The path to the application on your local system
17
- # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
18
- def initialize(
19
- application,
20
- container_path: nil,
21
- local_path: nil,
22
- start_container_dependencies_on_test: true,
23
- exclude: []
24
- )
10
+ attr_reader :ruby
11
+
12
+ # Allow for custom container path for the application
13
+ def initialize(application, container_path: nil, local_path: nil, exclude: [])
25
14
  @ruby = Dev::Ruby.new(container_path:, local_path:)
26
- @start_container_dependencies_on_test = start_container_dependencies_on_test
27
15
  super(application, exclude:)
28
16
  end
29
17
 
30
18
  # Create the rake task which runs linting for the application name
31
- # rubocop:disable Metrics/MethodLength
32
19
  def create_lint_task!
33
20
  application = @name
34
21
  ruby = @ruby
@@ -42,13 +29,6 @@ module Dev
42
29
  # This is just a placeholder to execute the dependencies
43
30
  end
44
31
 
45
- namespace :lint do
46
- desc 'Run all linting software and apply all available fixes'
47
- task fix: %w(ruby:lint:fix) do
48
- # This is just a placeholder to execute the dependencies
49
- end
50
- end
51
-
52
32
  namespace :ruby do
53
33
  desc "Run the ruby linting software against the #{application}'s codebase"
54
34
  task lint: %w(init_docker up_no_deps) do
@@ -73,14 +53,12 @@ module Dev
73
53
  end
74
54
  end
75
55
  end
76
- # rubocop:enable Metrics/MethodLength
77
56
 
78
57
  # Create the rake task which runs all tests for the application name
79
58
  def create_test_task!
80
59
  application = @name
81
60
  ruby = @ruby
82
61
  exclude = @exclude
83
- up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
84
62
  return if exclude.include?(:test)
85
63
 
86
64
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
@@ -92,7 +70,7 @@ module Dev
92
70
 
93
71
  namespace :ruby do
94
72
  desc "Run all ruby tests against the #{application}'s codebase"
95
- task test: %W(init_docker #{up_cmd}) do
73
+ task test: %w(init_docker up_no_deps) do
96
74
  LOG.debug("Running all ruby tests in the #{application} codebase")
97
75
 
98
76
  options = []
@@ -12,10 +12,9 @@ module Dev
12
12
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
13
13
  return if exclude.include?(:eol)
14
14
 
15
- desc 'Compares the current date to the EOL date for all configured projects' \
16
- "\n\toptionally specify CHECK_AWS=<true/false> to toggle whether AWS resources are checked for EOL (defaults to true)"
15
+ desc 'Compares the current date to the EOL date for all configured projects'
17
16
  task eol: %w(init) do
18
- Dev::EndOfLife.new.status
17
+ Dev::EndOfLife.new.check
19
18
  end
20
19
  end
21
20
  end
@@ -4,23 +4,6 @@ module Dev
4
4
  module Template
5
5
  # Class contains rake templates for managing your git project
6
6
  class Git < Dev::Template::BaseInterface
7
- # Create the rake task for cloning all defined repos
8
- def create_clone_task!
9
- # Have to set a local variable to be accessible inside of the instance_eval block
10
- exclude = @exclude
11
-
12
- DEV_COMMANDS_TOP_LEVEL.instance_eval do
13
- namespace :git do
14
- return if exclude.include?(:clone)
15
-
16
- desc 'Make sure all repos are cloned'
17
- task :clone do
18
- Dev::Git.new.clone_repos
19
- end
20
- end
21
- end
22
- end
23
-
24
7
  # Create the rake task for the git checkout method
25
8
  def create_checkout_task!
26
9
  # Have to set a local variable to be accessible inside of the instance_eval block