Example #1
0
gulp.task('publish', function () {
    var data = {
        "name": "smart-select",
        "version": "0.2.0",
        "description": "Smart select is replacing and beautifying standard selects while keeping them async",
        "keywords": [
            "select",
            "multi-select",
            "standalone",
            "library",
            "micro",
            "smart"
        ]
    };
    gulp.src("./package.json")
        .pipe(jeditor(data))
        .pipe(gulp.dest("./"));

    gulp.src("./bower.json")
        .pipe(jeditor(function(json) {
            json.name = data.name;
            json.description = data.description;
            json.keywords = data.keywords;
            return json;
        }))
        .pipe(gulp.dest("./"));

    gulp.src("./smartSelect.jquery.json")
        .pipe(jeditor(data))
        .pipe(gulp.dest("./"));
});
Example #2
0
  gulp.task('create semantic.json', function() {

    var
      jsonConfig = install.createJSON(answers)
    ;

    // adjust variables in theme.less
    if( fs.existsSync(files.config) ) {
      console.info('Extending config file (semantic.json)', installPaths.config);
      return gulp.src(installPaths.config)
        .pipe(plumber())
        .pipe(rename(settings.rename.json)) // preserve file extension
        .pipe(jsonEditor(jsonConfig))
        .pipe(gulp.dest(installPaths.configFolder))
      ;
    }
    else {
      console.info('Creating config file (semantic.json)', installPaths.config);
      return gulp.src(source.config)
        .pipe(plumber())
        .pipe(rename({ extname : '' })) // remove .template from ext
        .pipe(jsonEditor(jsonConfig))
        .pipe(gulp.dest(installPaths.configFolder))
      ;
    }

  });
Example #3
0
    }, function(res){

        if(res.bootstrap === 'default') {
            gulp.src('node_modules/bootstrap/dist/css/bootstrap.min.css')
            .pipe(concat('bootstrap.min.css'))
            .pipe(gulp.dest('app/assets/css/'))
            gulp.src("app/config.json")
              .pipe(jeditor({
                'bootstrap': {
                  'theme': 'default'
                }
              }))
              .pipe(gulp.dest("app/"));
        } else if (bootswatch.indexOf(res.bootstrap) != -1 ) {
            gulp.src('node_modules/bootswatch/' + res.bootstrap + '/bootstrap.min.css')
            .pipe(concat('bootstrap.min.css'))
            .pipe(gulp.dest('app/assets/css/')),

            gulp.src("app/config.json")
            .pipe(jeditor({
              'bootstrap': {
                'theme': res.bootstrap
              }
            }))
            .pipe(gulp.dest("app/"));
        }
    }));
Example #4
0
	return promptBump(function(newVer) {
		var streamqueue = require('streamqueue');
		var stream = streamqueue({objectMode: true});

		// make the changelog
		stream.queue(makeChangelog(newVer));

		// update the main project version number
		stream.queue(
			gulp.src('package.json')
				.pipe(jeditor({
					'version': newVer
				}))
				.pipe(gulp.dest("./"))
		);

		stream.queue(
			gulp.src('bower.json')
				.pipe(jeditor({
					'version': newVer
				}))
				.pipe(gulp.dest("./"))
		);

		stream.queue(build(newVer));

		return stream.done();
	});
Example #5
0
gulp.task('meta-align', ['js'], function(){
    var meta = JSON.parse(fs.readFileSync('src/meta.json', 'utf8'));
    var bowerMeta = _.pick(meta, ['name', 'version', 'description', 'license', 'homepage']);
    var nodeMeta = _.pick(meta, ['name', 'version', 'description', 'license', 'repository']);

    var bowerStream = gulp.src('bower.json')
        .pipe(jedit(bowerMeta))
        .pipe(gulp.dest('.'));

    var nodeStream = gulp.src('package.json')
        .pipe(jedit(nodeMeta))
        .pipe(gulp.dest('.'));

    return merge(bowerStream, nodeStream);
});
gulp.task('generate-route', function () {
  var routes = '../routes.json';

  /* init vars */
  initVarsModule();

  function addRoute (jsonRoutes) {

    /* Verify exists module with name equal */
    notExistsRoute = !jsonRoutes.filter(function(route){
      return route.url === moduleURL;
    }).length;

    if ( notExistsRoute ) {
      jsonRoutes.push({
        url: moduleURL,
        path: pathModuleRoute
      });
    }

    return jsonRoutes;
  }

  gulp.src(routes)
    .pipe(jeditor(addRoute))
    .pipe(gulp.dest('../'));
});
Example #7
0
    git.long(function (str) {
        // bump package.json
        gulp.src('./package.json')
            // .pipe(bump({version:'minor'}))
            .pipe(jeditor({
                'lastDocHash': str,
                'version': newVer
            }))
            .pipe(gulp.dest('./'));


        // create changelog
        var opts = {
            repository: 'https://github.com/Envoc/envoc.directives',
            version: newVer
        };

        if(from) opts.from = from;

        changelog(opts, function(err, log) {
            var stream = fs.createWriteStream("changelog.md");
            stream.once('open', function(fd) {
                stream.write(log);
                stream.end();
            });
        });
    })
  gulp.task("metadata", function metadataTask() {
    var metaData = process.env;

    return gulp.src(["package.json"])
      .pipe(jeditor(function packageEditor(json) {
        //set attributes based on environment
        json.version = metaData.bamboo_jira_version &&
          metaData.bamboo_jira_version !== "DEV" ? metaData.bamboo_jira_version : "0.0.0";

        //delete or clear properties not to be published
        //json.optionalDependencies = {};
        if (!json.hasOwnProperty("config")) {
          json.config = {};
        }

        //set config
        json.config.build = metaData.bamboo_buildNumber ? metaData.bamboo_buildNumber : "n/a";
        json.config.buildTimestamp =
          metaData.bamboo_buildTimeStamp ? metaData.bamboo_buildTimeStamp : new global.Date().toISOString();

        return json;
      }))
      .pipe(gulp.dest("Build"))
      .pipe(gulp.dest("."));
  });
