Fix the bug to allow use of space in a name of a experiment

<form method="post" action="/host/experiment/create" style="margin: 5%;">

        実験作成

        <input type="hidden" name="_csrf_token" value="<%= @csrf_token %>">

              <input type="text" placeholder="実験名" class="validate" id="experiment" name="experiment_name" value="<%= @experiment_name %>">
              実験名

              <select id="theme" name="theme" value="<%= @theme_id %>">
                <%= if @themes do %>
                  <%= for theme <- @themes do %>
                    <option value="<%= theme.id %>"><%= theme.name %></option>
                  <% end %>
                <% end %>
              </select>
              実験テーマ

              <input type="text" placeholder="Experiment ID" class="validate" id="x_token" name="x_token" placeholder="" value="<%= @x_token %>">
              実験ID

        <button class="btn btn-primary pull-right" type="submit">実験作成</button>

</form>

<%= if @themes do %>

実験テーマ一覧

        #
        タイトル

      <%= for theme <- @themes do %>

          <%= theme.name %>

      <% end %>

<% end %>

<form method="post" action="/host/experiment/create" style="margin: 5%;">

        実験作成

        <input type="hidden" name="_csrf_token" value="<%= @csrf_token %>">

              <input type="text" placeholder="実験名" class="validate" id="experiment" name="experiment_name" value="<%= @experiment_name %>">
              実験名

              <select id="theme" name="theme" value="<%= @theme_id %>">
                <%= if @themes do %>
                  <%= for theme <- @themes do %>
                    <option value=<%= theme.id %>><%= theme.name %></option>
                  <% end %>
                <% end %>
              </select>
              実験テーマ

              <input type="text" placeholder="Experiment ID" class="validate" id="x_token" name="x_token" placeholder="" value="<%= @x_token %>">
              実験ID

        <button class="btn btn-primary pull-right" type="submit">実験作成</button>

</form>

<%= if @themes do %>

実験テーマ一覧

        #
        タイトル

      <%= for theme <- @themes do %>

          <%= theme.name %>

      <% end %>

<% end %>


Make piece duration fields wider on phone-sized screens

<piece-panel
  v-for="(piece, index) in pieces"
  v-bind:key="index"
  v-bind:index="index"
  v-bind:piece="pieces[index]"
  v-bind:epoch_options="epoch_options"
  v-bind:errors="(errors.pieces && errors.pieces[index]) || {}"
  v-bind:begins_expanded="expandedPiecePanelIndex === index"
  v-bind:piece_term="vocabulary['piece']"
  v-bind:genre="genre"
  v-on:remove-piece="removePiece"
  inline-template>

        {{panelTitle}}

      <button
        type="button"
        class="btn btn-xs btn-danger pull-right"
        v-on:click.stop="$emit('remove-piece', index)">

      </button>

        <input type="hidden" v-bind:name="fieldName('id')" v-model="piece.id" />

              <%= gettext("Title") %>

            <input
              type="text"
              class="form-control"
              v-bind:id="fieldId('title')"
              v-bind:name="fieldName('title')"
              v-model="piece.title">
            <form-field-error v-bind:errors="errors && errors.title" />

                <%= gettext("Composer") %>

              <input
                type="text"
                class="form-control"
                v-bind:id="fieldId('composer')"
                v-bind:name="fieldName('composer')"
                v-model="piece.composer">
              <form-field-error v-bind:errors="errors && errors.composer" />

                    <%= gettext("Born") %>

                  <input
                    type="text"
                    class="form-control"
                    v-bind:id="fieldId('composer_born')"
                    v-bind:name="fieldName('composer_born')"
                    v-model="piece.composer_born">
                  <form-field-error v-bind:errors="errors && errors.composer_born" />

                    (<%= gettext("Died") %>)

                  <input
                    type="text"
                    class="form-control"
                    v-bind:id="fieldId('composer_died')"
                    v-bind:name="fieldName('composer_died')"
                    v-model="piece.composer_died">
                  <form-field-error v-bind:errors="errors && errors.composer_died" />

                <%= gettext("Artist") %>

              <input
                type="text"
                class="form-control"
                v-bind:id="fieldId('artist')"
                v-bind:name="fieldName('artist')"
                v-model="piece.artist">
              <form-field-error v-bind:errors="errors && errors.artist" />

              <%= gettext("Epoch") %>

            <select
              class="form-control"
              v-bind:id="fieldId('epoch')"
              v-bind:name="fieldName('epoch')"
              v-model="piece.epoch">
              <option disabled value=""><%= gettext("Please choose") %></option>
              <option
                v-for="option in epoch_options"
                v-bind:value="option.id"
                v-text="option.label"></option>
            </select>
            <form-field-error v-bind:errors="errors && errors.epoch" />

              <%= gettext("Duration") %>

                  <input
                    type="number"
                    min="0"
                    max="59"
                    class="form-control"
                    v-bind:id="fieldId('minutes')"
                    v-bind:name="fieldName('minutes')"
                    v-model="piece.minutes">
                  <%= gettext("min") %>

                <form-field-error v-bind:errors="errors && errors.minutes" />

                  <input
                    type="number"
                    min="0"
                    max="59"
                    class="form-control"
                    v-bind:id="fieldId('seconds')"
                    v-bind:name="fieldName('seconds')"
                    v-model="piece.seconds">
                  <%= gettext("sec") %>

                <form-field-error v-bind:errors="errors && errors.seconds" />

</piece-panel>


update ro show template;

update ro show template;

<%= @map.title %>

<!- div id="coords"->

Show map

    Title:
    <%= @map.title %>

    Description:
    <%= @map.description %>

    Center lat:
    <%= @map.center_lat %>

    Center long:
    <%= @map.center_long %>

    Ovetrlay url:
    <%= @map.overlay_URL %>

    Overlay north:
    <%= @map.overlay_north %>

    Overlay south:
    <%= @map.overlay_south %>

    Overlay east:
    <%= @map.overlay_east %>

    Overlay west:
    <%= @map.overlay_west %>

<%= link "Edit", to: edit_map_path(@conn, :edit, @map) %>
 |
<%= link "Back", to: edit_map_path(@conn, :index) %>

<!- div id="coords"->


Use password_input instead of text_input for password

<%= form_for @changeset, @action, fn f -> %>
  <%= if @changeset.action do %>

Oops, something went wrong! Please check the errors below.

  <% end %>

    <%= label f, :name, class: "control-label" %>
    <%= text_input f, :name, class: "form-control" %>
    <%= error_tag f, :name %>

    <%= label f, :username, class: "control-label" %>
    <%= text_input f, :username, class: "form-control" %>
    <%= error_tag f, :username %>

    <%= label f, :password, class: "control-label" %>
    <%= password_input f, :password, class: "form-control" %>
    <%= error_tag f, :password %>

    <%= submit "Submit", class: "btn btn-primary" %>

<% end %>

<%= form_for @changeset, @action, fn f -> %>
  <%= if @changeset.action do %>

Oops, something went wrong! Please check the errors below.

  <% end %>

    <%= label f, :name, class: "control-label" %>
    <%= text_input f, :name, class: "form-control" %>
    <%= error_tag f, :name %>

    <%= label f, :username, class: "control-label" %>
    <%= text_input f, :username, class: "form-control" %>
    <%= error_tag f, :username %>

    <%= label f, :password, class: "control-label" %>
    <%= text_input f, :password, class: "form-control" %>
    <%= error_tag f, :password %>

    <%= submit "Submit", class: "btn btn-primary" %>

<% end %>


Improve description and switch stars/watchers to my own repo.


Update 'dead' screen styles

Update 'dead' screen styles

Dead jobs

<%= if @dead_jobs |> Enum.empty? do %>

No dead jobs at the moment.

<% else %>

    <%= form_for @conn, dead_path(@conn, :destroy), [as: :delete_job, method: "DELETE"], fn _ -> %>
    <input name="jobs_to_remove[]" type="hidden" value="" />

          Id
          Retry count
          Class/Worker
          Arguments

      <%= for job <- jobs(@dead_jobs) do %>

          <input name="jobs_to_remove[]" type="checkbox" value="<%= job.original_json %>" id="job_<%= job.jid %>" />
          <%= job.jid %>
          <%= job.retry_count %>
          <%= job.class %>

            <%= if String.length(job.args) > 128 do
                  String.slice(job.args, 0, 128) <> "..."
                else
                  job.args
                end %>

            <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#job-<%= job.jid %>-modal">
              Details
            </button>

            <%= render VerkWeb.SharedView, "job_modal.html", job: job.job, conn: @conn %>

      <% end %>

        <%= submit "Delete selected", class: "btn btn-danger btn-sm" %>

        <%= if @has_prev do %>
          <%= link "Previous", to: dead_path(@conn, :index, page: @page - 1, per_page: @per_page), class: "btn btn-default" %>
        <% end %>

        <%= if @has_next do %>
          <%= link "Next", to: dead_path(@conn, :index, page: @page + 1, per_page: @per_page), class: "btn btn-default" %>
        <% end %>

  <% end %>

      <%= button "Delete all", to: dead_path(@conn, :destroy, a: "true"), method: :delete, data: [confirm: "Are you sure?"], form: [a: "b"], class: "btn btn-danger btn-sm" %>

