firespring_dev_commands 3.0.0.pre.alpha.1 → 3.0.0.pre.alpha.3
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 +4 -4
- data/lib/firespring_dev_commands/docker/artifact.rb +12 -0
- data/lib/firespring_dev_commands/docker/compose.rb +5 -0
- data/lib/firespring_dev_commands/docker.rb +1 -1
- data/lib/firespring_dev_commands/templates/base_interface.rb +12 -12
- data/lib/firespring_dev_commands/templates/docker/application.rb +4 -4
- data/lib/firespring_dev_commands/templates/docker/default.rb +7 -5
- data/lib/firespring_dev_commands/templates/docker/node/application.rb +37 -7
- data/lib/firespring_dev_commands/templates/docker/php/application.rb +39 -7
- data/lib/firespring_dev_commands/templates/docker/ruby/application.rb +37 -6
- data/lib/firespring_dev_commands/version.rb +1 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 7ae0ecadec576f4f6c986fc7391faa03f1d148473f3c04f250c40edb120355df
         | 
| 4 | 
            +
              data.tar.gz: ab84f1118a1c28c1667d0a825bbf57bfddf01d3a219e07715422e4e0ec50bf04
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 575c45ba8a86cad256f030eebe6a9ee7987fb0cd0bb8f413989efa92e237d7fc40e1030a325e965696b5c6da47cd55e91a941eecd5b8e2f4bd81bcafcaeaee3b
         | 
| 7 | 
            +
              data.tar.gz: 3c07674f01809f4f8aaa2042691815c4795cffc298ff3ffffeabf293d00b4e61c64d5989a4d81ebcaa287258cf75002836eaa0d1c23ef22af445b7420dd786b7
         | 
| @@ -126,6 +126,11 @@ module Dev | |
| 126 126 | 
             
                    execute_command(build_command('stop'))
         | 
| 127 127 | 
             
                  end
         | 
| 128 128 |  | 
| 129 | 
            +
                  # Pull in supported env settings and call restart
         | 
| 130 | 
            +
                  def restart
         | 
| 131 | 
            +
                    execute_command(build_command('restart'))
         | 
| 132 | 
            +
                  end
         | 
| 133 | 
            +
             | 
| 129 134 | 
             
                  # Call the compose exec method passing the given args after it
         | 
| 130 135 | 
             
                  def exec(*args)
         | 
| 131 136 | 
             
                    execute_command(build_command('exec', *args))
         | 
| @@ -144,18 +144,18 @@ DEV_COMMANDS_TOP_LEVEL.instance_eval do | |
| 144 144 | 
             
                #   In that case it is recommended that you call the base _post_stop_hooks as a dependency of that task
         | 
| 145 145 | 
             
              end
         | 
| 146 146 |  | 
| 147 | 
            -
              # Define an empty  | 
| 148 | 
            -
              task : | 
| 149 | 
            -
                # The user may define custom  | 
| 150 | 
            -
                # Define this process in the appropriate namespace to add them only to a specific  | 
| 151 | 
            -
                #   In that case it is recommended that you call the base  | 
| 152 | 
            -
              end
         | 
| 153 | 
            -
             | 
| 154 | 
            -
              # Define an empty  | 
| 155 | 
            -
              task : | 
| 156 | 
            -
                # The user may define custom  | 
| 157 | 
            -
                # Define this process in the appropriate namespace to add them only to a specific  | 
| 158 | 
            -
                #   In that case it is recommended that you call the base  | 
| 147 | 
            +
              # Define an empty _pre_restart_hooks handler which can be overridden by the user
         | 
| 148 | 
            +
              task :_pre_restart_hooks do
         | 
| 149 | 
            +
                # The user may define custom _pre_restart_hooks tasks to add any pre-restart actions the restart process
         | 
| 150 | 
            +
                # Define this process in the appropriate namespace to add them only to a specific restart
         | 
| 151 | 
            +
                #   In that case it is recommended that you call the base _pre_restart_hooks as a dependency of that task
         | 
| 152 | 
            +
              end
         | 
| 153 | 
            +
             | 
