Version 0.5.0: Many improvements #8

Merged
cadey merged 5 commits from refactor-git-mod into main 2020-07-09 19:25:58 +00:00
5 changed files with 17 additions and 18 deletions
Showing only changes of commit d5b7b59e3e - Show all commits

View File

@ -2,7 +2,7 @@ use crate::{changelog, cmd::*, git, version};
use anyhow::Result; use anyhow::Result;
use std::path::PathBuf; use std::path::PathBuf;
pub(crate) async fn run( pub async fn run(
common: Common, common: Common,
fname: PathBuf, fname: PathBuf,
tag: Option<String>, tag: Option<String>,

View File

@ -3,7 +3,7 @@ use anyhow::Result;
use git2::Repository; use git2::Repository;
use url::Url; use url::Url;
pub(crate) async fn run(env: DroneEnv) -> Result<()> { pub async fn run(env: DroneEnv) -> Result<()> {
let common: Common = env.clone().into(); let common: Common = env.clone().into();
let default_branch = { let default_branch = {

View File

@ -1,11 +1,11 @@
use std::path::PathBuf; use std::path::PathBuf;
use structopt::StructOpt; use structopt::StructOpt;
pub(crate) mod cut; pub mod cut;
pub(crate) mod drone_plugin; pub mod drone_plugin;
#[derive(StructOpt, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
pub(crate) struct Common { pub struct Common {
/// The gitea server to connect to /// The gitea server to connect to
#[structopt(short, long, env = "GITEA_SERVER")] #[structopt(short, long, env = "GITEA_SERVER")]
pub server: String, pub server: String,
@ -36,7 +36,7 @@ pub(crate) struct Common {
} }
#[derive(StructOpt, Debug, Clone)] #[derive(StructOpt, Debug, Clone)]
pub(crate) struct DroneEnv { pub 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")]
@ -99,7 +99,7 @@ impl Into<Common> for DroneEnv {
} }
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
pub(crate) struct ReleaseMeta { pub struct ReleaseMeta {
/// Release name /// Release name
#[structopt(short, long)] #[structopt(short, long)]
pub name: Option<String>, pub name: Option<String>,
@ -113,7 +113,7 @@ pub(crate) struct ReleaseMeta {
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]
#[structopt(about = "Gitea release assistant")] #[structopt(about = "Gitea release assistant")]
pub(crate) enum Cmd { pub enum Cmd {
/// Create a new tag and release on Gitea /// Create a new tag and release on Gitea
#[structopt(alias = "release")] #[structopt(alias = "release")]
Cut { Cut {

8
src/lib.rs Normal file
View File

@ -0,0 +1,8 @@
pub mod changelog;
pub mod cmd;
pub mod git;
pub mod version;
// Name your user agent after your app?
pub static APP_USER_AGENT: &str =
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));

View File

@ -1,16 +1,7 @@
use anyhow::Result; use anyhow::Result;
use structopt::StructOpt; use structopt::StructOpt;
mod changelog; use ::gitea_release::{cmd::{self, Cmd}};
mod cmd;
mod git;
mod version;
pub(crate) use cmd::*;
// Name your user agent after your app?
pub(crate) static APP_USER_AGENT: &str =
concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"));
#[tokio::main] #[tokio::main]
async fn main() -> Result<()> { async fn main() -> Result<()> {