<% end %>

Dead jobs which have exceeded the allotted number of retries

<%= if @dead_jobs |> Enum.empty? do %>

No dead jobs at the moment.

<% else %>

    <%= form_for @conn, dead_path(@conn, :destroy), [as: :delete_job, method: "DELETE"], fn _ -> %>
    <input name="jobs_to_remove[]" type="hidden" value="" />

          Id
          Retry count
          Class/Worker
          Arguments

      <%= for job <- jobs(@dead_jobs) do %>

          <input name="jobs_to_remove[]" type="checkbox" value="<%= job.original_json %>" id="job_<%= job.jid %>" />
          <%= job.jid %>
          <%= job.retry_count %>
          <%= job.class %>

            <%= if String.length(job.args) > 128 do
                  String.slice(job.args, 0, 128) <> "..."
                else
                  job.args
                end %>

            <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#job-<%= job.jid %>-modal">
              Details
            </button>

            <%= render VerkWeb.SharedView, "job_modal.html", job: job.job, conn: @conn %>

      <% end %>

        <%= submit "Delete selected", class: "btn btn-danger btn-sm" %>

        <%= if @has_prev do %>
          <%= link "Previous", to: dead_path(@conn, :index, page: @page - 1, per_page: @per_page), class: "btn btn-default" %>
        <% end %>

        <%= if @has_next do %>
          <%= link "Next", to: dead_path(@conn, :index, page: @page + 1, per_page: @per_page), class: "btn btn-default" %>
        <% end %>

  <% end %>

      <%= button "Delete all", to: dead_path(@conn, :destroy, a: "true"), method: :delete, data: [confirm: "Are you sure?"], form: [a: "b"], class: "btn btn-danger btn-sm" %>

<% end %>


Update page title

Update page title

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Mr. Rebase</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

Mr. Rebase

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

        <%= render @view_module, @view_template, assigns %>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Hello MrRebase!</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

Mr. Rebase

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

        <%= render @view_module, @view_template, assigns %>


Add line breaks to long line on index page.

<img src='<%= static_path(@conn, "/images/readerl-icon-text.png") %>' alt='ReadErl' width='227' height='48'/>™

An RSS feed aggregator written in Elixir/Phoenix

I'm working on it: github.com/billstclair/readerl

  <%= :erlang.system_info(:system_version) %>

  Erlang: <%= {:ok, version} =
                :file.read_file(
                  :filename.join(
                    [:code.root_dir(), "releases",
                     :erlang.system_info(:otp_release),
                     "OTP_VERSION"]))
              Regex.named_captures(~r/(?<v>.*)\n*/, version)["v"] %>,
  Elixir: <%= System.version %>,
  Phoenix: <%= {:ok, vsn} = :application.get_key(:phoenix, :vsn); vsn %>

<img src='<%= static_path(@conn, "/images/readerl-icon-text.png") %>' alt='ReadErl' width='227' height='48'/>™

An RSS feed aggregator written in Elixir/Phoenix

I'm working on it: github.com/billstclair/readerl

  <%= :erlang.system_info(:system_version) %>

  Erlang: <%= {:ok, version} = :file.read_file(:filename.join([:code.root_dir(), "releases", :erlang.system_info(:otp_release), "OTP_VERSION"])); Regex.named_captures(~r/(?<v>.*)\n*/, version)["v"] %>,
  Elixir: <%= System.version %>,
  Phoenix: <%= {:ok, vsn} = :application.get_key(:phoenix, :vsn); vsn %>


Add released Android 10

Add released Android 10

<!DOCTYPE html>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/style.css">

<title>Android SDK API level - <%=@lib%></title>

Android SDK API level of @aar artifacts

<form method="get" style="display:flex">
<input type="search" name="library" placeholder="groupId:artifactId:version" value="<%=@lib%>" autocapitalize="none">
<input type="submit" value="Search">

</form>

<a id="url" href="<%=@path%>@svg">
<%=@host%><%=@path%>@svg

<a id="badge" href="<%=@path%>">
<img alt="API level <%=@api%>" src="<%=@path%>@svg">

Android version history

Android 10
[2019]

Android 9.0 Pie
[2018]

Android 8.1 Oreo
[2017]

Android 8.0 Oreo
[2017]

Android 7.1 Nougat
[2016]

Android 7.0 Nougat
[2016]

Android 6.0 Marshmallow
[2015]

Android 5.1 Lollipops
[2015]

Android 5.0 Lollipop
[2014]

Android 4.4 KitKat Wear
[2014]

Android 4.4 KitKat
[2013]

Android 4.3 Jelly Bean
[2013]

Android 4.2 Jelly Bean
[2012]

Android 4.1 Jelly Bean
[2012]

Android 4.0.3 Ice Cream Sandwich
[2011]

Android 4.0 Ice Cream Sandwich
[2011]

Android 3.2 Honeycomb
[2011]

Android 3.1 Honeycomb
[2011]

Android 3.0 Honeycomb
[2011]

Android 2.3.3 Gingerbread
[2011]

Android 2.3 Gingerbread
[2010]

Android 2.2 Froyo
[2010]

Android 2.1 Eclair
[2010]

Android 2.0.1 Eclair
[2009]

Android 2.0 Eclair
[2009]

Android 1.6 Donut
[2009]

Android 1.5 Cupcake
[2009]

Android 1.1
[2009]

Android 1.0
[2008]

Repositories

Maven Central

Google

JCenter

JitPack

References

shields.io

Android

Versions

Markdown

Contribute

asapi/lv

support

clear cache

© 2017   tynn   ♥ Berlin

<!DOCTYPE html>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/style.css">

<title>Android SDK API level - <%=@lib%></title>

Android SDK API level of @aar artifacts

<form method="get" style="display:flex">
<input type="search" name="library" placeholder="groupId:artifactId:version" value="<%=@lib%>" autocapitalize="none">
<input type="submit" value="Search">

</form>

<a id="url" href="<%=@path%>@svg">
<%=@host%><%=@path%>@svg

<a id="badge" href="<%=@path%>">
<img alt="API level <%=@api%>" src="<%=@path%>@svg">

Android version history

Android 10 Q
[2019]

Android 9.0 Pie
[2018]

Android 8.1 Oreo
[2017]

Android 8.0 Oreo
[2017]

Android 7.1 Nougat
[2016]

Android 7.0 Nougat
[2016]

Android 6.0 Marshmallow
[2015]

Android 5.1 Lollipops
[2015]

Android 5.0 Lollipop
[2014]

Android 4.4 KitKat Wear
[2014]

Android 4.4 KitKat
[2013]

Android 4.3 Jelly Bean
[2013]

Android 4.2 Jelly Bean
[2012]

Android 4.1 Jelly Bean
[2012]

Android 4.0.3 Ice Cream Sandwich
[2011]

Android 4.0 Ice Cream Sandwich
[2011]

Android 3.2 Honeycomb
[2011]

Android 3.1 Honeycomb
[2011]

Android 3.0 Honeycomb
[2011]

Android 2.3.3 Gingerbread
[2011]

Android 2.3 Gingerbread
[2010]

Android 2.2 Froyo
[2010]

Android 2.1 Eclair
[2010]

Android 2.0.1 Eclair
[2009]

Android 2.0 Eclair
[2009]

Android 1.6 Donut
[2009]

Android 1.5 Cupcake
[2009]

Android 1.1
[2009]

Android 1.0
[2008]

Repositories

Maven Central

Google

JCenter

JitPack

References

shields.io

Android

Versions

Markdown

Contribute

asapi/lv

support

clear cache

© 2017   tynn   ♥ Berlin


Format template functions

Format template functions

<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="robots" content="noindex" />

    <title>Action for Children</title>
    <link
      href="https://fonts.googleapis.com/css?family=Rubik:400,500"
      rel="stylesheet"
    />
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

          This is a trial service. We'd appreciate your <%= link "feedback", to: page_path(@conn, :feedback), class: "white" %>. It will take less than 5 minutes.

        <a href="<%= page_path(@conn, :index) %>">

      <%= unless (@conn.assigns[:user] || @conn.request_path == "/talk-to-us") do %>
      Speak to us
      <% end %>

      <%= render @view_module, @view_template, assigns %>

            Contact your local council if you are worried about a child's
            welfare. Contact 111 if you are worried about your child's health,
            or 999 in a medical emergency.

          <%= if @conn.assigns[:user] do %>

              You are logged in as <%= @conn.assigns.user.email %> –

            <%= link "Logout", to: session_path(@conn, :delete), class: "white"
            %>

          <% end %>
          <%= link to: page_path(@conn, :privacy), class: "white" do %>
            Privacy Policy
          <% end %>


Remove redundant trap in boot script

Remove redundant trap in boot script

#!/bin/sh

set -e

# Set VERBOSE to enable verbose logging of the boot script
#VERBOSE=true
if [ ! -z $DEBUG_BOOT ]; then
    set -x
