Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Initial add.

  • Loading branch information...
commit 89b29f231a788e4beb6cdfe9168da6be8c108d85 0 parents
Mike D Pilsbury authored
2  .gitignore
... ... @@ -0,0 +1,2 @@
  1 +
  2 +node_modules/
298,087 data/district.js
298,087 additions, 0 deletions not shown
1  data/district.json
1 addition, 0 deletions not shown
370,834 data/district.xml
370,834 additions, 0 deletions not shown
6 lib/app.coffee
... ... @@ -0,0 +1,6 @@
  1 +loadLine = require('./line-file').loadLine
  2 +
  3 +loadLine('district', (line) ->
  4 + stopPoints = line.StopPoints.AnnotatedStopPointRef
  5 + console.log(stopPoints.length)
  6 +)
2  lib/boot.js
... ... @@ -0,0 +1,2 @@
  1 +require('coffee-script')
  2 +require('./app')
9 lib/line-file.coffee
... ... @@ -0,0 +1,9 @@
  1 +fs = require('fs')
  2 +
  3 +loadLine = (line, callback) ->
  4 + fs.readFile(__dirname + "/../data/#{line}.json", (err, data) ->
  5 + line = JSON.parse(data)
  6 + callback(line)
  7 + )
  8 +
  9 +exports.loadLine = loadLine
12 lib/line.coffee
... ... @@ -0,0 +1,12 @@
  1 +loadLine = require('./line-file').loadLine
  2 +
  3 +class Line
  4 + constructor: (@name, loadedCallback) ->
  5 + loadLine('district', (@line) =>
  6 + loadedCallback()
  7 + )
  8 +
  9 + created: ->
  10 + new Date(@line['@'].CreationDateTime)
  11 +
  12 +module.exports = Line
