I hereby claim:
- I am matheusca on github.
- I am matheusca (https://keybase.io/matheusca) on keybase.
- I have a public key ASBGRtJ39-zFACv229R-WXNNkOx9fs-KFFJH9IaTqKWEkgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
This gist shows an approach how I think Roar JSONAPI render should be work. I appreciacte any thought.
JSONAPI specs described included
data MAY include along with primary requester avoiding many HTTP request to the server.
So, I think Roar could be implement it having two options, IMO.
You may need representer ever include compound in your JSON, so ROAR could be a way to interprete it. I think that can be doing as follow:
defmodule Weber.Controller do | |
defmacro __using__(_) do | |
quote do | |
@before_compile { unquote(__MODULE__), :purge_files} | |
import Weber.Controller.Layout | |
layout('main.html') | |
end | |
end | |
defmacro purge_files(_) do |
defmodule Test.Start.File do | |
use GenServer.Behaviour | |
def start do | |
Test.Supervisor.start_link(Test.Supervisor, []) | |
enable | |
end | |
def enable do | |
Test.Supervisor.start_child(Test.Supervisor, __MODULE__, []) |
defmodule Weber.App do | |
use GenServer.Behaviour | |
@moduledoc """ | |
Weber web application initial process (Starts cowboy, parse routes, and etc...) | |
""" | |
defrecord WeberApp, | |
name: nil, | |
routes: nil, |
defmodule Cowboy do | |
@moduledoc """ | |
Starts cowboy instance. | |
""" | |
def start(name, config) do | |
:application.start(:crypto) | |
:application.start(:asn1) | |
:application.start(:public_key) |
configs = ["test", "other", "another", "some", "one", "two"] | |
Enum.split_while(configs, &(&1 == "another")) | |
{[], ["test", "other", "another", "some", "one", "two"]} |
Code.require_file "support/config.exs", __DIR__ | |
defmodule WeberHelperTest do | |
use ExUnit.Case | |
setup_all do | |
{:ok, root} = File.cwd | |
Weber.run_weber(__MODULE__, [], root, Config.config) | |
:ok | |
end |
{ | |
deployed: | |
configs:{ | |
host: "22.22.22.22", | |
port: 22, // Default | |
user: "root", | |
password: "test", // don't use it, PLEASE! | |
// More options can put here, read documentation about others. | |
git: "https...", | |
branch: "master", |
defmodule Weber.Helper.Html do | |
def tag(html_tag, content, input_html // []) do | |
initial_tag = create_initial_tag(html_tag, input_html) | |
end_tag = create_end_tag(html_tag) | |
"#{initial_tag}#{content}#{end_tag}" | |
end | |
defp create_initial_tag(html_tag, input_html) do | |
"<#{html_tag}#{generate_input_html(input_html)}" |