Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update dist-tags properly

  • Loading branch information...
commit f628ae309612e2e807bc21f356f78ff4d9fad088 1 parent 337c376
Kris Zyp authored

Showing 1 changed file with 9 additions and 4 deletions. Show diff stats Hide diff stats

  1. +9 4 lib/model/package.js
13 lib/model/package.js
@@ -5,7 +5,7 @@ var Model = require("perstore/model").Model,
5 5 DefaultStore = require("perstore/stores").DefaultStore,
6 6 promiseModule = require("promised-io/promise"),
7 7 queryRepo = require("./git").queryRepo,
8   - host = require("commonjs-utils/settings").host,
  8 + host = require("commonjs-utils/settings").host || "/",
9 9 print = require("sys").puts,
10 10 httpClient = require("promised-io/http-client"),
11 11 when = promiseModule.when,
@@ -99,6 +99,7 @@ function updateVersions(pckg, force){
99 99 var repoName = repo.url.substring(repo.url.indexOf('/',10) + 1);
100 100 print(" querying repo " + repoName);
101 101 var packageUpdates = [];
  102 + var latestVersion;
102 103 return when(queryRepo(repoName).forEach(function(version, type){
103 104 print("add version " + version);
104 105 try{
@@ -107,9 +108,10 @@ function updateVersions(pckg, force){
107 108 // following semver v-prefixing for tags, strip it off
108 109 version = version.substring(1);
109 110 }
  111 + console.log("firstRepo " + firstRepo);
110 112 if(firstRepo && (!versions[version] || force)){
111 113 update();
112   - pckg["dist-tags"] = {"latest":version};
  114 + latestVersion = version;
113 115 }
114 116 var owner = repoName.substring(0, repoName.indexOf("/"));
115 117 version = owner + '-' + version;
@@ -162,8 +164,11 @@ function updateVersions(pckg, force){
162 164 }catch(e){
163 165 print("Error setting version " + e.stack);
164 166 }
165   - }), function(e){
166   - print("error " + e);
  167 + }), function(){
  168 + if(latestVersion && (!pckg["dist-tags"] || pckg["dist-tags"] != latestVersion)){
  169 + pckg["dist-tags"] = {"latest": latestVersion};
  170 + packageStore.put(pckg);
  171 + }
167 172 return all(packageUpdates);
168 173 });
169 174 });

0 comments on commit f628ae3

Please sign in to comment.
Something went wrong with that request. Please try again.