[前][次][番号順一覧][スレッド一覧]

ruby-changes:63169

From: Steven <ko1@a...>
Date: Mon, 28 Sep 2020 14:54:55 +0900 (JST)
Subject: [ruby-changes:63169] 8863bfb1f4 (master): [rubygems/rubygems] Move comment below shebang in bin/console template

https://git.ruby-lang.org/ruby.git/commit/?id=8863bfb1f4

From 8863bfb1f46ae3bdef52d7f9d72534df0ae8617a Mon Sep 17 00:00:00 2001
From: Steven Peckins <speckins@i...>
Date: Wed, 2 Sep 2020 22:30:55 -0500
Subject: [rubygems/rubygems] 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)

https://github.com/rubygems/rubygems/commit/962e669feb

diff --git a/lib/bundler/templates/newgem/bin/console.tt b/lib/bundler/templates/newgem/bin/console.tt
index 6378a5a..08dfaae 100644
--- a/lib/bundler/templates/newgem/bin/console.tt
+++ b/lib/bundler/templates/newgem/bin/console.tt
@@ -1,6 +1,5 @@ https://github.com/ruby/ruby/blob/trunk/lib/bundler/templates/newgem/bin/console.tt#L1
-# frozen_string_literal: true
-
 #!/usr/bin/env ruby
+# frozen_string_literal: true
 
 require "bundler/setup"
 require "<%= config[:namespaced_path] %>"
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 7dca5f5..70419f6 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -376,6 +376,8 @@ RSpec.describe "bundle gem" do https://github.com/ruby/ruby/blob/trunk/spec/bundler/commands/newgem_spec.rb#L376
       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
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]