amqp-client 1.2.0 → 2.0.0
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/amqp/client/channel.rb +115 -46
- data/lib/amqp/client/configuration.rb +66 -0
- data/lib/amqp/client/connection.rb +35 -18
- data/lib/amqp/client/consumer.rb +47 -0
- data/lib/amqp/client/errors.rb +84 -9
- data/lib/amqp/client/exchange.rb +30 -28
- data/lib/amqp/client/frame_bytes.rb +3 -4
- data/lib/amqp/client/message.rb +66 -1
- data/lib/amqp/client/message_codec_registry.rb +106 -0
- data/lib/amqp/client/message_codecs.rb +43 -0
- data/lib/amqp/client/properties.rb +16 -15
- data/lib/amqp/client/queue.rb +52 -14
- data/lib/amqp/client/rpc_client.rb +56 -0
- data/lib/amqp/client/table.rb +2 -2
- data/lib/amqp/client/version.rb +1 -1
- data/lib/amqp/client.rb +369 -61
- metadata +8 -18
- data/.github/workflows/codeql-analysis.yml +0 -41
- data/.github/workflows/docs.yml +0 -28
- data/.github/workflows/main.yml +0 -140
- data/.github/workflows/release.yml +0 -26
- data/.gitignore +0 -9
- data/.rubocop.yml +0 -30
- data/.rubocop_todo.yml +0 -65
- data/.yardopts +0 -1
- data/CHANGELOG.md +0 -109
- data/CODEOWNERS +0 -1
- data/Gemfile +0 -18
- data/README.md +0 -193
- data/Rakefile +0 -180
- data/amqp-client.gemspec +0 -29
- data/bin/console +0 -15
- data/bin/setup +0 -8
    
        data/Rakefile
    DELETED
    
    | @@ -1,180 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require "bundler/gem_tasks"
         | 
| 4 | 
            -
            require "rake/testtask"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Rake::TestTask.new(:test) do |t|
         | 
| 7 | 
            -
              t.description = "Run all but TLS tests"
         | 
| 8 | 
            -
              t.options = "--exclude=/_tls$/"
         | 
| 9 | 
            -
              t.pattern = "test/**/*_test.rb"
         | 
| 10 | 
            -
            end
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            namespace :test do
         | 
| 13 | 
            -
              Rake::TestTask.new(:all) do |t|
         | 
| 14 | 
            -
                t.description = "Run all tests"
         | 
| 15 | 
            -
                t.pattern = "test/**/*_test.rb"
         | 
| 16 | 
            -
              end
         | 
| 17 | 
            -
            end
         | 
| 18 | 
            -
             | 
| 19 | 
            -
            require "rubocop/rake_task"
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            RuboCop::RakeTask.new
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            require "yard"
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            YARD::Rake::YardocTask.new
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            # Release helper methods
         | 
| 28 | 
            -
            def current_version
         | 
| 29 | 
            -
              version_file = "lib/amqp/client/version.rb"
         | 
| 30 | 
            -
              content = File.read(version_file)
         | 
| 31 | 
            -
              content.match(/VERSION = "(.+)"/)[1]
         | 
| 32 | 
            -
            end
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            def bump_version(version_type)
         | 
| 35 | 
            -
              unless %w[major minor patch].include?(version_type)
         | 
| 36 | 
            -
                puts "Invalid version type. Use: major, minor, or patch"
         | 
| 37 | 
            -
                exit 1
         | 
| 38 | 
            -
              end
         | 
| 39 | 
            -
             | 
| 40 | 
            -
              version_file = "lib/amqp/client/version.rb"
         | 
| 41 | 
            -
              content = File.read(version_file)
         | 
| 42 | 
            -
             | 
| 43 | 
            -
              current_version = content.match(/VERSION = "(.+)"/)[1]
         | 
| 44 | 
            -
              major, minor, patch = current_version.split(".").map(&:to_i)
         | 
| 45 | 
            -
             | 
| 46 | 
            -
              case version_type
         | 
| 47 | 
            -
              when "major"
         | 
| 48 | 
            -
                major += 1
         | 
| 49 | 
            -
                minor = 0
         | 
| 50 | 
            -
                patch = 0
         | 
| 51 | 
            -
              when "minor"
         | 
| 52 | 
            -
                minor += 1
         | 
| 53 | 
            -
                patch = 0
         | 
| 54 | 
            -
              when "patch"
         | 
| 55 | 
            -
                patch += 1
         | 
| 56 | 
            -
              end
         | 
| 57 | 
            -
             | 
| 58 | 
            -
              new_version = "#{major}.#{minor}.#{patch}"
         | 
| 59 | 
            -
              new_content = content.gsub(/VERSION = ".+"/, %(VERSION = "#{new_version}"))
         | 
| 60 | 
            -
             | 
| 61 | 
            -
              File.write(version_file, new_content)
         | 
| 62 | 
            -
              puts "Bumped version from #{current_version} to #{new_version}"
         | 
