diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f232d7b..9c4e456 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,5 +12,21 @@ permissions: contents: read jobs: - Shared: - uses: fog/.github/.github/workflows/ci.yml@v1.4.0 + test: + + runs-on: ubuntu-latest + + strategy: + matrix: + ruby-version: ['3.0', '3.1', '3.2', '3.3', 'head'] + continue-on-error: ${{ matrix.ruby-version == 'head' }} + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake RUBYOPT="--enable-frozen-string-literal" diff --git a/lib/fog/compute.rb b/lib/fog/compute.rb index 330cc89..62d1620 100644 --- a/lib/fog/compute.rb +++ b/lib/fog/compute.rb @@ -29,7 +29,7 @@ def self.new(orig_attributes) Fog::Compute::DigitalOcean.new(attributes) end else - super(orig_attributes) + super end end diff --git a/lib/fog/core.rb b/lib/fog/core.rb index 230f047..3e86ee2 100644 --- a/lib/fog/core.rb +++ b/lib/fog/core.rb @@ -1,5 +1,4 @@ # external core dependencies -require "base64" require "cgi" require "uri" require "excon" diff --git a/lib/fog/core/mock.rb b/lib/fog/core/mock.rb index 9352c1a..33696d1 100644 --- a/lib/fog/core/mock.rb +++ b/lib/fog/core/mock.rb @@ -81,7 +81,7 @@ def self.random_letters_and_numbers(length) end def self.random_selection(characters, length) - selection = "" + selection = +"" length.times do position = rand(characters.length) selection << characters[position..position] diff --git a/lib/fog/core/provider.rb b/lib/fog/core/provider.rb index ccc0d90..04f95fa 100644 --- a/lib/fog/core/provider.rb +++ b/lib/fog/core/provider.rb @@ -18,7 +18,7 @@ def extended(base) private def underscore_name(string) - string.gsub(/::/, "/") + string.gsub("::", "/") .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2') .gsub(/([a-z\d])([A-Z])/,'\1_\2') .tr("-", "_") diff --git a/lib/fog/core/service.rb b/lib/fog/core/service.rb index 637f8d4..3188453 100644 --- a/lib/fog/core/service.rb +++ b/lib/fog/core/service.rb @@ -212,7 +212,7 @@ def secrets(*args) @secrets ||= [] else args.reduce(secrets) do |secrets, secret| - secrets << "@#{secret}".to_sym + secrets << :"@#{secret}" end end end diff --git a/lib/fog/formatador.rb b/lib/fog/formatador.rb index bc85aea..75c53a6 100644 --- a/lib/fog/formatador.rb +++ b/lib/fog/formatador.rb @@ -10,7 +10,7 @@ def self.formatador end def self.format(object, opts = { include_nested: true }) - string = init_string(object) + string = +init_string(object) indent { string << object_string(object, opts) } string << "#{indentation}>" end @@ -48,7 +48,7 @@ def self.init_string(object) end def self.object_string(object, opts) - string = attribute_string(object).to_s + string = +attribute_string(object).to_s string << nested_objects_string(object).to_s if opts[:include_nested] string end @@ -68,7 +68,7 @@ def self.nested_objects_string(object) return nested if object.respond_to?(:empty) and object.empty? return nested unless object.is_a?(Enumerable) - nested = "#{indentation}[\n" + nested = +"#{indentation}[\n" indent { nested << indentation + inspect_object(object) } nested << "#{indentation}\n#{indentation}]\n" end diff --git a/lib/fog/storage.rb b/lib/fog/storage.rb index f721def..dd0ca7b 100644 --- a/lib/fog/storage.rb +++ b/lib/fog/storage.rb @@ -59,7 +59,6 @@ def self.parse_data(data) headers: { "Content-Length" => get_body_size(data), "Content-Type" => get_content_type(data) - # "Content-MD5" => Base64.encode64(Digest::MD5.digest(metadata[:body])).strip } } end diff --git a/lib/tasks/test_task.rb b/lib/tasks/test_task.rb index e42a9d4..a904871 100644 --- a/lib/tasks/test_task.rb +++ b/lib/tasks/test_task.rb @@ -22,10 +22,9 @@ def initialize def tests(mocked) Fog::Formatador.display_line start = Time.now.to_i - threads = [] Thread.main[:results] = [] - Fog.providers.each do |key, value| - threads << Thread.new do + threads = Fog.providers.map do |key, value| + Thread.new do Thread.main[:results] << { provider: value, success: sh("export FOG_MOCK=#{mocked} && bundle exec shindont +#{key}") diff --git a/spec/core/collection_spec.rb b/spec/core/collection_spec.rb index acea928..a972174 100644 --- a/spec/core/collection_spec.rb +++ b/spec/core/collection_spec.rb @@ -2,7 +2,7 @@ require "securerandom" class FogTestModelForCollection < Fog::Model - identity :id + identity :id end class FogTestCollection < Fog::Collection diff --git a/spec/formatador_spec.rb b/spec/formatador_spec.rb index 90a77db..e645832 100644 --- a/spec/formatador_spec.rb +++ b/spec/formatador_spec.rb @@ -42,7 +42,7 @@ def all end it "returns formatted representation" do - Fog::Formatador.format(@collection).must_equal @expected + _(Fog::Formatador.format(@collection)).must_equal @expected end end @@ -65,7 +65,7 @@ def all end it "returns formatted representation" do - Fog::Formatador.format(@collection).must_equal @expected + _(Fog::Formatador.format(@collection)).must_equal @expected end end @@ -90,7 +90,7 @@ def all EOS opts = { include_nested: false } - Fog::Formatador.format(@collection, opts).must_equal @expected + _(Fog::Formatador.format(@collection, opts)).must_equal @expected end end @@ -105,7 +105,7 @@ def all end it "returns formatted representation" do - Fog::Formatador.format(@subject).must_equal @expected + _(Fog::Formatador.format(@subject)).must_equal @expected end end @@ -148,7 +148,7 @@ def all end it "returns formatted representation" do - Fog::Formatador.format(@collection).must_equal @expected + _(Fog::Formatador.format(@collection)).must_equal @expected end end end diff --git a/spec/service_spec.rb b/spec/service_spec.rb index d09f278..18b3668 100644 --- a/spec/service_spec.rb +++ b/spec/service_spec.rb @@ -88,7 +88,7 @@ class Mock; def initialize(*_args); end; end it "returns the real service" do Fog.stub :mocking?, false do service = TestService.new(generic_api_key: "abc") - service.must_be_instance_of TestService::Real + _(service).must_be_instance_of TestService::Real end end @@ -115,7 +115,7 @@ class Mock; def initialize(*_args); end; end it "returns mocked service" do Fog.stub :mocking?, true do service = TestService.new(generic_api_key: "abc") - service.must_be_instance_of TestService::Mock + _(service).must_be_instance_of TestService::Mock end end