mattbrictson / chandler

[unmaintained] chandler syncs your CHANGELOG entries to GitHub's release notes
MIT License
152 stars 15 forks source link

source code requires UTF-8 #40

Closed glensc closed 7 years ago

glensc commented 7 years ago

seems it fails to run on C locale because source code is not US-ASCII vs '

og.rb:39: invalid multibyte char (US-ASCII)
/home/travis/.rvm/gems/ruby-2.4.1/gems/chandler-0.7.0/lib/chandler/changelog.rb:39: invalid multibyte char (US-ASCII)
/home/travis/.rvm/gems/ruby-2.4.1/gems/chandler-0.7.0/lib/chandler/changelog.rb:39: syntax error, unexpected $end, expecting keyword_end
        raise NoMatchingVersion, "Couldn’t find #{tag} in #{path}"
                                          ^
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/travis/.rvm/gems/ruby-2.4.1/gems/chandler-0.7.0/lib/chandler/configuration.rb:1:in `<top (required)>'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from bin/ci/tag-update.rb:8:in `<main>'
mattbrictson commented 7 years ago

I thought that in Ruby 2.0 and higher, the default encoding for .rb files is assumed to be UTF-8.

This Ruby issue explicitly says that all Ruby files are interpreted as if they have #encoding: utf-8:

https://bugs.ruby-lang.org/issues/6679

Clearly that is not the case here. Do you know why it's not working? I hope there is a solution that doesn't require removing all non-ascii characters from the gem.

glensc commented 7 years ago

i've been using this gem code because unable to update release notes for tag that does not look like version. i have tag named snapshot.

➔ cat bin/ci/tag-update.rb
#!/usr/bin/ruby
#
# Script using chandler gem to update title/notes of release in GitHub
#

require 'rubygems'
require 'chandler'
require 'chandler/configuration'

github_repository = ENV['TRAVIS_REPO_SLUG']
tag = ENV['TRAVIS_TAG']
version = ENV['RELEASE_TITLE']
notes = ENV['RELEASE_NOTES']

github = Chandler::GitHub.new(
    :repository => github_repository,
    :config => Chandler::Configuration.new
)
github.create_or_update_release(
    :tag => tag,
    :title => version,
    :description => notes
)
glensc commented 7 years ago

blah. seems the problem is that the script was run with ruby 1.9. i couldn't figure this out in first place because the output was messed up. here's better log:

https://travis-ci.org/eventum/eventum/jobs/273510965#L3288

mattbrictson commented 7 years ago

Ah, glad to hear you got it all sorted. Cheers