├── .gitignore ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── README.md └── maps ├── denver ├── output │ └── output_2016-05-13_07-30-00_08-00-00_bus.geojson └── run_denver.rb ├── new_york ├── bower.json ├── bower_components │ └── mustache.js │ │ ├── .bower.json │ │ ├── CHANGELOG.md │ │ ├── LICENSE │ │ ├── MIGRATING.md │ │ ├── README.md │ │ ├── Rakefile │ │ ├── bin │ │ └── mustache │ │ ├── bower.json │ │ ├── hooks │ │ ├── install-hooks.sh │ │ └── pre-commit │ │ ├── mustache.js │ │ ├── mustache.js.nuspec │ │ ├── mustache.min.js │ │ ├── package.json │ │ ├── spec │ │ └── _files │ │ │ ├── bom_as_whitespace.js │ │ │ ├── bom_as_whitespace.mustache │ │ │ └── bom_as_whitespace.txt │ │ └── wrappers │ │ ├── dojo │ │ ├── mustache.js.post │ │ └── mustache.js.pre │ │ ├── jquery │ │ ├── mustache.js.post │ │ └── mustache.js.pre │ │ ├── mootools │ │ ├── mustache.js.post │ │ └── mustache.js.pre │ │ ├── qooxdoo │ │ ├── mustache.js.post │ │ └── mustache.js.pre │ │ └── yui3 │ │ ├── mustache.js.post │ │ └── mustache.js.pre ├── index.html ├── output_2016-01-22_07-30-00_08-00-00_bus.geojson ├── output_2016-01-22_07-30-00_08-00-00_subway.geojson ├── output_2016-01-23_07-30-00_08-00-00_bus.geojson ├── output_2016-01-23_07-30-00_08-00-00_subway.geojson └── run.rb ├── new_york_cartodb └── index.html └── new_york_mapbox_js ├── index.html ├── output_2016-01-22_07-30-00_08-00-00_bus.geojson ├── output_2016-01-22_07-30-00_08-00-00_subway.geojson ├── output_2016-01-23_07-30-00_08-00-00_bus.geojson ├── output_2016-01-23_07-30-00_08-00-00_subway.geojson └── run.rb /.gitignore: -------------------------------------------------------------------------------- 1 | cache/ 2 | transitland.log 3 | transitland.db 4 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | ruby "2.3.0" 3 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | 5 | PLATFORMS 6 | ruby 7 | 8 | DEPENDENCIES 9 | 10 | BUNDLED WITH 11 | 1.11.2 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Tyler A. Green 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *WARNING*: This branch depends on changes to the [Transitland Ruby client](https://github.com/transitland/transitland-ruby-client) gem that have not yet been pushed to RubyGems.org. A Gemfile will be provided once the library changes have been published. For now, the client can be cloned and installed locally. 2 | 3 | # New York City Transit Frequency Visualization 4 | 5 | This script and library uses the [Transitland Datastore](https://github.com/transitland/transitland-datastore) to create a transit frequency visualization for the five boroughs of New York City. The results are visible in `index.html` using [Mapbox](https://github.com/mapbox). 6 | 7 | ## Run Instructions 8 | No gems are required, so simply run `ruby run.rb`. 9 | 10 | ## Output 11 | Two GeoJSON files are produced for each run, one for subway routes and one for bus (and a few ferry) routes for the date, time, and location specified in `run.rb`. The output follows the [Mapbox simplestyle-spec](https://github.com/mapbox/simplestyle-spec/tree/master/1.1.0) for ease of display. 12 | 13 | The four GeoJSON files that are called by `new_york.html` are in the `output` directory. GitHub uses Mapbox, so the intended styling can be seen when previewing these files in GitHub. 14 | 15 | ## Notes 16 | The TransitlandAPIReader uses a local caching mechanism to store the JSON results of queries to the [Transitland Datastore](https://github.com/transitland/transitland-datastore). A JSON file is created on your local system for each API 'endpoint' and is reused when queried on future runs, given that endpoint's requested options are the same. 17 | 18 | ## Potential Improvements 19 | - The TransitlandAPIReader class could be generalized into a gem with a decent test suite, similar to one [Transitland used to maintain](https://github.com/transitland/transitland-ruby-client). 20 | - The run.rb script could take a job spec input to produce GeoJSON files for multiple days and cities in a single run. 21 | - The Mapbox front-end could be used to visualize any arbitrary transit system’s GTFS shape data. This would likely be done using a live Ruby on Rails back-end, rather than the offline Ruby script I am currently using. 22 | -------------------------------------------------------------------------------- /maps/denver/output/output_2016-05-13_07-30-00_08-00-00_bus.geojson: -------------------------------------------------------------------------------- 1 | {"type":"FeatureCollection","features":[{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64fx880-civiccenter~colfaxandlincoln","destination_onestop_id":"s-9xj64gu6jc-18thandcalifornia","frequency":0.08163265306122448,"trips":2,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"Civic Center - Colfax and Lincoln to 18th and California"},"geometry":{"type":"LineString","coordinates":[[-104.986029620867,39.7403826265565],[-104.990246729243,39.7475106005968]]}},{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64gu6jc-18thandcalifornia","destination_onestop_id":"s-9xj64th1bj-denverunionstation","frequency":0.04081632653061224,"trips":1,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"18th and California to Denver Union Station"},"geometry":{"type":"LineString","coordinates":[[-104.990246729243,39.7475106005968],[-105.001828978188,39.7543558705845]]}},{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64th1bj-denverunionstation","destination_onestop_id":"s-9xj64u7e68-denverbuscenter~greyhound","frequency":0.08163265306122448,"trips":2,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"Denver Union Station to Denver Bus Center - Greyhound"},"geometry":{"type":"LineString","coordinates":[[-105.001828978188,39.7543558705845],[-104.991418,39.750467]]}},{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64u7e68-denverbuscenter~greyhound","destination_onestop_id":"s-9xj64th1bj-denverunionstation","frequency":0.04081632653061224,"trips":1,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"Denver Bus Center - Greyhound to Denver Union Station"},"geometry":{"type":"LineString","coordinates":[[-104.991418,39.750467],[-105.001828978188,39.7543558705845]]}},{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64th1bj-denverunionstation","destination_onestop_id":"s-9xj3spd8dn-rtd~colorado~i~25stationgatee","frequency":0.04081632653061224,"trips":1,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"Denver Union Station to RTD - Colorado & I-25 Station Gate E"},"geometry":{"type":"LineString","coordinates":[[-105.001828978188,39.7543558705845],[-104.937883063824,39.6799907496565]]}},{"type":"Feature","properties":{"origin_onestop_id":"s-9xj64th1bj-denverunionstation","destination_onestop_id":"s-9xjmfu0dd3-loveland~greeleypark~ride","frequency":0.04081632653061224,"trips":1,"stroke-width":2,"stroke":"#fdcc8a","description":"Frequency: 0 trips / hour","title":"Denver Union Station to Loveland/Greeley Park & Ride"},"geometry":{"type":"LineString","coordinates":[[-105.001828978188,39.7543558705845],[-104.995545680165,40.4081511533595]]}}]} -------------------------------------------------------------------------------- /maps/denver/run_denver.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ruby 2 | #---------------------------------------------------- 3 | # 4 | # A script that reads the Transitland API and compiles a 5 | # frequency visualization of each consecutive transit 6 | # stops in Denver. 7 | # 8 | # Author: Tyler Green (greent@tyleragreen.com) 9 | # 10 | #---------------------------------------------------- 11 | require 'json' 12 | require 'date' 13 | require 'transitland_client' 14 | 15 | #---------------------------------------------------- 16 | # Constants 17 | #---------------------------------------------------- 18 | OUTPUT_DIR = "output" 19 | START_TIME = Time.new(2016,05,13,7,30,00) 20 | END_TIME = Time.new(2016,05,14,8,00,00) 21 | SECONDS_PER_HOUR = 3600 22 | # FIXME change this to detect light rail vs buses 23 | SUBWAY_ONESTOP_ID = "f-dr5r-nyctsubway" 24 | COORDINATES = [ -105.29, 39.53, 25 | -104.63, 39.99 ] 26 | LINE_WIDTH = 2.5 27 | COLORS = { light: { frequency: 0, 28 | color: '#fdcc8a', 29 | width: 2 30 | }, 31 | medium: { frequency: 3, 32 | color: '#fc8d59', 33 | width: 4, 34 | }, 35 | heavy: { frequency: 8, 36 | color: '#d7301f', 37 | width: 6 38 | }, 39 | } 40 | 41 | #---------------------------------------------------- 42 | # Iterate through the stop pairs (transit route between two stops that departed in the specified time frame) 43 | # and count the number of times each edge occurs to begin to tabulate frequency 44 | def get_edges(pairs) 45 | edges = {} 46 | edges.default = 0 47 | 48 | pairs.each do |edge| 49 | origin_id = edge.get(:origin_onestop_id) 50 | destination_id = edge.get(:destination_onestop_id) 51 | 52 | if origin_id != destination_id 53 | key = [ origin_id, destination_id ] 54 | edges[key] += 1 55 | end 56 | end 57 | 58 | return edges 59 | end 60 | 61 | #---------------------------------------------------- 62 | # Calculate the length of the time frame to calculate frequency 63 | def get_time_frame_length 64 | return (END_TIME - START_TIME) / SECONDS_PER_HOUR 65 | end 66 | 67 | #---------------------------------------------------- 68 | # Return the date in a format used by the output file names 69 | def get_date 70 | return START_TIME.strftime("%Y-%m-%d") 71 | end 72 | 73 | #---------------------------------------------------- 74 | # Main script flow 75 | #---------------------------------------------------- 76 | features = { :bus => [] } 77 | date = START_TIME.strftime("%Y-%m-%d") 78 | time_frame = "#{START_TIME.strftime("%H:%M:%S")},#{END_TIME.strftime("%H:%M:%S")}" 79 | time_frame_url = time_frame.gsub(':','-').split(',').join('_') 80 | 81 | # Fetch from the API a list of all edges between any 82 | # two consecutive transit stops 83 | pairs = TransitlandClient::ScheduleStopPair.find_by(bbox: COORDINATES.join(','), 84 | date: date, 85 | origin_departure_between: time_frame) 86 | # Pre-fetch all the stops within our bounding box so that the individual lookup 87 | # inside the edge loop are faster 88 | stops = TransitlandClient::Stop.find_by(bbox: COORDINATES.join(',')) 89 | 90 | # Convert the schedule stop pairs into edges with weights for occurences in the 91 | # given time frame 92 | edges = get_edges(pairs) 93 | 94 | # Now that we know the number of occurrences of each edge, 95 | # pass through them again to create their properties for an eventual GeoJSON output 96 | edges.each do |edge_key,edge_value| 97 | origin_id, destination_id = edge_key 98 | 99 | origin = TransitlandClient::Stop.find_by(onestop_id: origin_id).first 100 | destination = TransitlandClient::Stop.find_by(onestop_id: destination_id).first 101 | 102 | origin_coordinates = origin.get(:geometry)["coordinates"] 103 | destination_coordinates = destination.get(:geometry)["coordinates"] 104 | coordinates = [ origin_coordinates, destination_coordinates ] 105 | 106 | frequency = edge_value / get_time_frame_length 107 | color = width = nil 108 | 109 | # You are ensured to find a color, as the lowest key is 0 110 | COLORS.each do |key,properties| 111 | if frequency > properties[:frequency] 112 | color = properties[:color] 113 | width = properties[:width] 114 | end 115 | end 116 | 117 | # Remove the Long Island Railroad entries to declutter the map 118 | feeds = origin.get(:imported_from_feed_onestop_ids) & destination.get(:imported_from_feed_onestop_ids) 119 | next if feeds.include?("f-dr5-mtanyclirr") 120 | 121 | # Construct the properties for this GeoJSON feature 122 | properties = { origin_onestop_id: origin_id, 123 | destination_onestop_id: destination_id, 124 | frequency: frequency, 125 | trips: edge_value, 126 | 'stroke-width' => width, 127 | stroke: color, 128 | description: "Frequency: #{frequency.to_i} trips / hour", 129 | title: "#{origin.get(:name)} to #{destination.get(:name)}" 130 | } 131 | 132 | # Add the properties and coordinates to a new GeoJSON feature 133 | feature = { type: 'Feature', 134 | properties: properties, 135 | geometry: { type: 'LineString', 136 | coordinates: coordinates 137 | } 138 | } 139 | 140 | features[:bus] << feature 141 | end 142 | 143 | Dir.mkdir(OUTPUT_DIR) if OUTPUT_DIR && !File.exist?(OUTPUT_DIR) 144 | 145 | # Iterate through the types of feature sets 146 | features.each do |key, feature_array| 147 | 148 | # Output the GeoJSON results to a file 149 | filename = "#{OUTPUT_DIR}/output_#{get_date}_#{time_frame_url}_#{key.to_s}.geojson" 150 | 151 | File.open(filename, 'w') do |f| 152 | f.write JSON.generate({type: 'FeatureCollection', features: feature_array }) 153 | end 154 | 155 | end 156 | -------------------------------------------------------------------------------- /maps/new_york/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "new_york", 3 | "version": "0.0.0", 4 | "homepage": "https://github.com/tyleragreen/frequency-visualization", 5 | "authors": [ 6 | "tyleragreen " 7 | ], 8 | "description": "", 9 | "main": "", 10 | "moduleType": [], 11 | "license": "MIT", 12 | "ignore": [ 13 | "**/.*", 14 | "node_modules", 15 | "bower_components", 16 | "test", 17 | "tests" 18 | ], 19 | "dependencies": { 20 | "mustache.js": "mustache#~2.2.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/.bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mustache.js", 3 | "main": "mustache.js", 4 | "homepage": "https://github.com/janl/mustache.js", 5 | "authors": [ 6 | "mustache.js Authors " 7 | ], 8 | "description": "Logic-less {{mustache}} templates with JavaScript", 9 | "keywords": [ 10 | "mustache", 11 | "template", 12 | "templates", 13 | "ejs" 14 | ], 15 | "moduleType": [ 16 | "amd", 17 | "globals", 18 | "node" 19 | ], 20 | "license": "MIT", 21 | "ignore": [ 22 | "**/.*", 23 | "test" 24 | ], 25 | "version": "2.2.1", 26 | "_release": "2.2.1", 27 | "_resolution": { 28 | "type": "version", 29 | "tag": "v2.2.1", 30 | "commit": "cd06b22dabdaeffe3e4c74ee02bd492a11bbb740" 31 | }, 32 | "_source": "https://github.com/janl/mustache.js.git", 33 | "_target": "~2.2.1", 34 | "_originalSource": "mustache", 35 | "_direct": true 36 | } -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | This project adheres to [Semantic Versioning](http://semver.org/). 5 | 6 | ## [2.2.1] / 13 December 2015 7 | 8 | ### Fixes 9 | 10 | * Improve HTML escaping, by [@phillipj]. 11 | * Fix inconsistency in defining global mustache object, by [@simast]. 12 | * Fix switch-case indent error, by [@norfish]. 13 | * Unpin chai and eslint versions, by [@dasilvacontin]. 14 | * Update README.md with proper grammar, by [@EvanLovely]. 15 | * Update mjackson username in README, by [@mjackson]. 16 | * Remove syntax highlighting in README code sample, by [@imagentleman]. 17 | * Fix typo in README, by [@Xcrucifier]. 18 | * Fix link typo in README, by [@keirog]. 19 | 20 | ## [2.2.0] / 15 October 2015 21 | 22 | ### Added 23 | 24 | * Add Partials support to CLI, by [@palkan]. 25 | 26 | ### Changed 27 | 28 | * Move install instructions to README's top, by [@mateusortiz] 29 | * Improved devhook install output, by [@ShashankaNataraj]. 30 | * Clarifies and improves language in documentation, by [@jfmercer]. 31 | * Linting CLI tool, by [@phillipj]. 32 | * npm 2.x and node v4 on Travis, by [@phillipj]. 33 | 34 | ### Fixes 35 | 36 | * Fix README spelling error to "aforementioned", by [@djchie]. 37 | * Equal error message test in .render() for server and browser, by [@phillipj]. 38 | 39 | ### Dependencies 40 | 41 | * chai -> 3.3.0 42 | * eslint -> 1.6.0 43 | 44 | ## [2.1.3] / 23 July 2015 45 | 46 | ### Added 47 | 48 | * Throw error when providing .render() with invalid template type, by [@phillipj]. 49 | * Documents use of string literals containing double quotes, by [@jfmercer]. 50 | 51 | ### Changed 52 | 53 | * Move mustache gif to githubusercontent, by [@Andersos]. 54 | 55 | ### Fixed 56 | 57 | * Update UMD Shim to be resilient to HTMLElement global pollution, by [@mikesherov]. 58 | 59 | ## [2.1.2] / 17 June 2015 60 | 61 | ### Added 62 | 63 | * Mustache global definition ([#466]) by [@yousefcisco]. 64 | 65 | ## [2.1.1] / 11 June 2015 66 | 67 | ### Added 68 | 69 | * State that we use semver on the change log, by [@dasilvacontin]. 70 | * Added version links to change log, by [@dasilvacontin]. 71 | 72 | ### Fixed 73 | 74 | * Bugfix for using values from view's context prototype, by [@phillipj]. 75 | * Improve test with undefined/null lookup hit using dot notation, by [@dasilvacontin]. 76 | * Bugfix for null/undefined lookup hit when using dot notation, by [@phillipj]. 77 | * Remove moot `version` property from bower.json, by [@kkirsche]. 78 | * bower.json doesn't require a version bump via hook, by [@dasilvacontin]. 79 | 80 | 81 | ## [2.1.0] / 5 June 2015 82 | 83 | * Added license attribute to package.json, by [@pgilad]. 84 | * Minor changes to make mustache.js compatible with both WSH and ASP, by [@nagaozen]. 85 | * Improve CLI view parsing error, by [@phillipj]. 86 | * Bugfix for view context cache, by [@phillipj]. 87 | 88 | ## [2.0.0] / 27 Mar 2015 89 | 90 | * Fixed lookup not stopping upon finding `undefined` or `null` values, by [@dasilvacontin]. 91 | * Refactored pre-commit hook, by [@dasilvacontin]. 92 | 93 | ## [1.2.0] / 24 Mar 2015 94 | 95 | * Added -v option to CLI, by [@phillipj]. 96 | * Bugfix for rendering Number when it serves as the Context, by [@phillipj]. 97 | * Specified files in package.json for a cleaner install, by [@phillipj]. 98 | 99 | ## [1.1.0] / 18 Feb 2015 100 | 101 | * Refactor Writer.renderTokens() for better readability, by [@phillipj]. 102 | * Cleanup tests section in readme, by [@phillipj]. 103 | * Added JSHint to tests/CI, by [@phillipj]. 104 | * Added node v0.12 on travis, by [@phillipj]. 105 | * Created command line tool, by [@phillipj]. 106 | * Added *falsy* to Inverted Sections description in README, by [@kristijanmatic]. 107 | 108 | ## [1.0.0] / 20 Dec 2014 109 | 110 | * Inline tag compilation, by [@mjackson]. 111 | * Fixed AMD registration, volo package.json entry, by [@jrburke]. 112 | * Added spm support, by [@afc163]. 113 | * Only access properties of objects on Context.lookup, by [@cmbuckley]. 114 | 115 | ## [0.8.2] / 17 Mar 2014 116 | 117 | * Supporting Bower through a bower.json file. 118 | 119 | ## [0.8.1] / 3 Jan 2014 120 | 121 | * Fix usage of partial templates. 122 | 123 | ## [0.8.0] / 2 Dec 2013 124 | 125 | * Remove compile* writer functions, use mustache.parse instead. Smaller API. 126 | * Throw an error when rendering a template that contains higher-order sections and 127 | the original template is not provided. 128 | * Remove low-level Context.make function. 129 | * Better code readability and inline documentation. 130 | * Stop caching templates by name. 131 | 132 | ## [0.7.3] / 5 Nov 2013 133 | 134 | * Don't require the original template to be passed to the rendering function 135 | when using compiled templates. This is still required when using higher-order 136 | functions in order to be able to extract the portion of the template 137 | that was contained by that section. Fixes [#262]. 138 | * Performance improvements. 139 | 140 | ## [0.7.2] / 27 Dec 2012 141 | 142 | * Fixed a rendering bug ([#274]) when using nested higher-order sections. 143 | * Better error reporting on failed parse. 144 | * Converted tests to use mocha instead of vows. 145 | 146 | ## [0.7.1] / 6 Dec 2012 147 | 148 | * Handle empty templates gracefully. Fixes [#265], [#267], and [#270]. 149 | * Cache partials by template, not by name. Fixes [#257]. 150 | * Added Mustache.compileTokens to compile the output of Mustache.parse. Fixes 151 | [#258]. 152 | 153 | ## [0.7.0] / 10 Sep 2012 154 | 155 | * Rename Renderer => Writer. 156 | * Allow partials to be loaded dynamically using a callback (thanks 157 | [@TiddoLangerak] for the suggestion). 158 | * Fixed a bug with higher-order sections that prevented them from being 159 | passed the raw text of the section from the original template. 160 | * More concise token format. Tokens also include start/end indices in the 161 | original template. 162 | * High-level API is consistent with the Writer API. 163 | * Allow partials to be passed to the pre-compiled function (thanks 164 | [@fallenice]). 165 | * Don't use eval (thanks [@cweider]). 166 | 167 | ## [0.6.0] / 31 Aug 2012 168 | 169 | * Use JavaScript's definition of falsy when determining whether to render an 170 | inverted section or not. Issue [#186]. 171 | * Use Mustache.escape to escape values inside {{}}. This function may be 172 | reassigned to alter the default escaping behavior. Issue [#244]. 173 | * Fixed a bug that clashed with QUnit (thanks [@kannix]). 174 | * Added volo support (thanks [@guybedford]). 175 | 176 | [2.2.1]: https://github.com/janl/mustache.js/compare/v2.2.0...v2.2.1 177 | [2.2.0]: https://github.com/janl/mustache.js/compare/v2.1.3...v2.2.0 178 | [2.1.3]: https://github.com/janl/mustache.js/compare/v2.1.2...v2.1.3 179 | [2.1.2]: https://github.com/janl/mustache.js/compare/v2.1.1...v2.1.2 180 | [2.1.1]: https://github.com/janl/mustache.js/compare/v2.1.0...v2.1.1 181 | [2.1.0]: https://github.com/janl/mustache.js/compare/v2.0.0...v2.1.0 182 | [2.0.0]: https://github.com/janl/mustache.js/compare/v1.2.0...v2.0.0 183 | [1.2.0]: https://github.com/janl/mustache.js/compare/v1.1.0...v1.2.0 184 | [1.1.0]: https://github.com/janl/mustache.js/compare/v1.0.0...v1.1.0 185 | [1.0.0]: https://github.com/janl/mustache.js/compare/0.8.2...v1.0.0 186 | [0.8.2]: https://github.com/janl/mustache.js/compare/0.8.1...0.8.2 187 | [0.8.1]: https://github.com/janl/mustache.js/compare/0.8.0...0.8.1 188 | [0.8.0]: https://github.com/janl/mustache.js/compare/0.7.3...0.8.0 189 | [0.7.3]: https://github.com/janl/mustache.js/compare/0.7.2...0.7.3 190 | [0.7.2]: https://github.com/janl/mustache.js/compare/0.7.1...0.7.2 191 | [0.7.1]: https://github.com/janl/mustache.js/compare/0.7.0...0.7.1 192 | [0.7.0]: https://github.com/janl/mustache.js/compare/0.6.0...0.7.0 193 | [0.6.0]: https://github.com/janl/mustache.js/compare/0.5.2...0.6.0 194 | 195 | [#186]: https://github.com/janl/mustache.js/issues/186 196 | [#244]: https://github.com/janl/mustache.js/issues/244 197 | [#257]: https://github.com/janl/mustache.js/issues/257 198 | [#258]: https://github.com/janl/mustache.js/issues/258 199 | [#262]: https://github.com/janl/mustache.js/issues/262 200 | [#265]: https://github.com/janl/mustache.js/issues/265 201 | [#267]: https://github.com/janl/mustache.js/issues/267 202 | [#270]: https://github.com/janl/mustache.js/issues/270 203 | [#274]: https://github.com/janl/mustache.js/issues/274 204 | [#466]: https://github.com/janl/mustache.js/issues/466 205 | 206 | [@afc163]: https://github.com/afc163 207 | [@Andersos]: https://github.com/Andersos 208 | [@cmbuckley]: https://github.com/cmbuckley 209 | [@cweider]: https://github.com/cweider 210 | [@dasilvacontin]: https://github.com/dasilvacontin 211 | [@djchie]: https://github.com/djchie 212 | [@EvanLovely]: https://github.com/EvanLovely 213 | [@fallenice]: https://github.com/fallenice 214 | [@guybedford]: https://github.com/guybedford 215 | [@imagentleman]: https://github.com/imagentleman 216 | [@jfmercer]: https://github.com/jfmercer 217 | [@jrburke]: https://github.com/jrburke 218 | [@kannix]: https://github.com/kannix 219 | [@keirog]: https://github.com/keirog 220 | [@kkirsche]: https://github.com/kkirsche 221 | [@kristijanmatic]: https://github.com/kristijanmatic 222 | [@mateusortiz]: https://github.com/mateusortiz 223 | [@mikesherov]: https://github.com/mikesherov 224 | [@mjackson]: https://github.com/mjackson 225 | [@nagaozen]: https://github.com/nagaozen 226 | [@norfish]: https://github.com/norfish 227 | [@palkan]: https://github.com/palkan 228 | [@pgilad]: https://github.com/pgilad 229 | [@phillipj]: https://github.com/phillipj 230 | [@ShashankaNataraj]: https://github.com/ShashankaNataraj 231 | [@simast]: https://github.com/simast 232 | [@TiddoLangerak]: https://github.com/TiddoLangerak 233 | [@Xcrucifier]: https://github.com/Xcrucifier 234 | [@yousefcisco]: https://github.com/yousefcisco 235 | -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2009 Chris Wanstrath (Ruby) 4 | Copyright (c) 2010-2014 Jan Lehnardt (JavaScript) 5 | Copyright (c) 2010-2015 The mustache.js community 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 12 | -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/MIGRATING.md: -------------------------------------------------------------------------------- 1 | # Migrating Guide 2 | 3 | ## Moving to mustache.js v2 4 | 5 | ### Overview 6 | 7 | mustache.js v2 introduces a bug fix that breaks compatibility with older versions: fixing null and undefined lookup. 8 | 9 | When mustache.js tries to render a variable `{{name}}`, it executes a `lookup` function to figure out which value it should render. This function looks up the value for the key `name` in the current context, and if there is no such key in the current context it looks up the parent contexts recursively. 10 | 11 | Value lookup should stop whenever the key exists in the context. However, due to a bug, this was not happening when the value was `null` or `undefined` even though the key existed in the context. 12 | 13 | Here's a simple example of the same template rendered with both mustache.js v1 and v2: 14 | 15 | Template: 16 | ```mustache 17 | {{#friends}} 18 | {{name}}'s twitter is: {{twitter}} 19 | {{/friends}} 20 | ``` 21 | 22 | View: 23 | ```json 24 | { 25 | "name": "David", 26 | "twitter": "@dasilvacontin", 27 | "friends": [ 28 | { 29 | "name": "Phillip", 30 | "twitter": "@phillipjohnsen" 31 | }, 32 | { 33 | "name": "Jan", 34 | "twitter": null 35 | } 36 | ] 37 | } 38 | ``` 39 | 40 | Rendered using mustache.js v1: 41 | ```text 42 | Phillip's twitter is: @phillipjohnsen 43 | Jan's twitter is: @dasilvacontin 44 | ``` 45 | 46 | Rendered using mustache.js v2: 47 | ```text 48 | Phillip's twitter is: @phillipjohnsen 49 | Jan's twitter is: 50 | ``` -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/README.md: -------------------------------------------------------------------------------- 1 | # mustache.js - Logic-less {{mustache}} templates with JavaScript 2 | 3 | > What could be more logical awesome than no logic at all? 4 | 5 | [![Build Status](https://travis-ci.org/janl/mustache.js.svg?branch=master)](https://travis-ci.org/janl/mustache.js) [![Gitter chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/janl/mustache.js) 6 | 7 | [mustache.js](http://github.com/janl/mustache.js) is an implementation of the [mustache](http://mustache.github.com/) template system in JavaScript. 8 | 9 | [Mustache](http://mustache.github.com/) is a logic-less template syntax. It can be used for HTML, config files, source code - anything. It works by expanding tags in a template using values provided in a hash or object. 10 | 11 | We call it "logic-less" because there are no if statements, else clauses, or for loops. Instead there are only tags. Some tags are replaced with a value, some nothing, and others a series of values. 12 | 13 | For a language-agnostic overview of mustache's template syntax, see the `mustache(5)` [manpage](http://mustache.github.com/mustache.5.html). 14 | 15 | ## Where to use mustache.js? 16 | 17 | You can use mustache.js to render mustache templates anywhere you can use JavaScript. This includes web browsers, server-side environments such as [node](http://nodejs.org/), and [CouchDB](http://couchdb.apache.org/) views. 18 | 19 | mustache.js ships with support for both the [CommonJS](http://www.commonjs.org/) module API and the [Asynchronous Module Definition](https://github.com/amdjs/amdjs-api/wiki/AMD) API, or AMD. 20 | 21 | And this will be your templates after you use Mustache: 22 | 23 | !['stache](https://cloud.githubusercontent.com/assets/288977/8779228/a3cf700e-2f02-11e5-869a-300312fb7a00.gif) 24 | 25 | ## Install 26 | 27 | You can get Mustache via npm. 28 | 29 | ```bash 30 | $ npm install mustache --save 31 | ``` 32 | or install with bower: 33 | 34 | ```bash 35 | $ bower install --save mustache 36 | ``` 37 | 38 | ## Command line tool 39 | 40 | mustache.js is shipped with a node based command line tool. It might be installed as a global tool on your computer to render a mustache template of some kind 41 | 42 | ```bash 43 | $ npm install -g mustache 44 | 45 | $ mustache dataView.json myTemplate.mustache > output.html 46 | ``` 47 | 48 | also supports stdin. 49 | 50 | ```bash 51 | $ cat dataView.json | mustache - myTemplate.mustache > output.html 52 | ``` 53 | 54 | or as a package.json `devDependency` in a build process maybe? 55 | 56 | ```bash 57 | $ npm install mustache --save-dev 58 | ``` 59 | 60 | ```json 61 | { 62 | "scripts": { 63 | "build": "mustache dataView.json myTemplate.mustache > public/output.html" 64 | } 65 | } 66 | ``` 67 | ```bash 68 | $ npm run build 69 | ``` 70 | 71 | The command line tool is basically a wrapper around `Mustache.render` so you get all the features. 72 | 73 | If your templates use partials you should pass paths to partials using `-p` flag: 74 | 75 | ```bash 76 | $ mustache -p path/to/partial1.mustache -p path/to/partial2.mustache dataView.json myTemplate.mustache 77 | ``` 78 | 79 | ## Who uses mustache.js? 80 | 81 | An updated list of mustache.js users is kept [on the Github wiki](http://wiki.github.com/janl/mustache.js/beard-competition). Add yourself or your company if you use mustache.js! 82 | 83 | ## Contributing 84 | 85 | mustache.js is a mature project, but it continues to actively invite maintainers. You can help out a high-profile project that is used in a lot of places on the web. There is [plenty](https://github.com/janl/mustache.js/issues) of [work](https://github.com/janl/mustache.js/pulls) to do. No big commitment required, if all you do is review a single [Pull Request](https://github.com/janl/mustache.js/pulls), you are a maintainer. And a hero. 86 | 87 | ### Your First Contribution 88 | 89 | - review a [Pull Request](https://github.com/janl/mustache.js/pulls) 90 | - fix an [Issue](https://github.com/janl/mustache.js/issues) 91 | - update the [documentation](https://github.com/janl/mustache.js#usage) 92 | - make a website 93 | - write a tutorial 94 | 95 | * * * 96 | 97 | ## Usage 98 | 99 | Below is a quick example how to use mustache.js: 100 | 101 | ```js 102 | var view = { 103 | title: "Joe", 104 | calc: function () { 105 | return 2 + 4; 106 | } 107 | }; 108 | 109 | var output = Mustache.render("{{title}} spends {{calc}}", view); 110 | ``` 111 | 112 | In this example, the `Mustache.render` function takes two parameters: 1) the [mustache](http://mustache.github.com/) template and 2) a `view` object that contains the data and code needed to render the template. 113 | 114 | ## Templates 115 | 116 | A [mustache](http://mustache.github.com/) template is a string that contains any number of mustache tags. Tags are indicated by the double mustaches that surround them. `{{person}}` is a tag, as is `{{#person}}`. In both examples we refer to `person` as the tag's key. There are several types of tags available in mustache.js, described below. 117 | 118 | There are several techniques that can be used to load templates and hand them to mustache.js, here are two of them: 119 | 120 | #### Include Templates 121 | 122 | If you need a template for a dynamic part in a static website, you can consider including the template in the static HTML file to avoid loading templates separately. Here's a small example using `jQuery`: 123 | 124 | ```html 125 | 126 | 127 |
Loading...
128 | 131 | 132 | 133 | ``` 134 | 135 | ```js 136 | function loadUser() { 137 | var template = $('#template').html(); 138 | Mustache.parse(template); // optional, speeds up future uses 139 | var rendered = Mustache.render(template, {name: "Luke"}); 140 | $('#target').html(rendered); 141 | } 142 | ``` 143 | 144 | #### Load External Templates 145 | 146 | If your templates reside in individual files, you can load them asynchronously and render them when they arrive. Another example using `jQuery`: 147 | 148 | ```js 149 | function loadUser() { 150 | $.get('template.mst', function(template) { 151 | var rendered = Mustache.render(template, {name: "Luke"}); 152 | $('#target').html(rendered); 153 | }); 154 | } 155 | ``` 156 | 157 | ### Variables 158 | 159 | The most basic tag type is a simple variable. A `{{name}}` tag renders the value of the `name` key in the current context. If there is no such key, nothing is rendered. 160 | 161 | All variables are HTML-escaped by default. If you want to render unescaped HTML, use the triple mustache: `{{{name}}}`. You can also use `&` to unescape a variable. 162 | 163 | If you want `{{name}}` _not_ to be interpreted as a mustache tag, but rather to appear exactly as `{{name}}` in the output, you must change and then restore the default delimiter. See the ["Set Delimiter"](https://github.com/janl/mustache.js#set-delimiter) section for more information about custom delimiters. 164 | 165 | View: 166 | 167 | ```json 168 | { 169 | "name": "Chris", 170 | "company": "GitHub" 171 | } 172 | ``` 173 | 174 | Template: 175 | 176 | ``` 177 | * {{name}} 178 | * {{age}} 179 | * {{company}} 180 | * {{{company}}} 181 | * {{&company}} 182 | {{=<% %>=}} 183 | * {{company}} 184 | <%={{ }}=%> 185 | ``` 186 | 187 | Output: 188 | 189 | ```html 190 | * Chris 191 | * 192 | * <b>GitHub</b> 193 | * GitHub 194 | * GitHub 195 | * {{company}} 196 | ``` 197 | 198 | JavaScript's dot notation may be used to access keys that are properties of objects in a view. 199 | 200 | View: 201 | 202 | ```json 203 | { 204 | "name": { 205 | "first": "Michael", 206 | "last": "Jackson" 207 | }, 208 | "age": "RIP" 209 | } 210 | ``` 211 | 212 | Template: 213 | 214 | ```html 215 | * {{name.first}} {{name.last}} 216 | * {{age}} 217 | ``` 218 | 219 | Output: 220 | 221 | ```html 222 | * Michael Jackson 223 | * RIP 224 | ``` 225 | 226 | ### Sections 227 | 228 | Sections render blocks of text one or more times, depending on the value of the key in the current context. 229 | 230 | A section begins with a pound and ends with a slash. That is, `{{#person}}` begins a `person` section, while `{{/person}}` ends it. The text between the two tags is referred to as that section's "block". 231 | 232 | The behavior of the section is determined by the value of the key. 233 | 234 | #### False Values or Empty Lists 235 | 236 | If the `person` key does not exist, or exists and has a value of `null`, `undefined`, `false`, `0`, or `NaN`, or is an empty string or an empty list, the block will not be rendered. 237 | 238 | View: 239 | 240 | ```json 241 | { 242 | "person": false 243 | } 244 | ``` 245 | 246 | Template: 247 | 248 | ```html 249 | Shown. 250 | {{#person}} 251 | Never shown! 252 | {{/person}} 253 | ``` 254 | 255 | Output: 256 | 257 | ```html 258 | Shown. 259 | ``` 260 | 261 | #### Non-Empty Lists 262 | 263 | If the `person` key exists and is not `null`, `undefined`, or `false`, and is not an empty list the block will be rendered one or more times. 264 | 265 | When the value is a list, the block is rendered once for each item in the list. The context of the block is set to the current item in the list for each iteration. In this way we can loop over collections. 266 | 267 | View: 268 | 269 | ```json 270 | { 271 | "stooges": [ 272 | { "name": "Moe" }, 273 | { "name": "Larry" }, 274 | { "name": "Curly" } 275 | ] 276 | } 277 | ``` 278 | 279 | Template: 280 | 281 | ```html 282 | {{#stooges}} 283 | {{name}} 284 | {{/stooges}} 285 | ``` 286 | 287 | Output: 288 | 289 | ```html 290 | Moe 291 | Larry 292 | Curly 293 | ``` 294 | 295 | When looping over an array of strings, a `.` can be used to refer to the current item in the list. 296 | 297 | View: 298 | 299 | ```json 300 | { 301 | "musketeers": ["Athos", "Aramis", "Porthos", "D'Artagnan"] 302 | } 303 | ``` 304 | 305 | Template: 306 | 307 | ```html 308 | {{#musketeers}} 309 | * {{.}} 310 | {{/musketeers}} 311 | ``` 312 | 313 | Output: 314 | 315 | ```html 316 | * Athos 317 | * Aramis 318 | * Porthos 319 | * D'Artagnan 320 | ``` 321 | 322 | If the value of a section variable is a function, it will be called in the context of the current item in the list on each iteration. 323 | 324 | View: 325 | 326 | ```js 327 | { 328 | "beatles": [ 329 | { "firstName": "John", "lastName": "Lennon" }, 330 | { "firstName": "Paul", "lastName": "McCartney" }, 331 | { "firstName": "George", "lastName": "Harrison" }, 332 | { "firstName": "Ringo", "lastName": "Starr" } 333 | ], 334 | "name": function () { 335 | return this.firstName + " " + this.lastName; 336 | } 337 | } 338 | ``` 339 | 340 | Template: 341 | 342 | ```html 343 | {{#beatles}} 344 | * {{name}} 345 | {{/beatles}} 346 | ``` 347 | 348 | Output: 349 | 350 | ```html 351 | * John Lennon 352 | * Paul McCartney 353 | * George Harrison 354 | * Ringo Starr 355 | ``` 356 | 357 | #### Functions 358 | 359 | If the value of a section key is a function, it is called with the section's literal block of text, un-rendered, as its first argument. The second argument is a special rendering function that uses the current view as its view argument. It is called in the context of the current view object. 360 | 361 | View: 362 | 363 | ```js 364 | { 365 | "name": "Tater", 366 | "bold": function () { 367 | return function (text, render) { 368 | return "" + render(text) + ""; 369 | } 370 | } 371 | } 372 | ``` 373 | 374 | Template: 375 | 376 | ```html 377 | {{#bold}}Hi {{name}}.{{/bold}} 378 | ``` 379 | 380 | Output: 381 | 382 | ```html 383 | Hi Tater. 384 | ``` 385 | 386 | ### Inverted Sections 387 | 388 | An inverted section opens with `{{^section}}` instead of `{{#section}}`. The block of an inverted section is rendered only if the value of that section's tag is `null`, `undefined`, `false`, *falsy* or an empty list. 389 | 390 | View: 391 | 392 | ```json 393 | { 394 | "repos": [] 395 | } 396 | ``` 397 | 398 | Template: 399 | 400 | ```html 401 | {{#repos}}{{name}}{{/repos}} 402 | {{^repos}}No repos :({{/repos}} 403 | ``` 404 | 405 | Output: 406 | 407 | ```html 408 | No repos :( 409 | ``` 410 | 411 | ### Comments 412 | 413 | Comments begin with a bang and are ignored. The following template: 414 | 415 | ```html 416 |

Today{{! ignore me }}.

417 | ``` 418 | 419 | Will render as follows: 420 | 421 | ```html 422 |

Today.

423 | ``` 424 | 425 | Comments may contain newlines. 426 | 427 | ### Partials 428 | 429 | Partials begin with a greater than sign, like {{> box}}. 430 | 431 | Partials are rendered at runtime (as opposed to compile time), so recursive partials are possible. Just avoid infinite loops. 432 | 433 | They also inherit the calling context. Whereas in ERB you may have this: 434 | 435 | ```html+erb 436 | <%= partial :next_more, :start => start, :size => size %> 437 | ``` 438 | 439 | Mustache requires only this: 440 | 441 | ```html 442 | {{> next_more}} 443 | ``` 444 | 445 | Why? Because the `next_more.mustache` file will inherit the `size` and `start` variables from the calling context. In this way you may want to think of partials as includes, imports, template expansion, nested templates, or subtemplates, even though those aren't literally the case here. 446 | 447 | 448 | For example, this template and partial: 449 | 450 | base.mustache: 451 |

Names

452 | {{#names}} 453 | {{> user}} 454 | {{/names}} 455 | 456 | user.mustache: 457 | {{name}} 458 | 459 | Can be thought of as a single, expanded template: 460 | 461 | ```html 462 |

Names

463 | {{#names}} 464 | {{name}} 465 | {{/names}} 466 | ``` 467 | 468 | In mustache.js an object of partials may be passed as the third argument to `Mustache.render`. The object should be keyed by the name of the partial, and its value should be the partial text. 469 | 470 | ```js 471 | Mustache.render(template, view, { 472 | user: userTemplate 473 | }); 474 | ``` 475 | 476 | ### Set Delimiter 477 | 478 | Set Delimiter tags start with an equals sign and change the tag delimiters from `{{` and `}}` to custom strings. 479 | 480 | Consider the following contrived example: 481 | 482 | ``` 483 | * {{ default_tags }} 484 | {{=<% %>=}} 485 | * <% erb_style_tags %> 486 | <%={{ }}=%> 487 | * {{ default_tags_again }} 488 | ``` 489 | 490 | Here we have a list with three items. The first item uses the default tag style, the second uses ERB style as defined by the Set Delimiter tag, and the third returns to the default style after yet another Set Delimiter declaration. 491 | 492 | According to [ctemplates](http://google-ctemplate.googlecode.com/svn/trunk/doc/howto.html), this "is useful for languages like TeX, where double-braces may occur in the text and are awkward to use for markup." 493 | 494 | Custom delimiters may not contain whitespace or the equals sign. 495 | 496 | ## Pre-parsing and Caching Templates 497 | 498 | By default, when mustache.js first parses a template it keeps the full parsed token tree in a cache. The next time it sees that same template it skips the parsing step and renders the template much more quickly. If you'd like, you can do this ahead of time using `mustache.parse`. 499 | 500 | ```js 501 | Mustache.parse(template); 502 | 503 | // Then, sometime later. 504 | Mustache.render(template, view); 505 | ``` 506 | 507 | ## Plugins for JavaScript Libraries 508 | 509 | mustache.js may be built specifically for several different client libraries, including the following: 510 | 511 | - [jQuery](http://jquery.com/) 512 | - [MooTools](http://mootools.net/) 513 | - [Dojo](http://www.dojotoolkit.org/) 514 | - [YUI](http://developer.yahoo.com/yui/) 515 | - [qooxdoo](http://qooxdoo.org/) 516 | 517 | These may be built using [Rake](http://rake.rubyforge.org/) and one of the following commands: 518 | 519 | $ rake jquery 520 | $ rake mootools 521 | $ rake dojo 522 | $ rake yui3 523 | $ rake qooxdoo 524 | 525 | ## Testing 526 | 527 | In order to run the tests you'll need to install [node](http://nodejs.org/). 528 | 529 | You also need to install the sub module containing [Mustache specifications](http://github.com/mustache/spec) in the project root. 530 | 531 | $ git submodule init 532 | $ git submodule update 533 | 534 | Install dependencies. 535 | 536 | $ npm install 537 | 538 | Then run the tests. 539 | 540 | $ npm test 541 | 542 | The test suite consists of both unit and integration tests. If a template isn't rendering correctly for you, you can make a test for it by doing the following: 543 | 544 | 1. Create a template file named `mytest.mustache` in the `test/_files` 545 | directory. Replace `mytest` with the name of your test. 546 | 2. Create a corresponding view file named `mytest.js` in the same directory. 547 | This file should contain a JavaScript object literal enclosed in 548 | parentheses. See any of the other view files for an example. 549 | 3. Create a file with the expected output in `mytest.txt` in the same 550 | directory. 551 | 552 | Then, you can run the test with: 553 | 554 | $ TEST=mytest npm run test-render 555 | 556 | ### Browser tests 557 | 558 | Browser tests are not included in `npm test` as they run for too long, although they are ran automatically on Travis when merged into master. Run browser tests locally in any browser: 559 | 560 | $ npm run test-browser-local 561 | 562 | then point your browser to `http://localhost:8080/__zuul` 563 | 564 | ### Troubleshooting 565 | 566 | #### npm install fails 567 | 568 | Ensure to have a recent version of npm installed. While developing this project requires npm with support for `^` version ranges. 569 | 570 | $ npm install -g npm 571 | 572 | ## Thanks 573 | 574 | mustache.js wouldn't kick ass if it weren't for these fine souls: 575 | 576 | * Chris Wanstrath / defunkt 577 | * Alexander Lang / langalex 578 | * Sebastian Cohnen / tisba 579 | * J Chris Anderson / jchris 580 | * Tom Robinson / tlrobinson 581 | * Aaron Quint / quirkey 582 | * Douglas Crockford 583 | * Nikita Vasilyev / NV 584 | * Elise Wood / glytch 585 | * Damien Mathieu / dmathieu 586 | * Jakub Kuźma / qoobaa 587 | * Will Leinweber / will 588 | * dpree 589 | * Jason Smith / jhs 590 | * Aaron Gibralter / agibralter 591 | * Ross Boucher / boucher 592 | * Matt Sanford / mzsanford 593 | * Ben Cherry / bcherry 594 | * Michael Jackson / mjackson 595 | * Phillip Johnsen / phillipj 596 | * David da Silva Contín / dasilvacontin 597 | -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/Rakefile: -------------------------------------------------------------------------------- 1 | require 'rake' 2 | require 'rake/clean' 3 | 4 | task :default => :test 5 | 6 | def minified_file 7 | ENV['FILE'] || 'mustache.min.js' 8 | end 9 | 10 | task :install_mocha do 11 | sh "npm install -g mocha" if `which mocha`.empty? 12 | end 13 | 14 | task :install_uglify do 15 | sh "npm install -g uglify-js" if `which uglifyjs`.empty? 16 | end 17 | 18 | task :install_jshint do 19 | sh "npm install -g jshint" if `which jshint`.empty? 20 | end 21 | 22 | desc "Run all tests" 23 | task :test => :install_mocha do 24 | sh "mocha test" 25 | end 26 | 27 | desc "Make a compressed build in #{minified_file}" 28 | task :minify => :install_uglify do 29 | sh "uglifyjs mustache.js > #{minified_file}" 30 | end 31 | 32 | desc "Run JSHint" 33 | task :hint => :install_jshint do 34 | sh "jshint mustache.js" 35 | end 36 | 37 | # Creates a task that uses the various template wrappers to make a wrapped 38 | # output file. There is some extra complexity because Dojo and YUI use 39 | # different final locations. 40 | def templated_build(name, final_location=nil) 41 | short = name.downcase 42 | source = File.join("wrappers", short) 43 | dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*") 44 | target_js = final_location.nil? ? "#{short}.mustache.js" : "mustache.js" 45 | 46 | desc "Package for #{name}" 47 | task short.to_sym => dependencies do 48 | puts "Packaging for #{name}" 49 | 50 | mkdir_p final_location unless final_location.nil? 51 | 52 | sources = [ "#{source}/mustache.js.pre", 'mustache.js', "#{source}/mustache.js.post" ] 53 | relative_name = "#{final_location || '.'}/#{target_js}" 54 | 55 | open(relative_name, 'w') do |f| 56 | sources.each {|source| f << File.read(source) } 57 | end 58 | 59 | puts "Done, see #{relative_name}" 60 | end 61 | 62 | CLEAN.include(final_location.nil? ? target_js : final_location) 63 | end 64 | 65 | templated_build "jQuery" 66 | templated_build "MooTools" 67 | templated_build "Dojo", "dojox/string" 68 | templated_build "YUI3", "yui3/mustache" 69 | templated_build "qooxdoo" 70 | -------------------------------------------------------------------------------- /maps/new_york/bower_components/mustache.js/bin/mustache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var fs = require('fs'), 4 | path = require('path'); 5 | 6 | var Mustache = require('..'); 7 | var pkg = require('../package'); 8 | var partials = {}; 9 | 10 | var partialsPaths = []; 11 | var partialArgIndex = -1; 12 | 13 | while ((partialArgIndex = process.argv.indexOf('-p')) > -1) { 14 | partialsPaths.push(process.argv.splice(partialArgIndex, 2)[1]); 15 | } 16 | 17 | var viewArg = process.argv[2]; 18 | var templateArg = process.argv[3]; 19 | 20 | if (hasVersionArg()) { 21 | return console.log(pkg.version); 22 | } 23 | 24 | if (!templateArg || !viewArg) { 25 | console.error('Syntax: mustache