hephaestus 0.4.0 → 0.5.1
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/CHANGELOG.md +12 -0
- data/bin/hephaestus +1 -0
- data/lib/hephaestus/app_builder.rb +6 -6
- data/lib/hephaestus/exit_on_failure.rb +1 -1
- data/lib/hephaestus/generators/app_generator.rb +18 -15
- data/lib/hephaestus/generators/core_generator.rb +1 -1
- data/lib/hephaestus/generators/deployment_generator.rb +6 -0
- data/lib/hephaestus/version.rb +1 -1
- data/lib/hephaestus.rb +8 -3
- data/templates/.licensed.yml +6 -0
- data/templates/Dockerfile +2 -2
- data/templates/Gemfile.erb +2 -0
- data/templates/app/controllers/concerns/authable.rb +1 -1
- data/templates/app/controllers/settings_controller.rb +8 -0
- data/templates/app/services/yetto_service.rb +1 -1
- data/templates/lib/tasks/test_tasks.rake +1 -1
- data/templates/test/test_helper.rb +1 -1
- data/templates/vendor/fly/fly-production.toml +0 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a6ea72738e1e92fb2cde19166a290573e1a4f3d51f4889c13fcfb0530998ff28
         | 
| 4 | 
            +
              data.tar.gz: 6a5980d8b598044f144feda0aae7a74cafd156349fcd7871ff1b431c21fad32c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5b901a9802f9b40d387ee9f476583e79c3e04fd8f0f324497dd27dfe67464d408cc694ce0875aefe36ab1dabed4f1e7ceff25ce5f2a672868590da1893b2099a
         | 
| 7 | 
            +
              data.tar.gz: 48c94b50e1cf0420e91c69d1c2c17e8d5d96e4aead81f43a284d6f6999f31910cf29b9b9b349998c89403839eb559705a93337288637764292e3fc5ae1f7b9c6
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,15 @@ | |
| 1 | 
            +
            ## [v0.5.0] - 13-10-2023
         | 
| 2 | 
            +
            ## What's Changed
         | 
| 3 | 
            +
            * More edits by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/11
         | 
| 4 | 
            +
             | 
| 5 | 
            +
             | 
| 6 | 
            +
            **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.4.0...v0.5.0
         | 
| 7 | 
            +
            ## [v0.4.0] - 29-09-2023
         | 
| 8 | 
            +
            ## What's Changed
         | 
| 9 | 
            +
            * Yet more changes by @gjtorikian in https://github.com/yettoapp/hephaestus/pull/10
         | 
| 10 | 
            +
             | 
| 11 | 
            +
             | 
| 12 | 
            +
            **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.3.1...v0.4.0
         | 
| 1 13 | 
             
            ## [v0.3.1] - 18-09-2023
         | 
| 2 14 | 
             
            **Full Changelog**: https://github.com/yettoapp/hephaestus/compare/v0.3.0...v0.3.1
         | 
| 3 15 | 
             
            ## [v0.3.0] - 12-09-2023
         | 
    
        data/bin/hephaestus
    CHANGED
    
    
| @@ -73,7 +73,7 @@ module Hephaestus | |
| 73 73 | 
             
                def setup_slack_logger
         | 
| 74 74 | 
             
                  config = <<~EOD
         | 
| 75 75 | 
             
                    config.after_initialize do
         | 
| 76 | 
            -
                      Rails.logger. | 
| 76 | 
            +
                      Rails.logger.broadcast_to(SlackWebhookLogger.logger)
         | 
| 77 77 | 
             
                    end
         | 
| 78 78 | 
             
                  EOD
         | 
| 79 79 | 
             
                  configure_environment("production", config)
         | 
| @@ -158,17 +158,17 @@ module Hephaestus | |
| 158 158 | 
             
                def replace_generic_variables
         | 
| 159 159 | 
             
                  say(set_color("Replacing generic variable names...", :cyan))
         | 
| 160 160 | 
             
                  replace_in_files(destination_root, /App(?!lication)/, short_app_name.capitalize)
         | 
| 161 | 
            -
                  replace_in_files(destination_root, %r{(?<!yetto|plugs\.yetto\.)app(?!lication|/|roximate)}, short_app_name.downcase)
         | 
| 161 | 
            +
                  replace_in_files(destination_root, %r{(?<!yetto|sw|plugs\.yetto\.)app(?!lication|/|roximate)}, short_app_name.downcase)
         | 