Example #9
0
gulp.task('buildBoardJsonDatas', function () {

 var indexBoard  = [];
 var currentFile = "";
 var currentBoardPath = "";

 process.jsonDatasToLoad = [];

 return gulp.src('src/app_data/xml/**/*.xml')
        .pipe(xml2json())
        .pipe(rename({extname: '.json'}))
        .pipe(tap(function (file,t) {
            currentFile = file.relative;
            currentBoardPath = pathUtil.dirname(file.relative);
            console.log(currentBoardPath);
            process.jsonDatasToLoad.push(currentFile);
        }))
        .pipe(jeditor(function(json) {
            indexBoard.push({
            'title':json.board.title,
            'description':json.board.description,
            'boardFile':'/json/'+currentFile,
            'decks':json.board.decks
            });
            return json; // must return JSON object.
        }))
        .pipe(gulp.dest('build/json'))
        .on('end',function(){
            process.jsonDatasToLoad.push(currentBoardPath+'/boards.json');
            jsonfile.writeFileSync('build/json/'+currentBoardPath+'/boards.json', indexBoard);
             console.log(process.jsonDatasToLoad);
             gulp.run('buildAppIndex');
        });
});
Example #10
0
function popup(popup_src) {
    return jeditor({
        browser_action: {
            default_popup: popup_src
        }
    });
}
gulp.task('facebook-strings-json2', function() {
    var cordova = process.env.CORDOVA_CMDLINE || argv.cordova;
    gutil.log('facebook-strings-json2 STARTED CORDOVA_CMDLINE:'+(cordova!=undefined)+'  Production:'+ argv.production);

    var jeditor = require("gulp-json-editor");
    var file = "plugins/android.json";
    return gulp.src(file)
        .pipe(jeditor(function(json) {
            if (argv.production){
                app_id = '1581785262035600';
                app_name = 'Delivery24hs';
            } else {
                app_id = '1630647053816087';
                app_name = 'Delivery24hs local';
            }

            if (app_id!=json['installed_plugins']['phonegap-facebook-plugin'].APP_ID){
                json['installed_plugins']['phonegap-facebook-plugin'].APP_ID = app_id;
            } else gutil.log('json id already configured');

            if (app_name!=json['installed_plugins']['phonegap-facebook-plugin'].APP_NAME){
                json['installed_plugins']['phonegap-facebook-plugin'].APP_NAME = app_name;
            } else gutil.log('json name already configured');

            return json;
        }))
        .pipe(gulp.dest("./plugins/"))
        .on('end', function() {
            return gutil.log('facebook-strings-json2 DONE');
        });
});
Example #12
0
gulp.task('tempDir',['scripts-prod','css-prod'],function(){
    var manifest = gulp.src('manifest.json')
        .pipe(jeditor(function(json){
            var minor_version = Number(manifestFile.version.charAt(manifestFile.version.length - 1));
            var major_version = Number(manifestFile.version.charAt(0));
            if(minor_version + 1 == 10){
                json.version = (major_version + 1) + ".0";
            } else {
                json.version = major_version + "." + (minor_version + 1);
            }
            return json;
        }))
        .pipe(newer(path.tmp))
        .pipe(gulp.dest(path.tmp));
    var dist = gulp.src(path.buildDir + '/*')
        .pipe(newer(path.tmp +'/' + path.buildDir))
        .pipe(gulp.dest(path.tmp +'/' + path.buildDir));
    var images = gulp.src(path.images + '/*')
        .pipe(newer(path.tmp +'/' + path.images))
        .pipe(gulp.dest(path.tmp +'/' +  path.images));
    var templates = gulp.src(path.templates + '/*')
        .pipe(newer(path.tmp +'/' + path.templates))
        .pipe(gulp.dest(path.tmp +'/' +  path.templates));
    return merge(manifest,dist,images,templates);
});
Example #13
0
gulp.task('package', ['clean'], function () {
  return gulp.src('./package.json')
    .pipe(editor({
      main: 'mix',
    }))
    .pipe(gulp.dest('build'));
});
Example #14
0
gulp.task('firefox-package', function() {
  
  packagejson = require('./src/firefox/package.json')
  permissions = packagejson.permissions || {}
  permissions['cross-domain-content'].push("https://" + dev_domain +":"+dev_port+"/")

  gulp.src('./src/firefox/package.json')
    .pipe(jeditor({
      'DEV_WARNING': 'THIS IS NOT the production package; use src/firefox/package.json for permanent changes'
    }))
    .pipe(jeditor({
      'permissions': permissions
    }))    
    .pipe(gulp.dest("./firefox"));

});
Example #15
0
    }, function(res){
        if(res.merge === 'y') {
            gulp.src([
                'app/assets/css/*.css',
                '!app/assets/css/listr.pack.css'
              ])
              .pipe(concat('listr.pack.css'))
              .pipe(gulp.dest('app/assets/css/')),

              gulp.src([
                'app/assets/js/*.js',
                '!app/assets/js/jquery.min.js',
                '!app/assets/js/listr.pack.js'
              ])
              .pipe(concat('listr.pack.js'))
              .pipe(gulp.dest('app/assets/js/'));

              gulp.src("app/config.json")
              .pipe(jeditor({
                'general': {
                  'dependencies': "pack"
                }
              }))
              .pipe(gulp.dest("app/"));
        }
    }));
