Skip to content

Commit

Permalink
small updates. bump version deps
Browse files Browse the repository at this point in the history
  • Loading branch information
kurtbuilds committed Dec 25, 2023
1 parent abf5d80 commit 4a98f4b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion core/template/base/README.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img src="https://img.shields.io/github/stars/{{ github_repo }}.svg?style=flat-square" alt="Stars" />
</a>
<a href="https://github.com/{{ github_repo }}/actions">
<img src="https://img.shields.io/github/workflow/status/{{ github_repo }}/ci?style=flat-square" alt="Build Status" />
<img src="https://img.shields.io/github/actions/workflow/{{ github_repo }}/ci.yaml?style=flat-square" alt="Build Status" />
</a>
{% block additional_shields %}
{% endblock %}
Expand Down
25 changes: 11 additions & 14 deletions libninja/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,16 +241,16 @@ fn static_shared_http_client(spec: &HirSpec, opt: &PackageConfig) -> TokenStream
}

/// Use this method if you want to add custom middleware to the httpclient.
/// It must be called before any requests are made, otherwise it will have no effect.
/// Example usage:
///
/// ```
/// init_http_client(|| {
/// default_http_client()
/// .with_middleware(..)
/// });
/// init_http_client(default_http_client()
/// .with_middleware(..)
/// );
/// ```
pub fn init_http_client(init: fn() -> httpclient::Client) {
SHARED_HTTPCLIENT.get_or_init(init);
pub fn init_http_client(init: httpclient::Client) {
let _ = SHARED_HTTPCLIENT.set(init);
}

fn shared_http_client() -> &'static httpclient::Client {
Expand All @@ -275,21 +275,18 @@ fn shared_oauth2_flow(auth: &Oauth2Auth, spec: &HirSpec, opts: &PackageConfig) -
quote! {
static SHARED_OAUTH2FLOW: OnceLock<httpclient_oauth2::OAuth2Flow> = OnceLock::new();

pub fn init_oauth2_flow(init: fn() -> httpclient_oauth2::OAuth2Flow) {
SHARED_OAUTH2FLOW.get_or_init(init);
pub fn init_oauth2_flow(init: httpclient_oauth2::OAuth2Flow) {
let _ = SHARED_OAUTH2FLOW.set(init);
}

fn shared_oauth2_flow() -> &'static httpclient_oauth2::OAuth2Flow {
let client_id = std::env::var(#client_id).expect(#client_id_expect);
let client_secret = std::env::var(#client_secret).expect(#client_secret_expect);
let redirect_uri = std::env::var(#redirect_uri).expect(#redirect_uri_expect);
SHARED_OAUTH2FLOW.get_or_init(|| httpclient_oauth2::OAuth2Flow {
client_id,
client_secret,
client_id: std::env::var(#client_id).expect(#client_id_expect),
client_secret: std::env::var(#client_secret).expect(#client_secret_expect),
init_endpoint: #init_endpoint.to_string(),
exchange_endpoint: #exchange_endpoint.to_string(),
refresh_endpoint: #refresh_endpoint.to_string(),
redirect_uri,
redirect_uri: std::env::var(#redirect_uri).expect(#redirect_uri_expect),
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions libninja/src/rust/cargo_toml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn update_cargo_toml(extras: &Extras, opts: &OutputConfig, context: &HashMap
}
let package_version = package.version().to_string();

ensure_dependency(&mut m.dependencies, "httpclient", "0.20.0", &[]);
ensure_dependency(&mut m.dependencies, "httpclient", "0.20.2", &[]);
ensure_dependency(&mut m.dependencies, "serde", "1.0.137", &["derive"]);
ensure_dependency(&mut m.dependencies, "serde_json", "1.0.81", &[]);
ensure_dependency(&mut m.dependencies, "futures", "0.3.25", &[]);
Expand Down Expand Up @@ -77,7 +77,7 @@ pub fn update_cargo_toml(extras: &Extras, opts: &OutputConfig, context: &HashMap
ensure_dependency(&mut m.dependencies, "base64", "0.21.0", &[]);
}
if extras.oauth2 {
ensure_dependency(&mut m.dependencies, "httpclient_oauth2", "0.1.2", &[]);
ensure_dependency(&mut m.dependencies, "httpclient_oauth2", "0.1.3", &[]);
}
m.example = vec![];
fs::write_file(&cargo, &toml::to_string(&m).unwrap())?;
Expand Down

0 comments on commit 4a98f4b

Please sign in to comment.