fi;
# Disable flow control for run_erl
# Flow control can cause several problems. On Linux, if you
# accidentally hit Ctrl-S (instead of Ctrl-D to detach) and
# then some other key, the entire beam process will hang when
# attempting to write to stdout. On Solaris, the beam process
# will hang on writing if ScrollLock is on.
RUN_ERL_DISABLE_FLOWCNTRL="${RUN_ERL_DISABLE_FLOWCNTRL:-true}"
# Path to this script
SCRIPT=$(readlink $0 || true)
if [ -z $SCRIPT ]; then
    SCRIPT=$0
fi;
# Parent directory of this script
SCRIPT_DIR="$(cd `dirname "$SCRIPT"` && pwd -P)"
# Root directory of all releases
RELEASE_ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd -P)"
# Name of the release
REL_NAME="<%= release_name %>"
# Current version of the release
REL_VSN="<%= release_version %>"
# Current version of ERTS being used
# If this is not present/unset, it will be detected
<%= unless is_nil(erts_vsn) do %>ERTS_VSN="<%= erts_vsn %>"<% end %>
# VM code loading mode, embedded by default, can also be interactive
# See http://erlang.org/doc/man/code.html
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
# Path to start_erl.data
START_ERL_DATA="$RELEASE_ROOT_DIR/releases/start_erl.data"
# Directory containing the current version of this release
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
# The lib directory for this release
REL_LIB_DIR="$RELEASE_ROOT_DIR/lib"
# Options passed to erl
ERL_OPTS="<%= release.profile.erl_opts %>"
# When stdout is piped to a file, this is the directory those files will
# be stored in. defaults to /log in the release root directory
RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}"
# A string of extra options to pass to erl, here for plugins
EXTRA_OPTS=""

# Pre-start/stop event hook paths
PRE_START_HOOK="$REL_DIR/hooks/pre_start"
POST_START_HOOK="$REL_DIR/hooks/post_start"
PRE_STOP_HOOK="$REL_DIR/hooks/pre_stop"
POST_STOP_HOOK="$REL_DIR/hooks/post_stop"

# Get node pid
get_pid() {
    if output="$(nodetool rpcterms os getpid)"
    then
        echo "$output" | sed -e 's/"//g'
        return 0
    else
        echo "$output"
        return 1
    fi
}

# Generate a unique nodename
gen_nodename() {
    id="longname$(gen_id)-${NAME}"
    "$BINDIR/erl" -boot start_clean -eval '[Host] = tl(string:tokens(atom_to_list(node()),"@")), io:format("~s~n", [Host]), halt()' -noshell ${NAME_TYPE} $id
}

# Generate a random id
gen_id() {
    od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
}

# Control a node
# Use like `nodetool "ping"`
nodetool() {
    command="$1"; shift

    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
                            -setcookie "$COOKIE" "$command" $@
}

# Run an escript in the node's environment
# Use like `escript "path/to/escript"`
escript() {
    shift; scriptpath="$1"; shift
    export RELEASE_ROOT_DIR

    "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}

# Private. For determining the version of ERTS available to the release
_detect_erts_vsn() {
    $BINDIR/erl -boot start_clean -eval 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' -noshell
}

# Private. Gets a list of code paths for this release
_get_code_paths() {
    $BINDIR/erl -noshell -boot start_clean -eval "{ok, [{release,_,_,Apps}]} = file:consult(\"$REL_DIR/$REL_NAME.rel\"),lists:foreach(fun(A) -> io:fwrite(\"-pa $ROOTDIR/lib/~p-~s/ebin \", [element(1, A), element(2, A)]) end, Apps),halt()."
}

# Private. For setting ERTS_DIR and ROOTDIR
_find_erts_dir() {
    __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN"
    if [ -d "$__erts_dir" ]; then
        ERTS_DIR="$__erts_dir";
        ROOTDIR="$RELEASE_ROOT_DIR"
    else
        __erl="$(which erl)"
        code="io:format(\"~s\", [code:root_dir()]), halt()."
        __erl_root="$("$__erl" -noshell -eval "$code")"
        ERTS_DIR="$__erl_root/erts-$ERTS_VSN"
        ROOTDIR="$__erl_root"
    fi
}

# Private. Open a shell on a remote node
_rem_sh() {
    # Generate a unique id used to allow multiple remsh to the same node
    # transparently
    id="remsh$(gen_id)-${NAME}"

    # Get the node's ticktime so that we use the same thing.
    TICKTIME="$(nodetool rpcterms net_kernel get_net_ticktime)"

    # Setup remote shell command to control node
    if [ ! -z "$USE_ERL_SHELL" ]; then
        exec "$BINDIR/erl" \
            -hidden \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            "$NAME_TYPE" "$id" -remsh "$NAME" -setcookie "$COOKIE"
    else
        __code_paths=$(_get_code_paths)
        exec "$BINDIR/erl" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -hidden -noshell \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            -user Elixir.IEx.CLI "$NAME_TYPE" "$id" -setcookie "$COOKIE" \
            -extra --no-halt +iex -"$NAME_TYPE" "$id" --cookie "$COOKIE" --remsh "$NAME"
    fi
}

# Output a start command for the last argument of run_erl
_start_command() {
    printf "exec \"%s\" \"%s\" -- %s %s" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \
           "$START_OPTION" "${ARGS}" "${EXTRA_OPTS}"
}

# If ERTS_VSN is not set, detect it
if [ -z "$ERTS_VSN" ]; then
    ERTS_VSN="$(_detect_erts_vsn)"
    echo "$ERTS_VSN $REL_VSN" > "$START_ERL_DATA"
fi

# Allow override of where to look for config files
# By default it's $CWD/
if [ -z "$RELEASE_CONFIG_DIR" ]; then
    RELEASE_CONFIG_DIR="$RELEASE_ROOT_DIR"
fi

# Set VMARGS_PATH, the path to the vm.args file to use
# Use $RELEASE_CONFIG_DIR/vm.args if exists, otherwise releases/VSN/vm.args
if [ -z "$VMARGS_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/vm.args" ]; then
        VMARGS_PATH="$RELEASE_CONFIG_DIR/vm.args"
    else
        VMARGS_PATH="$REL_DIR/vm.args"
    fi
fi

orig_vmargs_path="$VMARGS_PATH.orig"
if [ $REPLACE_OS_VARS ]; then
    #Make sure we don't break dev mode by keeping the symbolic link to
    #the user's vm.args
    if [ ! -L "$orig_vmargs_path" ]; then
       #we're in copy mode, rename the vm.args file to vm.args.orig
       mv "$VMARGS_PATH" "$orig_vmargs_path"
    fi

    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_vmargs_path" > "$VMARGS_PATH"
 else
    #We don't need to replace env. vars, just rename the
    #symlink vm.args.orig to vm.args, and keep it as a
    #symlink.
    if [ -L "$orig_vmargs_path" ]; then
       mv "$orig_vmargs_path" "$VMARGS_PATH"
    fi
fi

# Make sure log directory exists
mkdir -p "$RUNNER_LOG_DIR"

# Set SYS_CONFIG_PATH, the path to the sys.config file to use
# Use $RELEASE_CONFIG_DIR/sys.config if exists, otherwise releases/VSN/sys.config
if [ -z "$SYS_CONFIG_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/sys.config" ]; then
        SYS_CONFIG_PATH="$RELEASE_CONFIG_DIR/sys.config"
    else
        SYS_CONFIG_PATH="$REL_DIR/sys.config"
    fi
fi

orig_sys_config_path="$SYS_CONFIG_PATH.orig"
if [ $REPLACE_OS_VARS ]; then
    #Make sure we don't break dev mode by keeping the symbolic link to
    #the user's sys.config
    if [ ! -L "$orig_sys_config_path" ]; then
       #We're in copy mode, rename sys.config to sys.config.orig
       mv "$SYS_CONFIG_PATH" "$orig_sys_config_path"
    fi

    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_sys_config_path" > "$SYS_CONFIG_PATH"
 else
    #We don't need to replace env. vars, just rename the
    #symlink sys.config.orig to sys.config. Keep it as
    #a symlink.
    if [ -L "$orig_sys_config_path" ]; then
       mv "$orig_sys_config_path"  "$SYS_CONFIG_PATH"
    fi
fi

# Extract the target node name from node.args
# Should be `-sname somename` or `-name somename@somehost`
NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH" || true)
if [ -z "$NAME_ARG" ]; then
    echo "vm.args needs to have either -name or -sname parameter."
    exit 1
fi

# Extract the name type and name from the NAME_ARG for REMSH
# NAME_TYPE should be -name or -sname
NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')"
# NAME will be either `somename` or `somename@somehost`
NAME="$(echo "$NAME_ARG" | awk '{print $2}')"

# Where the pipe will be stored when using `start`
# This is used so you can attach the running application to the current
# shell using `attach`
PIPE_DIR="${PIPE_DIR:-$RELEASE_ROOT_DIR/tmp/erl_pipes/$NAME/}"

# Extract the target cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
    if [ -f "$DEFAULT_COOKIE_FILE" ]; then
        COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
    else
        printf "a secret cookie must be provided in one of the following ways:\n  - with vm.args using the -setcookie parameter,\n  or\n  by writing the cookie to '$DEFAULT_COOKIE_FILE', with permissions set to 0400"
        exit 1
    fi
else
    # Extract cookie name from COOKIE_ARG
    COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi

_find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"
export EMU="beam"
export PROGNAME="erl"
export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
ERTS_LIB_DIR="$ERTS_DIR/../lib"
CONSOLIDATED_DIR="$ROOTDIR/lib/${REL_NAME}-${REL_VSN}/consolidated"

cd "$ROOTDIR"

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
    *@*)
        # Nothing to do
        ;;
    *)
        NAME=$NAME@$(gen_nodename)
        ;;
