Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Merge foxdie targets together and update crate info (#5)
Browse files Browse the repository at this point in the history
* Merge separate targets together again for improved build times and easier publishing

* Update crate info

* Ran cargo fmt
  • Loading branch information
Aaron Sky authored Nov 2, 2019
1 parent 3cfeb64 commit 3377a53
Show file tree
Hide file tree
Showing 20 changed files with 43 additions and 105 deletions.
21 changes: 0 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
[workspace]
members = [
"src/what_git",
"src/foxdie_services",
"src/foxdie_actions",
"src/foxdie",
]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# foxdie

_A super fast tool for taking stale branches and push requests and deleting and/or closing them_
_A super-fast tool for taking stale branches and push requests and deleting and/or closing them_

[![Actions Status](https://github.com/wayfair/foxdie/workflows/CI/badge.svg?branch=master)](https://github.com/wayfair/foxdie/actions)

Expand Down
15 changes: 13 additions & 2 deletions src/foxdie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@ name = "foxdie"
version = "0.5.0"
authors = ["Aaron Sky <[email protected]>"]
edition = "2018"
description = "A super-fast tool for taking stale branches and push requests and deleting and/or closing them."
license = "BSD-2-Clause"
documentation = "https://docs.rs/foxdie"
homepage = "https://github.com/wayfair/foxdie"
repository = "https://github.com/wayfair/foxdie"

[dependencies]
chrono = { version = "0.4", features = ["serde"] }
clap = "2.33"
chrono = "0.4"
env_logger = "0.6"
git2 = "0.9"
glob = "0.3"
log = "0.4"
foxdie_actions = { version = "0.5.0", path = "../foxdie_actions" }
reqwest = "0.9"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
what_git = { version = "0.5.0", path = "../what_git" }
url = "1.7.2"
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::error::FoxdieError;
use crate::services::{
get_api_client_for_remote, git, ProtectedBranch, PushRequest, PushRequestState,
};
use chrono::{DateTime, FixedOffset};
use foxdie_services::{get_api_client_for_remote, git, PushRequestState};
use log::{info, warn};
use std::env;
use std::path::Path;
Expand Down Expand Up @@ -99,8 +101,8 @@ fn is_branch_to_delete<'a>(
current_branch: &'a git::Branch,
since_date: &'a DateTime<FixedOffset>,
repository: &'a git::Repository,
push_requests: &'a [foxdie_services::PushRequest],
protected_branches: &'a [foxdie_services::ProtectedBranch],
push_requests: &'a [PushRequest],
protected_branches: &'a [ProtectedBranch],
) -> impl FnMut(&git::Branch<'a>) -> bool {
move |branch| {
branch.name().into_iter().flatten().any(|branch_name| {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::error::FoxdieError;
use crate::services::{get_api_client_for_url, PushRequest, PushRequestState};
use chrono::{DateTime, FixedOffset};
use foxdie_services::{get_api_client_for_url, PushRequestState};
use log::info;

pub fn clean_push_requests(
Expand Down Expand Up @@ -58,10 +58,7 @@ pub fn clean_push_requests(
Ok(())
}

fn print_push_requests_to_close(
push_requests: &[foxdie_services::PushRequest],
all_push_requests_count: usize,
) {
fn print_push_requests_to_close(push_requests: &[PushRequest], all_push_requests_count: usize) {
info!(
"Found {} eligible push requests out of {} total{}",
push_requests.len(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::error::FoxdieError;
use crate::services::{git, PushRequest};
use chrono::{DateTime, TimeZone, Utc};
use foxdie_services::{git, PushRequest};
use log::info;
use serde::Serialize;
use serde_json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use foxdie_services::git;
use crate::services::git;
use reqwest;
use serde_json;
use std::error;
Expand Down
4 changes: 3 additions & 1 deletion src/foxdie/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

mod actions;
mod cli;
mod error;
mod services;

use cli::{build_cli, parse_shared_arguments, SharedArguments};
use env_logger;
use foxdie_actions::actions;
use log::{error, warn};
use std::env;
use std::process;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
mod v3;

pub(self) use self::v3::*;
use crate::{PushRequest, PushRequestState, SCMProviderImpl};
use super::{PushRequest, PushRequestState, SCMProviderImpl};
use log::debug;
use reqwest::header;
use reqwest::header::{HeaderMap, HeaderValue};
Expand Down Expand Up @@ -114,7 +114,7 @@ impl SCMProviderImpl for GitHub {
.map(|_| ())
}

fn list_protected_branches(&self) -> ReqwestResult<Vec<crate::ProtectedBranch>> {
fn list_protected_branches(&self) -> ReqwestResult<Vec<super::ProtectedBranch>> {
let url = format!("{}/branches", self.construct_base_url());
let protected_branches: Vec<ProtectedBranch> = self
.client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::PushRequest;
use super::PushRequest;
use chrono::{DateTime, FixedOffset};
use glob::{Pattern, PatternError};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -87,9 +87,9 @@ pub struct ProtectedBranch {
pub name: String,
}

impl From<ProtectedBranch> for Result<crate::ProtectedBranch, PatternError> {
impl From<ProtectedBranch> for Result<super::super::ProtectedBranch, PatternError> {
fn from(branch: ProtectedBranch) -> Self {
let pattern = Pattern::new(&branch.name)?;
Ok(crate::ProtectedBranch { pattern })
Ok(super::super::ProtectedBranch { pattern })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
mod v4;

pub(self) use self::v4::*;
use crate::{PushRequest, PushRequestState, SCMProviderImpl};
use super::{PushRequest, PushRequestState, SCMProviderImpl};
use log::{debug, error};
use reqwest::header::{HeaderMap, HeaderValue};
use reqwest::Client;
Expand Down Expand Up @@ -148,7 +148,7 @@ impl SCMProviderImpl for Gitlab {
.map_err(Gitlab::handle_error)
}

fn list_protected_branches(&self) -> ReqwestResult<Vec<crate::ProtectedBranch>> {
fn list_protected_branches(&self) -> ReqwestResult<Vec<super::ProtectedBranch>> {
let url = format!("{}/protected_branches", self.construct_base_url());
let protected_branches: Vec<ProtectedBranch> = self.client.get(&*url).send()?.json()?;
Ok(protected_branches
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

use crate::PushRequest;
use super::PushRequest;
use chrono::{DateTime, FixedOffset};
use glob::{Pattern, PatternError};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -107,9 +107,9 @@ pub struct ProtectedBranch {
pub name: String,
}

impl From<ProtectedBranch> for Result<crate::ProtectedBranch, PatternError> {
impl From<ProtectedBranch> for Result<super::super::ProtectedBranch, PatternError> {
fn from(branch: ProtectedBranch) -> Self {
let pattern = Pattern::new(&branch.name)?;
Ok(crate::ProtectedBranch { pattern })
Ok(super::super::ProtectedBranch { pattern })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl SCMProvider {
#[derive(Debug)]
pub enum PushRequestState {
Opened,
#[allow(dead_code)]
Closed,
}

Expand Down
17 changes: 0 additions & 17 deletions src/foxdie_actions/Cargo.toml

This file was deleted.

21 changes: 0 additions & 21 deletions src/foxdie_actions/src/lib.rs

This file was deleted.

20 changes: 0 additions & 20 deletions src/foxdie_services/Cargo.toml

This file was deleted.

6 changes: 6 additions & 0 deletions src/what_git/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name = "what_git"
version = "0.5.0"
authors = ["Aaron Sky <[email protected]>"]
edition = "2018"
description = "A crate for determining which SCM your Git URL is associated with."
license = "BSD-2-Clause"
documentation = "https://docs.rs/what_git"
homepage = "https://github.com/wayfair/foxdie"
repository = "https://github.com/wayfair/foxdie"


[dependencies]
reqwest = "0.9"

0 comments on commit 3377a53

Please sign in to comment.