218 lib/timetables.sublime-project
... ... @@ -0,0 +1,218 @@
  1 +{
  2 + "auto_complete":
  3 + {
  4 + "selected_items":
  5 + [
  6 + [
  7 + "deb",
  8 + "debugParam"
  9 + ]
  10 + ]
  11 + },
  12 + "buffers":
  13 + [
  14 + {
  15 + "file": "/home/mike/eclipse/workspace/timetables/lib/app.coffee",
  16 + "settings":
  17 + {
  18 + "buffer_size": 163,
  19 + "line_ending": "Unix"
  20 + }
  21 + },
  22 + {
  23 + "file": "/home/mike/eclipse/workspace/timetables/lib/line-file.coffee",
  24 + "settings":
  25 + {
  26 + "buffer_size": 197,
  27 + "line_ending": "Unix"
  28 + }
  29 + }
  30 + ],
  31 + "build_system": "",
  32 + "command_palette":
  33 + {
  34 + "height": 0,
  35 + "selected_items":
  36 + [
  37 + ],
  38 + "width": 0
  39 + },
  40 + "distraction_free":
  41 + {
  42 + "menu_visible": true,
  43 + "show_minimap": false,
  44 + "show_tabs": false,
  45 + "side_bar_visible": false,
  46 + "status_bar_visible": false
  47 + },
  48 + "file_history":
  49 + [
  50 + "/home/mike/.Sublime Text 2/Packages/CoffeeScript/CoffeeScript.sublime-settings",
  51 + "/home/mike/eclipse/workspace/timetables/lib/boot.js",
  52 + "/home/mike/eclipse/workspace/timetables/app.coffee",
  53 + "/home/mike/eclipse/workspace/timetables/line-file.coffee",
  54 + "/home/mike/eclipse/workspace/timetables/read-json.coffee",
  55 + "/home/mike/eclipse/workspace/timetables/xml-to-json.coffee",
  56 + "/home/mike/tmp/xml2js/district.js",
  57 + "/home/mike/tmp/xml2js/read-json.coffee",
  58 + "/home/mike/tmp/xml2js/app.coffee",
  59 + "/home/mike/tmp/xml2js/line-file.coffee",
  60 + "/home/mike/tmp/xml2js/boot.js",
  61 + "/home/mike/.Sublime Text 2/Packages/CoffeeScript/CoffeeScript.tmLanguage",
  62 + "/home/mike/.Sublime Text 2/Packages/User/Base File.sublime-settings",
  63 + "/home/mike/.Sublime Text 2/Packages/JavaScript/JavaScript.sublime-settings",
  64 + "/home/mike/greasemonkey/wahanda-site-debug.user.js",
  65 + "/home/mike/.Sublime Text 2/Packages/JavaScript/JavaScript.tmLanguage",
  66 + "/home/mike/.Sublime Text 2/Packages/JavaScript/JavaScript Indent.tmPreferences",
  67 + "/home/mike/.Sublime Text 2/Packages/C++/C++.sublime-settings",
  68 + "/home/mike/.mozilla/firefox/qreqt9kt.development/gm_scripts/wahanda_site_debug/wahanda_site_debug.user.js",
  69 + "/home/mike/.mozilla/firefox/qreqt9kt.development/gm_scripts/wahanda_debug/wahanda_debug.user.js",
  70 + "/home/mike/greasemonkey/wahanda-debug.user.js",
  71 + "/home/mike/tmp/xml2js/district.xml",
  72 + "/home/mike/tmp/xml2js/district.json",
  73 + "/home/mike/tmp/xml2js/xml-to-json.coffee",
  74 + "/home/mike/tmp/xml2js/test.js"
  75 + ],
  76 + "find_in_files":
  77 + {
  78 + "include_history":
  79 + [
  80 + ],
  81 + "location_history":
  82 + [
  83 + ]
  84 + },
  85 + "find_state":
  86 + {
  87 + "case_sensitive": false,
  88 + "find_history":
  89 + [
  90 + "VehicleJourney",
  91 + "JP_01DIS_H0_279",
  92 + "01DIS0H1515",
  93 + "VehicleJourney"
  94 + ],
  95 + "highlight": true,
  96 + "in_selection": false,
  97 + "preserve_case": false,
  98 + "regex": false,
  99 + "replace_history":
  100 + [
  101 + ],
  102 + "reverse": false,
  103 + "show_context": true,
  104 + "use_buffer": false,
  105 + "whole_word": false,
  106 + "wrap": true
  107 + },
  108 + "groups":
  109 + [
  110 + {
  111 + "selected": 0,
  112 + "sheets":
  113 + [
  114 + {
  115 + "buffer": 0,
  116 + "file": "/home/mike/eclipse/workspace/timetables/lib/app.coffee",
  117 + "settings":
  118 + {
  119 + "buffer_size": 163,
  120 + "regions":
  121 + {
  122 + },
  123 + "selection":
  124 + [
  125 + [
  126 + 0,
  127 + 0
  128 + ]
  129 + ],
  130 + "settings":
  131 + {
  132 + "rulers":
  133 + [
  134 + 100
  135 + ],
  136 + "syntax": "Packages/CoffeeScript/CoffeeScript.tmLanguage"
  137 + },
  138 + "translation.x": 0,
  139 + "translation.y": 0,
  140 + "zoom_level": 1
  141 + },
  142 + "type": "text"
  143 + },
  144 + {
  145 + "buffer": 1,
  146 + "file": "/home/mike/eclipse/workspace/timetables/lib/line-file.coffee",
  147 + "settings":
  148 + {
  149 + "buffer_size": 197,
  150 + "regions":
  151 + {
  152 + },
  153 + "selection":
  154 + [
  155 + [
  156 + 82,
  157 + 82
  158 + ]
  159 + ],
  160 + "settings":
  161 + {
  162 + "syntax": "Packages/CoffeeScript/CoffeeScript.tmLanguage"
  163 + },
  164 + "translation.x": 0,
  165 + "translation.y": 0,
  166 + "zoom_level": 1
  167 + },
  168 + "type": "text"
  169 + }
  170 + ]
  171 + }
  172 + ],
  173 + "layout":
  174 + {
  175 + "cells":
  176 + [
  177 + [
  178 + 0,
  179 + 0,
  180 + 1,
  181 + 1
  182 + ]
  183 + ],
  184 + "cols":
  185 + [
  186 + 0,
  187 + 1
  188 + ],
  189 + "rows":
  190 + [
  191 + 0,
  192 + 1
  193 + ]
  194 + },
  195 + "menu_visible": true,
  196 + "save_all_on_build": true,
  197 + "select_file":
  198 + {
  199 + "height": 0,
  200 + "selected_items":
  201 + [
  202 + ],
  203 + "width": 0
  204 + },
  205 + "select_project":
  206 + {
  207 + "height": 0,
  208 + "selected_items":
  209 + [
  210 + ],
  211 + "width": 0
  212 + },
  213 + "show_minimap": false,
  214 + "show_tabs": true,
  215 + "side_bar_visible": true,
  216 + "side_bar_width": 150,
  217 + "status_bar_visible": true
  218 +}
13 lib/xml-to-json.coffee
... ... @@ -0,0 +1,13 @@
  1 +sys = require('sys')
  2 +fs = require('fs')
  3 +xml2js = require('xml2js')
  4 +
  5 +parser = new xml2js.Parser()
  6 +
  7 +parser.addListener('end', (result) ->
  8 + console.log(JSON.stringify(result))
  9 +)
  10 +
  11 +fs.readFile(__dirname + '/district.xml', (err, data) ->
  12 + parser.parseString(data)
  13 +)
15 test/line-test.coffee
... ... @@ -0,0 +1,15 @@
  1 +Line = require('../lib/line')
  2 +
  3 +exports.load = (test) ->
  4 + new Line('district', ->
  5 + test.ok(true)
  6 +
  7 + test.done()
  8 + )
  9 +
  10 +exports.created = (test) ->
  11 + line = new Line('district', ->
  12 + test.strictEqual(line.created().getDate(), 23)
  13 +
  14 + test.done()
  15 + )

0 comments on commit 89b29f2

Please sign in to comment.
Something went wrong with that request. Please try again.