esac

# Check the first argument for instructions
case "$1" in
    start|start_boot)

        # Make sure there is not already a node running
        #RES=`$NODETOOL ping`
        #if [ "$RES" = "pong" ]; then
        #    echo "Node is already running!"
        #    exit 1
        #fi
        # Save this for later.
        CMD=$1
        case "$1" in
            start)
                shift
                START_OPTION="console"
                HEART_OPTION="start"
                ;;
            start_boot)
                shift
                START_OPTION="console_boot"
                HEART_OPTION="start_boot"
                ;;
        esac
        ARGS="$@"
        RUN_PARAM="$@"

        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        # Set arguments for the heart command
        set -- "$SCRIPT_DIR/$REL_NAME" "$HEART_OPTION"
        [ "$RUN_PARAM" ] && set -- "$@" "$RUN_PARAM"

        # Export the HEART_COMMAND
        HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $CMD"
        export HEART_COMMAND

        mkdir -p "$PIPE_DIR"

        "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
                          "$(_start_command)"

        [ -f "$POST_START_HOOK" ] && . "$POST_START_HOOK"
        ;;

    stop)
        [ -f "$PRE_STOP_HOOK" ] && . "$PRE_STOP_HOOK"
        # Wait for the node to completely stop...
        PID="$(get_pid)"
        if ! nodetool "stop"; then
            exit 1
        fi
        while $(kill -s 0 "$PID" 2>/dev/null);
        do
            sleep 1
        done
        [ -f "$POST_STOP_HOOK" ] && . "$POST_STOP_HOOK"
        ;;

    restart)
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"
        ## Restart the VM without exiting the process
        if ! nodetool "restart"; then
            exit 1
        fi
        ;;

    reboot)
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"
        ## Restart the VM completely (uses heart to restart it)
        if ! nodetool "reboot"; then
            exit 1
        fi
        ;;

    pid)
        ## Get the VM's pid
        if ! get_pid; then
            exit 1
        fi
        ;;

    ping)
        ## See if the VM is alive
        if ! nodetool "ping"; then
            exit 1
        fi
        ;;

    escript)
        ## Run an escript under the node's environment
        if ! escript $@; then
            exit 1
        fi
        ;;

    attach)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        exec "$BINDIR/to_erl" "$PIPE_DIR"
        ;;

    remote_console)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        _rem_sh
        ;;

    upgrade|downgrade|install)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
             "install" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    unpack)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
             "unpack" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    console|console_clean|console_boot)
        # .boot file typically just $REL_NAME (ie, the app name)
        # however, for debugging, sometimes start_clean.boot is useful.
        # For e.g. 'setup', one may even want to name another boot script.
        case "$1" in
            console)
                if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
                  BOOTFILE="$REL_DIR/$REL_NAME"
                else
                  BOOTFILE="$REL_DIR/start"
                fi
                ;;
            console_clean)
                BOOTFILE="$ROOTDIR/bin/start_clean"
                ;;
            console_boot)
                shift
                BOOTFILE="$1"
                shift
                ;;
        esac
        # Setup beam-required vars
        EMU="beam"
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        # Start the VM, executing pre_start hook along
        # the way. We can't run the post_start hook because
        # the console will crash with no TTY attached
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        __code_paths=$(_get_code_paths)
        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" \
            -boot "$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -user Elixir.IEx.CLI \
            -extra --no-halt +iex

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS} ${EXTRA_OPTS}
            echo "Root: $ROOTDIR"

            # Log the startup
            echo "$RELEASE_ROOT_DIR"
        fi;

        logger -t "$REL_NAME[$$]" "Starting up"

        exec "$@" -- ${1+$ARGS} ${EXTRA_OPTS}
        ;;

    foreground)
        # start up the release in the foreground for use by runit
        # or other supervision services

        [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
        FOREGROUNDOPTIONS="-noshell -noinput +Bd"

        # Setup beam-required vars
        EMU=beam
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        # Start the VM, executing pre and post start hooks
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
            -boot "$REL_DIR/$BOOTFILE" -mode "$CODE_LOADING_MODE" -config "$SYS_CONFIG_PATH" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -args_file "$VMARGS_PATH" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${ERL_OPTS} \
            -extra ${EXTRA_OPTS}

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS}
            echo "Root: $ROOTDIR"
        fi;

        "$@" -- ${1+$ARGS} &
        __bg_pid=$!
        [ -f "$POST_START_HOOK" ] && . "$POST_START_HOOK"
        wait $__bg_pid
        ;;
    rpc)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpc $@
        ;;
    rpcterms)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpcterms $@
        ;;
    eval)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        nodetool "eval" $@
        ;;
    command)
        # Execute as command-line utility
        #
        # Like the escript command, this does not start the OTP application.
        # If your command depends on a running OTP application,
        # use
        #
        #     {:ok, _} = Application.ensure_all_started(:your_app)

        shift
        MODULE="$1"; shift
        FUNCTION="$1"; shift

        # Save extra arguments
        ARGS="$@"

        # Build arguments for erlexec
        set -- "$ERL_OPTS"
        [ "$SYS_CONFIG_PATH" ] && set -- "$@" -config "$SYS_CONFIG_PATH"
        set -- "$@" -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR"
        set -- "$@" -noshell
        set -- "$@" -boot start_clean
        set -- "$@" -s "$MODULE" "$FUNCTION"

        $BINDIR/erlexec $@ -extra $ARGS
        exit "$?"
        ;;
    *)
        __command_path="$REL_DIR/commands/$1"
        if [ -f "$__command_path" ]; then
            . "$__command_path"
        else
            echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|escript|rpc|rpcterms|eval|command <module> <function> <args>}"
            exit 1
        fi
        ;;
esac

exit 0

#!/bin/sh

set -e

# Set VERBOSE to enable verbose logging of the boot script
#VERBOSE=true
if [ ! -z $DEBUG_BOOT ]; then
    set -x
fi;
# Disable flow control for run_erl
# Flow control can cause several problems. On Linux, if you
# accidentally hit Ctrl-S (instead of Ctrl-D to detach) and
# then some other key, the entire beam process will hang when
# attempting to write to stdout. On Solaris, the beam process
# will hang on writing if ScrollLock is on.
RUN_ERL_DISABLE_FLOWCNTRL="${RUN_ERL_DISABLE_FLOWCNTRL:-true}"
# Path to this script
SCRIPT=$(readlink $0 || true)
if [ -z $SCRIPT ]; then
    SCRIPT=$0
fi;
# Parent directory of this script
SCRIPT_DIR="$(cd `dirname "$SCRIPT"` && pwd -P)"
# Root directory of all releases
RELEASE_ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd -P)"
# Name of the release
REL_NAME="<%= release_name %>"
# Current version of the release
REL_VSN="<%= release_version %>"
# Current version of ERTS being used
# If this is not present/unset, it will be detected
<%= unless is_nil(erts_vsn) do %>ERTS_VSN="<%= erts_vsn %>"<% end %>
# VM code loading mode, embedded by default, can also be interactive
# See http://erlang.org/doc/man/code.html
CODE_LOADING_MODE="${CODE_LOADING_MODE:-embedded}"
# Path to start_erl.data
START_ERL_DATA="$RELEASE_ROOT_DIR/releases/start_erl.data"
# Directory containing the current version of this release
REL_DIR="$RELEASE_ROOT_DIR/releases/$REL_VSN"
# The lib directory for this release
REL_LIB_DIR="$RELEASE_ROOT_DIR/lib"
# Options passed to erl
ERL_OPTS="<%= release.profile.erl_opts %>"
# When stdout is piped to a file, this is the directory those files will
# be stored in. defaults to /log in the release root directory
RUNNER_LOG_DIR="${RUNNER_LOG_DIR:-$RELEASE_ROOT_DIR/log}"
# A string of extra options to pass to erl, here for plugins
EXTRA_OPTS=""

# Pre-start/stop event hook paths
PRE_START_HOOK="$REL_DIR/hooks/pre_start"
POST_START_HOOK="$REL_DIR/hooks/post_start"
PRE_STOP_HOOK="$REL_DIR/hooks/pre_stop"
POST_STOP_HOOK="$REL_DIR/hooks/post_stop"

# Get node pid
get_pid() {
    if output="$(nodetool rpcterms os getpid)"
    then
        echo "$output" | sed -e 's/"//g'
        return 0
    else
        echo "$output"
        return 1
    fi
}