gulp.task('update_ip', ['get_ip'], function() {
  return gulp.src('./config.json')
      .pipe(jeditor({
        'local_ip': localIP
      }))
      .pipe(gulp.dest('./dist'));
});
Example #17
0
gulp.task("openReport", function(){

  console.log('\nTesting with ',paths.compareConfigFileName);
  console.log('Opening report -> ',paths.compareReportURL + '\n');

  var options = {
    url: paths.compareReportURL
    ,app: isWin ? "chrome" : "Google Chrome"
  };

  // cache bitmaps_reference files locally
  gulp.src(paths.bitmaps_reference + '/**/*')
    .pipe(gulp.dest(referenceDir));

  // cache bitmaps_test files locally
  gulp.src(paths.bitmaps_test + '/**/*')
    .pipe(gulp.dest(testDir));


  gulp.src(paths.compareConfigFileName)
    .pipe(jeditor(function(json) {
      json.testPairs.forEach(function(item){
        var rFile = referenceDir + item.reference.split('/').slice(-1)[0];
        var tFile = testDir + item.test.split('/').slice(-2).join('/');
        item.local_reference = rFile;
        item.local_test = tFile;
      })
      return json;
    }))
    .pipe(rename('compare/config.json'))
    .pipe(gulp.dest('.'))
    .pipe(open("",options));

});
Example #18
0
// Update version and any additional properties.
function makeManifest(dest, props) {
  var manifestProps = Object.assign({}, props);

  return gulp.src(manifest)
    .pipe(jeditor(manifestProps))
    .pipe(gulp.dest(dest));
}
Example #19
0
gulp.task('bump', function() {
    gulp.src('./package.json')
        .pipe(jsonEditor({
            revision: String( Date.now() )
        }))
        .pipe(gulp.dest('./'));
});
Example #20
0
 gulp.task(task.package, false, function() {
   return gulp.src(release.templates.package)
     .pipe(plumber())
     .pipe(flatten())
     .pipe(jsonEditor(function(npm) {
       if(isJavascript) {
         npm.dependencies = {
           jquery: 'x.x.x'
         };
         npm.main = 'index.js';
       }
       npm.name = packageName;
       if(version) {
         npm.version = version;
       }
       npm.title       = 'Semantic UI - ' + capitalizedComponent;
       npm.description = 'Single component release of ' + component;
       npm.repository  = {
         type : 'git',
         url  : gitURL
       };
       return npm;
     }))
     .pipe(gulp.dest(outputDirectory))
   ;
 });
