Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
Changes some method signatures
  • Loading branch information
Vitor Mattos committed Mar 27, 2015
1 parent 3fb62d4 commit 1902ee5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions libs/s3-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/


exports.uploadObject = function(obj, client, bucket, path, dryRun) {
exports.putObject = function(obj, client, bucket, path, dryRun) {
var json, params;
if (dryRun == null) {
dryRun = false;
Expand All @@ -37,7 +37,7 @@
*/


exports.downloadObject = function(client, bucket, path) {
exports.getObject = function(client, bucket, path) {
return Q.ninvoke(client, "getObject", {
Bucket: bucket,
Key: path
Expand Down
10 changes: 5 additions & 5 deletions libs/version-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@


VersionMap.prototype.uploadRegistry = function(registry) {
return utils.uploadObject(registry, this.s3Client, this.bucket, this.registryPath, this.dryRun);
return utils.putObject(registry, this.s3Client, this.bucket, this.registryPath, this.dryRun);
};

/*
Expand All @@ -153,7 +153,7 @@


VersionMap.prototype.downloadRegistry = function() {
return utils.downloadObject(this.s3Client, this.bucket, this.registryPath);
return utils.getObject(this.s3Client, this.bucket, this.registryPath);
};

/*
Expand All @@ -162,8 +162,8 @@


VersionMap.prototype.uploadTags = function(tags) {
utils.uploadObject(tags, this.s3Client, this.bucket, this.tagsPath, this.dryRun);
return utils.uploadObject(tags, this.s3Client, this.bucket, this.newTagsPath, this.dryRun);
utils.putObject(tags, this.s3Client, this.bucket, this.tagsPath, this.dryRun);
return utils.putObject(tags, this.s3Client, this.bucket, this.newTagsPath, this.dryRun);
};

/*
Expand All @@ -172,7 +172,7 @@


VersionMap.prototype.downloadTags = function() {
return utils.downloadObject(this.s3Client, this.bucket, this.tagsPath);
return utils.getObject(this.s3Client, this.bucket, this.tagsPath);
};

/*
Expand Down
4 changes: 2 additions & 2 deletions src/s3-utils.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parseData = (data) -> JSON.parse data.Body
###
Uploads a object to s3
###
exports.uploadObject = (obj, client, bucket, path, dryRun = false) =>
exports.putObject = (obj, client, bucket, path, dryRun = false) =>
json = JSON.stringify(obj)
if dryRun
console.log '\nWARNING: Running in dry run mode. No upload was actually made.\n'
Expand All @@ -23,5 +23,5 @@ exports.uploadObject = (obj, client, bucket, path, dryRun = false) =>
###
Returns a object from s3. If none is found at this path, an empty object is returned.
###
exports.downloadObject = (client, bucket, path) =>
exports.getObject = (client, bucket, path) =>
Q.ninvoke(client, "getObject", { Bucket: bucket, Key: path }).then parseData
10 changes: 5 additions & 5 deletions src/version-map.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ class VersionMap
###
Uploads a registry object to s3
###
uploadRegistry: (registry) => utils.uploadObject(registry, @s3Client, @bucket, @registryPath, @dryRun)
uploadRegistry: (registry) => utils.putObject(registry, @s3Client, @bucket, @registryPath, @dryRun)

###
Returns a registry object.
###
downloadRegistry: => utils.downloadObject(@s3Client, @bucket, @registryPath)
downloadRegistry: => utils.getObject(@s3Client, @bucket, @registryPath)

###
Uploads a tags object to s3
###
uploadTags: (tags) =>
utils.uploadObject(tags, @s3Client, @bucket, @tagsPath, @dryRun)
utils.uploadObject(tags, @s3Client, @bucket, @newTagsPath, @dryRun) #TODO remove once Janus uses new version
utils.putObject(tags, @s3Client, @bucket, @tagsPath, @dryRun)
utils.putObject(tags, @s3Client, @bucket, @newTagsPath, @dryRun) #TODO remove once Janus uses new version

###
Returns a tags object.
###
downloadTags: => utils.downloadObject(@s3Client, @bucket, @tagsPath)
downloadTags: => utils.getObject(@s3Client, @bucket, @tagsPath)

###
Adds version to the registry
Expand Down

0 comments on commit 1902ee5

Please sign in to comment.