Closed25

rust で作った cli ツールを公開する

tkttkt
impl M3U8 {
    pub fn to_string(&self) -> &str {
        &self.value
    }
    pub fn url_decode(&self) -> String {
        percent_decode_str(&self.value)
            .decode_utf8()
            .unwrap()
            .to_string()
    }
}

こうやって書いたら

warning: implementation of inherent method `to_string(&self) -> String` for type `domain::models::youtube::video::id::Id`
  --> src/domain/models/youtube/video/id/mod.rs:10:5
   |
10 | /     pub fn to_string(&self) -> String {
11 | |         self.value.clone()
12 | |     }
   | |_____^
   |
   = note: `#[warn(clippy::inherent_to_string)]` on by default
   = help: implement trait `Display` for type `domain::models::youtube::video::id::Id` instead
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#inherent_to_string

なんか怒られた

tkttkt
pub struct Id {
    value: String,
}
pub fn new(st: &str) -> Id {
    Id {
        value: st.to_string(),
    }
}
impl Id {
    pub fn to_string(&self) -> String {
        self.value.clone()
    }
}

こっちだった

tkttkt
use std::fmt;

pub struct Id {
    value: String,
}
pub fn new(st: &str) -> Id {
    Id {
        value: st.to_string(),
    }
}
impl fmt::Display for Id {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "{}", self.value)
    }
}

こう書けとのこと

tkttkt
run pkg_config fail: "`\"pkg-config\" \"--libs\" \"--cflags\" \"openssl\"` did not exit successfully: exit code: 1\n--- stderr\nPackage openssl was not found in the pkg-config search path.\nPerhaps you should add the directory containing `openssl.pc\'\nto the PKG_CONFIG_PATH environment variable\nNo package \'openssl\' found\n"

怒られてる
cross で build した時に
なので

Cross.toml
[target.x86_64-unknown-freebsd]
image = "docker.io/rustembedded/cross:x86_64-unknown-freebsd"

を作ってみる

tkttkt

crates.io に登録して、
メアド登録して、
メールボックスで確認して、
token 取得して、
secrets に貼り付けた

tkttkt
  --- stderr
  thread 'main' panicked at '

  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.58

  ', /cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.58/build/find_normal.rs:157:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

こっちは治らない

tkttkt

cargo.toml の version 変更を triger にしていろいろ走らせたい
tag 切るのと cargo を手で合わせるのがめんどくさい

世の oss は手でやっているんだろうか

tkttkt

できてなかった

  • github release の actions が on: tag: でしか機能しない
  • tag push は branch 指定で行う

ここが共存できないのが問題っぽい

tkttkt
  • 使う token を別途設定する
  • v1 を使う

で実現できそう

このスクラップは2021/03/29にクローズされました