Example #21
0
 gulp.task(task.bower, false, function() {
   return gulp.src(release.templates.bower)
     .pipe(plumber())
     .pipe(flatten())
     .pipe(jsonEditor(function(bower) {
       bower.name = packageName;
       bower.description = capitalizedComponent + ' - Semantic UI';
       if(isJavascript) {
         if(isCSS) {
           bower.main = [
             component + '.js',
             component + '.css'
           ];
         }
         else {
           bower.main = [
             component + '.js'
           ];
         }
         bower.dependencies = {
           jquery: '>=1.8'
         };
       }
       else {
         bower.main = [
           component + '.css'
         ];
       }
       return bower;
     }))
     .pipe(gulp.dest(outputDirectory))
   ;
 });
Example #22
0
gulp.task('extras', function () {
  var packageFileResult = gulp.src(['package.json'], {base: './'})
    .pipe(jeditor(function(json) {
      if (!argv.public) {
        var now = new Date();
        json.version = json.version + '-v' + now.getFullYear() + formatTwoDigitsNumber(now.getMonth() + 1) + formatTwoDigitsNumber(now.getDate()) + '-' + formatTwoDigitsNumber(now.getHours()) + formatTwoDigitsNumber(now.getMinutes()) + formatTwoDigitsNumber(now.getSeconds());
      } else {
        json.private = false;
      }

      json.peerDependencies = json.dependencies;
      json.dependencies = {};
      json.devDependencies = {};
      json.scripts = {};
      return json; // must return JSON object.
    }))
    .pipe(gulp.dest('./.tmp/dist'));

  var extraResult = gulp.src(['./LICENSE','./.gitignore','./README.md','.npmignore'], {base: './'}).pipe(gulp.dest('./.tmp/dist'));


  return merge([
    extraResult,
    packageFileResult
  ])
});
gulp.task('localization-read-template', ['create-localization-template'], function(){
    template = null;
    return  gulp.src(locConfig.src + '/' + locConfig.mainFile)
        .pipe(jeditor(function(json){
            template = json.template;
            return json;
        }));
});
Example #24
0
	return promptBump(function(newVer) {
		var streamqueue = require('streamqueue');
		var stream = streamqueue({ objectMode: true });

		// make the changelog
		stream.queue(makeChangelog(newVer));

		// update the main project version number
		stream.queue(
			gulp.src('package.json')
			.pipe(jeditor({
				'version': newVer
			}))
			.pipe(gulp.dest("./"))
		);

		stream.queue(
			gulp.src('bower.json')
			.pipe(jeditor({
				'version': newVer
			}))
			.pipe(gulp.dest("./"))
		);

		// update docs dependency
		stream.queue(
			gulp.src('famous-angular-docs/bower.json')
			.pipe(jeditor(function(json) {
		        json.dependencies['famous-angular'] = newVer;
				return json; // must return JSON object.
			}))
			.pipe(gulp.dest("famous-angular-docs"))
		);

		// update examples dependency
		stream.queue(
			gulp.src(EXAMPLES_DIR+'bower.json')
			.pipe(jeditor(function(json) {
				json.dependencies['famous-angular'] = newVer;
				return json; // must return JSON object.
			}))
			.pipe(gulp.dest(EXAMPLES_DIR))
		);

		return stream.done();
	});
Example #25
0
function background(globs, options) {
    var scripts = expandGlobs(globs, options);
    return jeditor({
        background: {
            scripts: scripts
        }
    });
}
Example #26
0
gulp.task('manifest:chrome', function() {
  return gulp.src('./dist/chrome/manifest.json')
  .pipe(jsoneditor(function(json) {
    delete json.applications
    return json
  }))
  .pipe(gulp.dest('./dist/chrome', { overwrite: true }))
})
gulp.task('i18n:pseudo', function() {
  gulp.src('src/assets/locales/locale-en.json') // url to source file
    .pipe(jeditor(function(json) {
      return pseudoTranslator(json, {increasePercent: 50});
    }))
    .pipe(rename('locale-gb.json')) // destination file name
    .pipe(gulp.dest('src/assets/locales/')); // destination folder
});
Example #28
0
gulp.task('concatenate_posts', ['compile_posts'], function(){
    return gulp.src('./target/json/posts/*.json')
        .pipe(jsonCombine("posts.json",function(data){
            return new Buffer(JSON.stringify(data));   
        }))
        .pipe(jsonEditor(function(json){return json;}))
        .pipe(gulp.dest('./target/json/'));
});
gulp.task('manifest', () => {
  return gulp.src('src/manifest.json')
    .pipe(jeditor({
      version: version,
      name: name
    }))
    .pipe(gulp.dest(path_map.dest_dir));
});
gulp.task('create-localization-template', ['generate-pot'], function() {
    return gulp.src(config.localization.src + '/' + config.localization.mainFile)
        .pipe(jeditor(function(json){
            json.template = localizations;
            return json;
        }))
        .pipe(gulp.dest(config.localization.src));
});