# Generate a unique nodename
gen_nodename() {
    id="longname$(gen_id)-${NAME}"
    "$BINDIR/erl" -boot start_clean -eval '[Host] = tl(string:tokens(atom_to_list(node()),"@")), io:format("~s~n", [Host]), halt()' -noshell ${NAME_TYPE} $id
}

# Generate a random id
gen_id() {
    od -t x -N 4 /dev/urandom | head -n1 | awk '{print $2}'
}

# Control a node
# Use like `nodetool "ping"`
nodetool() {
    command="$1"; shift

    "$ERTS_DIR/bin/escript" "$ROOTDIR/bin/nodetool" "$NAME_TYPE" "$NAME" \
                            -setcookie "$COOKIE" "$command" $@
}

# Run an escript in the node's environment
# Use like `escript "path/to/escript"`
escript() {
    shift; scriptpath="$1"; shift
    export RELEASE_ROOT_DIR

    "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@
}

# Private. For determining the version of ERTS available to the release
_detect_erts_vsn() {
    $BINDIR/erl -boot start_clean -eval 'Ver = erlang:system_info(version), io:format("~s~n", [Ver]), halt()' -noshell
}

# Private. Gets a list of code paths for this release
_get_code_paths() {
    $BINDIR/erl -noshell -boot start_clean -eval "{ok, [{release,_,_,Apps}]} = file:consult(\"$REL_DIR/$REL_NAME.rel\"),lists:foreach(fun(A) -> io:fwrite(\"-pa $ROOTDIR/lib/~p-~s/ebin \", [element(1, A), element(2, A)]) end, Apps),halt()."
}

# Private. For setting ERTS_DIR and ROOTDIR
_find_erts_dir() {
    __erts_dir="$RELEASE_ROOT_DIR/erts-$ERTS_VSN"
    if [ -d "$__erts_dir" ]; then
        ERTS_DIR="$__erts_dir";
        ROOTDIR="$RELEASE_ROOT_DIR"
    else
        __erl="$(which erl)"
        code="io:format(\"~s\", [code:root_dir()]), halt()."
        __erl_root="$("$__erl" -noshell -eval "$code")"
        ERTS_DIR="$__erl_root/erts-$ERTS_VSN"
        ROOTDIR="$__erl_root"
    fi
}

# Private. Open a shell on a remote node
_rem_sh() {
    # Generate a unique id used to allow multiple remsh to the same node
    # transparently
    id="remsh$(gen_id)-${NAME}"

    # Get the node's ticktime so that we use the same thing.
    TICKTIME="$(nodetool rpcterms net_kernel get_net_ticktime)"

    # Setup remote shell command to control node
    if [ ! -z "$USE_ERL_SHELL" ]; then
        exec "$BINDIR/erl" \
            -hidden \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            "$NAME_TYPE" "$id" -remsh "$NAME" -setcookie "$COOKIE"
    else
        __code_paths=$(_get_code_paths)
        exec "$BINDIR/erl" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -hidden -noshell \
            -boot start_clean -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -kernel net_ticktime $TICKTIME \
            -user Elixir.IEx.CLI "$NAME_TYPE" "$id" -setcookie "$COOKIE" \
            -extra --no-halt +iex -"$NAME_TYPE" "$id" --cookie "$COOKIE" --remsh "$NAME"
    fi
}

# Output a start command for the last argument of run_erl
_start_command() {
    printf "exec \"%s\" \"%s\" -- %s %s" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \
           "$START_OPTION" "${ARGS}" "${EXTRA_OPTS}"
}

# If ERTS_VSN is not set, detect it
if [ -z "$ERTS_VSN" ]; then
    ERTS_VSN="$(_detect_erts_vsn)"
    echo "$ERTS_VSN $REL_VSN" > "$START_ERL_DATA"
fi

# Allow override of where to look for config files
# By default it's $CWD/
if [ -z "$RELEASE_CONFIG_DIR" ]; then
    RELEASE_CONFIG_DIR="$RELEASE_ROOT_DIR"
fi

# Set VMARGS_PATH, the path to the vm.args file to use
# Use $RELEASE_CONFIG_DIR/vm.args if exists, otherwise releases/VSN/vm.args
if [ -z "$VMARGS_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/vm.args" ]; then
        VMARGS_PATH="$RELEASE_CONFIG_DIR/vm.args"
    else
        VMARGS_PATH="$REL_DIR/vm.args"
    fi
fi

orig_vmargs_path="$VMARGS_PATH.orig"
if [ $REPLACE_OS_VARS ]; then
    #Make sure we don't break dev mode by keeping the symbolic link to
    #the user's vm.args
    if [ ! -L "$orig_vmargs_path" ]; then
       #we're in copy mode, rename the vm.args file to vm.args.orig
       mv "$VMARGS_PATH" "$orig_vmargs_path"
    fi

    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_vmargs_path" > "$VMARGS_PATH"
 else
    #We don't need to replace env. vars, just rename the
    #symlink vm.args.orig to vm.args, and keep it as a
    #symlink.
    if [ -L "$orig_vmargs_path" ]; then
       mv "$orig_vmargs_path" "$VMARGS_PATH"
    fi
fi

# Make sure log directory exists
mkdir -p "$RUNNER_LOG_DIR"

# Set SYS_CONFIG_PATH, the path to the sys.config file to use
# Use $RELEASE_CONFIG_DIR/sys.config if exists, otherwise releases/VSN/sys.config
if [ -z "$SYS_CONFIG_PATH" ]; then
    if [ -f "$RELEASE_CONFIG_DIR/sys.config" ]; then
        SYS_CONFIG_PATH="$RELEASE_CONFIG_DIR/sys.config"
    else
        SYS_CONFIG_PATH="$REL_DIR/sys.config"
    fi
fi

orig_sys_config_path="$SYS_CONFIG_PATH.orig"
if [ $REPLACE_OS_VARS ]; then
    #Make sure we don't break dev mode by keeping the symbolic link to
    #the user's sys.config
    if [ ! -L "$orig_sys_config_path" ]; then
       #We're in copy mode, rename sys.config to sys.config.orig
       mv "$SYS_CONFIG_PATH" "$orig_sys_config_path"
    fi

    awk '{while(match($0,"[$]{[^}]*}")) {var=substr($0,RSTART+2,RLENGTH -3);gsub("[$]{"var"}",ENVIRON[var])}}1' < "$orig_sys_config_path" > "$SYS_CONFIG_PATH"
 else
    #We don't need to replace env. vars, just rename the
    #symlink sys.config.orig to sys.config. Keep it as
    #a symlink.
    if [ -L "$orig_sys_config_path" ]; then
       mv "$orig_sys_config_path"  "$SYS_CONFIG_PATH"
    fi
fi

# Extract the target node name from node.args
# Should be `-sname somename` or `-name somename@somehost`
NAME_ARG=$(egrep '^-s?name' "$VMARGS_PATH" || true)
if [ -z "$NAME_ARG" ]; then
    echo "vm.args needs to have either -name or -sname parameter."
    exit 1
fi

# Extract the name type and name from the NAME_ARG for REMSH
# NAME_TYPE should be -name or -sname
NAME_TYPE="$(echo "$NAME_ARG" | awk '{print $1}')"
# NAME will be either `somename` or `somename@somehost`
NAME="$(echo "$NAME_ARG" | awk '{print $2}')"

# Where the pipe will be stored when using `start`
# This is used so you can attach the running application to the current
# shell using `attach`
PIPE_DIR="${PIPE_DIR:-$RELEASE_ROOT_DIR/tmp/erl_pipes/$NAME/}"

# Extract the target cookie
COOKIE_ARG="$(grep '^-setcookie' "$VMARGS_PATH" || true)"
DEFAULT_COOKIE_FILE="$HOME/.erlang.cookie"
if [ -z "$COOKIE_ARG" ]; then
    if [ -f "$DEFAULT_COOKIE_FILE" ]; then
        COOKIE="$(cat "$DEFAULT_COOKIE_FILE")"
    else
        printf "a secret cookie must be provided in one of the following ways:\n  - with vm.args using the -setcookie parameter,\n  or\n  by writing the cookie to '$DEFAULT_COOKIE_FILE', with permissions set to 0400"
        exit 1
    fi
else
    # Extract cookie name from COOKIE_ARG
    COOKIE="$(echo "$COOKIE_ARG" | awk '{print $2}')"
fi

_find_erts_dir
export ROOTDIR="$RELEASE_ROOT_DIR"
export BINDIR="$ERTS_DIR/bin"
export EMU="beam"
export PROGNAME="erl"
export LD_LIBRARY_PATH="$ERTS_DIR/lib:$LD_LIBRARY_PATH"
ERTS_LIB_DIR="$ERTS_DIR/../lib"
CONSOLIDATED_DIR="$ROOTDIR/lib/${REL_NAME}-${REL_VSN}/consolidated"

cd "$ROOTDIR"

# User can specify an sname without @hostname
# This will fail when creating remote shell
# So here we check for @ and add @hostname if missing
case $NAME in
    *@*)
        # Nothing to do
        ;;
    *)
        NAME=$NAME@$(gen_nodename)
        ;;