| 63 | 
            -
            end
         | 
| 64 | 
            -
             | 
| 65 | 
            -
            def update_changelog
         | 
| 66 | 
            -
              version = current_version
         | 
| 67 | 
            -
              date = Time.now.strftime("%Y-%m-%d")
         | 
| 68 | 
            -
             | 
| 69 | 
            -
              changelog = File.read("CHANGELOG.md")
         | 
| 70 | 
            -
             | 
| 71 | 
            -
              if changelog.include?("## [#{version}]")
         | 
| 72 | 
            -
                puts "Version #{version} already exists in CHANGELOG.md"
         | 
| 73 | 
            -
              else
         | 
| 74 | 
            -
                updated_changelog = changelog.sub(
         | 
| 75 | 
            -
                  "## [Unreleased]",
         | 
| 76 | 
            -
                  "## [Unreleased]\n\n## [#{version}] - #{date}"
         | 
| 77 | 
            -
                )
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                File.write("CHANGELOG.md", updated_changelog)
         | 
| 80 | 
            -
                puts "Updated CHANGELOG.md with version #{version}"
         | 
| 81 | 
            -
              end
         | 
| 82 | 
            -
            end
         | 
| 83 | 
            -
             | 
| 84 | 
            -
            def create_git_tag
         | 
| 85 | 
            -
              version = current_version
         | 
| 86 | 
            -
             | 
| 87 | 
            -
              system("git add .")
         | 
| 88 | 
            -
              system("git commit -m 'Release #{version}'")
         | 
| 89 | 
            -
             | 
| 90 | 
            -
              # Check if tag already exists and remove it if it does
         | 
| 91 | 
            -
              if system("git tag -l v#{version} | grep -q v#{version}")
         | 
| 92 | 
            -
                puts "Tag v#{version} already exists, removing it..."
         | 
| 93 | 
            -
                system("git tag -d v#{version}")
         | 
| 94 | 
            -
              end
         | 
| 95 | 
            -
             | 
| 96 | 
            -
              system("git tag v#{version}")
         | 
| 97 | 
            -
             | 
| 98 | 
            -
              puts "Created git tag v#{version}"
         | 
| 99 | 
            -
            end
         | 
| 100 | 
            -
             | 
| 101 | 
            -
            def push_gem_to_rubygems
         | 
| 102 | 
            -
              version = current_version
         | 
| 103 | 
            -
             | 
| 104 | 
            -
              # Look for gem file in both current directory and pkg directory
         | 
| 105 | 
            -
              gem_file = "amqp-client-#{version}.gem"
         | 
| 106 | 
            -
              pkg_gem_file = "pkg/amqp-client-#{version}.gem"
         | 
| 107 | 
            -
             | 
| 108 | 
            -
              if File.exist?(pkg_gem_file)
         | 
| 109 | 
            -
                system("gem push #{pkg_gem_file}")
         | 
| 110 | 
            -
                puts "Pushed #{pkg_gem_file} to RubyGems"
         | 
| 111 | 
            -
              elsif File.exist?(gem_file)
         | 
| 112 | 
            -
                system("gem push #{gem_file}")
         | 
| 113 | 
            -
                puts "Pushed #{gem_file} to RubyGems"
         | 
| 114 | 
            -
              else
         | 
| 115 | 
            -
                puts "Gem file #{gem_file} not found in current directory or pkg/. Make sure to build first."
         | 
| 116 | 
            -
                exit 1
         | 
| 117 | 
            -
              end
         | 
| 118 | 
            -
            end
         | 
| 119 | 
            -
             | 
| 120 | 
            -
            def full_release_process(version_type)
         | 
| 121 | 
            -
              puts "Starting release process..."
         | 
| 122 | 
            -
             | 
| 123 | 
            -
              # Ensure working directory is clean
         | 
| 124 | 
            -
              unless system("git diff --quiet && git diff --cached --quiet")
         | 
| 125 | 
            -
                puts "Working directory is not clean. Please commit or stash changes first."
         | 
| 126 | 
            -
                exit 1
         | 
| 127 | 
            -
              end
         | 
| 128 | 
            -
             | 
| 129 | 
            -
              # Bump version
         | 
| 130 | 
            -
              Rake::Task["release:bump"].invoke(version_type)
         | 
| 131 | 
            -
              Rake::Task["release:bump"].reenable
         | 
| 132 | 
            -
             | 
| 133 | 
            -
              # Update changelog
         | 
| 134 | 
            -
              Rake::Task["release:changelog"].invoke
         | 
| 135 | 
            -
              Rake::Task["release:changelog"].reenable
         | 
| 136 | 
            -
             | 
| 137 | 
            -
              # Create tag and push
         | 
| 138 | 
            -
              Rake::Task["release:tag"].invoke
         | 
| 139 | 
            -
              Rake::Task["release:tag"].reenable
         | 
| 140 | 
            -
             | 
| 141 | 
            -
              # Build and push gem
         | 
