<commit_before>"use strict";

var yaml = require('yamljs');

module.exports = {
    write: function (fs, answers, inline) {
        if (!inline) {
            inline = 10;
        }

        var service = {
            apiVersion: 'v1',
            kind: 'Service',
            metadata: {
                name: answers.name,
                namespace: answers.namespace
            },
            spec: {
                ports: [{
                    port: answers.servicePort,
                    targetPort: answers.ContainerPort
                }]
            },
            selector: {
                app: answers.name
            }
        };

        var yamlContent = yaml.stringify(service, inline);
        fs.write('svc.yml', yamlContent);
    },
    getPrompts: function () { 
        var prompts = [{        
            name: 'containerPort',
            type: 'input',
            message: '(Service) In which port is the Container listening?',
            default: 80,
            validate: function (str) {
                return str && !Number.isNaN(str) && Number.isInteger(str) ? true : false;
            },
            filter: function (str) {
                return parseInt(str);
            }
        },{
            name: 'servicePort',
            type: 'input',
            message: '(Service) In which port should the Service listen?',
            default: 80,
            validate: function (str) {
                return str && !Number.isNaN(str) && Number.isInteger(str) ? true : false;
            },
            filter: function (str) {
                return parseInt(str);
            }            
        }];

        return prompts;
    }
}<commit_msg>Fixed incorrect service yaml structure<commit_after>"use strict";

var yaml = require('yamljs');

module.exports = {
    write: function (fs, answers, inline) {
        if (!inline) {
            inline = 10;
        }

        var service = {
            apiVersion: 'v1',
            kind: 'Service',
            metadata: {
                name: answers.name,
                namespace: answers.namespace
            },
            spec: {
                ports: [{
                    port: answers.servicePort,
                    targetPort: answers.ContainerPort
                }],
                selector: {
                    app: answers.name
                }
            }
        };

        var yamlContent = yaml.stringify(service, inline);
        fs.write('svc.yml', yamlContent);
    },
    getPrompts: function () {
        var prompts = [{
            name: 'ContainerPort',
            type: 'input',
            message: '(Service) In which port is the Container listening?',
            default: 80,
            validate: function (str) {
                return str && !Number.isNaN(str) && Number.isInteger(str) ? true : false;
            },
            filter: function (str) {
                return parseInt(str);
            }
        }, {
            name: 'servicePort',
            type: 'input',
            message: '(Service) In which port should the Service listen?',
            default: 80,
            validate: function (str) {
                return str && !Number.isNaN(str) && Number.isInteger(str) ? true : false;
            },
            filter: function (str) {
                return parseInt(str);
            }
        }];

        return prompts;
    }
}
{'fraction_non_alphanumeric': 0.11173184357541899, 'fraction_numerical': 0.004116436342252279, 'mean_word_length': 1.2220770738079687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6688011', 'n_tokens_mistral': 883, 'n_tokens_neox': 825, 'n_words': 214}