palkan / anyway_config

Configuration library for Ruby gems and applications
MIT License
778 stars 52 forks source link

Raising SyntaxError with Ruby 3.0.0 #73

Closed fladson closed 3 years ago

fladson commented 3 years ago

What did you do?

I followed the installation steps on a ruby project.

What did you expect to happen?

The gem loads with no issues.

What actually happened?

I am getting some SyntaxError exceptions.

/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway_config.rb:16:in `require': /Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:113: syntax error, unexpected instance variable (SyntaxError)
        end => @defaults
               ^~~~~~~~~
/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:123: syntax error, unexpected instance variable
...      end => @config_attributes
...             ^~~~~~~~~~~~~~~~~~
/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:141: syntax error, unexpected instance variable
...    end => @required_attributes
...           ^~~~~~~~~~~~~~~~~~~~
/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:161: syntax error, unexpected instance variable
        end => @load_callbacks
               ^~~~~~~~~~~~~~~
/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:192: syntax error, unexpected instance variable
        end => @env_prefix
               ^~~~~~~~~~~
/Users/fladson/.asdf/installs/ruby/3.0.0/lib/ruby/gems/3.0.0/gems/anyway_config-2.0.6/lib/anyway/config.rb:220: syntax error, unexpected instance variable
...       end => @accessors_module
...              ^~~~~~~~~~~~~~~~~

Additional context

# app/lib/foo_bar/config.rb
require "anyway_config"
module FooBar
  class Config < Anyway::Config
    attr_config :host
  end
end

# app/lib/foo_bar.rb
require_relative "foo_bar/config"
module FooBar
  def self.config
    @config ||= Config.new
  end
end

app/config/foo_bar.yml

test:
  host: localhost

development:
  host: localhost

staging:
  host: staging

production:
  host: production

Environment

macOS Big Sur

Ruby Version: 3.0.0

Framework Version (Rails, whatever): N/A

Anyway Config Version: 2.0.6

palkan commented 3 years ago

Ruby 3.0 compatibility has been released in 2.1.0