Skip to content

Commit

Permalink
We come in peace 👾
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Jun 25, 2015
0 parents commit e152fe1
Show file tree
Hide file tree
Showing 42 changed files with 2,547 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Mix artifacts
/_build
/deps
/*.ez

# Generate on crash by the VM
erl_crash.dump

# Static artifacts
/node_modules

# Since we are building js and css from web/static,
# we ignore priv/static/{css,js}. You may want to
# comment this depending on your deployment strategy.
/priv/static/css
/priv/static/js

# The config/prod.secret.exs file by default contains sensitive
# data and you should not commit it into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets file as long as you replace its contents by environment
# variables.
/config/prod.secret.exs
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2015 René Föhring

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ElixirStatus

To start your new Phoenix application:

1. Install dependencies with `mix deps.get`
2. Start Phoenix endpoint with `mix phoenix.server`

Now you can visit `localhost:4000` from your browser.
46 changes: 46 additions & 0 deletions brunch-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: 'js/app.js'
// To use a separate vendor.js bundle, specify two files path
// https://github.com/brunch/brunch/blob/stable/docs/config.md#files
// joinTo: {
// 'js/app.js': /^(web\/static\/js)/,
// 'js/vendor.js': /^(web\/static\/vendor)/
// }
//
// To change the order of concatenation of files, explictly mention here
// https://github.com/brunch/brunch/tree/stable/docs#concatenation
// order: {
// before: [
// 'web/static/vendor/js/jquery-2.1.1.js',
// 'web/static/vendor/js/bootstrap.min.js'
// ]
// }
},
stylesheets: {
joinTo: 'css/app.css'
},
templates: {
joinTo: 'js/app.js'
}
},

// Phoenix paths configuration
paths: {
// Which directories to watch
watched: ["web/static", "test/static"],

// Where to compile files to
public: "priv/static"
},

// Configure your plugins
plugins: {
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/^(web\/static\/vendor)/]
}
}
};
24 changes: 24 additions & 0 deletions config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
#
# This configuration file is loaded before any dependency and
# is restricted to this project.
use Mix.Config

# Configures the endpoint
config :elixir_status, ElixirStatus.Endpoint,
url: [host: "localhost"],
root: Path.dirname(__DIR__),
secret_key_base: "LstH3/4lI4FeMXhEDifTp4UP+EAUR8RsyElC9rzzC7uyR1+hJ9U94iTHiajgzEwQ",
debug_errors: false,
pubsub: [name: ElixirStatus.PubSub,
adapter: Phoenix.PubSub.PG2]

# Configures Elixir's Logger
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]

# Import environment specific config. This must remain at the bottom
# of this file so it overrides the configuration defined above.
import_config "#{Mix.env}.exs"
35 changes: 35 additions & 0 deletions config/dev.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
use Mix.Config

# For development, we disable any cache and enable
# debugging and code reloading.
#
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with brunch.io to recompile .js and .css sources.
config :elixir_status, ElixirStatus.Endpoint,
http: [port: 4000],
debug_errors: true,
code_reloader: true,
cache_static_lookup: false,
watchers: [node: ["node_modules/brunch/bin/brunch", "watch"]]

# Watch static and templates for browser reloading.
config :elixir_status, ElixirStatus.Endpoint,
live_reload: [
patterns: [
~r{priv/static/.*(js|css|png|jpeg|jpg|gif)$},
~r{web/views/.*(ex)$},
~r{web/templates/.*(eex)$}
]
]

# Do not include metadata nor timestamps in development logs
config :logger, :console, format: "[$level] $message\n"

# Configure your database
config :elixir_status, ElixirStatus.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "elixir_status_dev",
size: 10 # The amount of database connections in the pool
51 changes: 51 additions & 0 deletions config/prod.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
use Mix.Config

# For production, we configure the host to read the PORT
# from the system environment. Therefore, you will need
# to set PORT=80 before running your server.
#
# You should also configure the url host to something
# meaningful, we use this information when generating URLs.
#
# Finally, we also include the path to a manifest
# containing the digested version of static files. This
# manifest is generated by the mix phoenix.digest task
# which you typically run after static files are built.
config :elixir_status, ElixirStatus.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: "example.com"],
cache_static_manifest: "priv/static/manifest.json"

# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section:
#
# config :elixir_status, ElixirStatus.Endpoint,
# ...
# https: [port: 443,
# keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
# certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
#
# Where those two env variables point to a file on
# disk for the key and cert.

# Do not print debug messages in production
config :logger, level: :info

# ## Using releases
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
# config :phoenix, :serve_endpoints, true
#
# Alternatively, you can configure exactly which server to
# start per endpoint:
#
# config :elixir_status, ElixirStatus.Endpoint, server: true
#

# Finally import the config/prod.secret.exs
# which should be versioned separately.
import_config "prod.secret.exs"
18 changes: 18 additions & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use Mix.Config

# We don't run a server during test. If one is required,
# you can enable the server option below.
config :elixir_status, ElixirStatus.Endpoint,
http: [port: 4001],
server: false

# Print only warnings and errors during test
config :logger, level: :warn

# Configure your database
config :elixir_status, ElixirStatus.Repo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: "postgres",
database: "elixir_status_test",
size: 1 # Use a single connection for transactional tests
30 changes: 30 additions & 0 deletions lib/elixir_status.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
defmodule ElixirStatus do
use Application

# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false

children = [
# Start the endpoint when the application starts
supervisor(ElixirStatus.Endpoint, []),
# Start the Ecto repository
worker(ElixirStatus.Repo, []),
# Here you could define other workers and supervisors as children
# worker(ElixirStatus.Worker, [arg1, arg2, arg3]),
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: ElixirStatus.Supervisor]
Supervisor.start_link(children, opts)
end

# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
ElixirStatus.Endpoint.config_change(changed, removed)
:ok
end
end
35 changes: 35 additions & 0 deletions lib/elixir_status/endpoint.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
defmodule ElixirStatus.Endpoint do
use Phoenix.Endpoint, otp_app: :elixir_status

# Serve at "/" the static files from "priv/static" directory.
#
# You should set gzip to true if you are running phoenix.digest
# when deploying your static files in production.
plug Plug.Static,
at: "/", from: :elixir_status, gzip: false,
only: ~w(css images js favicon.ico robots.txt)

# Code reloading can be explicitly enabled under the
# :code_reloader configuration of your endpoint.
if code_reloading? do
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
end

plug Plug.Logger

plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Poison

plug Plug.MethodOverride
plug Plug.Head

plug Plug.Session,
store: :cookie,
key: "_elixir_status_key",
signing_salt: "XPXyl9lg"

plug :router, ElixirStatus.Router
end
3 changes: 3 additions & 0 deletions lib/elixir_status/repo.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule ElixirStatus.Repo do
use Ecto.Repo, otp_app: :elixir_status
end
40 changes: 40 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
defmodule ElixirStatus.Mixfile do
use Mix.Project

def project do
[app: :elixir_status,
version: "0.0.1",
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end

# Configuration for the OTP application
#
# Type `mix help compile.app` for more information
def application do
[mod: {ElixirStatus, []},
applications: [:phoenix, :phoenix_html, :cowboy, :logger,
:phoenix_ecto, :postgrex, :oauth2]]
end

# Specifies which paths to compile per environment
defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
defp elixirc_paths(_), do: ["lib", "web"]

# Specifies your project dependencies
#
# Type `mix help deps` for examples and options
defp deps do
[{:phoenix, "~> 0.13.1"},
{:phoenix_ecto, "~> 0.4"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 1.0"},
{:phoenix_live_reload, "~> 0.4", only: :dev},
{:cowboy, "~> 1.0"},
{:oauth2, "~> 0.1.0"}]
end
end
19 changes: 19 additions & 0 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
%{"cowboy": {:hex, :cowboy, "1.0.0"},
"cowlib": {:hex, :cowlib, "1.0.1"},
"decimal": {:hex, :decimal, "1.1.0"},
"ecto": {:hex, :ecto, "0.12.0-rc"},
"fs": {:hex, :fs, "0.9.2"},
"hackney": {:hex, :hackney, "1.1.0"},
"httpoison": {:hex, :httpoison, "0.7.0"},
"idna": {:hex, :idna, "1.0.2"},
"oauth2": {:hex, :oauth2, "0.1.1"},
"phoenix": {:hex, :phoenix, "0.13.1"},
"phoenix_ecto": {:hex, :phoenix_ecto, "0.4.0"},
"phoenix_html": {:hex, :phoenix_html, "1.2.1"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "0.4.1"},
"plug": {:hex, :plug, "0.13.0"},
"poison": {:hex, :poison, "1.4.0"},
"poolboy": {:hex, :poolboy, "1.5.1"},
"postgrex": {:hex, :postgrex, "0.8.2"},
"ranch": {:hex, :ranch, "1.0.0"},
"ssl_verify_hostname": {:hex, :ssl_verify_hostname, "1.0.5"}}
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"repository": {
},
"dependencies": {
"brunch": "^1.8.1",
"babel-brunch": "^5.1.1",
"clean-css-brunch": ">= 1.0 < 1.8",
"css-brunch": ">= 1.0 < 1.8",
"javascript-brunch": ">= 1.0 < 1.8",
"sass-brunch": "^1.8.10",
"uglify-js-brunch": ">= 1.0 < 1.8"
}
}
Binary file added priv/static/images/avatar_rrrene.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added priv/static/images/phoenix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions priv/static/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
#
# To ban all spiders from the entire site uncomment the next two lines:
# User-agent: *
# Disallow: /
8 changes: 8 additions & 0 deletions test/controllers/page_controller_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule ElixirStatus.PageControllerTest do
use ElixirStatus.ConnCase

test "GET /" do
conn = get conn(), "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
Loading

0 comments on commit e152fe1

Please sign in to comment.