telus-agcg / nib

A Docker Compose wrapper geared towards Ruby/Rails development with a focus on: convention, convenience and productivity.
MIT License
15 stars 3 forks source link

Syntax error with ruby versions < 2.3 #118

Closed scotthelm closed 7 years ago

scotthelm commented 7 years ago

While working with a project with ruby version 2.2.2, I encountered the error below. Should nib be compatible with older versions of ruby, or should it have a spec.required_ruby_version '>= 2.3.0' in the gemspec?

/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require': /.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nib-1.4.0/lib/nib/command.rb:27: syntax error, unexpected << (SyntaxError)
    @script ||= <<~SCRIPT
                  ^
/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nib-1.4.0/lib/nib/command.rb:29: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '('
        run \
           ^
    from /.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nib-1.4.0/lib/nib.rb:9:in `<top (required)>'
    from /.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/nib-1.4.0/bin/nib:4:in `<top (required)>'
    from /.rbenv/versions/2.2.2/bin/nib:23:in `load'
    from /.rbenv/versions/2.2.2/bin/nib:23:in `<main>'
johnallen3d commented 7 years ago

I had been wondering if that would crop up. Previously the gem ran inside a container where we were confident about what version of Ruby was present. According to the Ruby download page v2.1 will be EOL soon so I'm thinking it would be best to support v2.2 at least.

In the mean time though, since moving to Docker for development I've shed the Ruby version switchers (ie. rvm, rbenv, chruby) on MacOS in favor of:

brew install ruby
brew link --overwrite ruby