<commit_before>var settings = require("./settings");
var gulp = require("gulp");
var spsave = require("gulp-spsave");
var replace = require("gulp-replace");
var tap = require("gulp-tap");
var gutil = require("gulp-util");
var del = require("del");
var prompt = require("gulp-prompt");
var inquirer = require("inquirer");
var urlParser = require("url");
var runSequence = require("run-sequence");
var merge = require("merge-stream");
var plumber = require("gulp-plumber");
var pathUtil = require("path");
var Cpass = require("cpass");

var _ = require("lodash");

var styleSettings = _.defaults({folder: "Style Library"}, settings);
var catalogSettings = _.defaults({folder: "_catalogs/wp"}, settings);

function setUsername(username){
    styleSettings = _.extend(styleSettings, { username });
    catalogSettings = _.extend(catalogSettings, { username });
}

function setPassword(password){
    styleSettings = _.extend(styleSettings, { password });
    catalogSettings = _.extend(catalogSettings, { password });
}

function setSiteUrl(url){

    var urlObject = urlParser.parse(url);
    var newSite = { siteUrl: urlObject.href, basePath: urlObject.pathname };

    settings = _.extend(settings, newSite);
    styleSettings = _.extend(styleSettings, newSite);
    catalogSettings = _.extend(catalogSettings, newSite);

}

gulp.task("check-site", function(){
    
    if(!settings.siteUrl || settings.siteUrl == "https://[tenant].sharepoint.com"){
    
        return inquirer.prompt([{
                type: "text",
                name: "site",
                message: "Deployment site:"
            }])
            .then(function(result){
                    setSiteUrl(result.site);
                });
     }else{
        setSiteUrl(settings.siteUrl);
     }
});

gulp.task("check-user", function(){
    
    if(settings.username == "[username]"){
    
        return inquirer.prompt([{
                type: "text",
                name: "user",
                message: "Deployment user:"
            }])
            .then(function(result){
                    setUsername(result.user);
                });
     }
});

gulp.task("check-password", function(){
    
    if(settings.password == "[password]"){

        return inquirer.prompt([{
                type: "password",
                name: "pass",
                message: "Password:"
            }])
            .then(function(result){
                    setPassword(result.pass);
                });
     }
});
<commit_msg>password decryption<commit_after>var settings = require("./settings");
var gulp = require("gulp");
var spsave = require("gulp-spsave");
var replace = require("gulp-replace");
var tap = require("gulp-tap");
var gutil = require("gulp-util");
var del = require("del");
var prompt = require("gulp-prompt");
var inquirer = require("inquirer");
var urlParser = require("url");
var runSequence = require("run-sequence");
var merge = require("merge-stream");
var plumber = require("gulp-plumber");
var pathUtil = require("path");
var Cpass = require("cpass");

var _ = require("lodash");

var styleSettings = _.defaults({folder: "Style Library"}, settings);
var catalogSettings = _.defaults({folder: "_catalogs/wp"}, settings);

function setUsername(username){
    styleSettings = _.extend(styleSettings, { username });
    catalogSettings = _.extend(catalogSettings, { username });
}

function setPassword(password){
    styleSettings = _.extend(styleSettings, { password });
    catalogSettings = _.extend(catalogSettings, { password });
}

function setSiteUrl(url){

    var urlObject = urlParser.parse(url);
    var newSite = { siteUrl: urlObject.href, basePath: urlObject.pathname };

    settings = _.extend(settings, newSite);
    styleSettings = _.extend(styleSettings, newSite);
    catalogSettings = _.extend(catalogSettings, newSite);

}

gulp.task("check-site", function(){
    
    if(!settings.siteUrl || settings.siteUrl == "https://[tenant].sharepoint.com"){
    
        return inquirer.prompt([{
                type: "text",
                name: "site",
                message: "Deployment site:"
            }])
            .then(function(result){
                    setSiteUrl(result.site);
                });
     }else{
        setSiteUrl(settings.siteUrl);
     }
});

gulp.task("check-user", function(){
    
    if(!settings.username || settings.username == "[username]"){
    
        return inquirer.prompt([{
                type: "text",
                name: "user",
                message: "Deployment user:"
            }])
            .then(function(result){
                    setUsername(result.user);
                });
     }
});

gulp.task("check-password", function(){
    
    function decrypt(pass){
        var cp = new Cpass();
        return cp.decode(pass);
    }

    if(!settings.password || settings.password == "[password]"){

        return inquirer.prompt([{
                type: "password",
                name: "pass",
                message: "Password:"
            }])
            .then(function(result){
                    setPassword(result.pass);
                });
     }else{
        setPassword(decrypt(settings.password));
     }
});

{'fraction_non_alphanumeric': 0.15363881401617252, 'fraction_numerical': 0.0, 'mean_word_length': 2.5292119565217392, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '86736', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1410, 'n_words': 295}