Skip to content

Commit

Permalink
Add travis config (#15)
Browse files Browse the repository at this point in the history
* Starting travis

* Fix formatting for rustfmt

* Add postgres dependency

* Create budgetron user

* Try fixing postgres connection again

* doot

* Keep src/images directory

* Simplify a bit
  • Loading branch information
zmbush authored Oct 24, 2017
1 parent e5ea696 commit 0ee71d0
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 13 deletions.
1 change: 1 addition & 0 deletions .env.travis
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DATABASE_URL=postgres://postgres@localhost/budgetron
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
language: rust
rust:
- stable
- 1.21.0
cache: cargo
services:
- postgresql
install:
- rustup install nightly
- rustup run nightly cargo install --force rustfmt-nightly
- nvm install 6
- npm install -g yarn
- cargo install --force diesel_cli
- (cd web && yarn)
before_script:
- psql -c 'create database budgetron;' -U postgres
- cp .env.travis .env
script:
- (cd web && yarn run webpack)
- rustup run nightly rustfmt --write-mode=diff src/lib.rs src/bin/budgetron.rs budgetronlib/src/lib.rs data_store/src/lib.rs
- diesel migration run
- cargo build
- cargo test
6 changes: 3 additions & 3 deletions budgetronlib/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ use toml;
pub struct EmailAccount {
pub username: String,
pub password: String,
pub server: String,
pub port: u16,
pub server: String,
pub port: u16,
}

#[derive(Deserialize)]
pub struct SecureConfig {}

#[derive(Deserialize, Debug)]
pub struct CategoryConfig {
pub categories: HashMap<String, Vec<String>>,
pub categories: HashMap<String, Vec<String>>,
pub ignored_accounts: Vec<String>,
}

Expand Down
4 changes: 3 additions & 1 deletion budgetronlib/src/fintime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ impl Date {
}

pub fn ymd(y: i32, m: i32, d: i32) -> Date {
Date { date: chrono::Utc.ymd(y, m as u32, d as u32) }
Date {
date: chrono::Utc.ymd(y, m as u32, d as u32),
}
}

pub fn year(&self) -> i32 {
Expand Down
6 changes: 3 additions & 3 deletions budgetronlib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
extern crate chrono;
extern crate csv;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate chrono;
extern crate toml;
extern crate csv;

pub mod fintime;
pub mod config;
Expand Down
10 changes: 4 additions & 6 deletions data_store/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#![recursion_limit="128"]
#![recursion_limit = "128"]

#[macro_use]
extern crate diesel_codegen;

pub mod schema;
pub mod models;

extern crate chrono;
#[macro_use]
extern crate diesel;
extern crate dotenv;
extern crate chrono;
extern crate itertools;

use diesel::pg::PgConnection;
Expand All @@ -31,10 +31,8 @@ impl Transactions {

pub fn new(database_url: &str) -> Transactions {
Transactions {
db: PgConnection::establish(database_url).expect(&format!(
"Error connecting to {}",
database_url
)),
db: PgConnection::establish(database_url)
.expect(&format!("Error connecting to {}", database_url)),
}
}

Expand Down
Empty file added web/src/images/.gitkeep
Empty file.

0 comments on commit 0ee71d0

Please sign in to comment.