| 162 162 | 
             
                  replace_in_files(destination_root, "PlugApp", app_name.underscore.camelcase)
         | 
| 163 163 | 
             
                  replace_in_files(destination_root, "plug-app", app_name.dasherize)
         | 
| 164 164 | 
             
                  replace_in_files("destination_root}/.github/workflows/test.yml", "plug-app", app_name.dasherize)
         | 
| 165 165 | 
             
                  replace_in_files(destination_root, "PLUG_APP", app_name.underscore.upcase)
         | 
| 166 | 
            -
                   | 
| 167 | 
            -
                  # rename methods...I think. I actually can't say for sure I remember what it's for.
         | 
| 168 | 
            -
                  replace_in_files(destination_root, "plug_", "")
         | 
| 166 | 
            +
                  replace_in_files(destination_root, "plug_app", app_name.underscore)
         | 
| 169 167 |  | 
| 170 | 
            -
                  #  | 
| 168 | 
            +
                  # these are erroneously changed
         | 
| 171 169 | 
             
                  replace_in_file("script/server", "/usr/src/#{short_app_name.downcase}", "/usr/src/app")
         | 
| 170 | 
            +
                  replace_in_file("vendor/fly/fly-production.toml", "#{short_app_name.downcase} = ", "app = ")
         | 
| 171 | 
            +
                  replace_in_file("vendor/fly/fly-staging.toml", "#{short_app_name.downcase} = ", "app =")
         | 
| 172 172 | 
             
                end
         | 
| 173 173 |  | 
| 174 174 | 
             
                private
         | 
| @@ -52,6 +52,8 @@ module Hephaestus | |
| 52 52 | 
             
                  build(:replace_gemfile)
         | 
| 53 53 | 
             
                  capture_stdout do
         | 
| 54 54 | 
             
                    bundle_command("install")
         | 
| 55 | 
            +
                    bundle_command("update")
         | 
| 56 | 
            +
                    bundle_command("binstub foreman")
         | 
| 55 57 | 
             
                    bundle_command("lock --add-platform x86_64-linux")
         | 
| 56 58 | 
             
                  end
         | 
| 57 59 | 
             
                end
         | 
| @@ -202,11 +204,12 @@ module Hephaestus | |
| 202 204 |  | 
| 203 205 | 
             
                    * Set `settings/branches` to protect `production`
         | 
| 204 206 | 
             
                      * ✅ Require status checks to pass before merging
         | 
| 205 | 
            -
                      * 🖊️ Status checks that are required: `test`, `ruby / brakeman`, `ruby / bundle-audit`.
         | 
| 207 | 
            +
                      * 🖊️ Status checks that are required: `ruby / test_without_services`, `docker / test-build`, `ruby / brakeman`, `ruby / bundle-audit`.
         | 
| 208 | 
            +
             | 
| 206 209 | 
             
                        You can only set those 👆 after you've opened the first PR on GitHub. Crazy, I know!!
         | 
| 207 210 | 
             
                        But, doing so is *essential* for automerge to function properly.
         | 
| 208 211 |  | 
| 209 | 
            -
                    *  | 
| 212 | 
            +
                    * In `/settings`:
         | 
| 210 213 | 
             
                      * ✅ Allow auto-merge
         | 
| 211 214 | 
             
                      * ✅ Automatically delete head branches
         | 
| 212 215 | 
             
                  OUTPUT
         | 
| @@ -229,22 +232,22 @@ module Hephaestus | |
| 229 232 | 
             
                end
         | 
| 230 233 |  | 
| 231 234 | 
             
                private def capture_stdout
         | 
| 232 | 
            -
                  stream = "stdout"
         | 
| 233 | 
            -
                  captured_stream = Tempfile.new(stream)
         | 
| 234 | 
            -
                  stream_io = eval("$#{stream}", binding, __FILE__, __LINE__)
         | 
| 235 | 
            -
                  origin_stream = stream_io.dup
         | 
| 236 | 
            -
                  stream_io.reopen(captured_stream)
         | 
| 235 | 
            +
                  # stream = "stdout"
         | 
| 236 | 
            +
                  # captured_stream = Tempfile.new(stream)
         | 
| 237 | 
            +
                  # stream_io = eval("$#{stream}", binding, __FILE__, __LINE__)
         | 
