Skip to content

Commit 40d0dc5

Browse files
committed
Fix update command adding extra new lines
1 parent b51f709 commit 40d0dc5

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

lib/importmap/commands.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def update_importmap_with_pin(package, pin)
131131
new_pin = "#{pin}\n"
132132

133133
if packager.packaged?(package)
134-
gsub_file("config/importmap.rb", Importmap::Map.pin_line_regexp_for(package), new_pin, verbose: false)
134+
gsub_file("config/importmap.rb", Importmap::Map.pin_line_regexp_for(package), pin, verbose: false)
135135
else
136136
append_to_file("config/importmap.rb", new_pin, verbose: false)
137137
end

test/commands_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class CommandsTest < ActiveSupport::TestCase
146146

147147
private
148148
def importmap_config(content)
149-
File.write("#{@tmpdir}/dummy/config/importmap.rb", content)
149+
File.write("#{@tmpdir}/dummy/config/importmap.rb", "#{content}\n")
150150
end
151151

152152
def run_importmap_command(command, *args)

test/test_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
ActiveRecord::Migrator.migrations_paths << File.expand_path('../db/migrate', __dir__)
77
require "rails/test_help"
88

9-
109
# Load fixtures from the engine
1110
# Remove this when support to Rails 7.0 is dropped.
1211
if ActiveSupport::TestCase.respond_to?(:fixture_path=)

0 commit comments

Comments
 (0)