dorky 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +6 -7
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -56,14 +56,14 @@ function listFiles() {
56
56
  });
57
57
  }
58
58
 
59
- if (process.env.AWS_ACCESS_KEY && process.env.AWS_SECRET_KEY && process.env.AWS_REGION) {
59
+ if (process.env.bucketName && process.env.AWS_ACCESS_KEY && process.env.AWS_SECRET_KEY && process.env.AWS_REGION) {
60
60
  AWS.config.update({
61
61
  accessKeyId: process.env.AWS_ACCESS_KEY,
62
62
  secretAccessKey: process.env.AWS_SECRET_KEY,
63
63
  region: process.env.AWS_REGION
64
64
  });
65
65
  } else {
66
- console.log('Set AWS_ACCESS_KEY, AWS_SECRET_KEY and AWS_REGION first.')
66
+ console.log('Set Bucket Name, AWS_ACCESS_KEY, AWS_SECRET_KEY and AWS_REGION first.')
67
67
  exit();
68
68
  }
69
69
 
@@ -90,7 +90,7 @@ if (args.length == 0) {
90
90
  console.log(rootFolder)
91
91
  function rootFolderExists(rootFolder) {
92
92
  let s3 = new AWS.S3();
93
- const bucketParams = { Bucket: 'dorky' };
93
+ const bucketParams = { Bucket: process.env.bucketName };
94
94
  s3.listObjects(bucketParams, (err, s3Objects) => {
95
95
  if (err) console.log(err);
96
96
  else {
@@ -106,7 +106,7 @@ if (args.length == 0) {
106
106
  else {
107
107
  const putObjectParams = {
108
108
  Bucket: 'dorky',
109
- Key: path.join(rootFolder, path.relative(process.cwd(), file)).replace(/\\/g, '/'),
109
+ Key: path.join(rootFolder, path.relative(process.cwd(), file)).split('\\').join('/'),
110
110
  Body: fs.readFileSync(path.relative(process.cwd(), file)).toString()
111
111
  }
112
112
  // Upload records
@@ -208,7 +208,7 @@ if (args.length == 0) {
208
208
  rootFolder = process.cwd().split('/').pop()
209
209
  } else rootFolder = process.cwd()
210
210
  let s3 = new AWS.S3();
211
- const bucketParams = { Bucket: 'dorky' };
211
+ const bucketParams = { Bucket: process.env.bucketName };
212
212
  s3.listObjects(bucketParams, (err, s3Objects) => {
213
213
  if (err) console.log(err);
214
214
  else {
@@ -231,6 +231,7 @@ if (args.length == 0) {
231
231
  Bucket: 'dorky',
232
232
  Key: rootFolder + '/' + file
233
233
  }
234
+ console.log(pullFileParams)
234
235
  s3.getObject(pullFileParams, (err, data) => {
235
236
  if (err) console.log(err);
236
237
  else {
@@ -242,9 +243,7 @@ if (args.length == 0) {
242
243
  } else if (process.cwd().includes('/')) {
243
244
  subDirectories = path.relative(process.cwd(), file).split('/');
244
245
  } else subDirectories = path.relative(process.cwd(), file)
245
- console.log(subDirectories)
246
246
  subDirectories.pop()
247
- console.log(subDirectories)
248
247
  if (process.platform === "win32") {
249
248
  subDirectories = subDirectories.join('\\')
250
249
  } else if (process.platform === "linux" || process.platform === "darwin") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dorky",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "DevOps Records Keeper.",
5
5
  "main": "index.js",
6
6
  "bin": {