Sha256: 7d634b7cf2f9c15058b00b044babf7dbcb931240de21b84e9fbb50854ddb3709

Contents?: true

Size: 374 Bytes

Versions: 15

Compression:

Stored size: 374 Bytes

Contents

require "puma/plugin"

Puma::Plugin.create do
  def start(launcher)
    return unless defined?(Rails) && defined?(Launchy)
    return unless Rails.env.development?

    binding = launcher.options[:binds].grep(/^tcp|ssl/).first
    return if binding.nil?

    url = binding.sub(/^tcp/, "http").sub(/^ssl/, "https").sub("0.0.0.0", "localhost")
    Launchy.open(url)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
nextgen-0.14.0 template/lib/puma/plugin/open.rb
nextgen-0.13.0 template/lib/puma/plugin/open.rb
nextgen-0.12.0 template/lib/puma/plugin/open.rb
nextgen-0.11.0 template/lib/puma/plugin/open.rb
nextgen-0.10.0 template/lib/puma/plugin/open.rb
nextgen-0.9.0 template/lib/puma/plugin/open.rb
nextgen-0.8.0 template/lib/puma/plugin/open.rb
nextgen-0.7.0 template/lib/puma/plugin/open.rb
nextgen-0.6.0 template/lib/puma/plugin/open.rb
nextgen-0.5.1 template/lib/puma/plugin/open.rb
nextgen-0.5.0 template/lib/puma/plugin/open.rb
nextgen-0.4.0 template/lib/puma/plugin/open.rb
nextgen-0.3.0 template/lib/puma/plugin/open.rb
nextgen-0.2.0 template/lib/puma/plugin/open.rb
nextgen-0.1.0 template/lib/puma/plugin/open.rb