Skip to content

Commit 34a0866

Browse files
committed
Revert "Merge pull request #329 from merhard/master"
This reverts commit 2480a8e, reversing changes made to 9cd21d2. Revert "Changelog: binstub_prelude support for commands. #329." This reverts commit 8a3546d. Conflicts: CHANGELOG.md Reasoning: * #329 (comment) * jonleighton/spring-commands-rspec#20 (comment) * 2480a8e Since the thing that this feature was aiming to allow is already possible via the commands API, I prefer not to add an extra feature to Spring.
1 parent 50bb670 commit 34a0866

File tree

4 files changed

+1
-35
lines changed

4 files changed

+1
-35
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
* Accept -e and --environment options for `rails console`.
44
* Watch `config/secrets.yml` by default. #289 - @morgoth
5-
* Custom Spring commands that implement `#binstub_prelude` will have that
6-
snippet of code inserted into generated binstubs just after Spring is
7-
set up. #329 - @merhard
85
* Change monkey-patched `Kernel.raise` from public to private (to match default Ruby behavior) #351 - @mattbrictson
96
* Let application_id also respect RUBY_VERSION for the use case of switching between Ruby versions for a given Rails app - @methodmissing
107

lib/spring/client/binstub.rb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,8 @@ def generate(fallback = nil)
104104
fallback = "require 'bundler/setup'\n" \
105105
"load Gem.bin_path('#{command.gem_name}', '#{command.exec_name}')\n"
106106
end
107-
if prelude = command.binstub_prelude
108-
formatted_prelude = prelude.chomp.gsub(/^(?!$)/, ' ')
109-
loader = LOADER.sub(/^end$/, "else\n#{formatted_prelude}\nend")
110-
else
111-
loader = LOADER
112-
end
113107

114-
File.write(command.binstub, "#!/usr/bin/env ruby\n#{loader}#{fallback}")
108+
File.write(command.binstub, "#!/usr/bin/env ruby\n#{LOADER}#{fallback}")
115109
command.binstub.chmod 0755
116110
end
117111

lib/spring/command_wrapper.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,6 @@ def binstub_name
6969
"bin/#{name}"
7070
end
7171

72-
def binstub_prelude
73-
if command.respond_to?(:binstub_prelude)
74-
command.binstub_prelude
75-
end
76-
end
77-
7872
def exec
7973
if binstub.exist?
8074
binstub.to_s

test/acceptance/app_test.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -188,25 +188,6 @@ def exec_name
188188
assert_success "bin/rake -T", stdout: "rake db:migrate"
189189
end
190190

191-
test "binstub with prelude code" do
192-
prelude = "Prelude code line 1\nPrelude code line 2\n"
193-
194-
File.write(app.spring_config, <<-CODE)
195-
class PreludeCode
196-
def binstub_prelude
197-
"#{prelude}"
198-
end
199-
end
200-
201-
Spring.register_command "prelude", PreludeCode.new
202-
CODE
203-
204-
assert_success "bin/spring binstub prelude"
205-
prelude.each_line do |line|
206-
assert app.path("bin/prelude").read.include?(line), "'#{line}' not found in bin/prelude"
207-
end
208-
end
209-
210191
test "binstub when spring is uninstalled" do
211192
app.run! "gem uninstall --ignore-dependencies spring"
212193
File.write(app.gemfile, app.gemfile.read.gsub(/gem 'spring.*/, ""))

0 commit comments

Comments
 (0)