Skip to content

Using RUBY_VERSION in a gemspec doesn't work #79

@ekohl

Description

@ekohl

Currently there's the following code in the gemspec:

if RUBY_VERSION < "2.3"
spec.add_development_dependency "ruby_dep", "~> 1.3.1"
spec.add_development_dependency "listen", "~> 3.0.8"
else
spec.add_development_dependency "listen", "~> 3.1"
end

This doesn't work because gemspecs evaluate tot static content. This means it's evaluated only when gem build is called. That Ruby version used there determines the actual resulting gem dependencies.

I'm not aware of any method to do this more dynamically for users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions