Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Update index on elba publish
Browse files Browse the repository at this point in the history
Resolves #47.
  • Loading branch information
David Cao committed Apr 8, 2019
1 parent abb416f commit f882f3f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib/cli/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn login(ctx: &RegistryCtx, token: &str) -> Res<String> {
pub fn yank(bcx: &build::BuildCtx, ctx: &RegistryCtx, name: &Name, ver: &Version) -> Res<()> {
let token = get_token(ctx)?;
let mut cache = Cache::from_disk(&bcx.logger, bcx.global_cache.clone(), bcx.shell)?;
let registry = get_registry(&mut cache, ctx.index.res.clone()).1?;
let registry = get_registry(&mut cache, ctx.index.res.clone(), false).1?;
registry.yank(name, ver, &token)?;
Ok(())
}
Expand All @@ -109,7 +109,7 @@ pub fn yank(bcx: &build::BuildCtx, ctx: &RegistryCtx, name: &Name, ver: &Version
// TODO: Search from multiple indices
pub fn search(bcx: &build::BuildCtx, ctx: &RegistryCtx, query: &str) -> Res<String> {
let mut cache = Cache::from_disk(&bcx.logger, bcx.global_cache.clone(), bcx.shell)?;
let (indices, registry) = get_registry(&mut cache, ctx.index.res.clone());
let (indices, registry) = get_registry(&mut cache, ctx.index.res.clone(), false);
let registry = registry?;

let res = registry.search(&indices, query)?;
Expand All @@ -125,7 +125,7 @@ pub fn search(bcx: &build::BuildCtx, ctx: &RegistryCtx, query: &str) -> Res<Stri
pub fn publish(bcx: &build::BuildCtx, ctx: &RegistryCtx, project: &Path, verify: bool) -> Res<()> {
let token = get_token(ctx)?;
let mut cache = Cache::from_disk(&bcx.logger, bcx.global_cache.clone(), bcx.shell)?;
let registry = get_registry(&mut cache, ctx.index.res.clone()).1?;
let registry = get_registry(&mut cache, ctx.index.res.clone(), true).1?;

let (tar, name, ver) = package(bcx, project, verify)?;
let tar = File::open(tar)?;
Expand Down Expand Up @@ -175,9 +175,9 @@ fn get_token(ctx: &RegistryCtx) -> Res<String> {
})
}

fn get_registry(c: &mut Cache, d: DirectRes) -> (remote::Indices, Res<remote::Registry>) {
fn get_registry(c: &mut Cache, d: DirectRes, eager: bool) -> (remote::Indices, Res<remote::Registry>) {
let dt = d.to_string();
let indices = c.get_indices(&[d], false, false);
let indices = c.get_indices(&[d], eager, false);
let registry = (|| {
indices
.indices
Expand Down

0 comments on commit f882f3f

Please sign in to comment.