| 154 | 
            +
              # Define an empty _post_restart_hooks handler which can be overridden by the user
         | 
| 155 | 
            +
              task :_post_restart_hooks do
         | 
| 156 | 
            +
                # The user may define custom _post_restart_hooks tasks to add any post-restart actions the restart process
         | 
| 157 | 
            +
                # Define this process in the appropriate namespace to add them only to a specific restart
         | 
| 158 | 
            +
                #   In that case it is recommended that you call the base _post_restart_hooks as a dependency of that task
         | 
| 159 159 | 
             
              end
         | 
| 160 160 |  | 
| 161 161 | 
             
              # Define an empty _pre_clean_hooks handler which can be overridden by the user
         | 
| @@ -145,17 +145,17 @@ module Dev | |
| 145 145 | 
             
                    end
         | 
| 146 146 |  | 
| 147 147 | 
             
                    # Create the rake task which stops, cleans, and starts the application
         | 
| 148 | 
            -
                    def  | 
| 148 | 
            +
                    def create_restart_task!
         | 
| 149 149 | 
             
                      application = @name
         | 
| 150 150 | 
             
                      exclude = @exclude
         | 
| 151 151 |  | 
| 152 152 | 
             
                      DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| 153 153 | 
             
                        namespace application do
         | 
| 154 | 
            -
                          return if exclude.include?(: | 
| 154 | 
            +
                          return if exclude.include?(:restart)
         | 
| 155 155 |  | 
| 156 156 | 
             
                          desc "Reloads the #{application} container"
         | 
| 157 | 
            -
                          task  | 
| 158 | 
            -
                            Rake::Task[: | 
| 157 | 
            +
                          task restart: %w(init_docker _pre_restart_hooks down up_no_deps) do
         | 
| 158 | 
            +
                            Rake::Task[:_post_restart_hooks].execute
         | 
| 159 159 | 
             
                          end
         | 
| 160 160 | 
             
                        end
         | 
| 161 161 | 
             
                      end
         | 
| @@ -101,16 +101,18 @@ module Dev | |
| 101 101 | 
             
                      end
         | 
| 102 102 | 
             
                    end
         | 
| 103 103 |  | 
| 104 | 
            -
                    # Create the rake task which runs a docker compose  | 
| 105 | 
            -
                    def  | 
| 104 | 
            +
                    # Create the rake task which runs a docker compose restart
         | 
| 105 | 
            +
                    def create_restart_task!
         | 
| 106 106 | 
             
                      exclude = @exclude
         | 
| 107 107 |  | 
| 108 108 | 
             
                      DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| 109 | 
            -
                        return if exclude.include?(: | 
| 109 | 
            +
                        return if exclude.include?(:restart)
         | 
| 110 110 |  | 
| 111 111 | 
             
                        desc 'Runs a "down" followed by an "up"'
         | 
| 112 | 
            -
                        task  | 
| 113 | 
            -
                           | 
| 112 | 
            +
                        task restart: %w(_pre_restart_hooks) do
         | 
| 113 | 
            +
                          LOG.debug('In base restart')
         | 
| 114 | 
            +
                          Dev::Docker::Compose.new.restart
         | 
| 115 | 
            +
                          Rake::Task[:_post_restart_hooks].execute
         | 
| 114 116 | 
             
                        end
         | 
| 115 117 | 
             
                      end
         | 
| 116 118 | 
             
                    end
         | 
| @@ -17,6 +17,8 @@ module Dev | |
| 17 17 | 
             
                      # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
         | 
| 18 18 | 
             
                      # @param test_isolation [Boolean] Whether or not to start tests in an isolated project and clean up after tests are run
         | 
| 19 19 | 
             
                      # @param coverage [Dev::Coverage::Base] The coverage class which is an instance of Base to be used to evaluate coverage
         | 
| 20 | 
            +
                      # @param lint_artifacts [Dev::Docker::Artifact] An array of lint artifacts to copy back from the container
         | 
| 21 | 
            +
                      # @param test_artifacts [Dev::Docker::Artifact] An array of test artifacts to copy back from the container
         | 
| 20 22 | 
             
                      # @param exclude [Array<Symbol>] An array of default template tasks to exclude
         | 
| 21 23 | 
             
                      def initialize(
         | 
| 22 24 | 
             
                        application,
         | 
| @@ -25,20 +27,28 @@ module Dev | |
| 25 27 | 
             
                        start_container_dependencies_on_test: false,
         | 
| 26 28 | 
             
                        test_isolation: false,
         | 
| 27 29 | 
             
                        coverage: nil,
         | 
| 30 | 
            +
                        lint_artifacts: nil,
         | 
| 31 | 
            +
                        test_artifacts: nil,
         | 
| 28 32 | 
             
                        exclude: []
         | 
| 29 33 | 
             
                      )
         | 
| 30 34 | 
             
                        @node = Dev::Node.new(container_path:, local_path:, coverage:)
         | 
| 31 35 | 
             
                        @start_container_dependencies_on_test = start_container_dependencies_on_test
         | 
| 32 36 | 
             
                        @test_isolation = test_isolation
         | 
| 37 | 
            +
                        @lint_artifacts = lint_artifacts
         | 
| 38 | 
            +
                        @test_artifacts = test_artifacts
         | 
| 39 | 
            +
                        raise 'lint artifact must be instance of Dev::Docker::Artifact' if lint_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 40 | 
            +
                        raise 'test artifact must be instance of Dev::Docker::Artifact' if test_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 33 41 |  | 
| 34 42 | 
             
                        super(application, exclude:)
         | 
| 35 43 | 
             
                      end
         | 
| 36 44 |  | 
| 45 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 37 46 | 
             
                      # Create the rake task which runs linting for the application name
         | 
| 38 47 | 
             
                      def create_lint_task!
         | 
| 39 48 | 
             
                        application = @name
         | 
| 40 49 | 
             
                        node = @node
         | 
| 41 50 | 
             
                        exclude = @exclude
         | 
| 51 | 
            +
                        lint_artifacts = @lint_artifacts
         | 
| 42 52 | 
             
                        return if exclude.include?(:lint)
         | 
| 43 53 |  | 
| 44 54 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -54,9 +64,16 @@ module Dev | |
| 54 64 | 
             
                              task lint: %w(init_docker up_no_deps) do
         | 
| 55 65 | 
             
                                LOG.debug("Check for node linting errors in the #{application} codebase")
         | 
| 56 66 |  | 
| 67 | 
            +
                                # Run the lint command
         | 
| 57 68 | 
             
                                options = []
         | 
| 58 69 | 
             
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 59 70 | 
             
                                Dev::Docker::Compose.new(services: application, options:).exec(*node.lint_command)
         | 
| 71 | 
            +
                              ensure
         | 
| 72 | 
            +
                                # Copy any defined artifacts back
         | 
| 73 | 
            +
                                container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 74 | 
            +
                                lint_artifacts&.each do |artifact|
         | 
| 75 | 
            +
                                  Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 76 | 
            +
                                end
         | 
| 60 77 | 
             
                              end
         | 
| 61 78 |  | 
| 62 79 | 
             
                              namespace :lint do
         | 
| @@ -73,7 +90,9 @@ module Dev | |
| 73 90 | 
             
                          end
         | 
| 74 91 | 
             
                        end
         | 
| 75 92 | 
             
                      end
         | 
| 93 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 76 94 |  | 
| 95 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 77 96 | 
             
                      # Create the rake task which runs all tests for the application name
         | 
| 78 97 | 
             
                      def create_test_task!
         | 
| 79 98 | 
             
                        application = @name
         | 
| @@ -81,6 +100,7 @@ module Dev | |
| 81 100 | 
             
                        exclude = @exclude
         | 
| 82 101 | 
             
                        test_isolation = @test_isolation
         | 
| 83 102 | 
             
                        up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
         | 
| 103 | 
            +
                        test_artifacts = @test_artifacts
         | 
| 84 104 | 
             
                        return if exclude.include?(:test)
         | 
| 85 105 |  | 
| 86 106 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -100,13 +120,22 @@ module Dev | |
| 100 120 | 
             
                              desc "Run all node tests against the #{application}'s codebase" \
         | 
| 101 121 | 
             
                                   "\n\t(optional) use OPTS=... to pass additional options to the command"
         | 
| 102 122 | 
             
                              task test: %W(test_init_docker #{up_cmd}) do
         | 
| 103 | 
            -
                                 | 
| 104 | 
            -
             | 
| 105 | 
            -
                                options = []
         | 
| 106 | 
            -
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 107 | 
            -
                                Dev::Docker::Compose.new(services: application, options:).exec(*node.test_command)
         | 
| 108 | 
            -
                                node.check_test_coverage(application:)
         | 
| 123 | 
            +
                                begin
         | 
| 124 | 
            +
                                  LOG.debug("Running all node tests in the #{application} codebase")
         | 
| 109 125 |  | 
| 126 | 
            +
                                  # Run the test command
         | 
| 127 | 
            +
                                  options = []
         | 
| 128 | 
            +
                                  options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 129 | 
            +
                                  Dev::Docker::Compose.new(services: application, options:).exec(*node.test_command)
         | 
| 130 | 
            +
                                  node.check_test_coverage(application:)
         | 
| 131 | 
            +
                                ensure
         | 
| 132 | 
            +
                                  # Copy any defined artifacts back
         | 
| 133 | 
            +
                                  container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 134 | 
            +
                                  test_artifacts&.each do |artifact|
         | 
| 135 | 
            +
                                    Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 136 | 
            +
                                  end
         | 
| 137 | 
            +
                                end
         | 
| 138 | 
            +
                              ensure
         | 
| 110 139 | 
             
                                # Clean up resources if we are on an isolated project name
         | 
| 111 140 | 
             
                                if test_isolation
         | 
| 112 141 | 
             
                                  Dev::Docker::Compose.new.down
         | 
| @@ -117,6 +146,7 @@ module Dev | |
| 117 146 | 
             
                          end
         | 
| 118 147 | 
             
                        end
         | 
| 119 148 | 
             
                      end
         | 
| 149 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 120 150 |  | 
| 121 151 | 
             
                      # Create the rake task which runs the install command for the application packages
         | 
| 122 152 | 
             
                      def create_install_task!
         | 
| @@ -162,7 +192,7 @@ module Dev | |
| 162 192 | 
             
                                opts = []
         | 
| 163 193 | 
             
                                opts << '-T' if Dev::Common.new.running_codebuild?
         | 
| 164 194 |  | 
| 165 | 
            -
                                #  | 
| 195 | 
            +
                                # Run the audit command and retrieve the results
         | 
| 166 196 | 
             
                                data = Dev::Docker::Compose.new(services: application, options: opts, capture: true).exec(*node.audit_command)
         | 
| 167 197 | 
             
                                Dev::Node::Audit.new(data).to_report.check
         | 
| 168 198 | 
             
                              end
         | 
| @@ -17,6 +17,9 @@ module Dev | |
| 17 17 | 
             
                      # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
         | 
| 18 18 | 
             
                      # @param test_isolation [Boolean] Whether or not to start tests in an isolated project and clean up after tests are run
         | 
| 19 19 | 
             
                      # @param coverage [Dev::Coverage::Base] The coverage class which is an instance of Base to be used to evaluate coverage
         | 
| 20 | 
            +
                      # @param lint_artifacts [Dev::Docker::Artifact] An array of lint artifacts to copy back from the container
         | 
| 21 | 
            +
                      # @param test_artifacts [Dev::Docker::Artifact] An array of test artifacts to copy back from the container
         | 
| 22 | 
            +
                      # @param exclude [Array<Symbol>] An array of default template tasks to exclude
         | 
| 20 23 | 
             
                      def initialize(
         | 
| 21 24 | 
             
                        application,
         | 
| 22 25 | 
             
                        container_path: nil,
         | 
| @@ -24,11 +27,17 @@ module Dev | |
| 24 27 | 
             
                        start_container_dependencies_on_test: false,
         | 
| 25 28 | 
             
                        test_isolation: false,
         | 
| 26 29 | 
             
                        coverage: nil,
         | 
| 30 | 
            +
                        lint_artifacts: nil,
         | 
| 31 | 
            +
                        test_artifacts: nil,
         | 
| 27 32 | 
             
                        exclude: []
         | 
| 28 33 | 
             
                      )
         | 
| 29 34 | 
             
                        @php = Dev::Php.new(container_path:, local_path:, coverage:)
         | 
| 30 35 | 
             
                        @start_container_dependencies_on_test = start_container_dependencies_on_test
         | 
| 31 36 | 
             
                        @test_isolation = test_isolation
         | 
| 37 | 
            +
                        @lint_artifacts = lint_artifacts
         | 
| 38 | 
            +
                        @test_artifacts = test_artifacts
         | 
| 39 | 
            +
                        raise 'lint artifact must be instance of Dev::Docker::Artifact' if lint_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 40 | 
            +
                        raise 'test artifact must be instance of Dev::Docker::Artifact' if test_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 32 41 |  | 
| 33 42 | 
             
                        super(application, exclude:)
         | 
| 34 43 | 
             
                      end
         | 
| @@ -77,11 +86,13 @@ module Dev | |
| 77 86 | 
             
                        end
         | 
| 78 87 | 
             
                      end
         | 
| 79 88 |  | 
| 89 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 80 90 | 
             
                      # Create the rake task which runs linting for the application name
         | 
| 81 91 | 
             
                      def create_lint_task!
         | 
| 82 92 | 
             
                        application = @name
         | 
| 83 93 | 
             
                        php = @php
         | 
| 84 94 | 
             
                        exclude = @exclude
         | 
| 95 | 
            +
                        lint_artifacts = @lint_artifacts
         | 
| 85 96 | 
             
                        return if exclude.include?(:lint)
         | 
| 86 97 |  | 
| 87 98 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -97,9 +108,16 @@ module Dev | |
| 97 108 | 
             
                              task lint: %w(init_docker up_no_deps) do
         | 
| 98 109 | 
             
                                LOG.debug("Check for php linting errors in the #{application} codebase")
         | 
| 99 110 |  | 
| 111 | 
            +
                                # Run the lint command
         | 
| 100 112 | 
             
                                options = []
         | 
| 101 113 | 
             
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 102 114 | 
             
                                Dev::Docker::Compose.new(services: application, options:).exec(*php.lint_command)
         | 
| 115 | 
            +
                              ensure
         | 
| 116 | 
            +
                                # Copy any defined artifacts back
         | 
| 117 | 
            +
                                container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 118 | 
            +
                                lint_artifacts&.each do |artifact|
         | 
| 119 | 
            +
                                  Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 120 | 
            +
                                end
         | 
| 103 121 | 
             
                              end
         | 
| 104 122 |  | 
| 105 123 | 
             
                              namespace :lint do
         | 
| @@ -107,6 +125,7 @@ module Dev | |
| 107 125 | 
             
                                task fix: %w(init_docker up_no_deps) do
         | 
| 108 126 | 
             
                                  LOG.debug("Check and fix all php linting errors in the #{application} codebase")
         | 
| 109 127 |  | 
| 128 | 
            +
                                  # Run the lint fix command
         | 
| 110 129 | 
             
                                  options = []
         | 
| 111 130 | 
             
                                  options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 112 131 | 
             
                                  Dev::Docker::Compose.new(services: application, options:).exec(*php.lint_fix_command)
         | 
| @@ -116,7 +135,9 @@ module Dev | |
| 116 135 | 
             
                          end
         | 
| 117 136 | 
             
                        end
         | 
| 118 137 | 
             
                      end
         | 
| 138 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 119 139 |  | 
| 140 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 120 141 | 
             
                      # Create the rake task which runs all tests for the application name
         | 
| 121 142 | 
             
                      def create_test_task!
         | 
| 122 143 | 
             
                        application = @name
         | 
| @@ -124,6 +145,7 @@ module Dev | |
| 124 145 | 
             
                        exclude = @exclude
         | 
| 125 146 | 
             
                        test_isolation = @test_isolation
         | 
| 126 147 | 
             
                        up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
         | 
| 148 | 
            +
                        test_artifacts = @test_artifacts
         | 
| 127 149 | 
             
                        return if exclude.include?(:test)
         | 
| 128 150 |  | 
| 129 151 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -143,13 +165,22 @@ module Dev | |
| 143 165 | 
             
                              desc "Run all php tests against the #{application}'s codebase" \
         | 
| 144 166 | 
             
                                   "\n\t(optional) use OPTS=... to pass additional options to the command"
         | 
| 145 167 | 
             
                              task test: %W(test_init_docker #{up_cmd}) do
         | 
| 146 | 
            -
                                 | 
| 147 | 
            -
             | 
| 148 | 
            -
                                options = []
         | 
| 149 | 
            -
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 150 | 
            -
                                Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
         | 
| 151 | 
            -
                                php.check_test_coverage(application:)
         | 
| 168 | 
            +
                                begin
         | 
| 169 | 
            +
                                  LOG.debug("Running all php tests in the #{application} codebase")
         | 
| 152 170 |  | 
| 171 | 
            +
                                  # Run the test command
         | 
| 172 | 
            +
                                  options = []
         | 
| 173 | 
            +
                                  options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 174 | 
            +
                                  Dev::Docker::Compose.new(services: application, options:).exec(*php.test_command)
         | 
| 175 | 
            +
                                  php.check_test_coverage(application:)
         | 
| 176 | 
            +
                                ensure
         | 
| 177 | 
            +
                                  # Copy any defined artifacts back
         | 
| 178 | 
            +
                                  container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 179 | 
            +
                                  test_artifacts&.each do |artifact|
         | 
| 180 | 
            +
                                    Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 181 | 
            +
                                  end
         | 
| 182 | 
            +
                                end
         | 
| 183 | 
            +
                              ensure
         | 
| 153 184 | 
             
                                # Clean up resources if we are on an isolated project name
         | 
| 154 185 | 
             
                                if test_isolation
         | 
| 155 186 | 
             
                                  Dev::Docker::Compose.new.down
         | 
| @@ -160,6 +191,7 @@ module Dev | |
| 160 191 | 
             
                          end
         | 
| 161 192 | 
             
                        end
         | 
| 162 193 | 
             
                      end
         | 
| 194 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 163 195 |  | 
| 164 196 | 
             
                      # Create the rake tasks which runs the install command for the application packages
         | 
| 165 197 | 
             
                      def create_install_task!
         | 
| @@ -205,7 +237,7 @@ module Dev | |
| 205 237 | 
             
                                opts = []
         | 
| 206 238 | 
             
                                opts << '-T' if Dev::Common.new.running_codebuild?
         | 
| 207 239 |  | 
| 208 | 
            -
                                #  | 
| 240 | 
            +
                                # Run the audit command and retrieve the results
         | 
| 209 241 | 
             
                                data = Dev::Docker::Compose.new(services: application, options: opts, capture: true).exec(*php.audit_command)
         | 
| 210 242 | 
             
                                Dev::Php::Audit.new(data).to_report.check
         | 
| 211 243 | 
             
                              end
         | 
| @@ -17,6 +17,9 @@ module Dev | |
| 17 17 | 
             
                      # @param start_container_dependencies_on_test [Boolean] Whether or not to start up container dependencies when running tests
         | 
| 18 18 | 
             
                      # @param test_isolation [Boolean] Whether or not to start tests in an isolated project and clean up after tests are run
         | 
| 19 19 | 
             
                      # @param coverage [Dev::Coverage::Base] The coverage class which is an instance of Base to be used to evaluate coverage
         | 
| 20 | 
            +
                      # @param lint_artifacts [Dev::Docker::Artifact] An array of lint artifacts to copy back from the container
         | 
| 21 | 
            +
                      # @param test_artifacts [Dev::Docker::Artifact] An array of test artifacts to copy back from the container
         | 
| 22 | 
            +
                      # @param exclude [Array<Symbol>] An array of default template tasks to exclude
         | 
| 20 23 | 
             
                      def initialize(
         | 
| 21 24 | 
             
                        application,
         | 
| 22 25 | 
             
                        container_path: nil,
         | 
| @@ -24,20 +27,28 @@ module Dev | |
| 24 27 | 
             
                        start_container_dependencies_on_test: false,
         | 
| 25 28 | 
             
                        test_isolation: false,
         | 
| 26 29 | 
             
                        coverage: nil,
         | 
| 30 | 
            +
                        lint_artifacts: nil,
         | 
| 31 | 
            +
                        test_artifacts: nil,
         | 
| 27 32 | 
             
                        exclude: []
         | 
| 28 33 | 
             
                      )
         | 
| 29 34 | 
             
                        @ruby = Dev::Ruby.new(container_path:, local_path:, coverage:)
         | 
| 30 35 | 
             
                        @start_container_dependencies_on_test = start_container_dependencies_on_test
         | 
| 31 36 | 
             
                        @test_isolation = test_isolation
         | 
| 37 | 
            +
                        @lint_artifacts = lint_artifacts
         | 
| 38 | 
            +
                        @test_artifacts = test_artifacts
         | 
| 39 | 
            +
                        raise 'lint artifact must be instance of Dev::Docker::Artifact' if lint_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 40 | 
            +
                        raise 'test artifact must be instance of Dev::Docker::Artifact' if test_artifacts&.any? { |it| !it.is_a?(Dev::Docker::Artifact) }
         | 
| 32 41 |  | 
| 33 42 | 
             
                        super(application, exclude:)
         | 
| 34 43 | 
             
                      end
         | 
| 35 44 |  | 
| 45 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 36 46 | 
             
                      # Create the rake task which runs linting for the application name
         | 
| 37 47 | 
             
                      def create_lint_task!
         | 
| 38 48 | 
             
                        application = @name
         | 
| 39 49 | 
             
                        ruby = @ruby
         | 
| 40 50 | 
             
                        exclude = @exclude
         | 
| 51 | 
            +
                        lint_artifacts = @lint_artifacts
         | 
| 41 52 | 
             
                        return if exclude.include?(:lint)
         | 
| 42 53 |  | 
| 43 54 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -53,9 +64,16 @@ module Dev | |
| 53 64 | 
             
                              task lint: %w(init_docker up_no_deps) do
         | 
| 54 65 | 
             
                                LOG.debug("Check for ruby linting errors in the #{application} codebase")
         | 
| 55 66 |  | 
| 67 | 
            +
                                # Run the lint command
         | 
| 56 68 | 
             
                                options = []
         | 
| 57 69 | 
             
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 58 70 | 
             
                                Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_command)
         | 
| 71 | 
            +
                              ensure
         | 
| 72 | 
            +
                                # Copy any defined artifacts back
         | 
| 73 | 
            +
                                container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 74 | 
            +
                                lint_artifacts&.each do |artifact|
         | 
| 75 | 
            +
                                  Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 76 | 
            +
                                end
         | 
| 59 77 | 
             
                              end
         | 
| 60 78 |  | 
| 61 79 | 
             
                              namespace :lint do
         | 
| @@ -63,6 +81,7 @@ module Dev | |
| 63 81 | 
             
                                task fix: %w(init_docker up_no_deps) do
         | 
| 64 82 | 
             
                                  LOG.debug("Check and fix all ruby linting errors in the #{application} codebase")
         | 
| 65 83 |  | 
| 84 | 
            +
                                  # Run the lint fix command
         | 
| 66 85 | 
             
                                  options = []
         | 
| 67 86 | 
             
                                  options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 68 87 | 
             
                                  Dev::Docker::Compose.new(services: application, options:).exec(*ruby.lint_fix_command)
         | 
| @@ -72,7 +91,9 @@ module Dev | |
| 72 91 | 
             
                          end
         | 
| 73 92 | 
             
                        end
         | 
| 74 93 | 
             
                      end
         | 
| 94 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 75 95 |  | 
| 96 | 
            +
                      # rubocop:disable Metrics/MethodLength
         | 
| 76 97 | 
             
                      # Create the rake task which runs all tests for the application name
         | 
| 77 98 | 
             
                      def create_test_task!
         | 
| 78 99 | 
             
                        application = @name
         | 
| @@ -80,6 +101,7 @@ module Dev | |
| 80 101 | 
             
                        exclude = @exclude
         | 
| 81 102 | 
             
                        test_isolation = @test_isolation
         | 
| 82 103 | 
             
                        up_cmd = @start_container_dependencies_on_test ? :up : :up_no_deps
         | 
| 104 | 
            +
                        test_artifacts = @test_artifacts
         | 
| 83 105 | 
             
                        return if exclude.include?(:test)
         | 
| 84 106 |  | 
| 85 107 | 
             
                        DEV_COMMANDS_TOP_LEVEL.instance_eval do
         | 
| @@ -99,13 +121,21 @@ module Dev | |
| 99 121 | 
             
                              desc "Run all ruby tests against the #{application}'s codebase" \
         | 
| 100 122 | 
             
                                   "\n\t(optional) use OPTS=... to pass additional options to the command"
         | 
| 101 123 | 
             
                              task test: %W(test_init_docker #{up_cmd}) do
         | 
| 102 | 
            -
                                 | 
| 103 | 
            -
             | 
| 104 | 
            -
                                options = []
         | 
| 105 | 
            -
                                options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 106 | 
            -
                                Dev::Docker::Compose.new(services: application, options:).exec(*ruby.test_command)
         | 
| 107 | 
            -
                                ruby.check_test_coverage(application:)
         | 
| 124 | 
            +
                                begin
         | 
| 125 | 
            +
                                  LOG.debug("Running all ruby tests in the #{application} codebase")
         | 
| 108 126 |  | 
| 127 | 
            +
                                  options = []
         | 
| 128 | 
            +
                                  options << '-T' if Dev::Common.new.running_codebuild?
         | 
| 129 | 
            +
                                  Dev::Docker::Compose.new(services: application, options:).exec(*ruby.test_command)
         | 
| 130 | 
            +
                                  ruby.check_test_coverage(application:)
         | 
| 131 | 
            +
                                ensure
         | 
| 132 | 
            +
                                  # Copy any defined artifacts back
         | 
| 133 | 
            +
                                  container = Dev::Docker::Compose.new.container_by_name(application)
         | 
| 134 | 
            +
                                  test_artifacts&.each do |artifact|
         | 
| 135 | 
            +
                                    Dev::Docker.new.copy_from_container(container, artifact.container_path, artifact.local_path)
         | 
| 136 | 
            +
                                  end
         | 
| 137 | 
            +
                                end
         | 
| 138 | 
            +
                              ensure
         | 
| 109 139 | 
             
                                # Clean up resources if we are on an isolated project name
         | 
| 110 140 | 
             
                                if test_isolation
         | 
| 111 141 | 
             
                                  Dev::Docker::Compose.new.down
         | 
| @@ -116,6 +146,7 @@ module Dev | |
| 116 146 | 
             
                          end
         | 
| 117 147 | 
             
                        end
         | 
| 118 148 | 
             
                      end
         | 
| 149 | 
            +
                      # rubocop:enable Metrics/MethodLength
         | 
| 119 150 |  | 
| 120 151 | 
             
                      # Create the rake task which runs the install command for the application packages
         | 
| 121 152 | 
             
                      def create_install_task!
         | 
    
        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: 3.0.0.pre.alpha. | 
| 4 | 
            +
              version: 3.0.0.pre.alpha.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Firespring
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024-01- | 
| 11 | 
            +
            date: 2024-01-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: activesupport
         | 
| @@ -338,6 +338,7 @@ files: | |
| 338 338 | 
             
            - lib/firespring_dev_commands/coverage/none.rb
         | 
| 339 339 | 
             
            - lib/firespring_dev_commands/daterange.rb
         | 
| 340 340 | 
             
            - lib/firespring_dev_commands/docker.rb
         | 
| 341 | 
            +
            - lib/firespring_dev_commands/docker/artifact.rb
         | 
| 341 342 | 
             
            - lib/firespring_dev_commands/docker/compose.rb
         | 
| 342 343 | 
             
            - lib/firespring_dev_commands/docker/status.rb
         | 
| 343 344 | 
             
            - lib/firespring_dev_commands/dotenv.rb
         |