From 962e669febccd3282159727e3025f077fef31e0f Mon Sep 17 00:00:00 2001 From: Steven Peckins Date: Wed, 2 Sep 2020 22:30:55 -0500 Subject: [PATCH] Move comment below shebang in bin/console template In an executable script, the shebang line should be the first line (the file needs to start with the bytes 0x23 0x21). Putting a comment above it will break the script. (Regression test included per @deivid-rodriguez) --- bundler/lib/bundler/templates/newgem/bin/console.tt | 3 +-- bundler/spec/commands/newgem_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bundler/lib/bundler/templates/newgem/bin/console.tt b/bundler/lib/bundler/templates/newgem/bin/console.tt index 6378a5abce5b..08dfaaef6987 100644 --- a/bundler/lib/bundler/templates/newgem/bin/console.tt +++ b/bundler/lib/bundler/templates/newgem/bin/console.tt @@ -1,6 +1,5 @@ -# frozen_string_literal: true - #!/usr/bin/env ruby +# frozen_string_literal: true require "bundler/setup" require "<%= config[:namespaced_path] %>" diff --git a/bundler/spec/commands/newgem_spec.rb b/bundler/spec/commands/newgem_spec.rb index ea18a4505eb6..ddea8de29d2d 100644 --- a/bundler/spec/commands/newgem_spec.rb +++ b/bundler/spec/commands/newgem_spec.rb @@ -376,6 +376,8 @@ def create_temporary_dir(dir) expect(bundled_app("#{gem_name}/bin/console")).to exist expect(bundled_app("#{gem_name}/bin/setup")).to be_executable expect(bundled_app("#{gem_name}/bin/console")).to be_executable + expect(bundled_app("#{gem_name}/bin/setup").read).to start_with("#!") + expect(bundled_app("#{gem_name}/bin/console").read).to start_with("#!") end it "starts with version 0.1.0" do