Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Commit

Permalink
Make require name match the gem name
Browse files Browse the repository at this point in the history
In order to require this gem you currently must use `"yard_sorbet"`

When you omit the yard prefix, yard automatically adds `yard-` to the
beginning of the plugin name. Because the file naming in this gem, that
means that the plugin will fail to load when running
`yard doc --plugin sorbet` and instead only works correctly by using the
underscored version of the gem name: `yard doc --plugin yard_sorbet`.

By changing the file names to use hyphens, `--plugin sorbet` as well as
`--plugin yard-sorbet` (i.e. the actual gem name) correctly work.

n.b. this will break any existing usages of `--plugin yard_sorbet`

Unfortunately, this is against the recommended gem naming guidelines at
https://guides.rubygems.org/name-your-gem/ but ultimately I think this
is the most user friendly option short of modifying yard to attempt both
`yard-` and `yard_` prefixes.
  • Loading branch information
andrewhamon committed Jan 19, 2020
1 parent e267e6a commit 034678c
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/yard_sorbet.rb → lib/yard-sorbet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
# top-level namespace
module YARDSorbet; end

require_relative 'yard_sorbet/sig_handler'
require_relative 'yard_sorbet/sig_to_yard'
require_relative 'yard-sorbet/sig_handler'
require_relative 'yard-sorbet/sig_to_yard'
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative '../lib/yard_sorbet'
require_relative '../lib/yard-sorbet'

if ENV['CI'] == 'true'
require 'simplecov'
Expand Down
2 changes: 1 addition & 1 deletion yard-sorbet.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

require_relative 'lib/yard_sorbet/version'
require_relative 'lib/yard-sorbet/version'

Gem::Specification.new do |spec|
spec.name = 'yard-sorbet'
Expand Down

0 comments on commit 034678c

Please sign in to comment.