rustfmt
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Cadey Ratio 2020-06-12 07:15:36 -04:00
parent 1e71dd87ed
commit afef05b54d
4 changed files with 19 additions and 17 deletions

View File

@ -74,6 +74,9 @@ mod tests {
let res = super::read("testdata/basic.md".into(), "0.1.0".into()); let res = super::read("testdata/basic.md".into(), "0.1.0".into());
assert!(res.is_ok()); assert!(res.is_ok());
let delta = res.unwrap(); let delta = res.unwrap();
assert_eq!(delta, "Hi there this is a test\\!\n### ADDED\n - something\n") assert_eq!(
delta,
"Hi there this is a test\\!\n### ADDED\n - something\n"
)
} }
} }

View File

@ -9,7 +9,8 @@ pub(crate) async fn run(env: DroneEnv) -> Result<()> {
let default_branch = match &env.default_branch { let default_branch = match &env.default_branch {
None => { None => {
let cli = crate::client(&common)?; let cli = crate::client(&common)?;
let repo = crate::gitea::get_repo(&cli, &common.server, &common.owner, &common.repo).await?; let repo =
crate::gitea::get_repo(&cli, &common.server, &common.owner, &common.repo).await?;
repo.default_branch repo.default_branch
} }
Some(branch) => branch.to_string(), Some(branch) => branch.to_string(),

View File

@ -32,12 +32,10 @@ pub(crate) async fn run(
cr.prerelease = rm.pre_release; cr.prerelease = rm.pre_release;
let resp = cli let resp = cli
.post( .post(&format!(
&format!( "{}/api/v1/repos/{}/{}/releases/{}",
"{}/api/v1/repos/{}/{}/releases/{}", common.server, common.owner, common.repo, release.id
common.server, common.owner, common.repo, release.id ))
),
)
.json(&cr) .json(&cr)
.send() .send()
.await?; .await?;

View File

@ -32,33 +32,33 @@ pub(crate) struct Common {
pub(crate) struct DroneEnv { pub(crate) struct DroneEnv {
// Given by drone // Given by drone
/// push URL /// push URL
#[structopt(long, env="DRONE_GIT_HTTP_URL")] #[structopt(long, env = "DRONE_GIT_HTTP_URL")]
pub push_url: String, pub push_url: String,
/// repo owner /// repo owner
#[structopt(long, env="DRONE_REPO_OWNER")] #[structopt(long, env = "DRONE_REPO_OWNER")]
pub owner: String, pub owner: String,
/// repo name /// repo name
#[structopt(long, env="DRONE_REPO_NAME")] #[structopt(long, env = "DRONE_REPO_NAME")]
pub repo: String, pub repo: String,
/// branch /// branch
#[structopt(long, env="DRONE_REPO_BRANCH")] #[structopt(long, env = "DRONE_REPO_BRANCH")]
pub branch: String, pub branch: String,
// Given by the user // Given by the user
/// auth username /// auth username
#[structopt(long, env="PLUGIN_AUTH_USERNAME")] #[structopt(long, env = "PLUGIN_AUTH_USERNAME")]
pub auth_user: String, pub auth_user: String,
/// Gitea server /// Gitea server
#[structopt(long, env="PLUGIN_GITEA_SERVER")] #[structopt(long, env = "PLUGIN_GITEA_SERVER")]
pub server: String, pub server: String,
/// Gitea token /// Gitea token
#[structopt(long, env="PLUGIN_GITEA_TOKEN")] #[structopt(long, env = "PLUGIN_GITEA_TOKEN")]
pub token: String, pub token: String,
/// CHANGELOG path /// CHANGELOG path
#[structopt(long, env="PLUGIN_CHANGELOG_PATH", default_value="./CHANGELOG.md")] #[structopt(long, env = "PLUGIN_CHANGELOG_PATH", default_value = "./CHANGELOG.md")]
pub changelog_path: PathBuf, pub changelog_path: PathBuf,
/// Default branch name /// Default branch name
#[structopt(long, env="PLUGIN_DEFAULT_BRANCH")] #[structopt(long, env = "PLUGIN_DEFAULT_BRANCH")]
pub default_branch: Option<String>, pub default_branch: Option<String>,
} }