desc "Kill test and development postgres database connections"
task :pg_terminate => :environment do
dbs = []
dbs << ActiveRecord::Base.configurations["development"]["database"]
dbs << ActiveRecord::Base.configurations["test"]["database"]
db_names = "#{dbs.map{|name| "'#{name}'"}.join(", ")}"
terminated = false
defmodule MyApp.Web do | |
def controller do | |
quote do | |
use Phoenix.Controller | |
use MyApp.CatchAllController | |
... | |
end | |
end | |
end |
broadcast! socket, "insert_img", %{ | |
url: url, | |
start: params["start"], | |
end: params["end"] | |
} | |
A new socket behaviour has been introduced to handle socket authentication in a single place, wire up default channel assigns, and disconnect a user's multiplex connection as needed.
First things first, create a UserSocket
module in web/channels/user_socket.ex
and move all your channel routes from web/route.ex
to the user socket: (replace MyApp with your application module)
0.14.x - web/router.ex:
defmodule MyApp.Router do
...
defmodule MyApp.Password do | |
@moduledoc """ | |
Handles password authentication, encryption, and decryption | |
""" | |
@doc """ | |
Encrypte the password String | |
""" | |
def encrypt(raw_password) do |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
# Use vim keybindings in copy mode | |
setw -g mode-keys vi | |
# Setup 'v' to begin selection as in Vim | |
bind-key -t vi-copy v begin-selection | |
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
Update your web/static/vendor/phoenix.js
to the latest client: https://github.com/phoenixframework/phoenix/blob/v0.13.1/priv/static/phoenix.js
Simply create a test/support/channel_case.ex
file and replace the following MyApp
with your application:
defmodule MyApp.ChannelCase do
@moduledoc """
This module defines the test case to be used by
Plug.Static
added an :only
option which greatly improves performance by skipping disk reads at runtime. Replace your Plug.Static
lines in endpoint.ex
with the following configuration:
plug Plug.Static,
at: "/", from: :my_app,
only: ~w(css images js favicon.ico robots.txt)