| 238 | 
            +
                  # origin_stream = stream_io.dup
         | 
| 239 | 
            +
                  # stream_io.reopen(captured_stream)
         | 
| 237 240 |  | 
| 238 241 | 
             
                  yield
         | 
| 239 242 |  | 
| 240 | 
            -
                  stream_io.rewind
         | 
| 241 | 
            -
                  captured_stream.read
         | 
| 242 | 
            -
             | 
| 243 | 
            -
                  unless captured_stream.nil?
         | 
| 244 | 
            -
             | 
| 245 | 
            -
             | 
| 246 | 
            -
                  end
         | 
| 247 | 
            -
                  stream_io.reopen(origin_stream) unless stream_io.nil?
         | 
| 243 | 
            +
                  # stream_io.rewind
         | 
| 244 | 
            +
                  # captured_stream.read
         | 
| 245 | 
            +
             | 
| 246 | 
            +
                  # unless captured_stream.nil?
         | 
| 247 | 
            +
                  #   captured_stream.close
         | 
| 248 | 
            +
                  #   captured_stream.unlink
         | 
| 249 | 
            +
                  # end
         | 
| 250 | 
            +
                  # stream_io.reopen(origin_stream) unless stream_io.nil?
         | 
| 248 251 | 
             
                end
         | 
| 249 252 | 
             
              end
         | 
| 250 253 | 
             
            end
         | 
| @@ -19,7 +19,7 @@ module Hephaestus | |
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 21 | 
             
                def jobs
         | 
| 22 | 
            -
                  copy_file("app/jobs/application_job.rb", "app/jobs/application_job.rb")
         | 
| 22 | 
            +
                  copy_file("app/jobs/application_job.rb", "app/jobs/application_job.rb", force: true)
         | 
| 23 23 | 
             
                  copy_file("app/jobs/update_yetto_job.rb", "app/jobs/update_yetto_job.rb")
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| @@ -20,5 +20,11 @@ module Hephaestus | |
| 20 20 | 
             
                  copy_file("Dockerfile", "Dockerfile")
         | 
| 21 21 | 
             
                  copy_file("bin/docker-entrypoint", "bin/docker-entrypoint")
         | 
| 22 22 | 
             
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def fly
         | 
| 25 | 
            +
                  directory("vendor/fly", "vendor/fly")
         | 
| 26 | 
            +
                  copy_file("Dockerfile", "Dockerfile")
         | 
| 27 | 
            +
                  copy_file("bin/docker-entrypoint", "bin/docker-entrypoint")
         | 
| 28 | 
            +
                end
         | 
| 23 29 | 
             
              end
         | 
| 24 30 | 
             
            end
         | 
    
        data/lib/hephaestus/version.rb
    CHANGED
    
    
    
        data/lib/hephaestus.rb
    CHANGED
    
    | @@ -11,10 +11,15 @@ require "debug" if debugging? | |
| 11 11 |  | 
| 12 12 | 
             
            require "hephaestus/version"
         | 
| 13 13 | 
             
            require "hephaestus/exit_on_failure"
         | 
| 14 | 
            +
             | 
| 14 15 | 
             
            require "hephaestus/generators/app_generator"
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 16 | 
            +
            require "hephaestus/generators/config_generator"
         | 
| 17 | 
            +
            require "hephaestus/generators/core_generator"
         | 
| 18 | 
            +
            require "hephaestus/generators/deployment_generator"
         | 
| 19 | 
            +
            require "hephaestus/generators/lib_generator"
         | 
| 20 | 
            +
            require "hephaestus/generators/license_generator"
         | 
| 21 | 
            +
            require "hephaestus/generators/rubocop_generator"
         | 
| 22 | 
            +
            require "hephaestus/generators/sorbet_generator"
         | 
| 18 23 |  | 
| 19 24 | 
             
            require "hephaestus/actions"
         | 
| 20 25 | 
             
            require "hephaestus/actions/strip_comments_action"
         | 
    
        data/templates/.licensed.yml
    CHANGED
    
    | @@ -11,10 +11,16 @@ allowed: | |
| 11 11 |  | 
| 12 12 | 
             
            ignored:
         | 
| 13 13 | 
             
              bundler:
         | 
| 14 | 
            +
                - base64 # BSD-2-Clause ("This file is released under the same license as ruby.")
         | 