| 142 | 
            -
              Rake::Task["release:push"].invoke
         | 
| 143 | 
            -
              Rake::Task["release:push"].reenable
         | 
| 144 | 
            -
             | 
| 145 | 
            -
              # Push to git
         | 
| 146 | 
            -
              system("git push origin")
         | 
| 147 | 
            -
              system("git push origin --tags")
         | 
| 148 | 
            -
             | 
| 149 | 
            -
              version = current_version
         | 
| 150 | 
            -
              puts "Successfully released version #{version}!"
         | 
| 151 | 
            -
            end
         | 
| 152 | 
            -
             | 
| 153 | 
            -
            namespace :release do
         | 
| 154 | 
            -
              desc "Bump version (usage: rake release:bump[major|minor|patch])"
         | 
| 155 | 
            -
              task :bump, [:type] do |_t, args|
         | 
| 156 | 
            -
                bump_version(args[:type] || "patch")
         | 
| 157 | 
            -
              end
         | 
| 158 | 
            -
             | 
| 159 | 
            -
              desc "Update changelog with current version"
         | 
| 160 | 
            -
              task :changelog do
         | 
| 161 | 
            -
                update_changelog
         | 
| 162 | 
            -
              end
         | 
| 163 | 
            -
             | 
| 164 | 
            -
              desc "Create git tag for current version"
         | 
| 165 | 
            -
              task :tag do
         | 
| 166 | 
            -
                create_git_tag
         | 
| 167 | 
            -
              end
         | 
| 168 | 
            -
             | 
| 169 | 
            -
              desc "Build and push gem to RubyGems"
         | 
| 170 | 
            -
              task push: :build do
         | 
| 171 | 
            -
                push_gem_to_rubygems
         | 
| 172 | 
            -
              end
         | 
| 173 | 
            -
             | 
| 174 | 
            -
              desc "Full release process (bump version, update changelog, tag, build and push)"
         | 
| 175 | 
            -
              task :full, [:type] => %i[test rubocop] do |_t, args|
         | 
| 176 | 
            -
                full_release_process(args[:type] || "patch")
         | 
| 177 | 
            -
              end
         | 
| 178 | 
            -
            end
         | 
| 179 | 
            -
             | 
| 180 | 
            -
            task default: [:test, *(:rubocop if ENV["CI"] != "true")]
         | 
    
        data/amqp-client.gemspec
    DELETED
    
    | @@ -1,29 +0,0 @@ | |
| 1 | 
            -
            # frozen_string_literal: true
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require_relative "lib/amqp/client/version"
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            Gem::Specification.new do |spec|
         | 
| 6 | 
            -
              spec.name          = "amqp-client"
         | 
| 7 | 
            -
              spec.version       = AMQP::Client::VERSION
         | 
| 8 | 
            -
              spec.authors       = ["CloudAMQP"]
         | 
| 9 | 
            -
              spec.email         = ["team@cloudamqp.com"]
         | 
| 10 | 
            -
             | 
| 11 | 
            -
              spec.summary       = "AMQP 0-9-1 client"
         | 
| 12 | 
            -
              spec.description   = "Modern AMQP 0-9-1 Ruby client"
         | 
| 13 | 
            -
              spec.homepage      = "https://github.com/cloudamqp/amqp-client.rb"
         | 
| 14 | 
            -
              spec.license       = "MIT"
         | 
| 15 | 
            -
              spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              spec.metadata["homepage_uri"] = spec.homepage
         | 
| 18 | 
            -
              spec.metadata["source_code_uri"] = "#{spec.homepage}.git"
         | 
| 19 | 
            -
              spec.metadata["changelog_uri"] = "https://github.com/cloudamqp/amqp-client.rb/blob/main/CHANGELOG.md"
         | 
| 20 | 
            -
             | 
| 21 | 
            -
              # Specify which files should be added to the gem when it is released.
         | 
| 22 | 
            -
              # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
         | 
| 23 | 
            -
              spec.files = Dir.chdir(File.expand_path(__dir__)) do
         | 
| 24 | 
            -
                `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
              spec.bindir        = "exe"
         | 
| 27 | 
            -
              spec.executables   = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
         | 
| 28 | 
            -
              spec.require_paths = ["lib"]
         | 
| 29 | 
            -
            end
         | 
    
        data/bin/console
    DELETED
    
    | @@ -1,15 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            # frozen_string_literal: true
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            require "bundler/setup"
         | 
| 5 | 
            -
            require "amqp/client"
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            # You can add fixtures and/or initialization code here to make experimenting
         | 
| 8 | 
            -
            # with your gem easier. You can also use a different console, if you like.
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            # (If you use this, don't forget to add pry to your Gemfile!)
         | 
| 11 | 
            -
            # require "pry"
         | 
| 12 | 
            -
            # Pry.start
         | 
| 13 | 
            -
             | 
| 14 | 
            -
            require "irb"
         | 
| 15 | 
            -
            IRB.start(__FILE__)
         |