esac

# Check the first argument for instructions
case "$1" in
    start|start_boot)

        # Make sure there is not already a node running
        #RES=`$NODETOOL ping`
        #if [ "$RES" = "pong" ]; then
        #    echo "Node is already running!"
        #    exit 1
        #fi
        # Save this for later.
        CMD=$1
        case "$1" in
            start)
                shift
                START_OPTION="console"
                HEART_OPTION="start"
                ;;
            start_boot)
                shift
                START_OPTION="console_boot"
                HEART_OPTION="start_boot"
                ;;
        esac
        ARGS="$@"
        RUN_PARAM="$@"

        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        # Set arguments for the heart command
        set -- "$SCRIPT_DIR/$REL_NAME" "$HEART_OPTION"
        [ "$RUN_PARAM" ] && set -- "$@" "$RUN_PARAM"

        # Export the HEART_COMMAND
        HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $CMD"
        export HEART_COMMAND

        mkdir -p "$PIPE_DIR"

        "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \
                          "$(_start_command)"

        [ -f "$POST_START_HOOK" ] && . "$POST_START_HOOK"
        ;;

    stop)
        [ -f "$PRE_STOP_HOOK" ] && . "$PRE_STOP_HOOK"
        # Wait for the node to completely stop...
        PID="$(get_pid)"
        if ! nodetool "stop"; then
            exit 1
        fi
        while $(kill -s 0 "$PID" 2>/dev/null);
        do
            sleep 1
        done
        [ -f "$POST_STOP_HOOK" ] && . "$POST_STOP_HOOK"
        ;;

    restart)
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"
        ## Restart the VM without exiting the process
        if ! nodetool "restart"; then
            exit 1
        fi
        ;;

    reboot)
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"
        ## Restart the VM completely (uses heart to restart it)
        if ! nodetool "reboot"; then
            exit 1
        fi
        ;;

    pid)
        ## Get the VM's pid
        if ! get_pid; then
            exit 1
        fi
        ;;

    ping)
        ## See if the VM is alive
        if ! nodetool "ping"; then
            exit 1
        fi
        ;;

    escript)
        ## Run an escript under the node's environment
        if ! escript $@; then
            exit 1
        fi
        ;;

    attach)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        exec "$BINDIR/to_erl" "$PIPE_DIR"
        ;;

    remote_console)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        _rem_sh
        ;;

    upgrade|downgrade|install)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
             "install" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    unpack)
        if [ -z "$2" ]; then
            echo "Missing package argument"
            echo "Usage: $REL_NAME $1 {package base name}"
            echo "NOTE {package base name} MUST NOT include the .tar.gz suffix"
            exit 1
        fi

        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        exec "$BINDIR/escript" "$ROOTDIR/bin/install_upgrade.escript" \
             "unpack" "$REL_NAME" "$NAME_TYPE" "$NAME" "$COOKIE" "$2"
        ;;

    console|console_clean|console_boot)
        # .boot file typically just $REL_NAME (ie, the app name)
        # however, for debugging, sometimes start_clean.boot is useful.
        # For e.g. 'setup', one may even want to name another boot script.
        case "$1" in
            console)
                if [ -f "$REL_DIR/$REL_NAME.boot" ]; then
                  BOOTFILE="$REL_DIR/$REL_NAME"
                else
                  BOOTFILE="$REL_DIR/start"
                fi
                ;;
            console_clean)
                BOOTFILE="$ROOTDIR/bin/start_clean"
                ;;
            console_boot)
                shift
                BOOTFILE="$1"
                shift
                ;;
        esac
        # Setup beam-required vars
        EMU="beam"
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        # Start the VM, executing pre_start hook along
        # the way. We can't run the post_start hook because
        # the console will crash with no TTY attached
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        __code_paths=$(_get_code_paths)
        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" \
            -boot "$BOOTFILE" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${__code_paths} \
            -args_file "$VMARGS_PATH" \
            -config "$SYS_CONFIG_PATH" \
            -mode "$CODE_LOADING_MODE" \
            ${ERL_OPTS} \
            -user Elixir.IEx.CLI \
            -extra --no-halt +iex

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS} ${EXTRA_OPTS}
            echo "Root: $ROOTDIR"

            # Log the startup
            echo "$RELEASE_ROOT_DIR"
        fi;

        logger -t "$REL_NAME[$$]" "Starting up"

        exec "$@" -- ${1+$ARGS} ${EXTRA_OPTS}
        ;;

    foreground)
        # start up the release in the foreground for use by runit
        # or other supervision services

        [ -f "$REL_DIR/$REL_NAME.boot" ] && BOOTFILE="$REL_NAME" || BOOTFILE=start
        FOREGROUNDOPTIONS="-noshell -noinput +Bd"

        # Setup beam-required vars
        EMU=beam
        PROGNAME="${0#*/}"

        export EMU
        export PROGNAME

        # Store passed arguments since they will be erased by `set`
        ARGS="$@"

        # Start the VM, executing pre and post start hooks
        [ -f "$PRE_START_HOOK" ] && . "$PRE_START_HOOK"

        # Build an array of arguments to pass to exec later on
        # Build it here because this command will be used for logging.
        set -- "$BINDIR/erlexec" $FOREGROUNDOPTIONS \
            -boot "$REL_DIR/$BOOTFILE" -mode "$CODE_LOADING_MODE" -config "$SYS_CONFIG_PATH" \
            -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR" \
            -args_file "$VMARGS_PATH" \
            -env ERL_LIBS "$REL_LIB_DIR" \
            -pa "$CONSOLIDATED_DIR" \
            ${ERL_OPTS} \
            -extra ${EXTRA_OPTS}

        # Dump environment info for logging purposes
        if [ ! -z $VERBOSE ]; then
            echo "Exec: $@" -- ${1+$ARGS}
            echo "Root: $ROOTDIR"
        fi;

        trap '{}' EXIT QUIT TERM KILL HUP USR1 USR2
        "$@" -- ${1+$ARGS} &
        __bg_pid=$!
        [ -f "$POST_START_HOOK" ] && . "$POST_START_HOOK"
        wait $__bg_pid
        ;;
    rpc)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpc $@
        ;;
    rpcterms)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift

        nodetool rpcterms $@
        ;;
    eval)
        # Make sure a node IS running
        if ! nodetool "ping" > /dev/null; then
            echo "Node is not running!"
            exit 1
        fi

        shift
        nodetool "eval" $@
        ;;
    command)
        # Execute as command-line utility
        #
        # Like the escript command, this does not start the OTP application.
        # If your command depends on a running OTP application,
        # use
        #
        #     {:ok, _} = Application.ensure_all_started(:your_app)

        shift
        MODULE="$1"; shift
        FUNCTION="$1"; shift

        # Save extra arguments
        ARGS="$@"

        # Build arguments for erlexec
        set -- "$ERL_OPTS"
        [ "$SYS_CONFIG_PATH" ] && set -- "$@" -config "$SYS_CONFIG_PATH"
        set -- "$@" -boot_var ERTS_LIB_DIR "$ERTS_LIB_DIR"
        set -- "$@" -noshell
        set -- "$@" -boot start_clean
        set -- "$@" -s "$MODULE" "$FUNCTION"

        $BINDIR/erlexec $@ -extra $ARGS
        exit "$?"
        ;;
    *)
        __command_path="$REL_DIR/commands/$1"
        if [ -f "$__command_path" ]; then
            . "$__command_path"
        else
            echo "Usage: $REL_NAME {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|escript|rpc|rpcterms|eval|command <module> <function> <args>}"
            exit 1
        fi
        ;;
esac

exit 0


Remove about menu entry

Remove about menu entry

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="csrf" content="<%= Plug.CSRFProtection.get_csrf_token %>">
    <%= if Guardian.Plug.current_token(@conn) do %>
      <meta name='guardian_token' content="<%= Guardian.Plug.current_token(@conn) %>">
    <% end %>
    <link rel="apple-touch-icon" sizes="120x120" href="/images/apple-touch-icon.png">
    <title>ExMoney</title>

    <link href="<%= static_path(@conn, "/css/framework7.css") %>" rel="stylesheet">
    <link href="<%= static_path(@conn, "/css/mobile.css") %>" rel="stylesheet">

ExMoney

Dashboard

Budget

Settings

    <%= render @view_module, @view_template, assigns %>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <meta name="csrf" content="<%= Plug.CSRFProtection.get_csrf_token %>">
    <%= if Guardian.Plug.current_token(@conn) do %>
      <meta name='guardian_token' content="<%= Guardian.Plug.current_token(@conn) %>">
    <% end %>
    <link rel="apple-touch-icon" sizes="120x120" href="/images/apple-touch-icon.png">
    <title>ExMoney</title>

    <link href="<%= static_path(@conn, "/css/framework7.css") %>" rel="stylesheet">
    <link href="<%= static_path(@conn, "/css/mobile.css") %>" rel="stylesheet">

ExMoney

Dashboard

Budget

Settings

About

    <%= render @view_module, @view_template, assigns %>


Update email live 2