| 15 | 
            +
                - bigdecimal # BSD-2-Clause ("This file is released under the same license as ruby.")
         | 
| 14 16 | 
             
                - bundler-audit # GPL-3.0; but also, only used in CI/test
         | 
| 15 17 | 
             
                - date # BSD-2-Clause
         | 
| 18 | 
            +
                - drb # BSD-2-Clause ("This file is released under the same license as ruby.")
         | 
| 19 | 
            +
                - io-console # BSD-2-Clause
         | 
| 20 | 
            +
                - mutex_m # BSD-2-Clause ("This file is released under the same license as ruby.")
         | 
| 16 21 | 
             
                - net-protocol # BSD-2-Clause
         | 
| 17 22 | 
             
                - racc # BSD-2-Clause
         | 
| 23 | 
            +
                - reline # BSD-2-Clause ("This file is released under the same license as ruby.")
         | 
| 18 24 | 
             
                - ruby2_keywords # BSD-2-Clause; ignored because of custom LICENSE text
         | 
| 19 25 | 
             
                - sidekiq # LGPL-3.0; ignored because of custom LICENSE text
         | 
| 20 26 |  | 
    
        data/templates/Dockerfile
    CHANGED
    
    
    
        data/templates/Gemfile.erb
    CHANGED
    
    
| @@ -17,7 +17,7 @@ module Authable | |
| 17 17 | 
             
                state = params.fetch(:state, "")
         | 
| 18 18 | 
             
                _, _, gh_nonce, _, _, _, _ = parse_state(state)
         | 
| 19 19 |  | 
| 20 | 
            -
                return if ActiveSupport::SecurityUtils.secure_compare((gh_nonce || ""), PLUG_APP_NONCE)
         | 
| 20 | 
            +
                return false if ActiveSupport::SecurityUtils.secure_compare((gh_nonce || ""), PLUG_APP_NONCE)
         | 
| 21 21 |  | 
| 22 22 | 
             
                self.status = PlugApp::HTTP::BAD_REQUEST_I
         | 
| 23 23 | 
             
                self.response_body = ::ErrorSerializer.format(PlugApp::HTTP::BAD_REQUEST)
         | 
| @@ -6,6 +6,14 @@ class SettingsController < ApplicationController | |
| 6 6 |  | 
| 7 7 | 
             
              include PathParameter::SettingsParameters
         | 
| 8 8 |  | 
| 9 | 
            +
              before_action :ensure_json_request
         | 
| 10 | 
            +
              sig { void }
         | 
| 11 | 
            +
              def ensure_json_request
         | 
| 12 | 
            +
                return if request.format.json?
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                not_acceptable
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 9 17 | 
             
              sig { void }
         | 
| 10 18 | 
             
              def new
         | 
| 11 19 | 
             
                @step = T.let(params.fetch(:step, 1).to_i || 1, T.nilable(Integer))
         | 
| @@ -8,7 +8,7 @@ class YettoService | |
| 8 8 |  | 
| 9 9 | 
             
              # explicitly different than what's in environment.rb, because local
         | 
| 10 10 | 
             
              # Yetto expects HTTP; environment.rb can use HTTPS because it passes through ngrok.io
         | 
| 11 | 
            -
              PROTOCOL = Rails.env.development? ? "http | 
| 11 | 
            +
              PROTOCOL = Rails.env.development? ? "http" : "https"
         | 
| 12 12 | 
             
              YETTO_API_VERSION_TLD = "#{PROTOCOL}://#{YETTO_API_TLD}/#{YETTO_API_VERSION}"
         | 
| 13 13 | 
             
              JWT_ALGORITHM = "RS256"
         | 
| 14 14 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hephaestus
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.5.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Garen Torikian
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-10-31 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 251 251 | 
             
                - !ruby/object:Gem::Version
         | 
| 252 252 | 
             
                  version: 3.4.7
         | 
| 253 253 | 
             
            requirements: []
         | 
| 254 | 
            -
            rubygems_version: 3.4. | 
| 254 | 
            +
            rubygems_version: 3.4.21
         | 
| 255 255 | 
             
            signing_key: 
         | 
| 256 256 | 
             
            specification_version: 4
         | 
| 257 257 | 
             
            summary: Generate a Rails app that can be used to create plugs for Yetto.
         |