Skip to content

Commit

Permalink
Tighten up file replacement regex to only replace in the extension.
Browse files Browse the repository at this point in the history
Before if a spec or cuke had a number in the filename, it would extract
this number instead of the number from the suffix.
  • Loading branch information
aclemons committed Jan 9, 2019
1 parent 3c20752 commit 2352172
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.9] - 2019-01-09
### Updated
- Tighten up regex for replacing file locations in spec / cuke files. This should
only be replaced in the extension.

## [1.0.8] - 2019-01-08
### Updated
- Made output file generate more robust to remove `[` and `]` from filenames when
Expand Down
2 changes: 1 addition & 1 deletion lib/nitra/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def filename_without_extension(filename)
# my_spec.rb[1]
# my_spec.rb[1:2]
# my_feature.feature:4
line_number = /\[?([\d:]+)\]?/.match(filename)&.[](1)&.gsub(':', '_')&.gsub(/^_/, '')
line_number = /\[?([\d:]+)\]?$/.match(filename)&.[](1)&.gsub(':', '_')&.gsub(/^_/, '')

Pathname(filename).sub_ext(line_number.nil? ? '' : "_#{line_number}")
end
Expand Down
2 changes: 1 addition & 1 deletion nitra.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = 'nitra'
s.version = '1.0.8'
s.version = '1.0.9'
s.platform = Gem::Platform::RUBY
s.license = "MIT"
s.homepage = "http://github.com/fluxfederation/nitra"
Expand Down

0 comments on commit 2352172

Please sign in to comment.