Skip to content

Commit

Permalink
(MAINT) Gemspec explicit file declarations
Browse files Browse the repository at this point in the history
Prior to this commit spec.files used git to collect the required files
for the gem. This would pull in everything that had been checked in to
git.

We can actually be a little bit more explicit here. This commit updates
spec.files to contain a known list of files to include in the gem.
  • Loading branch information
chelnak committed Dec 19, 2022
1 parent 6633bcd commit 5eda23d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ jobs:
fail-fast: false
matrix:
os:
- "windows-latest"
- "windows-2019"
- "ubuntu-latest"
ruby:
- 2.5
Expand Down
14 changes: 8 additions & 6 deletions ruby-pwsh.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
# to allow pushing to a single host or delete this section to allow pushing to any host.
if spec.respond_to?(:metadata)

spec.metadata['homepage_uri'] = spec.homepage
spec.metadata['source_code_uri'] = 'https://github.com/puppetlabs/ruby-pwsh'
spec.metadata['changelog_uri'] = 'https://github.com/puppetlabs/ruby-pwsh'
Expand All @@ -27,11 +26,14 @@ Gem::Specification.new do |spec|
'public gem pushes.'
end

# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
end
spec.files = Dir[
'README.md',
'LICENSE',
'.rubocop.yml',
'lib/**/*',
'bin/**/*',
'spec/**/*',
]

spec.bindir = 'exe'
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
Expand Down
3 changes: 0 additions & 3 deletions spec/unit/pwsh_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,11 @@ def close_stream(stream, style = :inprocess)

context 'it should handle UTF-8' do
# different UTF-8 widths
# rubocop:disable Style/AsciiComments
# 1-byte A
# 2-byte ۿ - http://www.fileformat.info/info/unicode/char/06ff/index.htm - 0xDB 0xBF / 219 191
# 3-byte ᚠ - http://www.fileformat.info/info/unicode/char/16A0/index.htm - 0xE1 0x9A 0xA0 / 225 154 160
# 4-byte 𠜎 - http://www.fileformat.info/info/unicode/char/2070E/index.htm - 0xF0 0xA0 0x9C 0x8E / 240 160 156 142
let(:mixed_utf8) { "A\u06FF\u16A0\u{2070E}" } # Aۿᚠ𠜎
# rubocop:enable Style/AsciiComments

it 'when writing basic text' do
code = "Write-Output '#{mixed_utf8}'"
result = manager.execute(code)
Expand Down

0 comments on commit 5eda23d

Please sign in to comment.