You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
337 B
Ruby
15 lines
337 B
Ruby
require "puma/plugin"
|
|
|
|
Puma::Plugin.create do
|
|
def start(launcher)
|
|
return unless defined?(Rails) && defined?(Launchy)
|
|
return unless Rails.env.development?
|
|
|
|
tcp = launcher.options[:binds].grep(/^tcp/).first
|
|
return if tcp.nil?
|
|
|
|
url = tcp.sub(/^tcp/, "http").sub("0.0.0.0", "localhost")
|
|
Launchy.open(url)
|
|
end
|
|
end
|