Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.3.10 Syntax error with ruby 2.1, requires 2.3 #142

Open
Skulli opened this issue Mar 27, 2021 · 8 comments
Open

0.3.10 Syntax error with ruby 2.1, requires 2.3 #142

Skulli opened this issue Mar 27, 2021 · 8 comments

Comments

@Skulli
Copy link

Skulli commented Mar 27, 2021

I still have an older app with an old ruby version

gem install mimemagic -v '0.3.10'

fails with

/mimemagic-0.3.10/ext/mimemagic/Rakefile:46: syntax error, unexpected <<, expecting ')'
    f.print(<<~SOURCE
    ^mimemagic-0.3.10/ext/mimemagic/Rakefile:51: syntax error, unexpected ')', expecting keyword_end

The <<~ only allowed with ruby 2.3+

Possible to make that code compatible with ruby 2.1? <<- should be enough here.

@powarvinayak
Copy link

Thanks @Skulli , I have fixed the syntax as suggested by you and it's working for me for ruby 2.2.1

@Skulli
Copy link
Author

Skulli commented Mar 29, 2021

Thanks, looks fine for me. Awaiting the merge :)

@jasonfine
Copy link

It would be great if this merge could gain some traction, this issue is holding up dev on a number of legacy sites we manage and i would imagine many others in the rails ecosystem.

@ivoanjo
Copy link

ivoanjo commented Mar 31, 2021

+1 this would help us out as well @DataDog as our Ruby gem also supports older rubies and this is affecting our test suite.

@stockett
Copy link

+1 any update on timing for the merge?

@ruchivora
Copy link

ruchivora commented Apr 6, 2021

Thanks, looks fine for me. Awaiting the merge :)

I still have an older app with an old ruby version

gem install mimemagic -v '0.3.10'

fails with

/mimemagic-0.3.10/ext/mimemagic/Rakefile:46: syntax error, unexpected <<, expecting ')'
    f.print(<<~SOURCE
    ^mimemagic-0.3.10/ext/mimemagic/Rakefile:51: syntax error, unexpected ')', expecting keyword_end

The <<~ only allowed with ruby 2.3+

Possible to make that code compatible with ruby 2.1? <<- should be enough here.

I am on ruby 2.2.4 and throwing the same syntax error , So updated my rake file and run bundle install , but bundle install updates the rakefile to the previous syntax and throws syntax error

@jasonfine
Copy link

There's a fork (https://github.com/powarvinayak/mimemagic) containing the fix since this is taking so long to merge

@khiav223577
Copy link

+1. It breaks my gem's test cases. (with mimemagic-0.4.3)

khiav223577 pushed a commit to khiav223577/pluck_all that referenced this issue Jun 10, 2021
Error message:
SyntaxError:
  /home/runner/work/pluck_all/pluck_all/vendor/bundle/ruby/2.2.0/gems/mimemagic-0.4.3/ext/mimemagic/Rakefile:31:
  syntax error, unexpected <<, expecting ')'
      f.print(<<~SOURCE
                ^

Caused by: mimemagicrb/mimemagic#138

See: mimemagicrb/mimemagic#142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants