コード例 #1
0
ファイル: gulpfile.js プロジェクト: Pandahisham/rangetouch
gulp.task("docs", function () {
    console.log("Uploading " + version + " docs to " + aws.docs.bucket);

    // Replace versioned files in readme.md
    gulp.src([r00t + "/readme.md"])
        .pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
        .pipe(gulp.dest(r00t));

    // Replace versioned files in rangetouch.js
    gulp.src(path.join(r00t, "src/js/rangetouch.js"))
        .pipe(replace(semver, "v" + version))
        .pipe(gulp.dest(path.join(r00t, "src/js/")));

    // Replace local file paths with remote paths in docs
    // e.g. "../dist/rangetouch.js" to "https://cdn.rangetouch.com/x.x.x/rangetouch.js"
    gulp.src([paths.docs.root + "*.html"])
        .pipe(replace(localpath, "https://" + aws.cdn.bucket + "/" + version))
        .pipe(htmlmin(htmlMinOptions))
        .pipe(s3(aws.docs, options.docs));

    // Upload error.html to cdn (as well as docs site)
    gulp.src([paths.docs.root + "error.html"])
        .pipe(replace(localpath, "https://" + aws.cdn.bucket + "/" + version))
        .pipe(htmlmin(htmlMinOptions))
        .pipe(s3(aws.cdn, options.docs));
});
コード例 #2
0
ファイル: publisher.js プロジェクト: j3parker/frau-publisher
function uploadSemVerAppConfigs( options ) {
	var version = options.getVersion();

	var semVerAppConfigs = getSemVerAppConfigs( version );

	if ( semVerAppConfigs === null ) {
		return util.noop();
	}

	var s3Options = {
		headers: {
			'cache-control': 'public, max-age=600'
		},
		uploadPath: options.getBasePath()
	};

	var gulpS3 = s3( options.getCreds(), s3Options );

	return pipe(
		filter(f => f.path.endsWith('appconfig.json.gz')),
		mirror(
			rename(semVerAppConfigs.major),
			rename(semVerAppConfigs.majorMinor)
		),
		gulpS3
	);
}
コード例 #3
0
gulp.task('s3', BUILD_TASKS, function() {
  var key = process.env.AWS_ACCESS_KEY;
  var secret = process.env.AWS_SECRET_KEY;

  gutil.log('NODE_ENV is ' + process.env.NODE_ENV + '.');

  if (!key || !secret) {
    throw new Error('Please set AWS_ACCESS_KEY and AWS_SECRET_KEY ' +
    'in your environment.');
  }

  // WARNING: Even if deploying to S3 fails, no errors will be raised.
  // https://github.com/nkostelnik/gulp-s3/issues/47

  return gulp.src('./dist/**')
    .pipe(gzip())
    .pipe(s3({
      key: key,
      secret: secret,
      bucket: process.env.AWS_BUCKET || 'teach.mofostaging.net',
      region: process.env.AWS_REGION || 'us-east-1'
    }, {
      gzippedOnly: true,
      headers: {
        'Cache-Control': 'max-age=600, public'
      }
    }));
});
コード例 #4
0
ファイル: publisher.js プロジェクト: j3parker/frau-publisher
		getStream: function() {

			var options = optionsValidator( opts );

			var overwriteCheck = overwrite( options );
			var compressorStream = compressor();
			var s3Options = {
				headers: {
					'cache-control': 'public, max-age=31536000'
				},
				uploadPath: options.getUploadPath()
			};
			var gulpS3 = s3( options.getCreds(), s3Options );

			var duplexStream = es.duplex( overwriteCheck, gulpS3 );

			overwriteCheck
				.pipe( compressorStream )
				.pipe( mirror(
					uploadBundle( options ),
					uploadSemVerAppConfigs( options )
				) );

			return duplexStream;

		},
コード例 #5
0
ファイル: Gulpfile.js プロジェクト: Zolmeister/yummy-cupcake
gulp.task('publish:cloudfront', function () {
 return gulp.src('build/**/*.*')
   .pipe(revall({skip: ['vendor.js'], hashLength: 6}))
   .pipe(gzip())
   .pipe(s3(aws, {gzippedOnly: true}))
   .pipe(cloudfront(aws))
})
コード例 #6
0
ファイル: gulpfile.js プロジェクト: hexicans/plyr
    gulp.task('cdn', () => {
        if (!allowed.includes(branch.current)) {
            console.error(`Must be on ${allowed.join(', ')} to publish! (current: ${branch.current})`);
            return null;
        }

        console.log(`Uploading '${version}' to ${aws.cdn.domain}...`);

        // Upload to CDN
        return (
            gulp
                .src(paths.upload)
                .pipe(
                    rename(p => {
                        p.basename = p.basename.replace(minSuffix, ''); // eslint-disable-line
                        p.dirname = p.dirname.replace('.', version); // eslint-disable-line
                    }),
                )
                // Remove min suffix from source map URL
                .pipe(replace(/sourceMappingURL=([\w-?.]+)/, (match, p1) => `sourceMappingURL=${p1.replace(minSuffix, '')}`))
                .pipe(
                    size({
                        showFiles: true,
                        gzip: true,
                    }),
                )
                .pipe(replace(localPath, versionPath))
                .pipe(s3(aws.cdn, options.cdn))
        );
    });
コード例 #7
0
ファイル: gulpfile.js プロジェクト: BigR-Lab/rodeo
gulp.task('upload', function () {
  const s3 = require('gulp-s3'),
    version = pkg.version;

  return gulp.src(['dist/*/*.{dmg,zip,exe}', 'dist/*.deb'])
    .pipe(rename(function (obj) {
      let arch;

      if (/darwin-x64\//.text(obj.dirname)) {
        arch = 'darwin_64';
      } else if (/linux-x64\//.text(obj.dirname)) {
        arch = 'linux_64';
      } else if (/linux-ia32\//.text(obj.dirname)) {
        arch = 'linux_32';
      } else if (/\/win-ia32\//.text(obj.dirname)) {
        arch = 'win_32';
      } else if (/\/win\//.text(obj.dirname)) {
        arch = 'win_64';
      }

      if (arch) {
        obj.basename = `Rodeo-v${version}-${arch}`;
      } else {
        obj.basename = `Rodeo-v${version}`;
      }

      obj.dirname = path.join(version, obj.dirname);
    }))
    .pipe(s3({
      key: process.env.AWS_ACCESS_KEY_ID,
      secret: process.env.AWS_SECRET_ACCESS_KEY,
      region: process.env.AWS_REGION,
      bucket: 'rodeo-upload-test'
    }));
});
コード例 #8
0
ファイル: s3.js プロジェクト: tylergaw/chrisgeth.com
gulp.task('s3', ['default'], function () {
  var aws = {}, failed;

  // Use the config to create an object for use as params for gulp-s3. Any
  // missing config values or resulting envvars will cause an error.
  ['key', 'secret', 'bucket', 'region'].forEach(function (key) {
    var value = config.deploy.s3[key];
    if (
      config.deploy.s3.hasOwnProperty(key) &&
      typeof value === 'string' &&
      value.length > 0
    ) {
      aws[key] = process.env[value];
      if (aws[key]) {
        success('✓ Required env var %s set', value);
      } else {
        failure('Missing env var: %s', value);
        failed = true;
      }
    } else {
      failure('Missing or bad config.deploy.s3.%s', key);
      failed = true;
    }
  });

  if (!failed) {
    return gulp.src(config.dest + '/**').pipe(s3(aws));
  }
});
コード例 #9
0
ファイル: gulpfile.js プロジェクト: gkoberger/big-gulp
gulp.task('sync', ['default'], function() {
  var awsRoot = JSON.parse(fs.readFileSync(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] + '/.aws.json'));
  var awsLocal = JSON.parse(fs.readFileSync('./aws.json'));
  var aws = _.extend({}, awsLocal, awsRoot);

  gulp.src('build/**').pipe(s3(aws));
});
コード例 #10
0
ファイル: s3.js プロジェクト: qrs/basscss
module.exports = function() {
  var version = require('../package.json').version;
  gulp.src('./css/*.gz')
    .pipe(s3(config, {
      uploadPath: 'basscss/' + version + '/'
    }));
};
コード例 #11
0
ファイル: gulpfile.js プロジェクト: EricBoersma/prague-client
gulp.task('deploy:s3', function(event) {
  var loaderFilter = filter('jquery.donations.loader*');
  var notLoaderFilter = filter('!jquery.donations.loader*');

  return gulp.src(sources.deployment)
    .pipe(debug({verbose: true}))
    .pipe(gzip())
    .pipe(debug({verbose: true}))
    .pipe(loaderFilter)
    .pipe(s3(aws, options.s3noCache))
    .pipe(loaderFilter.restore())
    .pipe(notLoaderFilter)
    .pipe(s3(aws, options.s3))
    .pipe(notLoaderFilter.restore())
    .pipe(debug({verbose: true}))
    .pipe(cloudfront(aws))
});
コード例 #12
0
ファイル: Gulpfile.js プロジェクト: edweena/dollar-x-euro
gulp.task('s3', function(){

    var aws = JSON.parse(fs.readFileSync('./env.json'));

    gulp.src('./build/**')
        .pipe(s3(aws));

});
コード例 #13
0
ファイル: publish.js プロジェクト: zamiang/vislet
gulp.task("publish-images", ['assets', 'compress'], function(cb) {
  var options = {
    headers: {
      "Cache-Control": config.defaultCacheControl
    }};

  // Images are still in dest - no need to move them to public
  gulp.src(["./dest/**/*.png","./dest/**/*.jpg"])
    .pipe(s3(config.aws, options))
    .on('end', cb);
});
コード例 #14
0
gulp.task('fwm:s3_fonts', function () {
        var aws = JSON.parse(fs.readFileSync('aws.json'));

        var options = {
                headers: {'Cache-Control': 'max-age=315360000, no-transform, web' },
                uploadPath: 'fonts/'
        };

        return gulp.src(['web/fonts/*.woff','web/fonts/*.woff2','web/fonts/*.ttf','web/fonts/*.eot','web/fonts/*.svg','web/fonts/*.otf'])
                .pipe(plumber(onError))
                .pipe(s3(aws, options));
});
コード例 #15
0
ファイル: gulpfile.js プロジェクト: jwulf/bgl-calculator
gulp.task('publish-prahlad', function() {
  var s3 = require("gulp-s3");
  var fs = require('fs');
  var awsCredentials = JSON.parse(fs.readFileSync('./aws.json'));
  return gulp.src('src/*.*')
       .pipe(s3(awsCredentials, {
         uploadPath: awsCredentials.prahladPath,
         headers: {
           'x-amz-acl': 'public-read'
         }
       }));
});
コード例 #16
0
ファイル: publish.js プロジェクト: zamiang/vislet
gulp.task("publish-html", ['assets', 'compress'], function(cb) {
  var options = {
    headers: {
      "Cache-Control": config.defaultCacheControl,
      'charset': 'utf-8',
      'Content-Type': 'text/html'
    }};

  gulp.src("./public/**/*.html")
    .pipe(s3(config.aws, options))
    .on('end', cb);
});
コード例 #17
0
ファイル: publisher.js プロジェクト: j3parker/frau-publisher
function uploadBundle( options ) {
	var s3Options = {
		headers: {
			'cache-control': 'public, max-age=31536000'
		},
		uploadPath: options.getUploadPath()
	};

	var gulpS3 = s3( options.getCreds(), s3Options );

	return gulpS3;
}
コード例 #18
0
ファイル: gulpfile.js プロジェクト: hexicans/plyr
    gulp.task('demo', () => {
        if (!allowed.includes(branch.current)) {
            console.error(`Must be on ${allowed.join(', ')} to publish! (current: ${branch.current})`);
            return null;
        }

        console.log(`Uploading '${version}' demo to ${aws.demo.domain}...`);

        // Replace versioned files in readme.md
        gulp
            .src([`${root}/readme.md`])
            .pipe(replace(cdnpath, `${aws.cdn.domain}/${version}/`))
            .pipe(gulp.dest(root));

        // Replace local file paths with remote paths in demo HTML
        // e.g. "../dist/plyr.js" to "https://cdn.plyr.io/x.x.x/plyr.js"
        const index = `${paths.demo.root}index.html`;
        const error = `${paths.demo.root}error.html`;
        const pages = [index];

        if (branch.current === branch.master) {
            pages.push(error);
        }

        gulp
            .src(pages)
            .pipe(replace(localPath, versionPath))
            .pipe(s3(aws.demo, options.demo));

        // Only update CDN for master (prod)
        if (branch.current !== branch.master) {
            return null;
        }

        // Upload error.html to cdn (as well as demo site)
        return gulp
            .src([error])
            .pipe(replace(localPath, versionPath))
            .pipe(s3(aws.cdn, options.demo));
    });
コード例 #19
0
ファイル: gulpfile.js プロジェクト: rafoli/istto-app
gulp.task("deploy-action", function () {
  var credentials = {
    "key":    process.env.TML_S3_KEY || "------",
    "secret": process.env.TML_S3_SECRET || "------",
    "bucket": process.env.TML_S3_BUCKET || "------",
    "region": process.env.TML_S3_REGION || "sa-east-1"
  };

  var s3Options = { headers: {"Cache-Control": "max-age=315360000, no-transform, public"} };

  return gulp.src("build/**")
    .pipe(s3(credentials, s3Options));
});
コード例 #20
0
ファイル: gulpfile.js プロジェクト: daveyclayton/papasmaths
gulp.task('upload', ['build'], function ( )
{
	var src =
	[
		'dist/**/*.gz',
		'dist/**/*.png'
	];

	var credentials = JSON.parse(fs.readFileSync('aws.json')),
		opt = {headers: {'Cache-Control': 'max-age=' + options.s3.ttl}};

    return gulp.src(src).pipe(s3(credentials, opt));
});
コード例 #21
0
gulp.task('fwm:s3_css', function () {
	var aws = JSON.parse(fs.readFileSync('aws.json'));

	var options = {
		headers: {'Cache-Control': 'max-age=315360000, no-transform, web' },
		uploadPath: 'css/',
		gzippedOnly: true
	};

	return gulp.src(['web/css/**/*.css'])
		.pipe(plumber(onError))
		.pipe(gzip())
		.pipe(s3(aws, options));
});
コード例 #22
0
ファイル: publish.js プロジェクト: zamiang/vislet
gulp.task("publish-styles", ['assets', 'compress'], function(cb) {
  var options = {
    headers: {
      "Cache-Control": config.defaultCacheControl,
      'Content-Encoding': 'gzip',
      'Content-Type': 'text/css',
      'charset': 'utf-8'
    }};

  gulp.src("./public/**/*.css")
    .pipe(gzip({ append: false }))
    .pipe(s3(config.aws, options))
    .on('end', cb);
});
コード例 #23
0
ファイル: gulpfile.js プロジェクト: staticbuild/staticbuild
gulp.task('s3', function () {
  var aws = require('./aws.json');
  var opt = {
    headers: {
      'Cache-Control': 'no-transform,public,max-age=300,s-maxage=900',
      'Content-Encoding': 'gzip'
    }
  };
  // We should always be uploading gzipped contents...
  //if (!gzipOn)
  //  delete opt['Content-Encoding'];
  gulp.src(build.destLocale('/**'))
  .pipe(s3(aws, opt));
});
コード例 #24
0
ファイル: gulpfile.js プロジェクト: Pandahisham/rangetouch
gulp.task("cdn", function () {
    console.log("Uploading " + version + " to " + aws.cdn.bucket);

    // Upload to CDN
    gulp.src(paths.upload)
        .pipe(size({
            showFiles: true,
            gzip: true
        }))
        .pipe(rename(function (path) {
            path.dirname = path.dirname.replace(".", version);
        }))
        .pipe(htmlmin(htmlMinOptions))
        .pipe(s3(aws.cdn, options.cdn));
});
コード例 #25
0
gulp.task('deploy', ['build'], function() {
    // Example ./aws.json file contents:

    // {
    //     "key": "AKIAI3Z7CUAFHG53DMJA",
    //     "secret": "acYxWRu5RRa6CwzQuhdXEfTpbQA+1XQJ7Z1bGTCx",
    //     "bucket": "dev.example.com",
    //     "region": "eu-west-1"
    // }

    var aws = JSON.parse(fs.readFileSync('./aws.json'));
    var options = { headers: {'Cache-Control': 'max-age=315360000, no-transform, public'} }
    var options = {};
    gulp.src('./dist/**')
        .pipe(s3(aws, options));
});
コード例 #26
0
ファイル: gulpfile.js プロジェクト: jwulf/bgl-calculator
gulp.task('publish-prahlad-secrets', function() {
  var s3 = require("gulp-s3");
  var fs = require('fs');
  var rename = require('gulp-rename');
  var awsCredentials = JSON.parse(fs.readFileSync('./aws.json'));
  return gulp.src('src/js/prahlad-secrets.js')
       .pipe(rename(function (path) {
          path.basename = 'secrets';
        }))
       .pipe(s3(awsCredentials, {
         uploadPath: awsCredentials.prahladPath +'js/',
         headers: {
           'x-amz-acl': 'public-read'
         }
       }));
});
コード例 #27
0
ファイル: Gulpfile.babel.js プロジェクト: MayankShah/farely
gulp.task('deploy', ['compress:js'], () => {
  const configPath = 'farely-aws.json'
  if (!fs.existsSync(configPath)) {
    return console.log(chalk.bold.red(`${configPath} not found.`))
  }
  gulp.src('./dist/**')
    .pipe(confirm({
      question : 'You\'re sure you want to release? (y/n)',
      input : '_key:y' // Proceed only if 'y' is entered
    }))
    .pipe(gzip())
    .pipe(s3(JSON.parse(fs.readFileSync(configPath)), {
      uploadPath : '/',
      headers : {
        'x-amz-acl' : 'public-read'
      }
    }))
})
コード例 #28
0
gulp.task('s3', BUILD_TASKS, function() {
  var key = process.env.AWS_ACCESS_KEY;
  var secret = process.env.AWS_SECRET_KEY;

  if (!key || !secret)
    throw new Error('Please set AWS_ACCESS_KEY and AWS_SECRET_KEY ' +
      'in your environment.');

  return gulp.src('./dist/**')
    .pipe(gzip())
    .pipe(s3({
      key: key,
      secret: secret,
      bucket: process.env.AWS_BUCKET || 'teach.mofostaging.net',
      region: process.env.AWS_REGION || 'us-east-1'
    }, {
      gzippedOnly: true,
      headers: {
        'Cache-Control': 'max-age=600, public'
      }
    }));
});
コード例 #29
0
ファイル: gulpfile.js プロジェクト: heyitsolivia/sf-icons
gulp.task('publish', function(){
  var s3Version = parseFloat(version).toString();
  gulp.src(paths.dist.img, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/img/',
      delay: 1000,
    }));
  gulp.src(paths.dist.css, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/css/',
      delay: 1000,
    }));
  gulp.src(paths.dist.cssgz, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/css/',
      delay: 1000,
      headers: {
        "Content-Disposition": "inline",
        "Content-Encoding": "gzip",
        "Content-Type": "text/css"
      }
    }));
  gulp.src(paths.dist.js, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/js/',
      delay: 1000,
    }));
  gulp.src(paths.dist.jsgz, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/js/',
      delay: 1000,
      headers: {
        "Content-Disposition": "inline",
        "Content-Encoding": "gzip",
        "Content-Type": "text/javascript"
      }
    }));
  gulp.src(paths.dist.fonts, {read: false})
    .pipe(s3(aws, {
      uploadPath: 'sf-icons/' + s3Version + '/fonts/',
      delay: 1000,
      headers: {
        "Access-Control-Allow-Origin": "*"
      }
    }));
});
コード例 #30
0
ファイル: gulpfile.js プロジェクト: hariv3114/groupSelfie
gulp.task('deploy', ['build'], function () {
  return gulp.src('./dist/**/*').pipe(s3(require('./aws.json')));
});