Update email live 2

Reminder: Join our second and final live event in 25 minutes

Our live event is starting in about 25 minutes, at 2:30PM EST (18:30 GST). You will have a chance to interact live with several of the key people from this MOOC, and we'd love to hear your ideas, questions and feedback. Please go to the Live section of Week 6 in the EdX MOOC, or follow this direct link: <a href='<%= Mail.gen_url(id, basename <> "/live_b") %>'>Live Session 2

Please don't respond to this email, replies will not be received. Add a message in the Tech issues thread in the forum, if you have any concerns.

Reminder: Join our second and final live event in 15 minutes

Our live event is starting in about 15 minutes, at 2:30PM EST (18:30 GST). You will have a chance to interact live with several of the key people from this MOOC, and we'd love to hear your ideas, questions and feedback. Please go to the Live section of Week 6 in the EdX MOOC, or follow this direct link: <a href='<%= Mail.gen_url(id, basename <> "/live_b") %>'>Live Session 1

Please don't respond to this email, replies will not be received. Add a message in the Tech issues thread in the forum, if you have any concerns.


missing do

missing do

    <%= link "Latest Episodes", to: episode_frontend_path(@conn, :index), style: "color: #fff" %>

      <%= link "more ...", to: episode_frontend_path(@conn, :index), style: "color: #fff" %>

      <%= for episode <- latest_episodes do %>

          <%= link [fa_icon("headphones"), " ", C.String.truncate(episode.title, 40)],
                      to: episode_frontend_path(@conn, :show, episode),
                      class: "btn btn-primary btn-xs" %>

          <%= link [fa_icon("podcast"), " ", episode.podcast.title],
                      to: podcast_frontend_path(@conn, :show, episode.podcast),
                      class: "btn btn-default btn-xs",
                      style: "color: #000;" %>

          <%= if episode.publishing_date do %>
            <%= fa_icon("calendar") %> <%= Ecto.DateTime.to_date(episode.publishing_date) %>

          <% end %>
          <%= if episode.duration do %>
            <%= fa_icon("clock-o") %> <%= episode.duration %>

          <%= end %>
          <%= if episode.author do %>
            <%= fa_icon("user") %> <%= episode.author %>

          <%= end %>
          <%= if episode.subtitle do %>
            <%= fa_icon("image") %> <%= episode.subtitle %>
          <%= end %>

      <% end %>

    <%= link "Latest Episodes", to: episode_frontend_path(@conn, :index), style: "color: #fff" %>

      <%= link "more ...", to: episode_frontend_path(@conn, :index), style: "color: #fff" %>

      <%= for episode <- latest_episodes do %>

          <%= link [fa_icon("headphones"), " ", C.String.truncate(episode.title, 40)],
                      to: episode_frontend_path(@conn, :show, episode),
                      class: "btn btn-primary btn-xs" %>

          <%= link [fa_icon("podcast"), " ", episode.podcast.title],
                      to: podcast_frontend_path(@conn, :show, episode.podcast),
                      class: "btn btn-default btn-xs",
                      style: "color: #000;" %>

          <%= if episode.publishing_date %>
            <%= fa_icon("calendar") %> <%= Ecto.DateTime.to_date(episode.publishing_date) %>

          <% end %>
          <%= if episode.duration do %>
            <%= fa_icon("clock-o") %> <%= episode.duration %>

          <%= end %>
          <%= if episode.author do %>
            <%= fa_icon("user") %> <%= episode.author %>

          <%= end %>
          <%= if episode.subtitle do %>
            <%= fa_icon("image") %> <%= episode.subtitle %>
          <%= end %>

      <% end %>


Clean up navbar ID used for collapsing

Clean up navbar ID used for collapsing

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse" aria-expanded="false">
        Toggle navigation

      </button>
      <%= link to: Routes.page_path(@conn, :home), class: "navbar-brand" do %>
        <%= img_tag "/images/jumuball.png", alt: gettext("Jumu logo") %>
      <% end %>

<%= link gettext("Home"), to: Routes.page_path(@conn, :home) %>

<%= link gettext("Registration"), to: Routes.page_path(@conn, :registration) %>

<%= link gettext("Rules"), to: Routes.page_path(@conn, :rules) %>

<%= link gettext("FAQ"), to: Routes.page_path(@conn, :faq) %>

<%= link gettext("Contact"), to: Routes.page_path(@conn, :contact) %>

        <%= if @current_user do %>

            <%= link to: Routes.internal_page_path(@conn, :home) do %>
              <%= icon_tag("home") %> <%= @current_user.given_name %>
            <% end %>

<%= link gettext("Log out"), to: Routes.session_path(@conn, :delete, @current_user), method: :delete %>

        <% else %>

            <%= link gettext("Internal Pages"), to: Routes.session_path(@conn, :new) %>

        <% end %>

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        Toggle navigation

      </button>
      <%= link to: Routes.page_path(@conn, :home), class: "navbar-brand" do %>
        <%= img_tag "/images/jumuball.png", alt: gettext("Jumu logo") %>
      <% end %>

<%= link gettext("Home"), to: Routes.page_path(@conn, :home) %>

<%= link gettext("Registration"), to: Routes.page_path(@conn, :registration) %>

<%= link gettext("Rules"), to: Routes.page_path(@conn, :rules) %>

<%= link gettext("FAQ"), to: Routes.page_path(@conn, :faq) %>

<%= link gettext("Contact"), to: Routes.page_path(@conn, :contact) %>

        <%= if @current_user do %>

            <%= link to: Routes.internal_page_path(@conn, :home) do %>
              <%= icon_tag("home") %> <%= @current_user.given_name %>
            <% end %>

<%= link gettext("Log out"), to: Routes.session_path(@conn, :delete, @current_user), method: :delete %>

        <% else %>

            <%= link gettext("Internal Pages"), to: Routes.session_path(@conn, :new) %>

        <% end %>


Revert "test copy change."

Revert "test copy change."

This reverts commit 3694d3deda298b9de92d86fc7d6600978ae663f7.


Adapt to Fitbit API response

Adapt to Fitbit API response

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>OAuth2/Phoenix!</title>
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

          OAuth2 Example

              View on GitHub

OAuth2/Phoenix Example Application!

        This is an application to show an example of how to wire up
        OAuth2 with
        Phoenix.

      <%= if @current_user do %>

Welcome, <%= @current_user["user"]["displayName"] %>!

        <img src="<%= @current_user["avatar_url"] %>" class="img-circle"/>
      <% else %>

        <a class="btn btn-primary btn-lg" href="<%= auth_path @conn, :index %>">

          Sign in with Fitbit

      <% end %>

      <%= @inner %>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>OAuth2/Phoenix!</title>
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/app.css") %>">

          OAuth2 Example

              View on GitHub

OAuth2/Phoenix Example Application!

        This is an application to show an example of how to wire up
        OAuth2 with
        Phoenix.

      <%= if @current_user do %>

Welcome, <%= @current_user["name"] %>!

        <img src="<%= @current_user["avatar_url"] %>" class="img-circle"/>
      <% else %>

        <a class="btn btn-primary btn-lg" href="<%= auth_path @conn, :index %>">

          Sign in with Fitbit

      <% end %>

      <%= @inner %>


adds "Forgot your password" link to session creation

<%= form_for @conn, session_path(@conn, :create), [as: :session], fn f  -> %>

  <% error = get_flash(@conn, :error) %>

        Welcome back!

        <%= CoursePlannerWeb.SharedView.form_text f, :email, required: true %>
        <%= if error do %>

            <%= error %>

        <% end %>

        <%= CoursePlannerWeb.SharedView.form_password f, :password, required: true %>

        <%= CoursePlannerWeb.SharedView.form_submit f, "Next", class: "login__button" %>

        <%= link "Forgot your password?", to: password_path(@conn, :new)%>

<% end %>

<%= form_for @conn, session_path(@conn, :create), [as: :session], fn f  -> %>

  <% error = get_flash(@conn, :error) %>

        Welcome back!

        <%= CoursePlannerWeb.SharedView.form_text f, :email, required: true %>
        <%= if error do %>

            <%= error %>

        <% end %>

        <%= CoursePlannerWeb.SharedView.form_password f, :password, required: true %>

        <%= CoursePlannerWeb.SharedView.form_submit f, "Next", class: "login__button" %>

<% end %>


feat(admin): make admin full-width without sidebar

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/admin.css") %>">

      Lyn Admin

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :dashboard)) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :dashboard) %>">Home (current)

        <li class="nav-item <%= active_class(@conn, object_path(@conn, :index)) %>">
          <a class="nav-link" href="<%= object_path(@conn, :index) %>">Objects (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "object_types")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "object_types") %>">Object Types (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "languages")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "languages") %>">Languages (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "domains")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "domains") %>">Domains (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "sites")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "sites") %>">Sites (current)

        <li class="nav-item <%= active_class(@conn, maintenance_path(@conn, :index)) %>">
          <a class="nav-link" href="<%= maintenance_path(@conn, :index) %>">Maintenance (current)

      <form class="form-inline pull-xs-right">
        <input class="form-control" type="text" placeholder="Search">
        <button class="btn btn-default" type="submit">Search</button>
      </form>

        <%
          sidebar_file = sidebar(@conn)
        %>
        <%= if sidebar_file do %>

            <%= render Lyn.Admin.SidebarView, sidebar_file, assigns %>

        <% end %>
        <div id="main" <%= if !sidebar_file do %>class="full-width"<% end %>>

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

            <%= render @view_module, @view_template, assigns %>

