Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ To get started quickly, add GraphQL.Parser to your deps in `mix.exs`:

```elixir
defp deps do
[{:graphql_parser, "~> 0.0.3"}]
[{:graphql_parser, "~> 0.0.4"}]
end
```

Expand Down
3 changes: 2 additions & 1 deletion lib/graphql/parser/nif.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ defmodule GraphQL.Parser.Nif do
|> :filename.dirname
|> :filename.dirname
|> :filename.join('priv')

path ->
path
end
end

def parse(_) do
exit(:nif_library_not_loaded)
:erlang.nif_error(:nif_library_not_loaded)
end
end
93 changes: 55 additions & 38 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
defmodule GraphQL.Parser.Mixfile do
use Mix.Project

@version "0.0.3"
@version "0.0.4"

def project do
[app: :graphql_parser,
name: "GraphQL.Parser",
version: @version,
elixir: "~> 1.2",
compilers: [:nif] ++ Mix.compilers,
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
description: description,
package: package,
docs: docs,
deps: deps]
[
app: :graphql_parser,
name: "GraphQL.Parser",
version: @version,
elixir: "~> 1.2",
compilers: [:nif] ++ Mix.compilers(),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
description: description(),
package: package(),
docs: docs(),
deps: deps()
]
end

def application do
[applications: [:logger]]
end

defp deps do
[{:poison, "~> 2.0"},
{:earmark, "~> 0.1", only: :dev},
{:ex_doc, "~> 0.11", only: :dev}]
[{:poison, "~> 2.0"}, {:earmark, "~> 0.1", only: :dev}, {:ex_doc, "~> 0.11", only: :dev}]
end

defp description do
Expand All @@ -35,36 +35,51 @@ defmodule GraphQL.Parser.Mixfile do
end

defp package do
[maintainers: ["Vignesh Rajagopalan"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/aarvay/graphql_parser"},
files: ["lib", "src", "Makefile", "mix.exs", "README.md",
"libgraphqlparser/ast/ast.ast", "libgraphqlparser/ast/*.py",
"libgraphqlparser/c/*.cpp", "libgraphqlparser/c/*.h",
"libgraphqlparser/*.h", "libgraphqlparser/*.cpp",
"libgraphqlparser/*.lpp", "libgraphqlparser/*.hh",
"libgraphqlparser/*.hpp", "libgraphqlparser/*.ypp",
"libgraphqlparser/CMakeLists.txt", "libgraphqlparser/LICENSE",
"libgraphqlparser/PATENTS", "libgraphqlparser/README.md"]]
[
maintainers: ["Vignesh Rajagopalan"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/aarvay/graphql_parser"},
files: [
"lib",
"src",
"Makefile",
"mix.exs",
"README.md",
"libgraphqlparser/ast/ast.ast",
"libgraphqlparser/ast/*.py",
"libgraphqlparser/c/*.cpp",
"libgraphqlparser/c/*.h",
"libgraphqlparser/*.h",
"libgraphqlparser/*.cpp",
"libgraphqlparser/*.lpp",
"libgraphqlparser/*.hh",
"libgraphqlparser/*.hpp",
"libgraphqlparser/*.ypp",
"libgraphqlparser/CMakeLists.txt",
"libgraphqlparser/LICENSE",
"libgraphqlparser/PATENTS",
"libgraphqlparser/README.md"
]
]
end

defp docs do
[source_ref: "v#{@version}",
extras: ["README.md"],
main: "README"]
[source_ref: "v#{@version}", extras: ["README.md"], main: "README"]
end
end

defmodule GraphQL.Parser.MixHelper do
def check_exit_status({res, exit_status_code}) do
if exit_status_code != 0 do
raise Mix.Error, message: """
Build command exited with status code: #{exit_status_code}.
Make sure you're running `mix compile` from project's root.
"""
raise Mix.Error,
message: """
Build command exited with status code: #{exit_status_code}.
Make sure you're running `mix compile` from project's root.
"""
end

IO.binwrite res # verbose
# verbose
IO.binwrite(res)
end
end

Expand All @@ -81,15 +96,17 @@ defmodule Mix.Tasks.Compile.Nif do
rescue
e in Mix.Error ->
raise e

e in ErlangError ->
case e.original do
:enoent ->
raise Mix.Error, message: """
Please check if `cmake` and `make` are installed
"""
raise Mix.Error,
message: """
Please check if `cmake` and `make` are installed
"""
end
end

Mix.Project.build_structure
Mix.Project.build_structure()
end
end
8 changes: 5 additions & 3 deletions mix.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
%{"earmark": {:hex, :earmark, "0.1.19"},
"ex_doc": {:hex, :ex_doc, "0.11.1"},
"poison": {:hex, :poison, "1.5.0"}}
%{
"earmark": {:hex, :earmark, "0.1.19", "ffec54f520a11b711532c23d8a52b75a74c09697062d10613fa2dbdf8a9db36e", [:mix], [], "hexpm", "db85f989ba3030d40d3a901d7eebbf926ee07355bf6113d730b8aaf9404a6bd7"},
"ex_doc": {:hex, :ex_doc, "0.11.1", "43a16e4168e384213a052e6ee77723b765165b866ac52a10394dfa8f7de5b203", [:mix], [{:earmark, "~> 0.1.17 or ~> 0.2", [hex: :earmark, repo: "hexpm", optional: true]}], "hexpm", "d9da03da5792939081ce8bc9753136a98978ec1f23b2ff364395fd4cd50e674f"},
"poison": {:hex, :poison, "2.2.0", "4763b69a8a77bd77d26f477d196428b741261a761257ff1cf92753a0d4d24a63", [:mix], [], "hexpm", "519bc209e4433961284174c497c8524c001e285b79bdf80212b47a1f898084cc"},
}