Skip to content

Commit bf03c08

Browse files
authored
Merge pull request #151 from robinmonjo/run-formatter
run mix deps.get with elixir 1.6 + add .formatter.exs + run mix format
2 parents 5726d42 + 614cf83 commit bf03c08

23 files changed

Lines changed: 727 additions & 455 deletions

.formatter.exs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Used by "mix format"
2+
[
3+
inputs: [
4+
"mix.exs",
5+
".formatter.exs",
6+
"{config,lib,test,examples}/**/*.{ex,exs}"
7+
],
8+
locals_without_parens: [
9+
# Query
10+
from: 2,
11+
12+
# Schema
13+
field: 1,
14+
field: 2,
15+
field: 3,
16+
timestamps: 0,
17+
timestamps: 1,
18+
belongs_to: 2,
19+
belongs_to: 3,
20+
has_one: 2,
21+
has_one: 3,
22+
has_many: 2,
23+
has_many: 3,
24+
many_to_many: 2,
25+
many_to_many: 3,
26+
embeds_one: 2,
27+
embeds_one: 3,
28+
embeds_one: 4,
29+
embeds_many: 2,
30+
embeds_many: 3,
31+
embeds_many: 4,
32+
33+
# Test assertion
34+
assert_fields: 2
35+
]
36+
]

.travis.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ elixir:
1111
- 1.5
1212

1313
before_install:
14-
- . $HOME/.nvm/nvm.sh
15-
- nvm install stable
16-
- nvm use stable
17-
- npm install -g mongodb-version-manager@1.0.6
18-
- m use $MONGOVERSION
14+
- wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${MONGOVERSION}.tgz
15+
- tar xzf mongodb-linux-x86_64-${MONGOVERSION}.tgz
16+
- ${PWD}/mongodb-linux-x86_64-${MONGOVERSION}/bin/mongod --version
1917
- mkdir db
2018

2119
install:
@@ -25,9 +23,7 @@ install:
2523
- (cd examples/simple; mix deps.get)
2624

2725
before_script:
28-
- sudo service mongodb stop
29-
- export PATH=$(m path):$PATH
30-
- mongod --fork --logpath mongo.log --dbpath db
26+
- ${PWD}/mongodb-linux-x86_64-${MONGOVERSION}/bin/mongod --dbpath db --logpath mongodb.log --fork
3127

3228
script:
3329
- mix test

config/test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ use Mix.Config
22

33
config :logger,
44
level: :info,
5-
handle_otp_reports: true
5+
handle_otp_reports: true,
66
handle_sasl_reports: true

examples/simple/lib/simple.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ defmodule Simple do
3333
import Ecto.Query
3434

3535
def sample_query do
36-
query = from w in Weather,
37-
where: w.prcp > 0.0 or is_nil(w.prcp),
38-
select: w
36+
query =
37+
from w in Weather,
38+
where: w.prcp > 0.0 or is_nil(w.prcp),
39+
select: w
40+
3941
Simple.Repo.all(query)
4042
end
4143

@@ -50,6 +52,6 @@ defmodule Simple do
5052

5153
weather
5254
|> Ecto.Changeset.change(%{city: "NYC"})
53-
|> Simple.Repo.update
55+
|> Simple.Repo.update()
5456
end
5557
end

examples/simple/mix.exs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ defmodule Simple.Mixfile do
22
use Mix.Project
33

44
def project do
5-
[app: :simple,
6-
version: "0.0.1",
7-
deps: deps]
5+
[app: :simple, version: "0.0.1", deps: deps]
86
end
97

108
def application do
11-
[mod: {Simple.App, []},
12-
applications: [:mongodb_ecto, :ecto, :logger]]
9+
[mod: {Simple.App, []}, applications: [:mongodb_ecto, :ecto, :logger]]
1310
end
1411

1512
defp deps do
16-
[{:mongodb_ecto, path: "../.."},
17-
{:ecto, path: "../../deps/ecto", override: true},
18-
{:mongodb, path: "../../deps/mongodb", override: true}]
13+
[
14+
{:mongodb_ecto, path: "../.."},
15+
{:ecto, path: "../../deps/ecto", override: true},
16+
{:mongodb, path: "../../deps/mongodb", override: true}
17+
]
1918
end
2019
end

examples/simple/test/simple_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ defmodule Simple.Test do
22
use Simple.Case
33

44
test "it works!" do
5-
Simple.sample_query
5+
Simple.sample_query()
66
end
77
end

examples/simple/test/test_helper.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ExUnit.start
1+
ExUnit.start()
22
Logger.configure(level: :info)
33

44
defmodule Simple.Case do

0 commit comments

Comments
 (0)