<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>Admin</title>
    <link rel="stylesheet" href="<%= static_path(@conn, "/css/admin.css") %>">

      Lyn Admin

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :dashboard)) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :dashboard) %>">Home (current)

        <li class="nav-item <%= active_class(@conn, object_path(@conn, :index)) %>">
          <a class="nav-link" href="<%= object_path(@conn, :index) %>">Objects (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "object_types")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "object_types") %>">Object Types (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "languages")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "languages") %>">Languages (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "domains")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "domains") %>">Domains (current)

        <li class="nav-item <%= active_class(@conn, admin_path(@conn, :index, "sites")) %>">
          <a class="nav-link" href="<%= admin_path(@conn, :index, "sites") %>">Sites (current)

        <li class="nav-item <%= active_class(@conn, maintenance_path(@conn, :index)) %>">
          <a class="nav-link" href="<%= maintenance_path(@conn, :index) %>">Maintenance (current)

      <form class="form-inline pull-xs-right">
        <input class="form-control" type="text" placeholder="Search">
        <button class="btn btn-default" type="submit">Search</button>
      </form>

        <%
          sidebar_file = sidebar(@conn)
        %>
        <%= if sidebar_file do %>

            <%= render Lyn.Admin.SidebarView, sidebar_file, assigns %>

        <% end %>
        <div id="main"
          <%= if !sidebar_file do %>
          class="full-width"
          <% end %>
        >

<%= get_flash(@conn, :info) %>

<%= get_flash(@conn, :error) %>

            <%= render @view_module, @view_template, assigns %>


making hard code values vary a little

making hard code values vary a little

    <%= render "nav_bar.html", conn: @conn %>

        <%= render "page_header.html", page_header: "Data Centers" %>

            <%= render "standard_card.html",card_color: "panel-primary",
                                            card_icon: "fa-building-o",
                                            card_count: 153,
                                            card_description: "ASH",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-primary",
                                            card_icon: "fa-building-o",
                                            card_count: 128,
                                            card_description: "CHA",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-yellow",
                                            card_icon: "fa-building-o",
                                            card_count: 16,
                                            card_description: "CRB",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-yellow",
                                            card_icon: "fa-building-o",
                                            card_count: 29,
                                            card_description: "CAN",
                                            card_link: page_path(@conn, :data_centers) %>

            <%= render "standard_card.html",card_color: "panel-green",
                                            card_icon: "fa-building-o",
                                            card_count: 41,
                                            card_description: "SEA",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-green",
                                            card_icon: "fa-building-o",
                                            card_count: 12,
                                            card_description: "SJC",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-green",
                                            card_icon: "fa-building-o",
                                            card_count: 98,
                                            card_description: "PHO",
                                            card_link: page_path(@conn, :data_centers) %>

                      New Data Center

                    <form role="form">

                            Data Center Name
                            <input class="form-control" placeholder="Enter text">

                        <button type="button" class="btn btn-default btn-circle btn-lg">

                        </button>
                    </form>

    <%= render "nav_bar.html", conn: @conn %>

        <%= render "page_header.html", page_header: "Data Centers" %>

            <%= render "standard_card.html",card_color: "panel-primary",
                                            card_icon: "fa-building-o",
                                            card_count: 26,
                                            card_description: "ASH",
                                            card_link: page_path(@conn, :data_centers) %>
            <%= render "standard_card.html",card_color: "panel-green",
                                            card_icon: "fa-building-o",
                                            card_count: 128,
                                            card_description: "CHA",
                                            card_link: page_path(@conn, :data_centers) %>


remove old coors code

remove old coors code

overlay opacity

<!- div id="coords">

<input id="opacity" class="range-slider" type="range" value= "0.8" min="0.0" max="1.0" step="0.05" />


fix: set index in index

fix: set index in index

<%= link to: picture_path(@conn, :index) <> ".atom" do %><img src="<%= static_path(@conn, "/images/atom-feed-icon.gif") %>" alt="Atom Feed"><% end %>

Pictures

<%= if logged_in?(@conn) do %>

<%= link "New picture", to: picture_path(@conn, :new) %>

<% end %>

  <%= for picture <- @pictures do %>

      <%= render "picture.html", conn: @conn, picture: picture, type: :thumbnail, index: true %>
      <%= if logged_in?(@conn) do %>
        <%= link "Edit", to: picture_path(@conn, :edit, picture) %>
        <%= button "Delete", to: picture_path(@conn, :delete, picture), method: :delete, data: [confirm: "Are you sure?"] %>
      <% end %>

  <% end %>

<%= pagination_links @conn, @page, previous: "←", next: "→" %>

<%= link to: picture_path(@conn, :index) <> ".atom" do %><img src="<%= static_path(@conn, "/images/atom-feed-icon.gif") %>" alt="Atom Feed"><% end %>

Pictures

<%= if logged_in?(@conn) do %>

<%= link "New picture", to: picture_path(@conn, :new) %>

<% end %>

  <%= for picture <- @pictures do %>

      <%= render "picture.html", conn: @conn, picture: picture, type: :thumbnail %>
      <%= if logged_in?(@conn) do %>
        <%= link "Edit", to: picture_path(@conn, :edit, picture) %>
        <%= button "Delete", to: picture_path(@conn, :delete, picture), method: :delete, data: [confirm: "Are you sure?"] %>
      <% end %>

  <% end %>

<%= pagination_links @conn, @page, previous: "←", next: "→" %>


Update configurator completion message

Update configurator completion message

Gives an aproximate time when Farmbot will reset
back into configurator

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> Configuration Complete </title>
    <link rel="stylesheet" href="/styles.css">

Configuration Complete

You're all set!

      FarmBot will now reboot to apply the configuration.

        If any configuration settings are incorrect, FarmBot will reset
        in about 2-5 minutes allowing you to enter the settings again.

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> Configuration Complete </title>
    <link rel="stylesheet" href="/styles.css">

Configuration Complete

You're all set!

      FarmBot will now reboot to apply the configuration.

        If any configuration settings are incorrect, FarmBot will reset
        allowing you to enter the settings again.


Use SVG instead of PNG in image links

Use SVG instead of PNG in image links

Share this recording

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

Link

          <input data-behavior="auto-select" readonly="" value="<%= asciicast_url(@conn, :show, @asciicast) %>" type="text">

          Append ?t=30 to start the playback at 30s, ?t=3:20 to start the playback at 3m 20s.

Embed image link

Use snippets below to display a screenshot linking to this recording.

          Useful in places where scripts are not allowed (e.g. in a project's README file).

          HTML:

          <input data-behavior="auto-select" readonly="" value="<a href="<%= asciicast_url(@conn, :show, @asciicast) %>" target="_blank"><img src="<%= asciicast_url(@conn, :show, @asciicast) %>.svg" />" type="text">

          Markdown:

          <input data-behavior="auto-select" readonly="" value="[![asciicast](<%= asciicast_url(@conn, :show, @asciicast) %>.svg)](<%= asciicast_url(@conn, :show, @asciicast) %>)" type="text">

Embed the player

If you're embedding on your own page or on a site which permits script tags,
          you can use the full player widget:

          <input data-behavior="auto-select" readonly="" value="<%= safe_to_string(embed_script(@asciicast)) %>" type="text">

Paste the above script tag where you want the player to be displayed on your page.

See <a href="<%= doc_path(@conn, :show, :embedding) %>">Sharing & embedding for additional options.

Share this recording

        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          ×
        </button>

Link

          <input data-behavior="auto-select" readonly="" value="<%= asciicast_url(@conn, :show, @asciicast) %>" type="text">

          Append ?t=30 to start the playback at 30s, ?t=3:20 to start the playback at 3m 20s.

Embed image link

Use snippets below to display a screenshot linking to this recording.

          Useful in places where scripts are not allowed (e.g. in a project's README file).

          HTML:

          <input data-behavior="auto-select" readonly="" value="<a href="<%= asciicast_url(@conn, :show, @asciicast) %>" target="_blank"><img src="<%= asciicast_image_url(@conn, @asciicast) %>" />" type="text">

          Markdown:

          <input data-behavior="auto-select" readonly="" value="[![asciicast](<%= asciicast_image_url(@conn, @asciicast) %>)](<%= asciicast_url(@conn, :show, @asciicast) %>)" type="text">

Embed the player

If you're embedding on your own page or on a site which permits script tags,
          you can use the full player widget:

          <input data-behavior="auto-select" readonly="" value="<%= safe_to_string(embed_script(@asciicast)) %>" type="text">

Paste the above script tag where you want the player to be displayed on your page.

See <a href="<%= doc_path(@conn, :show, :embedding) %>">Sharing & embedding for additional options.