o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1358533584.816577: @value"{I" class:EFI"ProcessedAsset;FI"logical_path;F"myreplicator/cronwtf.jsI" pathname;F"V/home/sasan/workspace/myreplicator/app/assets/javascripts/myreplicator/cronwtf.jsI"content_type;FI"application/javascript;FI" mtime;FI"2013-01-18T10:25:59-08:00;FI" length;FiI" digest;F"%a75f439e1ad40bb3e91a67e5d8323dcfI" source;FI"var CronWTF = { // parse multiple cron lines, returns an array of messages. parse: function(s) { lines = s.split("\n") messages = [] len = lines.length for(i = 0; i < len; i++) { var line = lines[i] if(line.length > 0 && !line.match(/^#/)) messages.push(this.entry(line).message) } return messages }, // parses a single cron line, returns an object entry: function(line) { pieces = line.replace(/^\s+|\s+$/g, '').split(/\s+/) e = { minutes: this.parseAttribute(pieces[0], 60), hours: this.parseAttribute(pieces[1], 24), days: this.parseAttribute(pieces[2], 31), months: this.parseAttribute(pieces[3], 12), week_days: this.parseAttribute(pieces[4], 8), //command: pieces.slice(5, pieces.length).join(" ") } e.message = this.generateMessage(e); return e; }, // parses an individual time attribute into an array of numbers. // * - every increment (returns '*') // \d+ - that value // 1,2,3 - those values // 1-3 - range of values // */3 - steps parseAttribute: function(value, upperBound) { if(value == '*') return value; if(value.match(/^\*\/\d+$/)) { step = parseInt(value.match(/^\*\/(\d+)$/)[1]) range = [] for(i = 0; i < upperBound; i++) { if(i % step == 0) range.push(i) } return range } if(value.match(/^\d+\-\d+$/)) { matches = value.match(/^(\d+)\-(\d+)$/) lower = parseInt(matches[1]) upper = parseInt(matches[2]) range = [] for(var i = lower; i <= upper; i++) { range.push(i); } return range } return value.split(",") }, // on minute :00, every hour, on months July, August, every week day generateMessage: function(entry) { var attribs = ['minute', 'hour', 'day', 'month', 'week_day'] var attribLen = attribs.length; var msg = [] for(var i = 0; i < attribLen; i++) { var key = attribs[i] + 's' var prev = msg[msg.length -1] var values = entry[key] if(values == '*') { if(!prev || !prev.match(/^every/)) msg.push("every " + attribs[i].replace('_', ' ')) } else { func = this[key + 'Message'] if(func) msg.push(func(values)) } } return "Runs " + msg.join(", ") + "." }, minutesMessage: function(values) { var m = 'at minute' var v = [] var len = values.length; for(var j = 0; j < len; j++) { num = values[j].toString(); if(num.length == 1) num = "0" + num v.push(":" + num) } if(len > 1) m += 's' return m + " " + v.join(", ") }, hoursMessage: function(values) { var m = 'on hour' if(values.length > 1) m += 's' return m + " " + values.join(", ") }, daysMessage: function(values) { var m = 'on day' if(values.length > 1) m += 's' return m + " " + values.join(", ") }, months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], monthsMessage: function(values) { var v = [] var len = values.length; for(var j = 0; j < len; j++) { v.push(CronWTF.months[values[j]]) } return "in " + v.join(", ") }, week_days: ['Sun', 'Mon', "Tue", 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], week_daysMessage: function(values) { var v = [] var len = values.length; for(var j = 0; j < len; j++) { v.push(CronWTF.week_days[values[j]]) } return "on " + v.join(", ") } } var CronUI = { translate: function(){ if($("#cron-slider-trigger-min").attr("checked") != "checked"){ var min = $("#min").val(); min_v = min == null ? '*' : this.process('#min',min) ; }else{ //grab from display as the lag between slider val assignment and the translation causes errors var min = "*/"+$("#cron-n-min").text().replace(':',"") min_v = min; } if($("#cron-slider-trigger-hr").attr("checked") != "checked"){ var hr = $("#hour").val() hr_v = hr == null ? '*' : this.process('#hour',hr) ; }else{ var hr = "*/"+$("#cron-n-hr").text().replace(':',"") hr_v = hr; } var d = $("#day").val(); d_v = d == null ? '*' : this.process('#day',d) ; var mon = $("#month").val(); mon_v = mon == null ? '*' : this.process('#month',mon) ; var dow = $("#dow").val(); dow_v = dow == null ? '*' : this.process('#dow', dow) ; var cron = min_v+" "+hr_v+" "+d_v+" "+mon_v+" "+dow_v; var trans = String(CronWTF.parse(cron)); $("#cron-val").text(cron); $("#export_cron").val(cron); $("#cronwtf").text(trans); }, process: function(id,value){ if(value.indexOf("*") != -1){ $(id).val("*").trigger("liszt:updated"); var all ='*'; return all; }else{ return value; } } } ; ;FI"dependency_digest;F"%cba06d0323548fa7752a67c4aa1a4385I"required_paths;F["V/home/sasan/workspace/myreplicator/app/assets/javascripts/myreplicator/cronwtf.jsI"dependency_paths;F[{I" path;F"V/home/sasan/workspace/myreplicator/app/assets/javascripts/myreplicator/cronwtf.jsI" mtime;FI"2013-01-18T10:25:59-08:00;FI" digest;F"%e64531e70167949998d6e615445b9f56I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862