GitHub PullRequestReviewCommentEvent at 2014-04-01 18:06:47
Repository: Newman
Actor: viig99
Payload: {"comment":{"url":"https://api.github.com/repos/a85/Newman/pulls/comments/11172740","id":11172740,"diff_hunk":"@@ -0,0 +1,66 @@\n+var jsface = require('jsface'),\n+\tlog    = require('./Logger.js'),\n+\t_und   = require('underscore');\n+\n+/** \n+ * @name VariableProcessor\n+ * @namespace\n+ * @classdesc Helper singleton class that does the variable and environment processing for newman\n+ */\n+var VariableProcessor = jsface.Class({\n+\t$singleton: true,\n+\n+\t$statics: {\n+\t\tPATH_REGEX     : new RegExp(),\n+\t\tFUNCTION_REGEX : new RegExp(),\n+\t\tENV_REGEX      : function(key) {\n+\t\t\treturn new RegExp(\"\\{\\{\" + key + \"\\}\\}\", 'g');\n+\t\t}\n+\t},\n+\n+\tgetFunctionVariables: {\n+\t\t\"$guid\": function() {\n+\t\t\treturn \"secret\";\n+\t\t},\n+\t\t\"$timestamp\": (function() {\n+\t\t\treturn Math.round(new Date().getTime() / 1000) })(),\n+\t\t\"$randomint\": (function() {\n+\t\t\treturn 4; })()\n+\t},\n+\n+\t_processPathVariable: function(request) {\n+\t},\n+\n+\t_processFunctionVariable: function(request) {\n+\t},\n+\n+\t_findReplace: function(source, findKey, replaceVal, regex) {\n+\t\treturn source.replace(regex, replaceVal);\n+\t},\n+\n+\t_processEnvVariable: function(request, envJson) {\n+\t\tvar kvpairs = envJson[\"values\"];\n+\t\t\n+\t\tif (kvpairs === undefined) {\n+\t\t\tlog.error(\"Incorrect environemnt JSON file.\");\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\t// TODO: Add processing code for each of these properties\n+\t\tproperties = [\"url\", \"data\", \"headers\"];\n+\n+\t\t_und.each(kvpairs, function(pair) {\n+\t\t\trequest.url =  this._findReplace(request.url, pair[\"key\"], ","path":"src/utilities/VariableProcessor.js","position":53,"original_position":53,"commit_id":"4cded0c8c5afee252394bf8855b6eeaa12eb8c0d","original_commit_id":"5b3409f7dac7e754f7e8ad4fcbac2ebf82aafbdc","user":{"login":"viig99","id":990443,"avatar_url":"https://avatars.githubusercontent.com/u/990443?","gravatar_id":"7bb3320355aa8396ad2b7861460b5d2e","url":"https://api.github.com/users/viig99","html_url":"https://github.com/viig99","followers_url":"https://api.github.com/users/viig99/followers","following_url":"https://api.github.com/users/viig99/following{/other_user}","gists_url":"https://api.github.com/users/viig99/gists{/gist_id}","starred_url":"https://api.github.com/users/viig99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viig99/subscriptions","organizations_url":"https://api.github.com/users/viig99/orgs","repos_url":"https://api.github.com/users/viig99/repos","events_url":"https://api.github.com/users/viig99/events{/privacy}","received_events_url":"https://api.github.com/users/viig99/received_events","type":"User","site_admin":false},"body":"Why cant be just JSON stringify the entire thing, replace the variables and JSON parse it back ? :dart: ","created_at":"2014-04-01T18:06:47Z","updated_at":"2014-04-01T18:06:47Z","html_url":"https://github.com/a85/Newman/pull/14#discussion_r11172740","pull_request_url":"https://api.github.com/repos/a85/Newman/pulls/14","_links":{"self":{"href":"https://api.github.com/repos/a85/Newman/pulls/comments/11172740"},"html":{"href":"https://github.com/a85/Newman/pull/14#discussion_r11172740"},"pull_request":{"href":"https://api.github.com/repos/a85/Newman/pulls/14"}}}}