8000 Allow `bin/github_changelog_generator` to be invoked from a path outside the repo · Issue #947 · github-changelog-generator/github-changelog-generator · GitHub
[go: up one dir, main page]

Skip to content
Allow bin/github_changelog_generator to be invoked from a path outside the repo #947
Open
@magneland

Description

@magneland

Is your feature request related to a problem? Please describe.
As part of my local development workflow, I would like to make some code changes to this repo, and quickly run the generator on another gem for testing it out.
I tried this command locally (note the cwd is outside the forked repo):

magne@C02ZV1LNMD6W af_json_api % /Users/magne/github/magneland/github-changelog-generator/bin/github_changelog_generator --base CHANGELOG.md --token TOKEN --user USER --project af_json_api
Traceback (most recent call last):
	4: from /Users/magne/github/magneland/github-changelog-generator/bin/github_changelog_generator:4:in `<main>'
	3: from /Users/magne/github/magneland/github-changelog-generator/bin/github_changelog_generator:4:in `require_relative'
	2: from /Users/magne/github/magneland/github-changelog-generator/lib/github_changelog_generator.rb:13:in `<top (required)>'
	1: from /Users/magne/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require'
/Users/magne/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:155:in `require': cannot load such file -- github_changelog_generator/helper (LoadError)

The error happens because files in lib/ use the "require" directive to include other files in lib/.

Incidentally, bin/github_changelog_generator already makes use of require_relative so that is already a pattern.

Describe the solution you'd like
Use require_relative instead of require.

Describe alternatives you've considered
Not sure if there's a better way or a workaround?

Additional context
See: rubocop/rubocop#8748

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0