Compare commits

...

120 Commits

Author SHA1 Message Date
Arfon Smith
c8b30a62f9 Merge pull request #2741 from github/cut-release-v4.7.2
Cut release v4.7.2
2015-11-23 15:24:29 -06:00
Arfon Smith
48dfdd2dfe Bumping version to v4.7.2 2015-11-23 14:04:48 -06:00
Arfon Smith
68727f724a Grammars update 2015-11-23 13:53:53 -06:00
Arfon Smith
49f3eb1286 Merge pull request #2736 from ppwwyyxx/patch-1
add jquery.fancybox.css to vendor list
2015-11-22 21:16:45 -06:00
Yuxin Wu
8ab94a8643 Use one line for jquery fancybox in vendor
(just another commit to pass CLA check
2015-11-21 21:55:08 -05:00
Yuxin Wu
f72c337c5b add jquery.fancybox.css to vendor list
fancybox has both js and css
2015-11-21 21:48:03 -05:00
Arfon Smith
d22321de07 Merge pull request #2733 from github/cake
.cake
2015-11-19 20:34:36 -06:00
Arfon Smith
473e5db51f Adding sample for Coffeescript too 2015-11-19 20:24:23 -06:00
Arfon Smith
8b9fc4683a Merge branch 'master' into cake 2015-11-19 20:19:08 -06:00
Arfon Smith
3b4415cc3c Merge pull request #2729 from larsbrinkhoff/fortran
Recognise END statement in FORTRAN files.
2015-11-19 20:07:10 -06:00
Arfon Smith
2afce1754a Merge pull request #2731 from soc/patch-1
Change Scala language color to Scala language's main color
2015-11-19 20:06:22 -06:00
Arfon Smith
f232b93214 Merge pull request #2728 from larsbrinkhoff/fs
Add new .eam.fs sample for Formatted.
2015-11-19 20:05:45 -06:00
soc
db64f192fa Change Scala language color to Scala language's main color 2015-11-19 15:25:55 +01:00
Lars Brinkhoff
ca96ecdc55 Recognise END statement in FORTRAN files. 2015-11-19 08:51:13 +01:00
Lars Brinkhoff
2a06d1aa19 Add new sample for Formatted.
Sample from qingguang/lammps-sph; GPL v2 license.
2015-11-19 07:59:31 +01:00
Arfon Smith
b2fa2a1f46 Merge pull request #2655 from iblech/pickle
Detect Pickle data dumps (.p, .pkl, .pickle)
2015-11-16 17:57:53 -06:00
Ingo Blechschmidt
6839516b5c Only classify .pkl files as Pickle data dumps
It seems to be the dominant extension at the moment, even though several
Python resources use `.p` or `.pickle`. This was discussed in #2655.
2015-11-17 00:05:22 +01:00
Arfon Smith
7247c80fac Merge pull request #2722 from github/cut-release-v4.7.1
Cut release v4.7.1
2015-11-12 19:51:41 -06:00
Arfon Smith
01d05d1d4e Bumping to v4.7.1 2015-11-12 18:43:16 -06:00
Arfon Smith
8db4cc482e Grammar update 2015-11-12 18:42:24 -06:00
Arfon Smith
074f17ed98 Merge pull request #2712 from matiasinsaurralde/master
Support for JSCAD files
2015-11-12 18:18:52 -06:00
Arfon Smith
68b553ea55 Updating grammars 2015-11-10 09:57:04 +00:00
Arfon Smith
fd5da9cb15 Merge pull request #2690 from github/licensee-6
Upgrade to licensee 6
2015-11-10 09:41:09 +00:00
Arfon Smith
d081f687b0 Merge branch 'master' into licensee-6 2015-11-10 09:34:39 +00:00
Arfon Smith
34abe5b983 Merge pull request #2717 from meatballhat/supercollider-grammar
Add SuperCollider grammar
2015-11-10 09:31:24 +00:00
Arfon Smith
5765f1faf1 Merge pull request #2718 from meatballhat/travis-apt-update
Fetch libicu via Travis, switch back to container-based
2015-11-10 09:30:04 +00:00
Dan Buch
550b67215c Fetch libicu via Travis, switch back to container-based
This is a test.  I don't understand the details of how the `bundle config
build.charlock_holmes` bit works/fails, so the intent here is to get a PR posted
for purposes of getting feedback via the full Travis machinery.
2015-11-08 06:41:22 -05:00
Dan Buch
d7b2826113 Add SuperCollider grammar
plus a few minor language support updates including:

- recognize `sclang` and `scsynth` interpreters
- set `tm_scope: source.supercollider`
- reorder extensions so that `.sc` is primary
2015-11-08 06:28:14 -05:00
Arfon Smith
b4f94c7c25 Merge pull request #2706 from redroot/add-csl-as-xml-support
adding csl as an extension for XML, included sample
2015-11-05 09:07:49 -08:00
Arfon Smith
d24677adbb Merge pull request #2716 from github/faster-string-tokenizer
Use negative lookbehind when tokenizing string literals
2015-11-05 08:40:34 -08:00
Arfon Smith
04f981eeac Merge pull request #2714 from github/aroben-patch-1
Remove mentions of treatment of vendored files in diffs
2015-11-05 08:14:26 -08:00
Arfon Smith
b53d84d8ff Merge pull request #2600 from manveru/pony-language
Add Pony language
2015-11-05 08:08:38 -08:00
Adam Roben
fea8bb21a0 Use negative lookbehind when tokenizing string literals
This can double the speed of tokenizing large RTF files that use \'hh
escape sequences.
2015-11-05 10:18:44 -05:00
Adam Roben
996ed8a8b1 Remove mentions of treatment of vendored files in diffs
Vendored files are treated just like any other files when diffing on github.com.
2015-11-04 13:26:24 -05:00
Matias Insaurralde
daef164163 adding jscad sample file 2015-11-03 00:24:15 -03:00
Matias Insaurralde
61a5cab1f2 adding extension for OpenJSCAD 2015-11-03 00:03:00 -03:00
Redth
2fddaaf3d7 Reordered extensions so the primary .cs is first 2015-10-31 12:45:54 -04:00
Redth
741d246581 Add .cake extension for C#
This adds the .cake file extension to the C# language.

Here is a search in the wild: https://github.com/search?q=extension%3Acake+NOT+coffee&type=Code

Cake (C# Make) is a cross platform build automation system with a C# DSL to do things like compiling code, copy files/folders, running unit tests, compress files and build NuGet packages.

You can find out out more about cake here: http://cakebuild.net/
2015-10-30 15:06:38 -04:00
redroot
1b23e81541 adding csl as an extension for XML, included sample 2015-10-30 10:40:15 +00:00
Arfon Smith
362d300cb0 Blob not FileBlob 2015-10-26 09:06:42 +00:00
Arfon Smith
932726863f Merge branch 'master' into licensee-6 2015-10-23 10:29:47 +01:00
Arfon Smith
a35a3e98ce Merge pull request #2702 from github/drop-ruby-1.9.3
Dropping support for Ruby 1.9.3
2015-10-23 10:29:13 +01:00
Arfon Smith
7c404e72d2 Dropping support for Ruby 1.9.3 2015-10-23 10:20:31 +01:00
Arfon Smith
8736e2305d Merge pull request #2700 from pchaigno/django-alias
Django as an alias for HTML+Django
2015-10-22 20:39:14 +01:00
Paul Chaignon
a13664698f Django as an alias for HTML+Django 2015-10-22 20:28:40 +02:00
Arfon Smith
6e934067a8 Merge pull request #2698 from phase/master
Change D color to match the website
2015-10-22 09:26:31 +01:00
phase
3040642f97 Change D color to its logo 2015-10-21 16:42:43 -07:00
phase
dd7e44f957 Change D color to match the website
The original yellow color doesn't fit D very well, and it looks an awful lot like the color for JavaScript. This changes it to the color used on the website's sidebar, and nice dark maroon: http://www.colorpicker.com/2e2324
2015-10-21 15:34:25 -07:00
Arfon Smith
6b56a243e7 Merge pull request #2696 from github/cut-linguist-4.7.0
Bumping to version 4.7.0
2015-10-21 10:19:16 +01:00
Arfon Smith
5d08605aef Bumping to version 4.7.0 2015-10-21 09:04:17 +01:00
Arfon Smith
bf705cbaf2 Grammars update 2015-10-21 09:02:56 +01:00
Arfon Smith
fe827896e0 Merge pull request #2681 from miek/kicad-brd-extension
Add .brd extension for KiCad
2015-10-21 08:55:05 +01:00
Arfon Smith
317219e479 Merge branch 'master' into licensee-6 2015-10-21 08:51:10 +01:00
Arfon Smith
64e7df7596 Merge pull request #2694 from github/memory_blob
Memory blob
2015-10-21 08:49:42 +01:00
Arfon Smith
b3ff84872b Merge branch 'master' into memory_blob 2015-10-20 19:24:43 +01:00
Arfon Smith
5d176a781c Fixing the build :-\ 2015-10-20 19:24:04 +01:00
Arfon Smith
e0c97f97ba Merge branch 'master' into memory_blob 2015-10-20 12:36:26 +01:00
Arfon Smith
83f358976e Fixing up some old MemoryBlob references 2015-10-20 12:33:43 +01:00
Arfon Smith
9ee6153891 Merge pull request #2676 from lucky/master
Support for files generated by Racc.
2015-10-19 12:05:12 +01:00
Arfon Smith
825e640061 Merge pull request #2684 from jeffkreeftmeijer/eex
Add EEx (Embedded Elixir)
2015-10-19 12:02:18 +01:00
Arfon Smith
e5ae213839 Merge pull request #2689 from edendramis/master
Add FreeMarker syntax highlighting
2015-10-19 12:00:38 +01:00
Arfon Smith
74e034c689 Merge pull request #2686 from pchaigno/metal
Support for Metal language
2015-10-19 11:49:36 +01:00
Evangelia Dendramis
a55a60a161 removing group and search term 2015-10-16 18:19:53 -07:00
Brandon Keepers
9d865ec018 license of factor grammar is now detected properly 2015-10-16 15:16:04 -04:00
Brandon Keepers
8b01e3dead Upgrade to licensee 6.0.0b1 2015-10-16 15:15:34 -04:00
edendramis
9e3cc01715 adding FreeMarker to grammars.yml 2015-10-16 09:54:17 -07:00
edendramis
0f204767a9 updating examples 2015-10-15 14:48:20 -07:00
edendramis
11e3251efd adding samples 2015-10-15 14:43:02 -07:00
edendramis
1f1416a5f7 adding freemarker grammar 2015-10-15 14:15:27 -07:00
edendramis
b3786f3825 Merge remote-tracking branch 'upstream/master' 2015-10-15 14:07:13 -07:00
Paul Chaignon
09c2eee91e Support for Metal language 2015-10-13 07:57:58 +02:00
Arfon Smith
dc78b14902 Merge pull request #2683 from hipikat/patch-1
Correct typo ("Any information you [c]an add")
2015-10-12 10:09:17 +01:00
Arfon Smith
500ce0959a Merge branch 'master' into memory_blob 2015-10-12 09:49:22 +01:00
Adam Wright
aa0c9e3572 Correct typo ("Any information you [c]an add") 2015-10-12 14:40:18 +08:00
Mike Walters
e6de75d48a Add .brd extension for KiCad 2015-10-11 23:50:29 +01:00
Arfon Smith
a5ad0a34f8 Merge pull request #2675 from fbonzon/master
Add .phps extension for PHP
2015-10-11 21:32:17 +01:00
Arfon Smith
6e609cc4e3 Merge pull request #2680 from k2b6s9j/patch-1
The Crystal Grammar repository has moved.
2015-10-11 21:31:55 +01:00
Kepler Sticka-Jones
27727a927f The Crystal Grammar repository has moved.
And I'm kinda thinking about changing my GitHub name...
2015-10-10 23:49:07 -06:00
Jared Kuolt
5ff580df0a Support for files generated by Racc.
This changeset includes a sample racc file from [this auto-generated
file](44e9bf0440/lib/rjson/parser.rb)
(MIT-licensed).

[Racc](https://github.com/tenderlove/racc) Racc is an LALR(1) parser
generator. It is written in Ruby itself, and generates ruby programs.
2015-10-09 16:20:59 -07:00
Jeff Kreeftmeijer
b34acac722 Add EEx (Embedded Elixir)
EEx is embedded Elixir: http://elixir-lang.org/docs/v1.0/eex/. Here's
some in-the-wild usage on Github: https://github.com/search?p=100&q=extension%3Aeex+NOT+nothack&ref=searchresults&type=Code&utf8=✓

This uses the "html_elixir" Ace mode, which was added in this pull
request on the Ace project: https://github.com/ajaxorg/ace/pull/2696
2015-10-10 00:20:38 +02:00
François B
37840856ed Add .phps extension for PHP
.phps stands for "PHP Source"

Useful to show examples of PHP code. A properly-configured server will
output a .phps file as is, with color-formated source code instead of
the HTML that would normally be generated.

Usage in GitHub:
https://github.com/search?utf8=%E2%9C%93&q=extension%3Aphps+NOT+nothack&
type=Code

Example taken from:
https://github.com/PHPMailer/PHPMailer/blob/master/examples/mail.phps
2015-10-09 14:43:22 +02:00
Brandon Keepers
acfad4371f Mention alphabetical order in contributing docs
Closes #2649
2015-10-07 19:41:37 -04:00
Arfon Smith
ae42cc0307 Merge pull request #2672 from github/cut-release-v4.6.4
Cut release v4.6.4
2015-10-05 11:15:35 +01:00
Arfon Smith
d06860df37 Bumping version to v4.6.4 2015-10-05 09:45:32 +01:00
Arfon Smith
7d5d162f6b Updating FSharp grammars to match 2015-10-05 09:45:05 +01:00
Arfon Smith
d39a75b68b Grammar updates 2015-10-05 09:41:56 +01:00
Arfon Smith
d72f7311f6 Merge pull request #2648 from jaredpetersen/master
Added .pck PLSQL file extension
2015-10-05 09:23:56 +01:00
Arfon Smith
3f81b7c179 Merge pull request #2640 from wizawu/master
Add new extension .tsx for TypeScript
2015-10-05 09:21:46 +01:00
Arfon Smith
33d1255a5a Merge pull request #2671 from pchaigno/change-stata-grammar-repo
Change Stata grammar repo
2015-10-05 09:15:15 +01:00
Paul Chaignon
0ebea6a0ff Use pschumm/Stata.tmbundle 2015-10-04 20:45:33 +02:00
Paul Chaignon
c28da3a4a9 Remove statatmbundle/Stata.tmbundle grammar 2015-10-04 20:42:29 +02:00
wizawu
d6d368a65d Replace the sample file for .tsx extension
The sample file is from https://github.com/Microsoft/TypeScript/blob/master/tests/cases/conformance/jsx/tsxAttributeResolution9.tsx
2015-10-03 11:01:22 +08:00
wizawu
c5be9cc3e9 Add .tsx extension for XML
The sample file is from https://github.com/nyxcharon/tiled/blob/master/src/examples/water.tsx
2015-10-02 19:50:10 +08:00
E
c462c2bd31 add FreeMarker to languages.yml 2015-10-01 13:59:52 -07:00
wizawu
3426165621 Add a TypeScript sample with .tsx extension 2015-09-30 13:45:38 +08:00
Vicent Marti
98b99e38bb Merge pull request #2654 from github/vmg/git-linguist-fixes
Small fixes for git-linguist
2015-09-28 11:12:49 +02:00
Vicent Marti
d8e3bec499 Bump version 2015-09-28 01:45:49 -07:00
Vicent Marti
7c759d4d29 git-linguist: Do not write cache if repo is gone 2015-09-28 01:45:49 -07:00
Vicent Marti
41d438b47e repository: Do not attempt to scan large repos 2015-09-28 01:45:49 -07:00
Vicent Marti
41911d6921 git-linguist: Properly handle $GIT_DIR from git 2015-09-28 01:45:49 -07:00
Arfon Smith
dca18d77cb Merge pull request #2656 from iblech/better-test-description
Clarified that only nonprimary extensions should be sorted
2015-09-27 20:34:30 +01:00
Ingo Blechschmidt
040af5dad2 Clarify that only nonprimary extensions should be sorted 2015-09-25 19:23:06 +02:00
Ingo Blechschmidt
01bb6c37ab Detect Pickle data dumps (.p, .pkl, .pickle) 2015-09-25 19:06:50 +02:00
Jared Petersen
c624d68628 Added .pck PLSQL file extension 2015-09-24 07:59:06 -07:00
Arfon Smith
4867c49bd9 Merge pull request #2642 from github/license-in-gemspec
Include LICENSE in gem
2015-09-23 09:19:18 +01:00
Brandon Keepers
a354eddf4b Update github-linguist.gemspec 2015-09-22 16:33:08 -04:00
Vicent Marti
9b78c533a5 Merge pull request #2641 from github/js-syntax-fix
github-linguist-grammars 4.6.2
2015-09-21 21:56:33 +02:00
Mislav Marohnić
090ea576b9 github-linguist-grammars 4.6.2 2015-09-21 21:23:40 +02:00
Mislav Marohnić
6a2d33a4b3 Bump language-javascript for syntax highlighting fix
This is primarily to pull
https://github.com/atom/language-javascript/pull/227

Full changelog:
c5c381e...7b14bbb (diff-46d5c1ca71eaebb92619d6c7abc9388d)
2015-09-21 19:04:30 +02:00
wizawu
b54a9c7412 Add new extension .tsx for TypeScript
TypeScript 1.6 has introduced a new .tsx file extension.
2015-09-21 13:48:30 +08:00
Vicent Marti
2c62da7834 Merge pull request #2636 from github/vmg/git-linguist-oid
git-linguist: Delay loading @commit_oid
2015-09-16 16:48:12 +02:00
Vicent Marti
0145a0adb2 git-linguist: Delay loading @commit_oid 2015-09-16 05:50:35 -07:00
Paul Chaignon
213cf322f5 Merge branch 'master' into blob_in_memory 2015-09-04 00:55:39 +02:00
Michael Fellinger
ecc750f445 Merge branch 'master' of https://github.com/github/linguist into origin/patch-1
* 'master' of https://github.com/github/linguist:
  Switch to Apache License.
  also add help for unapproved licenses
  Update X10 grammar license.
  add some help text to license test
  Fix typo in Obj-C heuristic keyword
  Add the X10 language (http://x10-lang.org/).
  Sublime Text workspace files as vendored
  Make Slick regexp more general
  Tests for new vendored files
  Test for new CodeMirror regexp
  New JS vendored files
  Fix CodeMirror regex for vendored files
  added *.lslp to samples/LSL folder
  added *.lslp as LSL(Linden Scripting Language)

Conflicts:
	.gitmodules
2015-08-28 14:08:31 -04:00
Michael Fellinger
cf5268a7d4 add Pony language 2015-08-28 14:04:10 -04:00
Paul Chaignon
2c2b37bec3 Reorganize tests
Rename test_memory_blob.rb to test_blob.rb for consistence with last commit
2015-08-19 18:07:42 +02:00
Paul Chaignon
c777f2d388 Merge branch 'master' into blob_in_memory 2015-08-19 18:02:31 +02:00
Paul Chaignon
eca10056a8 Rename MemoryBlob to Blob 2015-08-19 17:29:35 +02:00
Paul Chaignon
5a646384f6 FileBlob extends MemoryBlob 2015-07-12 20:56:51 +02:00
Paul Chaignon
8917f1a91a MemoryBlob class: wrapper around the content of a file
Makes it possible to detect the language of a snippet of code
without having an actual file on disk
Will allow github-markup to use Linguist without restricting its API
2015-07-12 20:28:42 +02:00
107 changed files with 21526 additions and 676 deletions

17
.gitmodules vendored
View File

@@ -85,6 +85,9 @@
[submodule "vendor/grammars/language-shellscript"]
path = vendor/grammars/language-shellscript
url = https://github.com/atom/language-shellscript
[submodule "vendor/grammars/language-supercollider"]
path = vendor/grammars/language-supercollider
url = https://github.com/supercollider/language-supercollider
[submodule "vendor/grammars/language-yaml"]
path = vendor/grammars/language-yaml
url = https://github.com/atom/language-yaml
@@ -253,9 +256,6 @@
[submodule "vendor/grammars/SublimeXtend"]
path = vendor/grammars/SublimeXtend
url = https://github.com/staltz/SublimeXtend
[submodule "vendor/grammars/Stata.tmbundle"]
path = vendor/grammars/Stata.tmbundle
url = https://github.com/statatmbundle/Stata.tmbundle
[submodule "vendor/grammars/Vala-TMBundle"]
path = vendor/grammars/Vala-TMBundle
url = https://github.com/technosophos/Vala-TMBundle
@@ -649,7 +649,7 @@
url = https://github.com/SRI-CSL/SMT.tmbundle.git
[submodule "vendor/grammars/language-crystal"]
path = vendor/grammars/language-crystal
url = https://github.com/k2b6s9j/language-crystal
url = https://github.com/atom-crystal/language-crystal
[submodule "vendor/grammars/language-xbase"]
path = vendor/grammars/language-xbase
url = https://github.com/hernad/atom-language-harbour
@@ -674,9 +674,18 @@
[submodule "vendor/grammars/sublime-typescript"]
path = vendor/grammars/sublime-typescript
url = https://github.com/Microsoft/TypeScript-Sublime-Plugin
[submodule "vendor/grammars/sublime-pony"]
path = vendor/grammars/sublime-pony
url = https://github.com/CausalityLtd/sublime-pony
[submodule "vendor/grammars/X10"]
path = vendor/grammars/X10
url = git@github.com:x10-lang/x10-highlighting.git
[submodule "vendor/grammars/language-babel"]
path = vendor/grammars/language-babel
url = https://github.com/gandm/language-babel
[submodule "vendor/grammars/Stata.tmbundle"]
path = vendor/grammars/Stata.tmbundle
url = https://github.com/pschumm/Stata.tmbundle
[submodule "vendor/grammars/FreeMarker.tmbundle"]
path = vendor/grammars/FreeMarker.tmbundle
url = https://github.com/freemarker/FreeMarker.tmbundle

View File

@@ -1,6 +1,12 @@
language: ruby
sudo: false
addons:
apt:
packages:
- libicu-dev
- libicu48
before_install: script/travis/before_install
rvm:
- 1.9.3
- 2.0.0
- 2.1
- 2.2

View File

@@ -12,7 +12,7 @@ We try only to add new extensions once they have some usage on GitHub. In most c
To add support for a new extension:
0. Add your extension to the language entry in [`languages.yml`][languages].
0. Add your extension to the language entry in [`languages.yml`][languages], keeping the extensions in alphabetical order.
0. Add at least one sample for your extension to the [samples directory][samples] in the correct subdirectory.
0. Open a pull request, linking to a [GitHub search result](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults) showing in-the-wild usage.

View File

@@ -17,7 +17,7 @@ The Language stats bar displays languages percentages for the files in the repos
0. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
0. If you see files that you didn't write, consider moving the files into one of the [paths for vendored code](/lib/linguist/vendor.yml), or use the [manual overrides](#overrides) feature to ignore them.
0. If the files are being misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you an add, especially links to public repositories, is helpful.
0. If the files are being misclassified, search for [open issues][issues] to see if anyone else has already reported the issue. Any information you can add, especially links to public repositories, is helpful.
0. If there are no reported issues of this misclassification, [open an issue][new-issue] and include a link to the repository or a sample of the code that is being misclassified.
## Overrides
@@ -33,9 +33,9 @@ $ cat .gitattributes
*.rb linguist-language=Java
```
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository. Vendored files are also hidden by default in diffs on github.com.
Checking code you didn't write, such as JavaScript libraries, into your git repo is a common practice, but this often inflates your project's language stats and may even cause your project to be labeled as another language. By default, Linguist treats all of the paths defined in [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml) as vendored and therefore doesn't include them in the language statistics for a repository.
Use the `linguist-vendored` attribute to vendor or un-vendor paths. Please note, overriding the vendored (or un-vendored) status of a file only affects the language statistics for the repository and not the behavior in diffs on github.com.
Use the `linguist-vendored` attribute to vendor or un-vendor paths.
```
$ cat .gitattributes

View File

@@ -8,20 +8,19 @@ require 'tmpdir'
require 'zlib'
class GitLinguist
attr_reader :repo_path
attr_reader :commit_oid
attr_reader :incremental
def initialize(path, commit_oid, incremental = true)
@repo_path = path
@commit_oid = commit_oid || rugged.head.target_id
@commit_oid = commit_oid
@incremental = incremental
end
def linguist
repo = Linguist::Repository.new(rugged, commit_oid)
if @commit_oid.nil?
raise "git-linguist must be called with a specific commit OID to perform language computation"
end
repo = Linguist::Repository.new(rugged, @commit_oid)
if incremental && stats = load_language_stats
if @incremental && stats = load_language_stats
old_commit_oid, old_stats = stats
# A cache with NULL oid means that we want to froze
@@ -33,19 +32,19 @@ class GitLinguist
result = yield repo
save_language_stats(commit_oid, repo.cache)
save_language_stats(@commit_oid, repo.cache)
result
end
def load_language_stats
version, commit_oid, stats = load_cache
if version == LANGUAGE_STATS_CACHE_VERSION && commit_oid && stats
[commit_oid, stats]
version, oid, stats = load_cache
if version == LANGUAGE_STATS_CACHE_VERSION && oid && stats
[oid, stats]
end
end
def save_language_stats(commit_oid, stats)
cache = [LANGUAGE_STATS_CACHE_VERSION, commit_oid, stats]
def save_language_stats(oid, stats)
cache = [LANGUAGE_STATS_CACHE_VERSION, oid, stats]
write_cache(cache)
end
@@ -64,25 +63,28 @@ class GitLinguist
LANGUAGE_STATS_CACHE_VERSION = "v3:#{Linguist::VERSION}"
def rugged
@rugged ||= Rugged::Repository.bare(repo_path)
@rugged ||= Rugged::Repository.bare(@repo_path)
end
def cache_file
File.join(repo_path, LANGUAGE_STATS_CACHE)
File.join(@repo_path, LANGUAGE_STATS_CACHE)
end
def write_cache(object)
tmp_path = Dir::Tmpname.make_tmpname(cache_file, nil)
return unless File.directory? @repo_path
File.open(tmp_path, "wb") do |f|
marshal = Marshal.dump(object)
f.write(Zlib::Deflate.deflate(marshal))
begin
tmp_path = Dir::Tmpname.make_tmpname(cache_file, nil)
File.open(tmp_path, "wb") do |f|
marshal = Marshal.dump(object)
f.write(Zlib::Deflate.deflate(marshal))
end
File.rename(tmp_path, cache_file)
rescue => e
(File.unlink(tmp_path) rescue nil)
raise e
end
File.rename(tmp_path, cache_file)
tmp_path = nil
ensure
(File.unlink(tmp_path) rescue nil) if tmp_path
end
def load_cache
@@ -97,24 +99,18 @@ end
def git_linguist(args)
incremental = true
commit = nil
git_dir = nil
parser = OptionParser.new do |opts|
opts.banner = "Usage: git-linguist [OPTIONS] stats|breakdown|dump-cache|clear|disable"
opts.on("-f", "--force", "Force a full rescan") { incremental = false }
opts.on("--git-dir=DIR", "Path to the git repository") { |v| git_dir = v }
opts.on("--commit=COMMIT", "Commit to index") { |v| commit = v}
end
parser.parse!(args)
git_dir ||= begin
pwd = Dir.pwd
dotgit = File.join(pwd, ".git")
File.directory?(dotgit) ? dotgit : pwd
end
git_dir = `git rev-parse --git-dir`.strip
raise "git-linguist must be ran in a Git repository" unless $?.success?
wrapper = GitLinguist.new(git_dir, commit, incremental)
case args.pop

View File

@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
s.homepage = "https://github.com/github/linguist"
s.license = "MIT"
s.files = Dir['lib/**/*'] - ['lib/linguist/grammars.rb']
s.files = Dir['lib/**/*'] - ['lib/linguist/grammars.rb'] + ['LICENSE']
s.executables = ['linguist', 'git-linguist']
s.add_dependency 'charlock_holmes', '~> 0.7.3'
@@ -24,6 +24,6 @@ Gem::Specification.new do |s|
s.add_development_dependency 'rake'
s.add_development_dependency 'yajl-ruby'
s.add_development_dependency 'color-proximity', '~> 0.2.1'
s.add_development_dependency 'licensee', '~> 4.7.4'
s.add_development_dependency 'licensee', '6.0.0b1'
end

View File

@@ -42,6 +42,8 @@ vendor/grammars/Docker.tmbundle:
- source.dockerfile
vendor/grammars/Elm.tmLanguage:
- source.elm
vendor/grammars/FreeMarker.tmbundle:
- text.html.ftl
vendor/grammars/G-Code/:
- source.LS
- source.MCPOST
@@ -92,7 +94,7 @@ vendor/grammars/Scalate.tmbundle:
- text.html.ssp
vendor/grammars/Slash.tmbundle:
- text.html.slash
vendor/grammars/Stata.tmbundle:
vendor/grammars/Stata.tmbundle/:
- source.mata
- source.stata
vendor/grammars/Stylus/:
@@ -178,6 +180,9 @@ vendor/grammars/assembly.tmbundle:
- source.x86asm
vendor/grammars/atom-fsharp/:
- source.fsharp
- source.fsharp.fsi
- source.fsharp.fsl
- source.fsharp.fsx
vendor/grammars/atom-language-purescript/:
- source.purescript
vendor/grammars/atom-salt:
@@ -297,8 +302,8 @@ vendor/grammars/io.tmbundle:
vendor/grammars/ioke-outdated:
- source.ioke
vendor/grammars/jade-tmbundle:
- source.jade
- source.pyjade
- text.jade
vendor/grammars/jasmin-sublime:
- source.jasmin
vendor/grammars/java.tmbundle:
@@ -350,6 +355,8 @@ vendor/grammars/language-python:
vendor/grammars/language-shellscript:
- source.shell
- text.shell-session
vendor/grammars/language-supercollider:
- source.supercollider
vendor/grammars/language-xbase:
- source.harbour
vendor/grammars/language-yaml:
@@ -510,6 +517,8 @@ vendor/grammars/sublime-nix:
vendor/grammars/sublime-opal/:
- source.opal
- source.opalsysdefs
vendor/grammars/sublime-pony:
- source.pony
vendor/grammars/sublime-robot-plugin:
- text.robot
vendor/grammars/sublime-rust:

73
lib/linguist/blob.rb Normal file
View File

@@ -0,0 +1,73 @@
require 'linguist/blob_helper'
module Linguist
# A Blob is a wrapper around the content of a file to make it quack
# like a Grit::Blob. It provides the basic interface: `name`,
# `data`, `path` and `size`.
class Blob
include BlobHelper
# Public: Initialize a new Blob.
#
# path - A path String (does not necessarily exists on the file system).
# content - Content of the file.
#
# Returns a Blob.
def initialize(path, content)
@path = path
@content = content
end
# Public: Filename
#
# Examples
#
# Blob.new("/path/to/linguist/lib/linguist.rb", "").path
# # => "/path/to/linguist/lib/linguist.rb"
#
# Returns a String
attr_reader :path
# Public: File name
#
# Returns a String
def name
File.basename(@path)
end
# Public: File contents.
#
# Returns a String.
def data
@content
end
# Public: Get byte size
#
# Returns an Integer.
def size
@content.bytesize
end
# Public: Get file extension.
#
# Returns a String.
def extension
extensions.last || ""
end
# Public: Return an array of the file extensions
#
# >> Linguist::Blob.new("app/views/things/index.html.erb").extensions
# => [".html.erb", ".erb"]
#
# Returns an Array
def extensions
basename, *segments = name.downcase.split(".")
segments.map.with_index do |segment, index|
"." + segments[index..-1].join(".")
end
end
end
end

View File

@@ -1,10 +1,11 @@
require 'linguist/blob_helper'
require 'linguist/blob'
module Linguist
# A FileBlob is a wrapper around a File object to make it quack
# like a Grit::Blob. It provides the basic interface: `name`,
# `data`, `path` and `size`.
class FileBlob
class FileBlob < Blob
include BlobHelper
# Public: Initialize a new FileBlob from a path
@@ -18,20 +19,6 @@ module Linguist
@path = base_path ? path.sub("#{base_path}/", '') : path
end
# Public: Filename
#
# Examples
#
# FileBlob.new("/path/to/linguist/lib/linguist.rb").path
# # => "/path/to/linguist/lib/linguist.rb"
#
# FileBlob.new("/path/to/linguist/lib/linguist.rb",
# "/path/to/linguist").path
# # => "lib/linguist.rb"
#
# Returns a String
attr_reader :path
# Public: Read file permissions
#
# Returns a String like '100644'
@@ -39,13 +26,6 @@ module Linguist
File.stat(@fullpath).mode.to_s(8)
end
# Public: File name
#
# Returns a String
def name
File.basename(@fullpath)
end
# Public: Read file contents.
#
# Returns a String.
@@ -59,26 +39,5 @@ module Linguist
def size
File.size(@fullpath)
end
# Public: Get file extension.
#
# Returns a String.
def extension
extensions.last || ""
end
# Public: Return an array of the file extensions
#
# >> Linguist::FileBlob.new("app/views/things/index.html.erb").extensions
# => [".html.erb", ".erb"]
#
# Returns an Array
def extensions
basename, *segments = name.downcase.split(".")
segments.map.with_index do |segment, index|
"." + segments[index..-1].join(".")
end
end
end
end

View File

@@ -71,7 +71,8 @@ module Linguist
generated_jni_header? ||
vcr_cassette? ||
generated_module? ||
generated_unity3d_meta?
generated_unity3d_meta? ||
generated_racc?
end
# Internal: Is the blob an Xcode file?
@@ -359,5 +360,18 @@ module Linguist
return false unless lines.count > 1
return lines[0].include?("fileFormatVersion: ")
end
# Internal: Is this a Racc-generated file?
#
# A Racc-generated file contains:
# # This file is automatically generated by Racc x.y.z
# on the third line.
#
# Return true or false
def generated_racc?
return false unless extname == '.rb'
return false unless lines.count > 2
return lines[2].start_with?("# This file is automatically generated by Racc")
end
end
end

View File

@@ -131,7 +131,7 @@ module Linguist
disambiguate ".for", ".f" do |data|
if /^: /.match(data)
Language["Forth"]
elsif /^([c*][^a-z]| (subroutine|program)\s|\s*!)/i.match(data)
elsif /^([c*][^abd-z]| (subroutine|program|end)\s|\s*!)/i.match(data)
Language["FORTRAN"]
end
end

View File

@@ -8,7 +8,8 @@
# Use "text" if a mode does not exist.
# wrap - Boolean wrap to enable line wrapping (default: false)
# extensions - An Array of associated extensions (the first one is
# considered the primary extension)
# considered the primary extension, the others should be
# listed alphabetically)
# interpreters - An Array of associated interpreters
# searchable - Boolean flag to enable searching (defaults to true)
# search_term - Deprecated: Some languages maybe indexed under a
@@ -392,6 +393,7 @@ C#:
- csharp
extensions:
- .cs
- .cake
- .cshtml
- .csx
@@ -567,6 +569,7 @@ CoffeeScript:
extensions:
- .coffee
- ._coffee
- .cake
- .cjsx
- .cson
- .iced
@@ -719,7 +722,7 @@ Cython:
D:
type: programming
color: "#fcd46d"
color: "#ba595e"
extensions:
- .d
- .di
@@ -1011,6 +1014,7 @@ Formatted:
type: data
extensions:
- .for
- .eam.fs
tm_scope: none
ace_mode: text
@@ -1028,6 +1032,16 @@ Forth:
- .fs
ace_mode: forth
FreeMarker:
type: programming
color: "#0050b2"
aliases:
- ftl
extensions:
- .ftl
tm_scope: text.html.ftl
ace_mode: ftl
Frege:
type: programming
color: "#00cafe"
@@ -1317,11 +1331,22 @@ HTML+Django:
- .mustache
- .jinja
aliases:
- django
- html+django/jinja
- html+jinja
- htmldjango
ace_mode: django
HTML+EEX:
type: markup
tm_scope: text.html.elixir
group: HTML
aliases:
- eex
extensions:
- .eex
ace_mode: text
HTML+ERB:
type: markup
tm_scope: text.html.erb
@@ -1331,7 +1356,7 @@ HTML+ERB:
extensions:
- .erb
- .erb.deface
ace_mode: html_ruby
ace_mode: text
HTML+PHP:
type: markup
@@ -1589,7 +1614,7 @@ Jade:
type: markup
extensions:
- .jade
tm_scope: source.jade
tm_scope: text.jade
ace_mode: jade
Jasmin:
@@ -1634,6 +1659,7 @@ JavaScript:
- .gs
- .jake
- .jsb
- .jscad
- .jsfl
- .jsm
- .jss
@@ -1680,6 +1706,7 @@ KiCad:
type: programming
extensions:
- .sch
- .brd
- .kicad_pcb
tm_scope: none
ace_mode: text
@@ -2062,6 +2089,14 @@ Mercury:
tm_scope: source.mercury
ace_mode: prolog
Metal:
type: programming
color: "#8f14e9"
extensions:
- .metal
tm_scope: source.c++
ace_mode: c_cpp
MiniD: # Legacy
type: programming
searchable: false
@@ -2440,6 +2475,7 @@ PHP:
- .php3
- .php4
- .php5
- .phps
- .phpt
filenames:
- Phakefile
@@ -2456,6 +2492,7 @@ PLSQL:
color: "#dad8d8"
extensions:
- .pls
- .pck
- .pkb
- .pks
- .plb
@@ -2572,6 +2609,13 @@ Perl6:
tm_scope: source.perl.6
ace_mode: perl
Pickle:
type: data
extensions:
- .pkl
tm_scope: none
ace_mode: text
PicoLisp:
type: programming
extensions:
@@ -2616,6 +2660,13 @@ PogoScript:
tm_scope: source.pogoscript
ace_mode: text
Pony:
type: programming
extensions:
- .pony
tm_scope: source.pony
ace_mode: text
PostScript:
type: markup
extensions:
@@ -3107,7 +3158,7 @@ Sass:
Scala:
type: programming
ace_mode: scala
color: "#7dd3b0"
color: "#DC322F"
extensions:
- .scala
- .sbt
@@ -3296,9 +3347,12 @@ SuperCollider:
type: programming
color: "#46390b"
extensions:
- .scd
- .sc
tm_scope: none
- .scd
interpreters:
- sclang
- scsynth
tm_scope: source.supercollider
ace_mode: text
Swift:
@@ -3441,6 +3495,7 @@ TypeScript:
- ts
extensions:
- .ts
- .tsx
tm_scope: source.ts
ace_mode: typescript
@@ -3611,6 +3666,7 @@ XML:
- .ccxml
- .clixml
- .cproject
- .csl
- .csproj
- .ct
- .dita
@@ -3657,6 +3713,7 @@ XML:
- .tmSnippet
- .tmTheme
- .ts
- .tsx
- .ui
- .urdf
- .vbproj

View File

@@ -126,12 +126,13 @@ module Linguist
end
protected
MAX_TREE_SIZE = 100_000
def compute_stats(old_commit_oid, cache = nil)
return {} if current_tree.count_recursive(MAX_TREE_SIZE) >= MAX_TREE_SIZE
old_tree = old_commit_oid && Rugged::Commit.lookup(repository, old_commit_oid).tree
read_index
diff = Rugged::Tree.diff(repository, old_tree, current_tree)
# Clear file map and fetch full diff if any .gitattributes files are changed

View File

@@ -86,13 +86,13 @@ module Linguist
if s.peek(1) == "\""
s.getch
else
s.skip_until(/[^\\]"/)
s.skip_until(/(?<!\\)"/)
end
elsif s.scan(/'/)
if s.peek(1) == "'"
s.getch
else
s.skip_until(/[^\\]'/)
s.skip_until(/(?<!\\)'/)
end
# Skip number literals

View File

@@ -95,7 +95,7 @@
- jquery.fn.gantt.js
# jQuery fancyBox
- jquery.fancybox.js
- jquery.fancybox.(js|css)
# Fuel UX
- fuelux.js

View File

@@ -1,3 +1,3 @@
module Linguist
VERSION = "4.6.0"
VERSION = "4.7.2"
end

86
samples/C#/build.cake Normal file
View File

@@ -0,0 +1,86 @@
///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");
///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
///////////////////////////////////////////////////////////////////////////////
var solutions = GetFiles("./**/*.sln");
var solutionPaths = solutions.Select(solution => solution.GetDirectory());
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
Setup(() =>
{
// Executed BEFORE the first task.
Information("Running tasks...");
});
Teardown(() =>
{
// Executed AFTER the last task.
Information("Finished running tasks.");
});
///////////////////////////////////////////////////////////////////////////////
// TASK DEFINITIONS
///////////////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean solution directories.
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin/" + configuration);
CleanDirectories(path + "/**/obj/" + configuration);
}
});
Task("Restore")
.Does(() =>
{
// Restore all NuGet packages.
foreach(var solution in solutions)
{
Information("Restoring {0}...", solution);
NuGetRestore(solution);
}
});
Task("Build")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.Does(() =>
{
// Build all solutions.
foreach(var solution in solutions)
{
Information("Building {0}", solution);
MSBuild(solution, settings =>
settings.SetPlatformTarget(PlatformTarget.MSIL)
.WithProperty("TreatWarningsAsErrors","true")
.WithTarget("Build")
.SetConfiguration(configuration));
}
});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
///////////////////////////////////////////////////////////////////////////////
// EXECUTION
///////////////////////////////////////////////////////////////////////////////
RunTarget(target);

View File

@@ -0,0 +1,17 @@
fs = require 'fs'
{print} = require 'sys'
{spawn} = require 'child_process'
build = (callback) ->
coffee = spawn 'coffee', ['-c', '-o', '.', '.']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
print data.toString()
coffee.on 'exit', (code) ->
callback?() if code is 0
task 'build', 'Build from source', ->
build()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
<#import "layout.ftl" as layout>
<#assign results = [
{
"title": "Example Result",
"description": "Lorem ipsum dolor sit amet, pede id pellentesque, sollicitudin turpis sed in sed sed, libero dictum."
}
] />
<@layout.page title="FreeMarker Example">
<#if results?size == 0>
There were no results.
<#else>
<ul>
<#list results as result>
<li>
<strong>${result.title}</strong>
<p>${result.description}</p>
</li>
</#list>
</ul>
</#if>
<#-- This is a FreeMarker comment -->
<@currentTime />
</@layout.page>
<#macro currentTime>
${.now?string.full}
</#macro>

View File

@@ -0,0 +1,32 @@
<#ftl strip_text=true />
<#macro page title>
<!doctype html>
<html lang="${.lang}">
<head>
<title>${title}</title>
<@metaTags />
</head>
<body>
<#nested />
<@footer />
</body>
</html>
</#macro>
<#---
Default meta tags
-->
<#macro metaTags>
<#compress>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="format-detection" content="telephone=no">
</#compress>
</#macro>
<#macro footer>
<p>This page is using FreeMarker v${.version}</p>
</#macro>

View File

@@ -0,0 +1,26 @@
<h1>Listing Books</h1>
<table>
<tr>
<th>Title</th>
<th>Summary</th>
<th></th>
<th></th>
<th></th>
</tr>
<%= for book <- @books do %>
<tr>
<%# comment %>
<td><%= book.title %></td>
<td><%= book.content %></td>
<td><%= link "Show", to: book_path(@conn, :show, book) %></td>
<td><%= link "Edit", to: book_path(@conn, :edit, book) %></td>
<td><%= link "Delete", to: book_path(@conn, :delete, book), method: :delete, data: [confirm: "Are you sure?"] %></td>
</tr>
<% end %>
</table>
<br />
<%= link "New book", to: book_path(@conn, :new) %>

View File

@@ -0,0 +1,19 @@
// title : OpenJSCAD.org Logo
// author : Rene K. Mueller
// license : MIT License
// revision : 0.003
// tags : Logo,Intersection,Sphere,Cube
// file : logo.jscad
function main() {
return union(
difference(
cube({size: 3, center: true}),
sphere({r:2, center: true})
),
intersection(
sphere({r: 1.3, center: true}),
cube({size: 2.1, center: true})
)
).translate([0,0,1.5]).scale(10);
}

14069
samples/KiCad/tc14badge.brd Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,99 @@
// Copyright 2014 Isis Innovation Limited and the authors of InfiniTAM
#include <metal_stdlib>
#include "../../DeviceAgnostic/ITMSceneReconstructionEngine.h"
#include "../../DeviceAgnostic/ITMVisualisationEngine.h"
#include "ITMVisualisationEngine_Metal.h"
using namespace metal;
kernel void genericRaycastVH_device(DEVICEPTR(Vector4f) *pointsRay [[ buffer(0) ]],
const CONSTPTR(ITMVoxel) *voxelData [[ buffer(1) ]],
const CONSTPTR(typename ITMVoxelIndex::IndexData) *voxelIndex [[ buffer(2) ]],
const CONSTPTR(Vector2f) *minmaxdata [[ buffer(3) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(4) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
int locId = x + y * params->imgSize.x;
int locId2 = (int)floor((float)x / minmaximg_subsample) + (int)floor((float)y / minmaximg_subsample) * params->imgSize.x;
castRay<ITMVoxel, ITMVoxelIndex>(pointsRay[locId], x, y, voxelData, voxelIndex, params->invM, params->invProjParams,
params->voxelSizes.y, params->lightSource.w, minmaxdata[locId2]);
}
kernel void genericRaycastVGMissingPoints_device(DEVICEPTR(Vector4f) *forwardProjection [[ buffer(0) ]],
const CONSTPTR(int) *fwdProjMissingPoints [[ buffer(1) ]],
const CONSTPTR(ITMVoxel) *voxelData [[ buffer(2) ]],
const CONSTPTR(typename ITMVoxelIndex::IndexData) *voxelIndex [[ buffer(3) ]],
const CONSTPTR(Vector2f) *minmaxdata [[ buffer(4) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(5) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int pointId = threadIdx.x + blockIdx.x * blockDim.x;
if (pointId >= params->imgSize.z) return;
int locId = fwdProjMissingPoints[pointId];
int y = locId / params->imgSize.x, x = locId - y * params->imgSize.x;
int locId2 = (int)floor((float)x / minmaximg_subsample) + (int)floor((float)y / minmaximg_subsample) * params->imgSize.x;
castRay<ITMVoxel, ITMVoxelIndex>(forwardProjection[locId], x, y, voxelData, voxelIndex, params->invM, params->invProjParams,
params->voxelSizes.y, params->lightSource.w, minmaxdata[locId2]);
}
kernel void renderICP_device(const CONSTPTR(Vector4f) *pointsRay [[ buffer(0) ]],
DEVICEPTR(Vector4f) *pointsMap [[ buffer(1) ]],
DEVICEPTR(Vector4f) *normalsMap [[ buffer(2) ]],
DEVICEPTR(Vector4u) *outRendering [[ buffer(3) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(4) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
processPixelICP<false>(outRendering, pointsMap, normalsMap, pointsRay, params->imgSize.xy, x, y, params->voxelSizes.x, TO_VECTOR3(params->lightSource));
}
kernel void renderForward_device(DEVICEPTR(Vector4u) *outRendering [[ buffer(0) ]],
const CONSTPTR(Vector4f) *pointsRay [[ buffer(1) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(2) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = threadIdx.x + blockIdx.x * blockDim.x, y = threadIdx.y + blockIdx.y * blockDim.y;
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
processPixelForwardRender<false>(outRendering, pointsRay, params->imgSize.xy, x, y, params->voxelSizes.x, TO_VECTOR3(params->lightSource));
}
kernel void forwardProject_device(DEVICEPTR(Vector4f) *forwardProjection [[ buffer(0) ]],
const CONSTPTR(Vector4f) *pointsRay [[ buffer(1) ]],
const CONSTPTR(CreateICPMaps_Params) *params [[ buffer(2) ]],
uint2 threadIdx [[ thread_position_in_threadgroup ]],
uint2 blockIdx [[ threadgroup_position_in_grid ]],
uint2 blockDim [[ threads_per_threadgroup ]])
{
int x = (threadIdx.x + blockIdx.x * blockDim.x), y = (threadIdx.y + blockIdx.y * blockDim.y);
if (x >= params->imgSize.x || y >= params->imgSize.y) return;
int locId = x + y * params->imgSize.x;
Vector4f pixel = pointsRay[locId];
int locId_new = forwardProjectPixel(pixel * params->voxelSizes.x, params->M, params->projParams, params->imgSize.xy);
if (locId_new >= 0) forwardProjection[locId_new] = pixel;
}

31
samples/PHP/mail.phps Normal file
View File

@@ -0,0 +1,31 @@
<?php
/**
* This example shows sending a message using PHP's mail() function.
*/
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Set who the message is to be sent from
$mail->setFrom('from@example.com', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('whoto@example.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

View File

@@ -0,0 +1,90 @@
create or replace package plsqlguide is
-- Author : Jared Petersen
-- Created : 9/22/2015 12:26:22 AM
-- Purpose : Basic PLSQL template/guide
/* Procedures */
procedure p_main;
end plsqlguide;
/
create or replace package body plsqlguide is
/* Main entry point (homepage) */
procedure p_main
is
begin
htp.prn('
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>PL/SQL Sample Application</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Static navbar -->
<nav class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">PL/SQL Sample Application</a>
</div>
</div>
</nav>
<div class="container">
<table class="table table-bordered">
<tr>
<th>#</th>
<th>Name</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
</tr>
');
-- Fill out the parts table
for row in (select * from parts) loop
htp.prn('
<tr>
<td>'||row.pid||'</td>
<td>'||row.name||'</td>
<td>'||row.description||'</td>
<td>'||row.quantity||'</td>
<td>'||row.price||'</td>
</tr>
');
end loop;
htp.prn('
</table>
</div> <!-- /container -->
<!-- jQuery (necessary for Bootstrap''s JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</body>
</html>
');
end p_main;
begin
-- Initialization
null;
end plsqlguide;
/

24
samples/Pickle/data.pkl Normal file
View File

@@ -0,0 +1,24 @@
(dp0
S'a'
p1
(lp2
I1
aF2.0
aI3
ac__builtin__
complex
p3
(F4.0
F6.0
tp4
Rp5
asS'c'
p6
NsS'b'
p7
(S'string'
p8
VUnicode string
p9
tp10
s.

File diff suppressed because one or more lines are too long

36
samples/Pickle/random.pkl Normal file
View File

@@ -0,0 +1,36 @@
cnumpy.core.multiarray
_reconstruct
p0
(cnumpy
ndarray
p1
(I0
tp2
S'b'
p3
tp4
Rp5
(I1
(I100
tp6
cnumpy
dtype
p7
(S'f8'
p8
I0
I1
tp9
Rp10
(I3
S'<'
p11
NNNI-1
I-1
I0
tp12
bI00
S'\x1cc~\xc3\xa7r\xed?\xe5${\xec\xd6\xcd\xed?\x809-\x02%\xa9\xa2?F\x0f\x1d\xe8\xef\xa3\xdb?\xfe\xd1\x0c\xb7\x83\x13\xef?\xe0<o\xa1\xa9^\xdf?CE\x96\x88/o\xe2?<\xd8\xa1\x96\xa2T\xce?\x152\x8e\xe5\xa8\x7f\xe8?\xe4\xb7\x9a\xe0$\x0f\xdc?\x90\xe4\xe2\xd4=\xce\xc3?Ix\xe3P\xc4C\xe1?\x16\xd17\xc1Y\xfc\xed?5\xd7\xae@4\xfa\xe8?\x0f\x87\x8d>\xfcO\xe5?Y\x97\xcb"\xa7%\xe7?\x9b\x8d\x16\xda\x97\xe1\xeb?T\x14\xbd\xfe|\xf4\xd0?\x18\xdfH\xc56A\xba?\x90\xc5\xfb\xc63:\xe5?\xbf%\xad\xe5.\x86\xe9?\xc6\x0c\xa9\x8c\xd7\xd5\xe9?\xf8\xafc:\x84g\xd7?\xf8\x98\x879\x9a\x16\xee?\xba\xdf\x88\x8az\x06\xe2?~g-\xeb\xc8\xed\xee?\x08A\xcc\x8c\xe7>\xef?\xceD\xc4ar\n\xdc?\x92w\xbb\xa34\xb1\xd9?\x88\xb9\xc0{u\xa3\xdc?d\x1a\xad\xe8\xf3\x14\xdd?\x9c\x95\x13\x96o?\xe5?\x9cT[\xb8r\xa9\xe5?0\xf1\x01+(\x0f\xdf?W\xbdjqD&\xed?c\xcf1-W\xe6\xe1?\xce\xbc\xe1{zW\xd9?"d\xcf\xd7\x13\x93\xde?\xf2P\xf6\xc3\xd6\x87\xd5?\xc2\x0e\x92q\x89\xda\xd5?\xc0:B\x1bb\x00\x9e?Y\xafHmr\x80\xe3?\x1co\xa7\xba\xa5/\xe4?\xa2\xbc \x9c\xddB\xd0?\xd2L\x935\x17\'\xee?|\x8cM\xeb\x97=\xe8?\x0f0xN*V\xea?\x81p\xe3,!\xf2\xee?\xf5w\xed\x10\x9eu\xe0?\xc5\x16\\LR\xb5\xe1?\xbeh\x04\xa4g\xe5\xd6?\xea\xc0\xb9\xf0\xb2\xd8\xd9?\xac\x9c\xeep\x1a\xa9\xd8?@W9hp\x16\xb1?\xc4\xedS\xd6V\xa1\xed?\x93,!\xdc\xa1\x8b\xe9?\x80)\xb1\xa6[T\xc9?\xac\xbc\x8a\xd21\xdd\xc5?\x80\x9c.g\xf1\xf2\xc6?\tLu\xc3\xf7U\xe9?n\'\x9f?\xbe\xf9\xe9?\xa3\xe7K\x1c\xb3\xa9\xea?X\x98\x1a\xcb\xa0\xcd\xd3? \xb6O\x9c\x1bQ\xc2?"\x89[\xad1\x8e\xea?\xdd\x8f\xa0P\xc7\x0e\xe2?c\xa4j\xa3\r\xac\xef?\xba\xb6\x0f\x8emo\xef?\xe0\xed\xa0\xc5R9\xab?U\xf1\xcd\xcf\xbf\xcb\xea?\x89*#\x06\xb0|\xe8?d\xa3\xad\xcd\xe0]\xcc?\xb5\xe78\xa7w\x13\xe3?\xce\x99\x98\xefS%\xd7?\xb1\xf8\xd8\x8eI\x13\xef?\x91`]\x93\xd4 \xec?\xc0\rPz\xee\xbd\xe7?7\x92\xd4\x0fP\x8f\xe1?L\x0f\xaf\xa9\xc3\x19\xdd?\\}\x15X\x870\xc7? ~ t\xcat\xb1?@?\xec\x97u\x05\xe9?F\x8d:\xac4D\xdb?qY\xe1Qk|\xe2? \xaf\xeaj\xa5\x04\xab?J[\x1al;\x00\xd5?\x00^{n\xc2\xf1S?\xb0\x82dN\xda\xb5\xc7?\xe0 \x07\xe1?R\x92?\xc4\r\x08+\x99J\xe1?I|&U\x19\xc4\xe1?|*\xf9\xebq\x7f\xed?\xbc*\x93\x89k\xab\xe9?oiL\x90;\xe0\xef?\x96\xcd\x9b\xff\x18g\xdc?pt\xb4\xa5\x9c\xa2\xbc?Nu]w*\xb7\xd2?\x88k\xac\xd0\xfd\xbf\xd5?Q\x02$b\xfeH\xea?5\xf6\t\xb6K\x1a\xee?'
p13
tp14
b.

10
samples/Pickle/save.pkl Normal file
View File

@@ -0,0 +1,10 @@
(dp0
S'lion'
p1
S'yellow'
p2
sS'kitty'
p3
S'red'
p4
s.

30
samples/Pony/circle.pony Normal file
View File

@@ -0,0 +1,30 @@
use "collections"
class Circle
var _radius: F32
new create(radius': F32) =>
_radius = radius'
fun ref get_radius(): F32 =>
_radius
fun ref get_area(): F32 =>
F32.pi() * _radius.pow(2)
fun ref get_circumference(): F32 =>
2 * _radius * F32.pi()
actor Main
new create(env: Env) =>
for i in Range[F32](1.0, 101.0) do
let c = Circle(i)
var str =
"Radius: " + c.get_radius().string() + "\n" +
"Circumference: " + c.get_circumference().string() + "\n" +
"Area: " + c.get_area().string() + "\n"
env.out.print(str)
end

32
samples/Pony/counter.pony Normal file
View File

@@ -0,0 +1,32 @@
use "collections"
actor Counter
var _count: U32
new create() =>
_count = 0
be increment() =>
_count = _count + 1
be get_and_reset(main: Main) =>
main.display(_count)
_count = 0
actor Main
var _env: Env
new create(env: Env) =>
_env = env
var count: U32 = try env.args(1).u32() else 10 end
var counter = Counter
for i in Range[U32](0, count) do
counter.increment()
end
counter.get_and_reset(this)
be display(result: U32) =>
_env.out.print(result.string())

261
samples/Pony/gups-opt.pony Normal file
View File

@@ -0,0 +1,261 @@
use "options"
use "time"
use "collections"
class Config
var logtable: U64 = 20
var iterate: U64 = 10000
var logchunk: U64 = 10
var logactors: U64 = 2
fun ref apply(env: Env): Bool =>
var options = Options(env)
options
.add("logtable", "l", I64Argument)
.add("iterate", "i", I64Argument)
.add("chunk", "c", I64Argument)
.add("actors", "a", I64Argument)
for option in options do
match option
| ("table", var arg: I64) => logtable = arg.u64()
| ("iterate", var arg: I64) => iterate = arg.u64()
| ("chunk", var arg: I64) => logchunk = arg.u64()
| ("actors", var arg: I64) => logactors = arg.u64()
| let err: ParseError =>
err.report(env.out)
env.out.print(
"""
gups_opt [OPTIONS]
--table N log2 of the total table size. Defaults to 20.
--iterate N number of iterations. Defaults to 10000.
--chunk N log2 of the chunk size. Defaults to 10.
--actors N log2 of the actor count. Defaults to 2.
"""
)
return false
end
end
env.out.print(
"logtable: " + logtable.string() +
"\niterate: " + iterate.string() +
"\nlogchunk: " + logchunk.string() +
"\nlogactors: " + logactors.string()
)
true
actor Main
let _env: Env
let _config: Config = Config
var _updates: U64 = 0
var _confirm: U64 = 0
let _start: U64
var _actors: Array[Updater] val
new create(env: Env) =>
_env = env
if _config(env) then
let actor_count = 1 << _config.logactors
let loglocal = _config.logtable - _config.logactors
let chunk_size = 1 << _config.logchunk
let chunk_iterate = chunk_size * _config.iterate
_updates = chunk_iterate * actor_count
_confirm = actor_count
var updaters = recover Array[Updater](actor_count) end
for i in Range[U64](0, actor_count) do
updaters.push(Updater(this, actor_count, i, loglocal, chunk_size,
chunk_iterate * i))
end
_actors = consume updaters
_start = Time.nanos()
for a in _actors.values() do
a.start(_actors, _config.iterate)
end
else
_start = 0
_actors = recover Array[Updater] end
end
be done() =>
if (_confirm = _confirm - 1) == 1 then
for a in _actors.values() do
a.done()
end
end
be confirm() =>
_confirm = _confirm + 1
if _confirm == _actors.size() then
let elapsed = (Time.nanos() - _start).f64()
let gups = _updates.f64() / elapsed
_env.out.print(
"Time: " + (elapsed / 1e9).string() +
"\nGUPS: " + gups.string()
)
end
actor Updater
let _main: Main
let _index: U64
let _updaters: U64
let _chunk: U64
let _mask: U64
let _loglocal: U64
let _output: Array[Array[U64] iso]
let _reuse: List[Array[U64] iso] = List[Array[U64] iso]
var _others: (Array[Updater] val | None) = None
var _table: Array[U64]
var _rand: U64
new create(main:Main, updaters: U64, index: U64, loglocal: U64, chunk: U64,
seed: U64)
=>
_main = main
_index = index
_updaters = updaters
_chunk = chunk
_mask = updaters - 1
_loglocal = loglocal
_rand = PolyRand.seed(seed)
_output = _output.create(updaters)
let size = 1 << loglocal
_table = Array[U64].undefined(size)
var offset = index * size
try
for i in Range[U64](0, size) do
_table(i) = i + offset
end
end
be start(others: Array[Updater] val, iterate: U64) =>
_others = others
iteration(iterate)
be apply(iterate: U64) =>
iteration(iterate)
fun ref iteration(iterate: U64) =>
let chk = _chunk
for i in Range(0, _updaters) do
_output.push(
try
_reuse.pop()
else
recover Array[U64](chk) end
end
)
end
for i in Range(0, _chunk) do
var datum = _rand = PolyRand(_rand)
var updater = (datum >> _loglocal) and _mask
try
if updater == _index then
_table(i) = _table(i) xor datum
else
_output(updater).push(datum)
end
end
end
try
let to = _others as Array[Updater] val
repeat
let data = _output.pop()
if data.size() > 0 then
to(_output.size()).receive(consume data)
else
_reuse.push(consume data)
end
until _output.size() == 0 end
end
if iterate > 1 then
apply(iterate - 1)
else
_main.done()
end
be receive(data: Array[U64] iso) =>
try
for i in Range(0, data.size()) do
let datum = data(i)
var j = (datum >> _loglocal) and _mask
_table(j) = _table(j) xor datum
end
data.clear()
_reuse.push(consume data)
end
be done() =>
_main.confirm()
primitive PolyRand
fun apply(prev: U64): U64 =>
(prev << 1) xor if prev.i64() < 0 then _poly() else 0 end
fun seed(from: U64): U64 =>
var n = from % _period()
if n == 0 then
return 1
end
var m2 = Array[U64].undefined(64)
var temp = U64(1)
try
for i in Range(0, 64) do
m2(i) = temp
temp = this(temp)
temp = this(temp)
end
end
var i: U64 = 64 - n.clz()
var r = U64(2)
try
while i > 0 do
temp = 0
for j in Range(0, 64) do
if ((r >> j) and 1) != 0 then
temp = temp xor m2(j)
end
end
r = temp
i = i - 1
if ((n >> i) and 1) != 0 then
r = this(r)
end
end
end
r
fun _poly(): U64 => 7
fun _period(): U64 => 1317624576693539401

View File

@@ -0,0 +1,3 @@
actor Main
new create(env: Env) =>
env.out.print("Hello, world.")

View File

@@ -0,0 +1,188 @@
use "files"
use "options"
use "collections"
actor Worker
new mandelbrot(main: Main, x: U64, y: U64, width: U64, iterations: U64,
limit: F32, real: Array[F32] val, imaginary: Array[F32] val)
=>
var view: Array[U8] iso =
recover
Array[U8]((y - x) * (width >> 3))
end
let group_r = Array[F32].undefined(8)
let group_i = Array[F32].undefined(8)
var row = x
try
while row < y do
let prefetch_i = imaginary(row)
var col: U64 = 0
while col < width do
var j: U64 = 0
while j < 8 do
group_r.update(j, real(col + j))
group_i.update(j, prefetch_i)
j = j + 1
end
var bitmap: U8 = 0xFF
var n = iterations
repeat
var mask: U8 = 0x80
var k: U64 = 0
while k < 8 do
let r = group_r(k)
let i = group_i(k)
group_r.update(k, ((r * r) - (i * i)) + real(col + k))
group_i.update(k, (2.0 * r * i) + prefetch_i)
if ((r * r) + (i * i)) > limit then
bitmap = bitmap and not mask
end
mask = mask >> 1
k = k + 1
end
until (bitmap == 0) or ((n = n - 1) == 1) end
view.push(bitmap)
col = col + 8
end
row = row + 1
end
main.draw(x * (width >> 3), consume view)
end
actor Main
var iterations: U64 = 50
var limit: F32 = 4.0
var chunks: U64 = 16
var width: U64 = 16000
var actors: U64 = 0
var header: U64 = 0
var real: Array[F32] val = recover Array[F32] end
var imaginary: Array[F32] val = recover Array[F32] end
var outfile: (File | None) = None
new create(env: Env) =>
try
arguments(env)
let length = width
let recip_width = 2.0 / width.f32()
var r = recover Array[F32](length) end
var i = recover Array[F32](length) end
for j in Range(0, width) do
r.push((recip_width * j.f32()) - 1.5)
i.push((recip_width * j.f32()) - 1.0)
end
real = consume r
imaginary = consume i
spawn_actors()
create_outfile()
end
be draw(offset: U64, pixels: Array[U8] val) =>
match outfile
| var out: File =>
out.seek_start(header + offset)
out.write(pixels)
if (actors = actors - 1) == 1 then
out.dispose()
end
end
fun ref create_outfile() =>
match outfile
| var f: File =>
f.print("P4\n " + width.string() + " " + width.string() + "\n")
header = f.size()
f.set_length((width * (width >> 3)) + header)
end
fun ref spawn_actors() =>
actors = ((width + (chunks - 1)) / chunks)
var rest = width % chunks
if rest == 0 then rest = chunks end
var x: U64 = 0
var y: U64 = 0
for i in Range(0, actors - 1) do
x = i * chunks
y = x + chunks
Worker.mandelbrot(this, x, y, width, iterations, limit, real, imaginary)
end
Worker.mandelbrot(this, y, y + rest, width, iterations, limit, real,
imaginary)
fun ref arguments(env: Env) ? =>
let options = Options(env)
options
.add("iterations", "i", I64Argument)
.add("limit", "l", F64Argument)
.add("chunks", "c", I64Argument)
.add("width", "w", I64Argument)
.add("output", "o", StringArgument)
for option in options do
match option
| ("iterations", var arg: I64) => iterations = arg.u64()
| ("limit", var arg: F64) => limit = arg.f32()
| ("chunks", var arg: I64) => chunks = arg.u64()
| ("width", var arg: I64) => width = arg.u64()
| ("output", var arg: String) =>
outfile = try File(FilePath(env.root, arg)) end
| let err: ParseError => err.report(env.out) ; usage(env) ; error
end
end
fun tag usage(env: Env) =>
env.out.print(
"""
mandelbrot [OPTIONS]
The binary output can be converted to a BMP with the following command
(ImageMagick Tools required):
convert <output> JPEG:<output>.jpg
Available options:
--iterations, -i Maximum amount of iterations to be done for each pixel.
Defaults to 50.
--limit, -l Square of the limit that pixels need to exceed in order
to escape from the Mandelbrot set.
Defaults to 4.0.
--chunks, -c Maximum line count of chunks the image should be
divided into for divide & conquer processing.
Defaults to 16.
--width, -w Lateral length of the resulting mandelbrot image.
Defaults to 16000.
--output, -o File to write the output to.
"""
)

130
samples/Pony/mixed.pony Normal file
View File

@@ -0,0 +1,130 @@
use "collections"
actor Worker
var _env: Env
new create(env: Env) =>
_env = env
var a: U64 = 86028157
var b: U64 = 329545133
var result = factorize(a*b)
var correct =
try
(result.size() == 2) and
(result(0) == 86028157) and
(result(1) == 329545133)
else
false
end
fun ref factorize(bigint: U64) : Array[U64] =>
var factors = Array[U64](2)
if bigint <= 3 then
factors.push(bigint)
else
var d: U64 = 2
var i: U64 = 0
var n = bigint
while d < n do
if (n % d) == 0 then
i = i + 1
factors.push(d)
n = n / d
else
d = if d == 2 then 3 else (d + 2) end
end
end
factors.push(d)
end
factors
actor Ring
var _env: Env
var _size: U32
var _pass: U32
var _repetitions: U32
var _next: Ring
new create(env: Env, size: U32, pass: U32, repetitions: U32) =>
_env = env
_size = size
_pass = pass
_repetitions = repetitions
_next = spawn_ring(_env, _size, _pass)
run()
new neighbor(env: Env, next: Ring) =>
_env = env
_next = next
_size = 0
_pass = 0
_repetitions = 0
be apply(i: U32) =>
if i > 0 then
_next(i - 1)
else
run()
end
fun ref run() =>
if _repetitions > 0 then
_repetitions = _repetitions - 1
_next(_pass * _size)
Worker(_env)
end
fun tag spawn_ring(env: Env, size: U32, pass': U32) : Ring =>
var next: Ring = this
for i in Range[U32](0, size) do
next = Ring.neighbor(env, next)
end
next
actor Main
var _size: U32 = 50
var _count: U32 = 20
var _pass: U32 = 10000
var _repetitions: U32 = 5
var _env: Env
new create(env: Env) =>
_env = env
try
arguments()
start_benchmark()
else
usage()
end
fun ref arguments() ? =>
_count = _env.args(1).u32()
_size = _env.args(2).u32()
_pass = _env.args(3).u32()
_repetitions = _env.args(4).u32()
fun ref start_benchmark() =>
for i in Range[U32](0, _count) do
Ring(_env, _size, _pass, _repetitions)
end
fun ref usage() =>
_env.out.print(
"""
mixed OPTIONS
N number of actors in each ring"
N number of rings"
N number of messages to pass around each ring"
N number of times to repeat"
"""
)

267
samples/Ruby/racc.rb Normal file
View File

@@ -0,0 +1,267 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.7
# from Racc grammer file "".
#
require 'racc/parser.rb'
module RJSON
class Parser < Racc::Parser
require 'rjson/handler'
attr_reader :handler
def initialize tokenizer, handler = Handler.new
@tokenizer = tokenizer
@handler = handler
super()
end
def next_token
@tokenizer.next_token
end
def parse
do_parse
handler
end
##### State transition tables begin ###
racc_action_table = [
9, 33, 9, 11, 13, 16, 19, 22, 9, 7,
23, 1, 9, 11, 13, 16, 19, 29, 30, 7,
21, 1, 9, 11, 13, 16, 19, 31, nil, 7,
21, 1, 23, 7, nil, 1 ]
racc_action_check = [
6, 27, 33, 33, 33, 33, 33, 3, 31, 33,
6, 33, 29, 29, 29, 29, 29, 12, 22, 29,
12, 29, 2, 2, 2, 2, 2, 25, nil, 2,
2, 2, 25, 0, nil, 0 ]
racc_action_pointer = [
24, nil, 20, 7, nil, nil, -2, nil, nil, nil,
nil, nil, 10, nil, nil, nil, nil, nil, nil, nil,
nil, nil, 18, nil, nil, 20, nil, -7, nil, 10,
nil, 6, nil, 0, nil, nil, nil ]
racc_action_default = [
-27, -12, -21, -27, -1, -2, -27, -10, -15, -26,
-8, -22, -27, -23, -17, -16, -24, -20, -18, -25,
-19, -11, -27, -13, -3, -27, -6, -27, -9, -21,
37, -27, -4, -21, -14, -5, -7 ]
racc_goto_table = [
8, 26, 24, 27, 10, 3, 25, 5, 4, 12,
nil, nil, nil, nil, 28, nil, nil, nil, nil, nil,
nil, 32, nil, nil, nil, nil, 35, 34, 27, nil,
nil, 36 ]
racc_goto_check = [
9, 7, 5, 8, 11, 1, 6, 3, 2, 12,
nil, nil, nil, nil, 11, nil, nil, nil, nil, nil,
nil, 5, nil, nil, nil, nil, 7, 9, 8, nil,
nil, 9 ]
racc_goto_pointer = [
nil, 5, 8, 7, nil, -4, 0, -5, -3, -2,
nil, 2, 7, nil, nil ]
racc_goto_default = [
nil, nil, 14, 18, 6, nil, nil, nil, 20, nil,
2, nil, nil, 15, 17 ]
racc_reduce_table = [
0, 0, :racc_error,
1, 14, :_reduce_none,
1, 14, :_reduce_none,
2, 15, :_reduce_none,
3, 15, :_reduce_none,
3, 19, :_reduce_none,
1, 19, :_reduce_none,
3, 20, :_reduce_none,
2, 16, :_reduce_none,
3, 16, :_reduce_none,
1, 23, :_reduce_10,
1, 24, :_reduce_11,
1, 17, :_reduce_12,
1, 18, :_reduce_13,
3, 25, :_reduce_none,
1, 25, :_reduce_none,
1, 22, :_reduce_none,
1, 22, :_reduce_none,
1, 22, :_reduce_none,
1, 26, :_reduce_none,
1, 26, :_reduce_20,
0, 27, :_reduce_none,
1, 27, :_reduce_22,
1, 27, :_reduce_23,
1, 27, :_reduce_24,
1, 27, :_reduce_25,
1, 21, :_reduce_26 ]
racc_reduce_n = 27
racc_shift_n = 37
racc_token_table = {
false => 0,
:error => 1,
:STRING => 2,
:NUMBER => 3,
:TRUE => 4,
:FALSE => 5,
:NULL => 6,
"," => 7,
":" => 8,
"[" => 9,
"]" => 10,
"{" => 11,
"}" => 12 }
racc_nt_base = 13
racc_use_result_var = true
Racc_arg = [
racc_action_table,
racc_action_check,
racc_action_default,
racc_action_pointer,
racc_goto_table,
racc_goto_check,
racc_goto_default,
racc_goto_pointer,
racc_nt_base,
racc_reduce_table,
racc_token_table,
racc_shift_n,
racc_reduce_n,
racc_use_result_var ]
Racc_token_to_s_table = [
"$end",
"error",
"STRING",
"NUMBER",
"TRUE",
"FALSE",
"NULL",
"\",\"",
"\":\"",
"\"[\"",
"\"]\"",
"\"{\"",
"\"}\"",
"$start",
"document",
"object",
"array",
"start_object",
"end_object",
"pairs",
"pair",
"string",
"value",
"start_array",
"end_array",
"values",
"scalar",
"literal" ]
Racc_debug_parser = false
##### State transition tables end #####
# reduce 0 omitted
# reduce 1 omitted
# reduce 2 omitted
# reduce 3 omitted
# reduce 4 omitted
# reduce 5 omitted
# reduce 6 omitted
# reduce 7 omitted
# reduce 8 omitted
# reduce 9 omitted
def _reduce_10(val, _values, result)
@handler.start_array
result
end
def _reduce_11(val, _values, result)
@handler.end_array
result
end
def _reduce_12(val, _values, result)
@handler.start_object
result
end
def _reduce_13(val, _values, result)
@handler.end_object
result
end
# reduce 14 omitted
# reduce 15 omitted
# reduce 16 omitted
# reduce 17 omitted
# reduce 18 omitted
# reduce 19 omitted
def _reduce_20(val, _values, result)
@handler.scalar val[0]
result
end
# reduce 21 omitted
def _reduce_22(val, _values, result)
n = val[0]; result = n.count('.') > 0 ? n.to_f : n.to_i
result
end
def _reduce_23(val, _values, result)
result = true
result
end
def _reduce_24(val, _values, result)
result = false
result
end
def _reduce_25(val, _values, result)
result = nil
result
end
def _reduce_26(val, _values, result)
@handler.scalar val[0].gsub(/^"|"$/, '')
result
end
def _reduce_none(val, _values, result)
val[0]
end
end # class Parser
end # module RJSON

View File

@@ -0,0 +1,27 @@
//@jsx: preserve
//@module: amd
//@filename: react.d.ts
declare module JSX {
interface Element { }
interface IntrinsicElements {
}
interface ElementAttributesProperty {
props;
}
}
interface Props {
foo: string;
}
//@filename: file.tsx
export class MyComponent {
render() {
}
props: { foo: string; }
}
<MyComponent foo="bar" />; // ok
<MyComponent foo={0} />; // should be an error

1053
samples/XML/sample.csl Normal file

File diff suppressed because it is too large Load Diff

213
samples/XML/water.tsx Normal file
View File

@@ -0,0 +1,213 @@
<?xml version="1.0" ?>
<tileset name="Sunny Beach">
<tile id="0">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABYklEQVR42tVVq47DMBDsp/hHDxQcOFBwwMAgwMDEIKAgoCAgUqBhqH8l50126lHaq9TrQ7pKq8TOemd2dtfd7f7rz3TTbNpibpyNT/N7gUOxSHbKs+mLlW+vAwaQJ1B5ulQN+88kYkIJ3GhwkVwyFRABvKbEkKvfI0TOGYkha9nDe4AiqfqIHZUoznbTfURwYA1agn+rvAL2VRpuX8ym1Rw9QUpIiB/WLQilRZXfgXuVziro51hr69HxtPZUAlk3ui9ErZYNvvLeEplAU7MAx00tj3mVEhkMuWYdVeZGQTrtCZTDqz8IsAotleqCCDcUZ7aQUduSsanKjnVDe44yx9Qogdvj1k21m08KDiltqllAdnwX+xgvRzNqvLuaUQ4EDSCgB8oQtb4GxIBDfvxeOE9ApO7mUjltWl5HvQfiMy+kXhXBjGP8DhsF2rTYa6/kQKPFV7Sf3vinFLQX3Np0f43zA259mZw6IuSNAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="1">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAB/0lEQVR42tVVLYvDQBBduTJy5drIyMrY/oOTFScrKioqKioiwhFxcBWFVhQaU0JEOCIKPXFQGVmbvzI3M/vRlIM7ev2AKwwNk7Bv3nvzEiH+7S/dQG/dg2gVQZRpeBiuro+g8yPI+R7E8A3EQEC0jkDPNdf9gLcIvGtBr/Efr4k9lUoVxGUMYaJAZaaofzvgvAG9ahhUl1gfLYisADEpQE6ksWFrFIgWEcixhHAVXq+IXlhQKsuae3gtZoVnT/47QGKvZwEPxCqMBPcvUoQ9rh0wAr42BpjkTw+gp+j985IVoIOZ5VhAv+p7sF5p+kES+Gd+HYSkZYnnFjQ5GGDLmu/htRhtEBBruGRgqi6QnEkPqKxFdN/1SLEzaxjYSe2qwl5ltp2BP1szGJbCfSALeJCRjSKmgOQncAKL85j3g/qcELLFPuOG8eqdlq0zQN7xnodpQZVmmKBq2ALHjBgFCECH0y7wXmwjz5R6POQ8hLiKvQo/x622rEsbvcrETybvIJ4w+9PibMlUYsAJWE0VD+Ei6Qa5OBU8QG6TQPJnDQTpnv0PUwti2bLvC8OMpBdDYVJCqbhJHHdmT8TASK9Ty8hGjpmujN+8Ayj1N4+vfiHRCyjB5Ru88Oazv1l48hR7DLwIOYb3+xiMlp4d+U5yx3Xs4/ewjxLtQfcl89dzvgD75hkn04cPugAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="2">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACjElEQVR42r1VIY/iYBTkZ6ysrURWYpFIJBKLRJJTVZsUQcKKTajZEAQhCBIqmrSCpAiSIhCfQFQgKk5UnHk3876W3Iq7bLjdJXkp/dow8+bNPFqtBz+d2EgSjaQs5pKfJtL6ro93rqR7EuluS+lFpSTpWMx5ItlxjPpCIs5bLm5UiLcrZVmI+BcB+ATgvlQ/F5LEI1UiP40/VxEnzMR5QYGAd6jEOxvx3ox0VoVk6L4s50ogO0CJSyCb9UC/a0GV/W74GBlnZkG1Xu316TmR7nQv3bQSY5bo1FcgksgxBnPhfaPERJZhX58X1+DjJJwtwLYNMEg8o0hmZ6Q9y2WwrmR5E1WABmSHSTqSqlwoENUgGZ5xLMYEksMbfC/HuP4OHBlxVgCd1qA/EgvMogJryB5VMkD14IN+Kiq3zh6ABNZRANiOw1dTFte5ktlH9fnZqvYeuJG6KYA5a1zD3JJKC3Ffclu4J3j/INJbGZFfSy0CslOmoqiV4YhYJEm/6LUmV1AZPLMmQ6YpsYKz42ndNa+hBW6/Gn3G+I0ZQ4BT8rIIABjc5eYZKz+OLQGSIvDRArM226ESfRdb7bZRIPzDfFuj8WunpQzOkL1EBAsrP+Uk0F1eyk4/YBQkRflz3RETu7Rudmnx7J95VxPG1hNubMGfZkgAZq8RDCG9bDR2/PEstbNVJVKbAhvPOVTx9ayJ5sfTQAIYjwupvXUhvRjOBwEXY1A5jTUTu+G8lYiqMcT96L6gtOv/2ZAuuu2gYRdjGR5FFWBH9+xj7kZ3QKCxJClrzD3eWXzeRuTy8a9wP/xAiRtD6UzZPRfOJagN94X/Cb24VBC6mPJmBxKwbv/Wf0Wu3PK2UKdT/kd/5zeaE2gm63UKTAAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="3">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABvklEQVR42tVVr2/CQBTmb0XWVlZW1lZWoicWMkECgqQIklY0acVEBeIEomICe3vfd33H0Y1kY0AykpfCcbzv17tjNvuvr7ZLbbmL7fJlbodjYZ8GbA65rQS42ie2f88Izs91IpU+jki5jW3f57YVkPUqssYU4oC838Qkge/bJpVK+LwbsCqFOnMoaDvKgWEtF2LZ6Ehul69zvmeJKzcDAxRqoRSK2yZjEUwInD4Wjgyc6TKCYX9Irto5IiD5K2DU8i2y5SaixVQjzQCkmQMsdOY0LEhuEMI6oNPYWvn99akWxuWYJxV0yDfywLBX1VWBM8NQuGEUAn4gJ7GhB/pxvXNxBYq/5oYnWJOEgKAR1kFovYp9HFCI5krCRZCQXDiY6kSvJGSvgTNN4Mh3thGodg2MEIW9aKBOADiMiarVAVEK9XQJZCbuXp/60TZjcj6x2ZFJSQJk1AmAaEzqhq7r6UCVI6kL639y7n3jiW3lNmJsdGokyH114qPi3IxD2/7lgro4FTt32zkw54qS4PrmrLStEw7mXe9+r7o5Dyczrd1waUQPvZL1uOpwVXsQyPycPO1PCTkPxwUHFUf51j6f/7okyrolgPYAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="4">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACUklEQVR42tWVr2/qUBTHJ5FIZC2yEomdRCKRtVUvVUsz8dLMMUHSiSXMEDJBGgRJESRFkBRB0oknEE8gJvgXzjufU+4eZsl7+5Vsyclt77m73+/5nu8pFxff9a991xZ/5EvzuinJYiBfBty6aUk060k4uZR4NZDhNpDw8VIg1LnvfB4R79aT1nXLgCAQzfoSKInurCvZLpJ40RfOuPi4in+2hACgcdUQb+SJf+NJ8NCV6TqU6aYOiBj4VVP8e19Qiva8GXj/K5FqG8vhkEq+CMSf1JdWu0TSdWCgibYA2WlB9NizM5BwZFjJ/5ciABPZvAbNl6GUm0jKdWQEqB5iUyWRK4lcc7G2BJB42TfAYhtJtgqMAHewWqhqrwJXu1gKBTs+p8Jz9RQreCCNHw3ZPyUmZ61AnYNENO9Ze9gnkuXAgMcajhSEjMht21b+hyLOKh5KNhtYlUhZKnueAeAC5C/1mYsgFDzUcpODGN4ghyJjzac6kuYZVSOcdF+IEJxJ533DQQ2K+6uAVlWoqYpVKPv90AjQb1b2Dkr0qH6AHOfoP7nOqG3nbX9XFzFVBVAjcW3AtHddI8UUQfDVVlDtcBOo+YZy+J1KpqydGpBAapTIF6HKWVdDDpKstJB9fMQ7gOcj/M9m5EKMZ6tWx4UHlFFVCq2MtplSJz84tx+fx0ac1tIiqseI7xrHUo3HVBRKyPmhPKkCCT5MvBeniWG/Ui8dj+OP+yBR6UvVSsiZ06ZCVwdsiun7p32SM519KnUfJ6SutsnJtPHX/ShhxPN+v/WeP+Pal6x1OIpVAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="5">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACTElEQVR42tVUr2vrUBSenKyMjI28MjI2MrIyMjYyaoSJEepSUWhEoc+UMlFKRaAVhUwUOvFgExMVT0Q80X/hvO876X2rGlvf9mCBQ27Opff7cb7bq6vv+qw3iRx/T6X9NUaV8t+Al7tUmk0q6zqRfBsr+H6Xy9Mj6mf+dUSennNZLmI5HEoFIoE9QNNZCCfG0jyk4g5dabap9j8N+PBSyB6Ay1UCkEwP9ye+vgmY1311Ib0PlRh7XuXBkUyOx+nlRFQJAPW9y4REWqhvtok6oT26AWem6K0xGhLjKOYPiWT3fYnrUMzAFTMz7ydCZeUukbYtNWDnituXUrrwjcUZOB34JlYXSJTquTcHmRC/MZVRN9h3bh1dvzljzpEHqTINVaFlVVvFtDutIx2JP/K0T0cIzL1s1ZfiRIzkvYGna+7x7dw5r0SyRaTAnB9LlbdjDRn3qJyq13WqB3ezLnBQLMkkgNWR3obmGePC3OMfgSSLUIH5e6veTEzXm0VKwoyMBvjVAYDzetFCrglkU22tVdvPg3YoJMahcQVQHBbOfAmrDsgC85wSmTBDT4JFoH3m4s3Us5h6hufc2jlGoXmA9UusUygMoCw8qck3nUNqOwhmGBOLoAQP4M67w5itIs2BHQfJdA4UmvJ+BeWrUMuH8ilGQmBabYvf3OP74uvIwLBI4PrmWtxRZ2ECNTy4d9v7m3AqdW96SL+nZLn3aX9I51fJqqKt/O4BlD0lcKov+0umMmt1+Ygc4BZwrcT+xeqPPgT0ht399kbexcB/AEhbiVW/ps4pAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="6">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACOUlEQVR42tWVrW/bUBTF+2cEhhoaGpoGBgYamhoaWgOTFeaCSS6IlJEoKoiiAksNiJSASimIlIACgwKDAoOB0bv7u3bc7qPSlq2VFunpfeTl3XPPOffm4uJ//RyOiWy2kSyvA0lXI3m3wNVjJjsNvLuLpXxIpX7Km/19rCN5OyCbdSRlmclBg9wWoVRVrgzoehU1IBRQ/7Iv3Dvs/yGQU6ZkVz3mRjuDIAwYKcvUALAHhK2Vkbqeng8kXQWWLZmS8WGf2rBgCuDrl2kDBmaOqczXoXgTz34z34YGJF4MxR33xZ25vw+EbBnLm1A2q9AoJqPdNrZA0A24cOJLfDPsmGFNUL6f30UdEOfKsfPeh56tX3e10rdp9TR6j+gbdoHLh8wyZk/WnQnrvJ2nnSFhgzOAZLqOZ0ML3hs3IHofe89AkmIky0XQZMm4j1sNWxBKP1lyD0Bkyx66mfmtmVPvDj65kq4Dkw3qgyvPZIgmA3EnrjHnjB0DkRaBTPW9n+r6pdtNd505q5SBuso7OQBzW0RK/chkiq4HBpLAxpiOZDGy80ylcC8d8Re+ycGd113falpVmc0Aa8AkBgKtYYWHYAEgyENAHiY77kAzhuUeg+D+Z1/+qO5/1LuCGWWFMx6FKXQ1/6xPzSg22qGb7L2ZZ0DPLsfvqmLbdDuCYTACnMrPzlUKPABgfPBXfeBXvb8z3P7ZnFYxOhOUeqc/vGlLPpUrAKwnFDSstPPJu/0pYb76aWpGxYTnvvMN/STd514e0SYAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="7">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABjklEQVR42tVVsWrDMBDNp+i7+gnZO3UqoUMoHQL1YKgHgbWYoKEUD4Z4CHhUN636FVV30knnkBYSnEADRwKS7r179+6yWv3Xj+itFzpEPXkhjb8vsArRsRicf1d7jNsBJyAhCyh+18Yfvq3f9wcksN6++vXzZjkiQhkvGhPBQHKZwAMwKAHg7ThlApvdRyYBal0PXJsisYwgAJAVOAFv9ddMhYfHp0i4t5cRoQcROJDYJYmHklxUBoMDcxUyAZVUg+jCm9H9TgQO8WIVQcXLFGU+6TFJjORUJEZndI7gTXyLisFvzcgoNjXY46ObmQpJyEgGKoMqITlXAXssbfYCEQeysztkWMoPcXTniLCxUqz3w5SrbEczr7JK4InsOaWQhGZTI2P8PW49YwkPPx0SIZkpCZxRxbxVdDd7gaq+yIzwQKVJgErfUmsakwnM5j9Uimr1xRMIPrgFxpHk206lTckrBE6uJ3A0dWcXXEhjUkQXf+TNqJl/tMG47UpWbLT4ipb2jn9KKnmhjvvi2jw/5gK11tLQbjMAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="8">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACOElEQVR42tWVr2/bQBzF+ycMBoYaFgaGBhoGGoYaGgZN0cCkDERKQaWGBBhEVUGkBVRywCQHRDqDAIOAAwUHCgxG3t73e7nVqbQf6tpKi/TV2U7k97n3np2Li//1Y6oxim2K2zyBe5jj3YTtcYqSwuW3DPVhouJ6vss447cDKe5T1PUUhiJf1yNYO6cDPN6kCiHfm/2Yk+n6asJhp7I7e5yr7TJeTK5NCTY5OTLF7SrRYx268mLhXm4x2AHxIzDcNxSb6KgYAZrHGw8jzlQTFRN32nDl1oMI5F8Ld+8MZPoU7W8d4gOQNdCby42cu1EAOW870/C6wDlGEwr6PDZD0F8Lb2p0c4NoZtBbcve5Q39NgIoOfAdGRyCxQEpX1HoKyU2dm/syEuBnIZ/FJk4IlF6vfFznwktzPqsavY1TF3pbH8Xw4DDY0w1GktTQOGSHcvMA4SPIFK5dzOBEHSD4WyvO7FuOdBctgHB8bdD5WODyzjKOBjFdESBxIqEzqayMaESoEXxX9HEMIkfvkoy4IVDaj+o3T4kKSw/ufSTdWakwceU7ITCJA4+tuhTTjf7OR5XUDYaMagwfWXhCilMsZ9b/sYwCsPDinSuun0qEJ+NDXrKcjT/fcF0RhhAiPhCQB66O1wmnu/6XF5Q6sD71hHGEmDrXJaJlrQ5FVwaXa6sdESBxYyAQhH21F5KWVRzJT/34UqLzudCOhJjaxX2zV3IoabR4KqxEIjHJvNufUpSfIGT3s5cL/wB3sgL2s65DmgAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="9">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACYUlEQVR42tVVoW7jUBDsJwQGmhoaGpoWBhoGhgYGGp2igpN6IFICItUkqgKiKiBSDCo5IJIDLNkg4IECgwKDAwYlc7P77F7InapeW+kirTZ5D8zszOzL1dX/+vGTAulhguppjof1EF8HXDYIn4HBocGoBIpyyoqQnSas6POIOHEBZ8tKDIYkMMwBY+aoqjman3dIH8co8og10f5hwL3ZHv3vKYSA+2jg5TX8Y43BETp1/TwnkalWdpzgYTPUrsX79088y9BfZOgtUvT53VkX7Clc9rEB/F2FQSW9Zg5uYWiFAKaHTokI93GoROT+zcDuhpOynFWhwP2bVBXwdgbukndLA39TIUgaS4CZcI8V1anQ1HdWjfNUiYgtxtyiYDb2u5Hm5c/AW2On/JFp9QgsKjgLS8TjxN6KJGiFTO2faoxqZoF1zUyM2cMz1JKM4DK5EJEtETL7pD0rrVW/pWaoZNrLcjfGqhC3Zy0xISBEglOD4NzYPLAPSGAiRI7cEG5G+AINp5ARFaQyrqz2jpgok18o8gq2ugBeWvCOlJdQ6q2oYNQKb0VVaIe3rXB9qGlLDYdBlTUVYjKtKKAqUAEhpPko/7IlFqxQzwX81RrJA7PQ+9aGUraCBBU8b7TL9O6hQiRqPNEe/sbLvX0n2s14+xZwEifOrBKU37nJtAuozQTDSFBnYc/EmgEBAyoxJnjITbn0/p/W0dnZnMhGdDb1l5Zcp4ooEPB19NZU5MTpSUI8/7iXMGkVaTOh2yLg3bbwzGcGAtrhU4XPe5LbkLrxZWDtoyX1ZX9K8iIqCZl+9n7gXyTF4JLCnrXHAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="10">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACQ0lEQVR42tVVoW7jQBDtp5gaGhqaGgYGGpoaBgaGBvbASSmpTgVRFWCpAZFiYMkGkRxgsKDAIGBBgMGRd29mbQdVV7W9ShdpNJvx23nvza6Tu7v/9ePtGvg7A/+hgfezwvcR5yR9MvAem1uw5u0ZFPXviIWIJAHJ/S1zaTX7PxqETx3CbXcT85VCpKmOmTnYk+jcI6itEsskgrxDVPRILeAXFl7RwWfNO3xSiCcE28Et3QmR/2AQ5hbhwSJi+CQLBhEhI9gxKCI4OIz7zn0U827ikO7iVyA+gSQ9oi0bPRp1HnM9z4G0BeZ8PiuJI2Zecy01iTOQFMzsMROMAcKSU5O7QzFvE7e9kkqzhHnBjSmbROKYEbGWGEeado5oxojqHlnvBCWCN66HiJH9ijs5Q7HgmWU6E7Fp13jeJgqoygWaekkQxbQOKOpnV2D5mwStcxoPbkVQwvqsc8SZdfWA05Je/XWD5rxEc1pifiGWz+NymBS/R+w9CRHgschwPGQwZq1CmtNKszQTkv76S9eCk6bW3uNln6IqFlo37YrrTNcV93WvfJ6nsJd7HPeZZtknXG8exbix69aa1UHtXHSclggU0pecQs+rYZ0qYVUvpmci3hgXx1EU492XUYjEmebBXSeTYePjIdVj00kNAhVXLyYRIk5CXdfLj7+OQizxvEvpxI3WkbmpjCK0vr85bSjE2s3X/SAJyeSaxOPY9UyHezIeUfUZx38VcnJOx8tVlSJgNd2Tb/tTknO2l41eVHmVP9rnD/NFCxuaQAv3AAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="11">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACIUlEQVR42tWVrW/jQBDFCwsPFi41NDQ0NQwMLCy9vyLgwIGCgIAAEwMD62RgEGCpAZEcUCkFAQYFhgYHDI5M35vZ9VWV7qT22koXabRrOTvvN1/ri4v/9efqk7gStr4Tt+3kc4VzWHGSqO7NdoO4XS9893HCEKRIVMDKXuLDaGuOZwCp4dk17wzi8k7cpjPnFcT2AwziG8vCbChH1CITbW+l+deMuHU3O3Zbi46iIdIYMGkvktSDLM4iiyP2u1GS4yRxC0C81/P16XUg4YBGRDGARACIGfU37FedgXgYdwvQAJsbrFvdGUDu/QQYZOXPwj51KriG4HcY6p3UiKqBHSaNNuW+GXSvZQnCKJOu7AH6IDzBS+sRLV/ty1g+y4jWqnhRT3Y2ROJq0DU6jupMo4aDGF1PxwTkBLD2armHYZ9QnA1a2JkwMZqhrS9t/mx8w2iFiFSoMoG49SBwkJwndUxxXZkNwnpAhSp8+TYWuVrjA/UAfx+32kdBaoozyqKfnc6j6FeFK3y6V92cLbf5fWdoiV/TjBHmPEE3pwBJykGyBj2AkqTsdFiKTLAfUvYI+iHZ2/+ZEb2kcO5L1clVdZLL2x9vH0cVwZgpTAGA/WRiAYSrLwXf8XnxIBIdrEnf7UKK0YgZZvx6FLn5KXJ9NlvuRbJ20rtg+Yj9AyDux4+7kimU4dJZEgAgX38hOxDNDqIZ+LSPEtO8uIdRePf2iJ8AkT7BKeWMTHEAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="12">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAhklEQVR42mNgGKpgztI5/5Ex3S2u7mxGwTR3CC6Lae4QYi1Gx1GZSWBMscVAJhjDDCTBYjAmOUTQfUysQ3BZTHTUEApqXA4hZDHBNEJqHKM7hFiLCTqEUBzj8impaYVg4kQ3gNggJuQQknMFqXFLyCF0LweoXiCRUQ7QBhBRDtAHYCkHyAIATRZdO8VgYzoAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="13">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACNElEQVR42tWVrY/bQBTEAwMNDU0NAw8eDQwMDDQNDIwKqqisBZbOINKZRJGBZRlY2gORHHCSD0TaggJD/xuvM2+zl6hqq7b3ITXSUxwr8fx2ZnYzGv2vr7DoJCqsxFsr44+VvJtwd1xJVS4k3HYSl71MT4OEpZWg7GSct28Hss/n0h6WUtULud/OpHtcyb5I5KYeJM6tRBmAil6CXSejzLweCFdrHpxwd1zLfjfXMXUipklk0gxyexwkSNtnJ4IMTtCN9AXRtF4UK+WKTbPUoQv7Yi79t42DgTM3DwN6YCRCH2JcTzCEGH8yzo2/AaEwRe7SqdznMxWvigVE6UQi9rRWAMJ5Z+LMukLu8I44psWgUGHq3Bh/MYCpnCu/etFOCtqntXs4P0PcC7eHlbMe96+d6fvPMkEZ2QWKx4jjtmQvepmgE4RSkPQMghld7xq/Wgox78u4jO+ymQrynjqSXeLQCOCG/bpR17SIEIwfBxUn1PQJbhwAB8gwx075ULn5EYRiPlPfdooQhMJ0oKM7APFOMI7rmPg70ywkAgRd4RkR1xBmNE2vMYWA/O254dtOi7nnKeQb72PwTrQA9DF5N3hfhTm564ZGA1ei2v55GZ8fmDsBLacCLfUeY2uPS9eJs0s+Pl4H2JLRoddOBLv2Zdvx0hPXfsJpR+DMTyFYXHyPW/XVDiQt5HnVVe12iIfguA64iAj5ZkcyxTSC7LxldbWJQhHy3f6U9Mw4bVDWta78X5/zHZ1ZvLB/eOxTAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="14">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACSUlEQVR42tVVLW/jQBTsT1lquNAw1NDw4MHQwEKjKjqWgkgpqFSTgoCAAEs1iBSDSDaw5IACg4IFAYamrzNvN70rqO7UL+kijXbzIc+8efNeLi7+15fZdmLWwHIv5raWbyOOyl7MfSfR2p963zmJmgFn/3VClBDk0T2wASqnIuKNk0kxyKQEDqPERwBiPs/qvBZzU/tqaTmqNUUvNge2TuJdIIYAklsK2Pn7BHg/8bLWClmtuQ3kN506YAunhIkT+XEUmVQgoxCe7SjJIz7vAXxPEe5p8e9CTAESWG1Lpw9NylER48HxEp9fd2IhgrYnu1HSSvSkC2kQM21F3+93M+n7hXRNJg/FVLrj/G0h7K/ZgByVm2tUf1VLvPb9jYEIVdvQc62+8raTSFuB36QgnopIehCtugaxe1pJXV2CPJP6cCk9RPB8TRzSfE63ksEB2s/TIlQWbYgA7W8zauhiEvMOy9NB5Cdsn55EhtMdsFIHujZ7caI/i3ici6Mz7R+OmPy3iJc7e7/1ghRM/wHEaAExgRusPml81dqSxtvv3AJYyUM59WLKmZ4URDfebgWJuWQw0xo8JF5FBEERgmhJvAntKLwLtJ9tmZ98MAeQ9/1csa9mWvkr6/8aRgrIw/ghE+aXzwZFkJzLh6N4DiNd0Gy0fgJsOyi5Vt1kHxtHdYFCrvY+F2H+mRcVUPgpoAiK4fhlCCPFfN5CKoMja58PToi2IHd6TxlEWM8tyF3wdX9CIaRRWE5cSpyS80L6vn9DuBGdhSCY733OM8S85MLHyAKwAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="15">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACUElEQVR42tWVr4/icBDF90/BViIrschKZGVtJbKyFsmKS8CsQJANgoSKJosgAdGkFYgKxFcgKlZUnHn33rTcj+Tukg27myzJZL5pE+Yzb958+/DwVX9eXsNb1xg8HjH4dsSnFfZPDYYbh+HWwc8ay17uMMgIsyk/DkSFgiswqYDgDPhFi2FGiJXDaNvAXzsD8/aNwbxb4Rhd0dABowIYXxg8T3iWAqN9izFhgopAVMdnttHcq0h9TlGeEqTfgbhhMEeXXwoEVa9C37kvFTSSvIGnsQjiqTSIN4GosOJ5E+Eli7DLYhwPU4QESF8JcaICWWtgAc+SXmMY8zwh2Chv4T/WnU96rwxuMP8bTVkkLBijuc4tu8vc4rifoq5SO6ccx5wR0Qth3SmhEajokBBDFpIqgtKzUa+Ktyw7RRQrgix/25qySPGyjyEAhXMzBiHy2ELvd9sIDZ9JifI0tWft6wLhpRvLWN5Q508svGZRjkHFBSejevtuU7xVr0T+FxD9uTpVluyCUtcah0DcefYT4gbcNHPLET0SUZGw6sx5U8WUkFkPrSljAMvS4t+jqLqOZUABlFViZ1OHEILZyRvb2IAnGoU2hF2PtRFLZ/m2mjYCSq8NeZMZ3WVm81dBU4dKuHpm8r/kEfQ+pAeStjNjzDxip/KFyX5g8XO3mt4998IfW0GgI9UwqJsqBJm6zpC2CUV/UfX3wbtdSCr2vA5RmwqJjUkQzi2QoAdQcZoy4Fg+7Eo2BWhS2wyubKS7Ad3FFBT4vI+SjNhcF2bU8I6OfwC3fgnHe4r96AAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="16">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACP0lEQVR42tWVoW/qUBjF96dgkZWVtUjkZGVt5WQlFgnuzSAQhCCagGgCgqQIklYgKhAVExUTFc+cd853C1u2ZAvLtuTd5MulN4Tf+c53brm7+19XUSbY7mIs5yHCCvg1cH0eIyc43z+gOo0QPQMRgGHJOv6gkG0Wo6rGKA4J1mmEup7QgQTRGUgk4AQMKGDI5+F3OnLpNCe4Pk/MdlVxTKwEe6g7AQfg/ug++2WL/qL6uhBB1a06VcfFcWRVVSMbQfv8ByFBSUsgwTH3YN8a3NvU6O9r+KcW3qFBf3ODEIFVy1WE7SbCeuPmne/oRDlC8zQxmED3ZWc7HQiyBoNdi8FjbXuQNvAXFLFpzAmJ6K0KfGj1ljABzF6mfE0BF3B1Gl+t1zi8FUFnZ3vUsDiKsHQjCCQga01AwGd918voypwiHgurVx2PsVyErkvVwe2y30TQfgF1LkHrNL6OI6C9yoBcGAg4I3DBzumGHJAQ6z4lWHURsGDNJSTHu3v9Ou0G4q6zmkIb5sGc6pxomsm1W2/OLgnzj13nOptV1n1vRtiqctC34Hej6NJe12PbJUwiwr/AiHdeYi5OKHw2Z8LtBpzgrJ86cJ8C5EBPJRG3hFEgzV9BiznjmAJ05/WsAOrFo249ChDMV+gYOC9zoTPLVy54H4bvsxXDBStU0jVrBa92ZwJqBAPZrquXujKbP0v9rUv2D59eHLDuBZ0WNmsl3Cr9ZvDb5TP5dq3Slztu3XbJ/rU/pX7WBWyaW331d/4B+NMC1rjos6YAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="17">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAB/klEQVR42tVVLU/DUBTlp9RWPln57CRykv/BD0AiEBMTFTUVFRUVT1Q02QRJJ0geAlGBmEBM1l7Oue9t3QKEAIOEJSdru6Tn4577dnHxXz+J85JUwGIlSd7LnxGn3VZSEKfNIEnpAxyuW6DxvyeEhGkL8gLk9SBmsxPjtkign7AXc04hhsTlIFkLQgjIHkd1m+ZeTMM0hjAKkjOFLt7/NJH5g4i9H5U4c0AH1FsxAMnoPtuMYiCAiSQQlCCdpPaTIKLxXxOSIdr5KDJ7BNaj2HonlgLg3BZbsTlEFENAOUGToAAKuVkF8iKKUUG9pvIx8RMI4Mg2ELARmTvRa5JbprAOCdh21BRMHZxrN5jCnpwduAPZMvaCz3hdHYkpjrbGPOzk6kU0UkZOzF9CAiTht30OYmbdKJe4T10YhfYAwnQzulBQdc0e7AUcp1BFkfl7QjhTvExFIHoWTIFnhEUnMvxmMIqT+FlEjmDpA+Gyn0axOHLu4tpGAR+OYob4OW8S0Wm6DiIOZYTzzEVxFMAk3DA5u169Xc0ypvKVMnI0PHA0mQpkOVaxjNFzLdEXjiAtYtylP0UXV/Kn54I6Zho8fBb+UDyeCdp8kt/2U+v3rtsQ+flOQo6CxC4Qq3tGftufJlD1it87kqvhICCph+n4/axcZ/83LOKOL0LpvvueV8nivBN16X1tAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="18">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACQklEQVR42tVUr4vjQBTePyV25MjI2pGRKyPXVlZWHeXEQc1CKwoXU46IslQELiLQiEAiFhKxYkTFiBURJ2Lffe9NuqUcy+4t3YMrPObHy/u+731v6M3N//pruzkdyik9pDH1zyv6Z8TuuKQaxHU1I/u0EHI5NzPE/POEHIopWbukFiQ/sztybgUHsM+nIoLz7eMcMZP1asTSqV1Id+64Ets5PBnfLX1eHFnSwy6WvQRc+TBxVBHdOqJJM1DUEMgWEkIGATT8EBJxplu8CGJxYdmTeSQK85506Ujl9v1C+ONJNwjAbUd094QVAnTTy8yHX98pRm76TBRb5DmOOBORacaakZwjQt4AQ2cQUrnXhXBSui2JogLgCFNACM6mHASIhbAb8dETRQBmoVHnv2FCgxy7x2Fy1FcDTYCjcwjYW4kgqc9CAnQcpC0F25ZUaiksejgA68cuWH004Jz1XhyfIWbCOQCHEM3fh52/03uHPe53jvTWkt7ZC3KFu2DTes4LIYkXcRKiuBBgGvNUGfYF9hCnKggEuMlAkjovmDtMrIRKfK0QrWtPhHMADMHf+Hh1FPLRHlGMznChKIcwiFTrlnTqxYkLbDG7hRmHuDNJL/fsgNr4ZgST8fbt+x+jFMAiKb7H+rWWlUHFVjgjXbPN6XmMvAppMUb2l8R/CGHyk31fDhckMiKMQW/8/kUsr7mvudofkgCyIzxffiNrPw71rZb17EAt8Wl/yULCD/b0wLbjO3nrcV1dCLvBpPcHsf2jOL8BAQzkc/Yiwa4AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="19">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACN0lEQVR42tVUr4vjQBjdPyU2MjKyNjKyMjI2srKyticWeuJga1ZUlFIRaEShEYVUFFJREVExomLEidjv3vsmuestt+zt0j24wGPIJOT9+iYPD//rVZ/GsiszWS0SsdeZ/DNic5lKBeJqP5LmPFFyvT+MgPHnCdltM2maqdQg2eSpGDNDAiPZFJmK4PP6OAZGut6NuHdKd+Yy09gJR8a9KYRNukSmslomP58xlQ8Tk5Ru6ZSO6+NEoWQQ0H5/cmKYzGmiZHz/Vlx0FIkakcGplXcRE6t1Krsi1YjprkLcJOo7J9ltMq19UnFZK5LsgatIDAFhaSXctxLkRoKjfV0IFe+6PtUBpnwDAT0x4+3dVTfJWDtzwwgByQWEcJucRTE8AFhTiBlAzABCvEUt3rz6JeRlbMZMf4ud5CrkMNJ1k2e6zwr4LgXzwynIh3R+AlHZSrgwEkFAWFjxSyNe3oi/aMR7hoCt+YOQ7lzfTnvfO/cMErAQxjpINkbUKd3ZziW6jvJWBrlVQSHWaIv7A+IvDERYR/7N4fWp7zq9Pd9OzFhiOIpLAC4jkMRwPARx0rq9AdwmhUhAp18r8ee1I1XX2FvXfz+M/fmmY/aZwbXGzMlmtMdWBUWIm+CQMWKNfN1IcLAu6vydxC8vuoyvzmGMiOOz67hH8Ixuv8DtEqRriJh3PRduvdsPiY5CdMl+6dBHjwHIgsdaSSmA8BaV4tN+yXTlE+x32bllzG8N192F4Agp6eMO+LjjH9KwCMHNaVe4AAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="20">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACS0lEQVR42tWVrY/bQBDF708oDDQNLDQMDTQMDDQNDAyqogOVUlApB066kFNlUBAQKQaRHBDJBpEcELDggMGBBQELSqbvza7dkqq9T6mRVjMZW57fvHlxrq7+10/0tRSe/qqWflbLuzXu3ZTC8yEDAJpH97VCtPmbNY73jQyOTuLcaiNO3/tUSO9zIdGX0tcygiDPzeuBDCuR4aNIckLMnQyPIh83jfRvPET/3kjvNgDwAErjxuj1Zzeuq5nYx6XEBo2tkzEghoAYPYjElZX4e6NAcdZIcna6EsLye3Tt16QgVGT3BEXKairlYSrFbiL1aSbNw0JSNJ2Jbz42TtUYACIBHFcywHrGFsqssaY96ifXrUnXAoBo/RePsBmbc+oS0xNgu0kBsBRznisUr4/ggxQw6QUwZ5FJgwigMSJ9kmQEcgoTXRedObsY8l+Nj74ZH25Oc6H0rLUQxX4ixsxVCR5jFmrGFBMPDk5ssxBx33RqrQUFqFD/tvZeWQU16JnMeH9QldVvHmkBOGkbGzQrA5CCBV9Ye6eqWLuUbZ5qznsmlVeCKxv9CMbdI9/hHJDvCAZ1APfnVRznOjVXwmmZl/upfrfNUtVwAOBqFKxVC/c1UENVRG3qAHAOigBoAFXio/13M1JuNSNhQiPNK++VzqyoucsdIP2qOAAPvZJcvAoJlHnRz7Ez5TrtDMlIheowMUF4j9G1ecVYf7UXkkp98A9ujanmPczUK9vcK8UV8PqbvZKpRvueoCGpQFvj9O/2p6QK5JMg9/zZjX8CTEsEAZI+lIoAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="21">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAABfElEQVR42tVVoW7DQAw9WFhYGBoYGBg2RQVTpIJWChgoKCgYGBgYGNh33+7Zfo6jVZuqtJtW6ZSrk/g9Pz9fUvqvv+a4yt3zWlZb9r8H/JQyloC/bHK90z3jdwPuATYmXfuUh7cq91glPrxXEmtGXYjdvOL2vM7Vg17xHyBC6lH3iEENEMEziIPMoooJHsGkSiMEHwCUpHgPRBGnQlcpcglY9pYM++GjFhB6AUT6181U/W56nx6R575TREBLIoJLT01WVigKWGIkrLZJgU36ejt5wL1R7uEqhJHfMGbAsYdIgORkLjFUaNXENpCcE9wnrz7mxfN471CUi36CkrO5FnkL2/akgN5bEjCJmbCxieBe5I/KnVZfvMF8P7reWzJOQKiAxGKlVMKNauZ0HwRvXDd+RoDyM4bKOH4wJ/ZSrfUYvujCO7i/6ByIhoqOjj3mNOAqbTRv3O4kLJV2Z03uUzLqFMzGDa0oz971W+BngynDNjR/8VGSM2HB2f8JRvClN9IGbE8AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="22">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACO0lEQVR42tVVLW/CUBRFIpGVWGRlZW1lJRJZ26CqlmZiaeaKICmChBlCEM2CIAGxpAiSIkiKmKhAIBD8hbt77uN1H8m+P5ItuenbbXPPueect9Vq//XHvG6SOTBV8fnPgJu9JqHaU5vMsUnNiwaZQ5N0/9eAraFFxrUh1bo0yGYC1tQi9HFGT79H78eAHR6GzVqDFvljl8y+2hbbA6h+UVdKcK9x2SDjypBvG6wMyHwZuLyPqNiEdDgktJh7VGwjqbKMKkLugBXotSictylIXQHEu3q3TgYrohX6lCIARt3OPMqWngzO1wHlq4CiZYdOx4TPvpCL+XdUtg1psgvkDGLIBYgAGKogIwjrm4oUPCRb+gKAc7ELacEEAFzuQCqmDMD8Ln+izGTLxFiBZOWR0+c8MFBn6kghGyBgpzbVujW5LahnYcXg27QjWyZzfm4COWNDkOiwzABEH4QWc7+yI7vzheDplJC2zLuxyR1blKxZvZlbWYOs2DO7sg+EnNR5JAIwbIihZRkrAls1FL3ojuXnrUFOKwHgOG0zMV/6IAF75MyqhWwJVIKqL9V91QqRd5+wxLE88bEiw33YwGS0EgDRNmk1vIEt/cM+lsCisjMp1IfDqAfK87zdAcqI9J7YhuunCcp3sO9sleSGS7behN+7jtWtWAWSBwWmVBG7diqYCduhNy02yMbo5/4gAQRbCyADx1O3IoENAaotyr+z8btEztdVhytfg0BU5eTP/inB59NxJEHFVf7qnAcPbLZlMU2ZQwAAAABJRU5ErkJggg==
</data>
</image>
</tile>
<tile id="23">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACPUlEQVR42tVVLY/iUBSdn4KtrKzEVlYikVgkshKLZMUmjBmBaAiChIomVJC0okkRiCdGPIF4YkTFmrP33DclzSa7yczOTDKT3DwohPN1z5uHh+/6115SnMo5dtsp4nOHLwO2zytUAlydFzDXJeIGGBsgbByC3HwekVMxhzErtHWK42EGa9fiQIqkBiYXIM47RLlDdJGz+SBHCNQrrQTYPq/Vdk7bpDp0JCoc5r+8E5xIIomuHUb79v1ECEq1VEoibbPUMWapEXQvG0+GzlyWGJcdEnEiIYHS6fsgM0riTUQIzNntZzjlMxxzn3dVLhTI3dZKgOSGzpBQIvsQZhbx1qkr0cEikAlzOTMh8q8doZ0nASOA2itbfhQCPbC5ru7WVwNnnFsrkc5tMC46hGdRf/Az+tEi3BpMhFh89c6MtkLkscJA8Qq7bOpVcmp/UqGS4B7UqT4noeNhfo+D9pOgkpBo4jO0kvFNwPai+lEI7L0LwV7iYCQ/Wz9/Eul7Pdx2BZKTz6wQdaKa5Pg9RkPgPqaJtCHtPDCryTjYjqnzSxkUFqOn9k7gr1H0mVq70pPEPJlUSZDMMBp9LZ/HrKPYnEj+Y9ZRiESZ9YtI4MK8bRl7e/V8raKlM2r9TGOjU3w+swIs4KFYzZNkWMNA9mF0MP9fx3sryoWq9dV7dUWcSgrpv9isVZQ9UNWFV/6hd3+vmsD9cmpE4gprp9dyLaqz9vOu5L6uWkHeCbXfDV7JdODL/ilx+dxto0Pw9/7Ob7W/DzcYBXyyAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="24">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACK0lEQVR42tVVr2/CQBTmT5hEYpGVSCwSOYmsPVnZTF3mOrGkCBIUIROEIEiKICmCpAiSTiAqJhAT/Rfevu/BwUZGlv2AZCSXu757fe/7cVcqlf/6C0dt8bqeDju9las1rj3UhMProfnAk3DS1nW9W5dGr3E5ICxeva/qqN9VJVr60p8ZiScdCWe3YnpN3XMA/5wxGQ4XRrxHT8xTS9nzebg0umYsgC2dbkNzCebm7ubnQIqNlXwVynYbSzL1wbIj/bkvASQnoLQIZTzzZTiFAjgDjHGOMey8o8/NUVOyZSDbl0i+1ZhjPPElRYMEMrNItgjA2BcLIHxOwJwKsGn2bCXZhMq8BOD8OZQUe+ncSFFESoQkcuSdbZyv8RKala8ogDWLJADAxmxSbCKVlXsZlUFh9R97jCfI57vZYgeYJJhHW1iD9TQOEJyP1wkFxqMdK/qYrQJdEzVlJHIWYpyAkqnRovnaKkMWL8tYnGU8D7SNYLivgNkYgAsHArkkwBpHBT6RjQmcGdtCAcrLAsxjYTZ2NvH5ABY55WtfZz0veP9U3bNWqLwvMVhEOo/hu1ODIMygeVCCcppBS1XgNc3U612czYrC6kj3tnyQ/qufk1fnE9lS3AbapkqBjVPJSc0Y7XRAuP+r63i4FQCUuWaYeS1dQ43PjkzzFc9G/+8+SGxyYP3Ob/V07zstcuAu9kl215UA9NotCcDuD214vT8lHkSedItDym/ET+u8AfUc39TwIyvtAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="25">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACV0lEQVR42tWVr4/iUBDHV1YiK7HISmQtElmJrCUnLlWbZsWlwbHiEhAkrCEXREMQJEVsAoKkiE1YsQKBqFjBvzA3n+k+cifuR/Z2NzmSyXt9fW++P2Zeubr6X39p3pVgHNQxaMqHATdvm0IEEwWeBdK8btjcrb8bcHvSFn/gW7RufAnnobTnbWGdOWvuPWtvrrg1bon3yZPga60W9QB5155k9z2ZrnvSuGlIb9yWRMvTUGcg80/AALjR2W0ODFpGKJl1ZJhH8m3XN9D+vGNxeEilWMVSVSM57FM5PmV/TyS8CyXMw4tK5iRNV5EsFChVpZ28I/Gk3sN6pjHcxeJ/8c0NiHGmWPfleBxKpCWCxOHxN0ToZBI6cJIxYisgHEatA13sE/E+ewJhR/D8PJKO3op0GRlgqeqrk7rwmFqUu0S4PYwXYJI4qwHDYutqtRtrqSnkim1fFmorNcfuQpOwP5nr/CmVZNk1uzdbBVnXZDb3dWkYceL4QgJylT4fHn5wBMXUFQeC25YpQsF0HctIlWNtqQfZM1KFhZI7nDJzCqtxgXfltp4DCiF6wcjoHkb6Azd+WQqS+HqlUFGq7XVzdQ3IqWLPcBapaiWiBEtVzTpjsVK1eq46qeJjZrFRUij/yfo//WhArI/vaKDhxbbRqqdgsSzyntmKGsoCgUjLVe5riwFzpHDi1deRZMRiGRsZymKJdcSlukFTey5feoC9pVp9Pk/f7oMEiFNNw1JbAN2dR3GlTjly7/ZJBpCGcs1V7pTEPjObefdhf0o03/l5Ktk2th55bZ7vlm2RtXeU/5AAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="26">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACSElEQVR42tVVr4vjQBReWVkZGRsZGRlbWVkZOXY4FU4sYcUR1nVFIRWFrikloiwVhVQUuqLQioWuOBGxIuLE/gvfve+ls+yJ+8F1e3CFIdOZl/f9mDcvV1f/6y+89RGOQ9j7HqqnFP8M2L/zwRFOQoSzEP51V+du/WLA0SSCd+vpCG48xGWMbJUgLfsodkbX3D5jPwzYlj2kyz6CcYDOp44Cci1bD5CTwKKPh4PVNc69L57GmvtY185S7GwlqLObCpk43wn4rAczoRMDBZ+uDQqZH58yHfvHFPtdiuZliL8C5lyBOS8juL3eogWeP1pMNwZakBJHEq9NgeNzJkQSbDcWdT3E8ZChWhmJN/hlcTERrXVWcq1701VLOSco96g43yTIZ33UzVATM9773NZAthyg/ppjL8CMpxMkRTfq51yfb8CpBDtlBGMCrepTdSfjCFnZgpIA/89F9VzUzUXlgzyPYvFWriKVbgWsERdevxXqAI/COVELiam8Q3KN/B9u3jlC9SQRL2KEd4GScsqdxXrWUpBWzn66TtQtKq/WtlUnie2sLT4qbV4KtV7JSAyfWh9C5Lf33AHTQnuq/EpedjfCjOU4xD0jZNiMqJJWVyt7AhfFda6jWCZK8Afr/6ThENTdax6PI+WPfCSjqK0DGcYROKR6Y0ia75CIqj5kOKvzMRmPhiRYF60rbS/gvtaNtGV1TBzSYxyF6tTHdUJew1GgyQnqOl8sDed9S2YMYy/6LXjrDXRGWjIBO9edy34LfvpREjLn9P7vqg9kQ79shN4AAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="27">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAACMUlEQVR42tVVrW/bQBTvnzBYGDpoaBgaaGhoaHrw0HTQKkuZByK5JKoCLCsgkg0iOSBSAiI5YMCgwKDAYKD07f3e+bwUbNW6dNIsPeWcD/8+73Jz879ezdlQvVNUrCJS+Yz+GXD3NKcDAx/2mtpvCfXPqb0/ah7zcUTqrSK9DqhhkHITU9el7ACvKyUk8HlzMjxaXq8G7JRCXfeUiu2Yx50FhCNtmwyOzKnII1nLsCvvBvYXPk3uJ1SwonQdMVhCejkTF9RqRi/fM0uGlbfnRMDgTj0Qy6qYo7FEQPKPgPU6FHCsvaVn1yufHKmkiiheTIUMnEk2Ib30mTjRczSuoEKunY+xNUz0l8B4sHc3EQAMVMZQzANAlQcUfvUpePBlrRgUD+371JaRCbhCGhZwGVu2jYWUxHS2cb0Cdsrihynd3t2St2DVXz6RqUJKlgGVUMM/KtnWYh1LHBgohM2OhI1AS0Evi+mcaB0J/m7H98UlEad+mk/Ju/8spAyr1Kw2Yrs7FOxoM3U5A7hmUvNVOD543KKsFOrFJZAZdovslLP5fRRuQAqOmDzkCSjdKy5XJPGUG1u+ciibcwPvF0zC7Q5MPZB6Zf1bl+tBynmiZI87tv+oButj2W5SMFYj1m/dYWSjAjmMqP6bAwq2YhAF8j2MYEbsRExSMLxf/VTaHLUU86pn/6j6ZLeVIwGFst+5J47cx/0JnaxSV67DHgTsDrjqEfzWhZz750yajiP4vc/5ASZt46J2q67KAAAAAElFTkSuQmCC
</data>
</image>
</tile>
<tile id="30">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAF0lEQVR42mNgGAWjYBSMglEwCkbBSAcACBAAAb475JcAAAAASUVORK5CYII=
</data>
</image>
</tile>
<tile id="31">
<image format="png">
<data encoding="base64">
iVBORw0KGgoAAAANSUhEUgAAACAAAAAQCAYAAAB3AH1ZAAAAF0lEQVR42mNgGAWjYBSMglEwCkbBSAcACBAAAb475JcAAAAASUVORK5CYII=
</data>
</image>
</tile>
</tileset>

View File

@@ -5,18 +5,6 @@ set -ex
# Fetch all commits/refs needed to run our tests.
git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master
sudo apt-get update
script/vendor-deb libicu48 libicu-dev
if ruby -e 'exit RUBY_VERSION >= "2.0" && RUBY_VERSION < "2.1"'; then
# Workaround for https://bugs.ruby-lang.org/issues/8074. We can't use this
# solution on all versions of Ruby due to
# https://github.com/bundler/bundler/pull/3338.
bundle config build.charlock_holmes --with-icu-include=$(pwd)/vendor/debs/include --with-icu-lib=$(pwd)/vendor/debs/lib
else
bundle config build.charlock_holmes --with-icu-dir=$(pwd)/vendor/debs
fi
# Replace SSH links to submodules by HTTPS links.
sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules

View File

@@ -1,13 +0,0 @@
#!/bin/sh
set -ex
cd "$(dirname "$0")/.."
mkdir -p vendor/apt vendor/debs
(cd vendor/apt && apt-get --assume-yes download "$@")
for deb in vendor/apt/*.deb; do
ar p $deb data.tar.gz | tar -vzxC vendor/debs --strip-components=2
done

View File

@@ -3,6 +3,7 @@ require "minitest/autorun"
require "mocha/setup"
require "linguist"
require 'color-proximity'
require "linguist/blob"
require 'licensee'
def fixtures_path
@@ -10,8 +11,14 @@ def fixtures_path
end
def fixture_blob(name)
name = File.join(fixtures_path, name) unless name =~ /^\//
Linguist::FileBlob.new(name, fixtures_path)
filepath = (name =~ /^\//)? name : File.join(fixtures_path, name)
Linguist::FileBlob.new(filepath, fixtures_path)
end
def fixture_blob_memory(name)
filepath = (name =~ /^\//)? name : File.join(fixtures_path, name)
content = File.read(filepath)
Linguist::Blob.new(name, content)
end
def samples_path
@@ -19,6 +26,12 @@ def samples_path
end
def sample_blob(name)
name = File.join(samples_path, name) unless name =~ /^\//
Linguist::FileBlob.new(name, samples_path)
filepath = (name =~ /^\//)? name : File.join(samples_path, name)
Linguist::FileBlob.new(filepath, samples_path)
end
def sample_blob_memory(name)
filepath = (name =~ /^\//)? name : File.join(samples_path, name)
content = File.read(filepath)
Linguist::Blob.new(name, content)
end

View File

@@ -15,50 +15,47 @@ class TestBlob < Minitest::Test
end
def script_blob(name)
blob = sample_blob(name)
blob = sample_blob_memory(name)
blob.instance_variable_set(:@name, 'script')
blob
end
def test_name
assert_equal "foo.rb", sample_blob("foo.rb").name
assert_equal "foo.rb", sample_blob_memory("Ruby/foo.rb").name
end
def test_mime_type
assert_equal "application/postscript", fixture_blob("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob("Shell/script.sh").mime_type
assert_equal "application/xml", sample_blob("XML/bar.xml").mime_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").mime_type
assert_equal "text/plain", fixture_blob("Data/README").mime_type
assert_equal "application/postscript", fixture_blob_memory("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob_memory("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob_memory("Shell/script.sh").mime_type
assert_equal "text/plain", fixture_blob_memory("Data/README").mime_type
end
def test_content_type
assert_equal "application/pdf", fixture_blob("Binary/foo.pdf").content_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").content_type
assert_equal "image/png", fixture_blob("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob("Data/README").content_type
assert_equal "application/pdf", fixture_blob_memory("Binary/foo.pdf").content_type
assert_equal "image/png", fixture_blob_memory("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob_memory("Data/README").content_type
end
def test_disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob("Data/README").disposition
assert_equal "inline", sample_blob("Text/foo.txt").disposition
assert_equal "inline", sample_blob("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob("Binary/octocat.png").disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob_memory("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob_memory("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob_memory("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob_memory("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob_memory("Data/README").disposition
assert_equal "inline", sample_blob_memory("Text/foo.txt").disposition
assert_equal "inline", sample_blob_memory("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob_memory("Binary/octocat.png").disposition
end
def test_data
assert_equal "module Foo\nend\n", sample_blob("Ruby/foo.rb").data
assert_equal "module Foo\nend\n", sample_blob_memory("Ruby/foo.rb").data
end
def test_lines
assert_equal ["module Foo", "end", ""], sample_blob("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob("Text/mac.txt").lines
assert_equal 475, sample_blob("Emacs Lisp/ess-julia.el").lines.length
assert_equal ["module Foo", "end", ""], sample_blob_memory("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob_memory("Text/mac.txt").lines
assert_equal 475, sample_blob_memory("Emacs Lisp/ess-julia.el").lines.length
end
def test_lines_maintains_original_encoding
@@ -66,534 +63,173 @@ class TestBlob < Minitest::Test
# earlier versions of the gem made implicit guarantees that the encoding of
# each `line` is in the same encoding as the file was originally read (in
# practice, UTF-8 or ASCII-8BIT)
assert_equal Encoding.default_external, fixture_blob("Data/utf16le").lines.first.encoding
assert_equal Encoding.default_external, fixture_blob_memory("Data/utf16le").lines.first.encoding
end
def test_size
assert_equal 15, sample_blob("Ruby/foo.rb").size
assert_equal 15, sample_blob_memory("Ruby/foo.rb").size
end
def test_loc
assert_equal 3, sample_blob("Ruby/foo.rb").loc
assert_equal 3, sample_blob_memory("Ruby/foo.rb").loc
end
def test_sloc
assert_equal 2, sample_blob("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob("Data/iso8859-8-i").sloc
assert_equal 2, sample_blob_memory("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob_memory("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob_memory("Data/iso8859-8-i").sloc
end
def test_encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob("Binary/dog.o").encoding
assert_equal "ISO-8859-2", fixture_blob_memory("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob_memory("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob_memory("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob_memory("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob_memory("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob_memory("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob_memory("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob_memory("Binary/dog.o").encoding
end
def test_binary
# Large blobs aren't loaded
large_blob = sample_blob("git.exe")
large_blob.instance_eval do
def data; end
end
assert large_blob.binary?
assert fixture_blob("Binary/git.deb").binary?
assert fixture_blob("Binary/git.exe").binary?
assert fixture_blob("Binary/hello.pbc").binary?
assert fixture_blob("Binary/linguist.gem").binary?
assert fixture_blob("Binary/octocat.ai").binary?
assert fixture_blob("Binary/octocat.png").binary?
assert fixture_blob("Binary/zip").binary?
assert !fixture_blob("Data/README").binary?
assert !sample_blob("Ruby/foo.rb").binary?
assert !sample_blob("Perl/script.pl").binary?
assert fixture_blob_memory("Binary/git.deb").binary?
assert fixture_blob_memory("Binary/hello.pbc").binary?
assert fixture_blob_memory("Binary/linguist.gem").binary?
assert fixture_blob_memory("Binary/octocat.ai").binary?
assert fixture_blob_memory("Binary/octocat.png").binary?
assert fixture_blob_memory("Binary/zip").binary?
assert !fixture_blob_memory("Data/README").binary?
assert !sample_blob_memory("Ruby/foo.rb").binary?
assert !sample_blob_memory("Perl/script.pl").binary?
end
def test_all_binary
Samples.each do |sample|
blob = sample_blob(sample[:path])
blob = sample_blob_memory(sample[:path])
assert ! (blob.likely_binary? || blob.binary?), "#{sample[:path]} is a binary file"
end
end
def test_text
assert fixture_blob("Data/README").text?
assert fixture_blob("Data/md").text?
assert sample_blob("Shell/script.sh").text?
assert fixture_blob("Data/txt").text?
assert fixture_blob_memory("Data/README").text?
assert fixture_blob_memory("Data/md").text?
assert sample_blob_memory("Shell/script.sh").text?
assert fixture_blob_memory("Data/txt").text?
end
def test_image
assert fixture_blob("Binary/octocat.gif").image?
assert fixture_blob("Binary/octocat.jpeg").image?
assert fixture_blob("Binary/octocat.jpg").image?
assert fixture_blob("Binary/octocat.png").image?
assert !fixture_blob("Binary/octocat.ai").image?
assert !fixture_blob("Binary/octocat.psd").image?
assert fixture_blob_memory("Binary/octocat.png").image?
assert !fixture_blob_memory("Binary/octocat.ai").image?
assert !fixture_blob_memory("Binary/octocat.psd").image?
end
def test_solid
assert fixture_blob("Binary/cube.stl").solid?
assert fixture_blob("Data/cube.stl").solid?
assert fixture_blob_memory("Binary/cube.stl").solid?
assert fixture_blob_memory("Data/cube.stl").solid?
end
def test_csv
assert fixture_blob("Data/cars.csv").csv?
assert fixture_blob_memory("Data/cars.csv").csv?
end
def test_pdf
assert fixture_blob("Binary/foo.pdf").pdf?
assert fixture_blob_memory("Binary/foo.pdf").pdf?
end
def test_viewable
assert fixture_blob("Data/README").viewable?
assert sample_blob("Ruby/foo.rb").viewable?
assert sample_blob("Perl/script.pl").viewable?
assert !fixture_blob("Binary/linguist.gem").viewable?
assert !fixture_blob("Binary/octocat.ai").viewable?
assert !fixture_blob("Binary/octocat.png").viewable?
assert fixture_blob_memory("Data/README").viewable?
assert sample_blob_memory("Ruby/foo.rb").viewable?
assert sample_blob_memory("Perl/script.pl").viewable?
assert !fixture_blob_memory("Binary/linguist.gem").viewable?
assert !fixture_blob_memory("Binary/octocat.ai").viewable?
assert !fixture_blob_memory("Binary/octocat.png").viewable?
end
def test_generated
assert !fixture_blob("Data/README").generated?
# Xcode project files
assert !sample_blob("XML/MainMenu.xib").generated?
assert fixture_blob("Binary/MainMenu.nib").generated?
assert !sample_blob("XML/project.pbxproj").generated?
# Gemfile.lock is NOT generated
assert !sample_blob("Gemfile.lock").generated?
assert !fixture_blob_memory("Data/README").generated?
# Generated .NET Docfiles
assert sample_blob("XML/net_docfile.xml").generated?
assert sample_blob_memory("XML/net_docfile.xml").generated?
# Long line
assert !sample_blob("JavaScript/uglify.js").generated?
assert !sample_blob_memory("JavaScript/uglify.js").generated?
# Inlined JS, but mostly code
assert !sample_blob("JavaScript/json2_backbone.js").generated?
assert !sample_blob_memory("JavaScript/json2_backbone.js").generated?
# Minified JS
assert !sample_blob("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob("JavaScript/jquery-1.4.2.min.js").generated?
# CoffeeScript-generated JS
# TODO
# TypeScript-generated JS
# TODO
assert !sample_blob_memory("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob_memory("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob_memory("JavaScript/jquery-1.4.2.min.js").generated?
# Composer generated composer.lock file
assert sample_blob("JSON/composer.lock").generated?
assert sample_blob_memory("JSON/composer.lock").generated?
# PEG.js-generated parsers
assert sample_blob("JavaScript/parser.js").generated?
assert sample_blob_memory("JavaScript/parser.js").generated?
# Generated PostScript
assert !sample_blob("PostScript/sierpinski.ps").generated?
assert !sample_blob_memory("PostScript/sierpinski.ps").generated?
# These examples are too basic to tell
assert !sample_blob("JavaScript/hello.js").generated?
assert !sample_blob_memory("JavaScript/hello.js").generated?
assert sample_blob("JavaScript/intro-old.js").generated?
assert sample_blob("JavaScript/classes-old.js").generated?
assert sample_blob_memory("JavaScript/intro-old.js").generated?
assert sample_blob_memory("JavaScript/classes-old.js").generated?
assert sample_blob("JavaScript/intro.js").generated?
assert sample_blob("JavaScript/classes.js").generated?
assert sample_blob_memory("JavaScript/intro.js").generated?
assert sample_blob_memory("JavaScript/classes.js").generated?
# Protocol Buffer generated code
assert sample_blob("C++/protocol-buffer.pb.h").generated?
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
assert sample_blob("Java/ProtocolBuffer.java").generated?
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
assert sample_blob("Go/api.pb.go").generated?
assert sample_blob("Go/embedded.go").generated?
assert sample_blob_memory("C++/protocol-buffer.pb.h").generated?
assert sample_blob_memory("C++/protocol-buffer.pb.cc").generated?
assert sample_blob_memory("Java/ProtocolBuffer.java").generated?
assert sample_blob_memory("Python/protocol_buffer_pb2.py").generated?
assert sample_blob_memory("Go/api.pb.go").generated?
assert sample_blob_memory("Go/embedded.go").generated?
# Apache Thrift generated code
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob("Objective-C/gen-cocoa-linguist-thrift.m").generated?
assert sample_blob_memory("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob_memory("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob_memory("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob_memory("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob_memory("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob_memory("Objective-C/gen-cocoa-linguist-thrift.m").generated?
# Generated JNI
assert sample_blob("C/jni_layer.h").generated?
assert sample_blob_memory("C/jni_layer.h").generated?
# Minified CSS
assert !sample_blob("CSS/bootstrap.css").generated?
assert sample_blob("CSS/bootstrap.min.css").generated?
assert !sample_blob_memory("CSS/bootstrap.css").generated?
assert sample_blob_memory("CSS/bootstrap.min.css").generated?
# Generated VCR
assert sample_blob("YAML/vcr_cassette.yml").generated?
assert sample_blob_memory("YAML/vcr_cassette.yml").generated?
# Generated by Zephir
assert sample_blob("Zephir/filenames/exception.zep.c").generated?
assert sample_blob("Zephir/filenames/exception.zep.h").generated?
assert sample_blob("Zephir/filenames/exception.zep.php").generated?
assert !sample_blob("Zephir/Router.zep").generated?
assert sample_blob("node_modules/grunt/lib/grunt.js").generated?
# Godep saved dependencies
assert sample_blob("Godeps/Godeps.json").generated?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
assert !sample_blob_memory("Zephir/Router.zep").generated?
# Cython-generated C/C++
assert sample_blob("C/sgd_fast.c").generated?
assert sample_blob("C++/wrapper_inner.cpp").generated?
assert sample_blob_memory("C/sgd_fast.c").generated?
assert sample_blob_memory("C++/wrapper_inner.cpp").generated?
# Unity3D-generated metadata
assert sample_blob("Unity3D Asset/Tiles.meta").generated?
assert sample_blob_memory("Unity3D Asset/Tiles.meta").generated?
# Racc-generated Ruby
assert sample_blob_memory("Ruby/racc.rb").generated?
end
def test_vendored
assert !fixture_blob("Data/README").vendored?
assert !sample_blob("ext/extconf.rb").vendored?
# Dependencies
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
# Node dependencies
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
# Bower Components
assert sample_blob("bower_components/custom/custom.js").vendored?
assert sample_blob("app/bower_components/custom/custom.js").vendored?
assert sample_blob("vendor/assets/bower_components/custom/custom.js").vendored?
# Go dependencies
assert !sample_blob("Godeps/Godeps.json").vendored?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
# Rails vendor/
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
# Vendor/
assert sample_blob("Vendor/my_great_file.h").vendored?
# 'thirdparty' directory
assert sample_blob("thirdparty/lib/main.c").vendored?
# 'extern(al)' directory
assert sample_blob("extern/util/__init__.py").vendored?
assert sample_blob("external/jquery.min.js").vendored?
# C deps
assert sample_blob("deps/http_parser/http_parser.c").vendored?
assert sample_blob("deps/v8/src/v8.h").vendored?
assert sample_blob("tools/something/else.c").vendored?
# Chart.js
assert sample_blob("some/vendored/path/Chart.js").vendored?
assert !sample_blob("some/vendored/path/chart.js").vendored?
# Codemirror deps
assert sample_blob("codemirror/mode/blah.js").vendored?
assert sample_blob("codemirror/5.0/mode/blah.js").vendored?
# Debian packaging
assert sample_blob("debian/cron.d").vendored?
# Erlang
assert sample_blob("rebar").vendored?
# git config files
assert_predicate fixture_blob("some/path/.gitattributes"), :vendored?
assert_predicate fixture_blob(".gitignore"), :vendored?
assert_predicate fixture_blob("special/path/.gitmodules"), :vendored?
# Minified JavaScript and CSS
assert sample_blob("foo.min.js").vendored?
assert sample_blob("foo.min.css").vendored?
assert sample_blob("foo-min.js").vendored?
assert sample_blob("foo-min.css").vendored?
assert !sample_blob("foomin.css").vendored?
assert !sample_blob("foo.min.txt").vendored?
#.osx
assert sample_blob(".osx").vendored?
# Prototype
assert !sample_blob("public/javascripts/application.js").vendored?
assert sample_blob("public/javascripts/prototype.js").vendored?
assert sample_blob("public/javascripts/effects.js").vendored?
assert sample_blob("public/javascripts/controls.js").vendored?
assert sample_blob("public/javascripts/dragdrop.js").vendored?
# jQuery
assert sample_blob("jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.5.2.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.min.js").vendored?
assert !sample_blob("public/javascripts/jquery.github.menu.js").vendored?
# jQuery UI
assert sample_blob("themes/ui-lightness/jquery-ui.css").vendored?
assert sample_blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
assert sample_blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
assert sample_blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
assert sample_blob("ui/i18n/jquery-ui-i18n.js").vendored?
assert sample_blob("ui/jquery.effects.blind.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.js").vendored?
assert sample_blob("ui/jquery-ui.min.js").vendored?
assert sample_blob("ui/jquery.ui.accordion.js").vendored?
assert sample_blob("ui/minified/jquery.effects.blind.min.js").vendored?
assert sample_blob("ui/minified/jquery.ui.accordion.min.js").vendored?
# jQuery Gantt
assert sample_blob("web-app/jquery-gantt/js/jquery.fn.gantt.js").vendored?
# jQuery fancyBox
assert sample_blob("web-app/fancybox/jquery.fancybox.js").vendored?
# Fuel UX
assert sample_blob("web-app/fuelux/js/fuelux.js").vendored?
# jQuery File Upload
assert sample_blob("fileupload-9.0.0/jquery.fileupload-process.js").vendored?
# Slick
assert sample_blob("web-app/slickgrid/controls/slick.columnpicker.js").vendored?
# Leaflet plugins
assert sample_blob("leaflet-plugins/Leaflet.Coordinates-0.5.0.src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.draw-src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.spin.js").vendored?
# MooTools
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
# Dojo
assert sample_blob("public/javascripts/dojo.js").vendored?
# MochiKit
assert sample_blob("public/javascripts/MochiKit.js").vendored?
# YUI
assert sample_blob("public/javascripts/yahoo-dom-event.js").vendored?
assert sample_blob("public/javascripts/yahoo-min.js").vendored?
assert sample_blob("public/javascripts/yuiloader-dom-event.js").vendored?
# WYS editors
assert sample_blob("public/javascripts/ckeditor.js").vendored?
assert sample_blob("public/javascripts/tiny_mce.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
# AngularJS
assert sample_blob("public/javascripts/angular.js").vendored?
assert sample_blob("public/javascripts/angular.min.js").vendored?
# D3.js
assert sample_blob("public/javascripts/d3.v3.js").vendored?
assert sample_blob("public/javascripts/d3.v3.min.js").vendored?
# Modernizr
assert sample_blob("public/javascripts/modernizr-2.7.1.js").vendored?
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
# Fabric
assert sample_blob("fabfile.py").vendored?
# WAF
assert sample_blob("waf").vendored?
# Visual Studio IntelliSense
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
# Microsoft Ajax
assert sample_blob("Scripts/MicrosoftAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.js").vendored?
# jQuery validation plugin (MS bundles this with asp.net mvc)
assert sample_blob("Scripts/jquery.validate.js").vendored?
assert sample_blob("Scripts/jquery.validate.min.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
# NuGet Packages
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
# Font Awesome
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
assert sample_blob("some/asset/path/font-awesome.css").vendored?
# Normalize
assert sample_blob("some/asset/path/normalize.css").vendored?
# Carthage
assert sample_blob('Carthage/blah').vendored?
# Cocoapods
assert sample_blob('Pods/blah').vendored?
# Html5shiv
assert sample_blob("Scripts/html5shiv.js").vendored?
assert sample_blob("Scripts/html5shiv.min.js").vendored?
# Test fixtures
assert sample_blob("test/fixtures/random.rkt").vendored?
assert sample_blob("Test/fixtures/random.rkt").vendored?
assert sample_blob("tests/fixtures/random.rkt").vendored?
# Cordova/PhoneGap
assert sample_blob("cordova.js").vendored?
assert sample_blob("cordova.min.js").vendored?
assert sample_blob("cordova-2.1.0.js").vendored?
assert sample_blob("cordova-2.1.0.min.js").vendored?
# Foundation js
assert sample_blob("foundation.js").vendored?
assert sample_blob("foundation.min.js").vendored?
assert sample_blob("foundation.abide.js").vendored?
# Vagrant
assert sample_blob("Vagrantfile").vendored?
# Gradle
assert sample_blob("gradlew").vendored?
assert sample_blob("gradlew.bat").vendored?
assert sample_blob("gradle/wrapper/gradle-wrapper.properties").vendored?
assert sample_blob("subproject/gradlew").vendored?
assert sample_blob("subproject/gradlew.bat").vendored?
assert sample_blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
# Octicons
assert sample_blob("octicons.css").vendored?
assert sample_blob("public/octicons.min.css").vendored?
assert sample_blob("public/octicons/sprockets-octicons.scss").vendored?
# Typesafe Activator
assert sample_blob("activator").vendored?
assert sample_blob("activator.bat").vendored?
assert sample_blob("subproject/activator").vendored?
assert sample_blob("subproject/activator.bat").vendored?
assert_predicate fixture_blob(".google_apis/bar.jar"), :vendored?
assert_predicate fixture_blob("foo/.google_apis/bar.jar"), :vendored?
# Sphinx docs
assert sample_blob("docs/_build/asset.doc").vendored?
assert sample_blob("docs/theme/file.css").vendored?
# Vagrant
assert sample_blob("puphpet/file.pp").vendored?
# Fabric.io
assert sample_blob("Fabric.framework/Fabric.h").vendored?
# Crashlytics
assert sample_blob("Crashlytics.framework/Crashlytics.h").vendored?
# Xcode
assert sample_blob("myapp/My Template.xctemplate/___FILEBASENAME___.h").vendored?
assert sample_blob("myapp/My Images.xcassets/some/stuff.imageset/Contents.json").vendored?
assert !sample_blob("myapp/MyData.json").vendored?
end
def test_documentation
assert_predicate fixture_blob("doc/foo.html"), :documentation?
assert_predicate fixture_blob("docs/foo.html"), :documentation?
refute_predicate fixture_blob("project/doc/foo.html"), :documentation?
refute_predicate fixture_blob("project/docs/foo.html"), :documentation?
assert_predicate fixture_blob("Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/documentation/foo.md"), :documentation?
assert_predicate fixture_blob("javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("project/javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("man/foo.html"), :documentation?
refute_predicate fixture_blob("project/man/foo.html"), :documentation?
assert_predicate fixture_blob("README"), :documentation?
assert_predicate fixture_blob("README.md"), :documentation?
assert_predicate fixture_blob("README.txt"), :documentation?
assert_predicate fixture_blob("Readme"), :documentation?
assert_predicate fixture_blob("readme"), :documentation?
assert_predicate fixture_blob("foo/README"), :documentation?
assert_predicate fixture_blob("CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGE.md"), :documentation?
assert_predicate fixture_blob("CHANGE.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGELOG.md"), :documentation?
assert_predicate fixture_blob("CHANGELOG.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGES"), :documentation?
assert_predicate fixture_blob("CHANGES.md"), :documentation?
assert_predicate fixture_blob("CHANGES.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGES"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.md"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.txt"), :documentation?
assert_predicate fixture_blob("foo/CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("examples/some-file.pl"), :documentation?
assert_predicate fixture_blob("Examples/some-example-file.rb"), :documentation?
assert_predicate fixture_blob("LICENSE"), :documentation?
assert_predicate fixture_blob("LICENCE.md"), :documentation?
assert_predicate fixture_blob("License.txt"), :documentation?
assert_predicate fixture_blob("LICENSE.txt"), :documentation?
assert_predicate fixture_blob("foo/LICENSE"), :documentation?
assert_predicate fixture_blob("COPYING"), :documentation?
assert_predicate fixture_blob("COPYING.md"), :documentation?
assert_predicate fixture_blob("COPYING.txt"), :documentation?
assert_predicate fixture_blob("foo/COPYING"), :documentation?
assert_predicate fixture_blob("INSTALL"), :documentation?
assert_predicate fixture_blob("INSTALL.md"), :documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert_predicate fixture_blob("foo/INSTALL"), :documentation?
refute_predicate fixture_blob("foo.md"), :documentation?
# Samples
assert sample_blob("Samples/Ruby/foo.rb").documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert !fixture_blob_memory("Data/README").vendored?
end
def test_language
Samples.each do |sample|
blob = sample_blob(sample[:path])
blob = sample_blob_memory(sample[:path])
assert blob.language, "No language for #{sample[:path]}"
assert_equal sample[:language], blob.language.name, blob.name
end
@@ -612,7 +248,7 @@ class TestBlob < Minitest::Test
filepath = File.join(dirname, filename)
next unless File.file?(filepath)
blob = fixture_blob(filepath)
blob = fixture_blob_memory(filepath)
if language == 'Data'
assert blob.language.nil?, "A language was found for #{filepath}"
elsif language == 'Generated'
@@ -626,7 +262,7 @@ class TestBlob < Minitest::Test
end
def test_minified_files_not_safe_to_highlight
assert !sample_blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
assert !sample_blob_memory("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
end
def test_empty
@@ -639,27 +275,19 @@ class TestBlob < Minitest::Test
end
def test_include_in_language_stats
vendored = sample_blob("bower_components/custom/custom.js")
assert_predicate vendored, :vendored?
refute_predicate vendored, :include_in_language_stats?
documentation = fixture_blob("README")
assert_predicate documentation, :documentation?
refute_predicate documentation, :include_in_language_stats?
generated = sample_blob("CSS/bootstrap.min.css")
generated = sample_blob_memory("CSS/bootstrap.min.css")
assert_predicate generated, :generated?
refute_predicate generated, :include_in_language_stats?
data = sample_blob("Ant Build System/filenames/ant.xml")
data = sample_blob_memory("Ant Build System/filenames/ant.xml")
assert_equal :data, data.language.type
refute_predicate data, :include_in_language_stats?
prose = sample_blob("Markdown/tender.md")
prose = sample_blob_memory("Markdown/tender.md")
assert_equal :prose, prose.language.type
refute_predicate prose, :include_in_language_stats?
included = sample_blob("HTML/pages.html")
included = sample_blob_memory("HTML/pages.html")
assert_predicate included, :include_in_language_stats?
end
end

View File

@@ -1,9 +1,669 @@
require_relative "./helper"
class TestFileBlob < Minitest::Test
class TestBlob < Minitest::Test
include Linguist
def setup
# git blobs are normally loaded as ASCII-8BIT since they may contain data
# with arbitrary encoding not known ahead of time
@original_external = Encoding.default_external
Encoding.default_external = Encoding.find("ASCII-8BIT")
end
def teardown
Encoding.default_external = @original_external
end
def script_blob(name)
blob = sample_blob(name)
blob.instance_variable_set(:@name, 'script')
blob
end
def test_extensions
assert_equal [".gitignore"], Linguist::FileBlob.new(".gitignore").extensions
assert_equal [".xml"], Linguist::FileBlob.new("build.xml").extensions
assert_equal [".html.erb", ".erb"], Linguist::FileBlob.new("dotted.dir/index.html.erb").extensions
end
def test_name
assert_equal "foo.rb", sample_blob("foo.rb").name
end
def test_mime_type
assert_equal "application/postscript", fixture_blob("Binary/octocat.ai").mime_type
assert_equal "application/x-ruby", sample_blob("Ruby/grit.rb").mime_type
assert_equal "application/x-sh", sample_blob("Shell/script.sh").mime_type
assert_equal "application/xml", sample_blob("XML/bar.xml").mime_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").mime_type
assert_equal "text/plain", fixture_blob("Data/README").mime_type
end
def test_content_type
assert_equal "application/pdf", fixture_blob("Binary/foo.pdf").content_type
assert_equal "audio/ogg", fixture_blob("Binary/foo.ogg").content_type
assert_equal "image/png", fixture_blob("Binary/foo.png").content_type
assert_equal "text/plain; charset=iso-8859-2", fixture_blob("Data/README").content_type
end
def test_disposition
assert_equal "attachment; filename=foo+bar.jar", fixture_blob("Binary/foo bar.jar").disposition
assert_equal "attachment; filename=foo.bin", fixture_blob("Binary/foo.bin").disposition
assert_equal "attachment; filename=linguist.gem", fixture_blob("Binary/linguist.gem").disposition
assert_equal "attachment; filename=octocat.ai", fixture_blob("Binary/octocat.ai").disposition
assert_equal "inline", fixture_blob("Data/README").disposition
assert_equal "inline", sample_blob("Text/foo.txt").disposition
assert_equal "inline", sample_blob("Ruby/grit.rb").disposition
assert_equal "inline", fixture_blob("Binary/octocat.png").disposition
end
def test_data
assert_equal "module Foo\nend\n", sample_blob("Ruby/foo.rb").data
end
def test_lines
assert_equal ["module Foo", "end", ""], sample_blob("Ruby/foo.rb").lines
assert_equal ["line 1", "line 2", ""], sample_blob("Text/mac.txt").lines
assert_equal 475, sample_blob("Emacs Lisp/ess-julia.el").lines.length
end
def test_lines_maintains_original_encoding
# Even if the file's encoding is detected as something like UTF-16LE,
# earlier versions of the gem made implicit guarantees that the encoding of
# each `line` is in the same encoding as the file was originally read (in
# practice, UTF-8 or ASCII-8BIT)
assert_equal Encoding.default_external, fixture_blob("Data/utf16le").lines.first.encoding
end
def test_size
assert_equal 15, sample_blob("Ruby/foo.rb").size
end
def test_loc
assert_equal 3, sample_blob("Ruby/foo.rb").loc
end
def test_sloc
assert_equal 2, sample_blob("Ruby/foo.rb").sloc
assert_equal 3, fixture_blob("Data/utf16le-windows").sloc
assert_equal 1, fixture_blob("Data/iso8859-8-i").sloc
end
def test_encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").encoding
assert_equal "ISO-8859-2", fixture_blob("Data/README").ruby_encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").encoding
assert_equal "UTF-8", sample_blob("Text/foo.txt").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le").ruby_encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").encoding
assert_equal "UTF-16LE", fixture_blob("Data/utf16le-windows").ruby_encoding
assert_equal "ISO-2022-KR", sample_blob("Text/ISO-2022-KR.txt").encoding
assert_equal "binary", sample_blob("Text/ISO-2022-KR.txt").ruby_encoding
assert_nil fixture_blob("Binary/dog.o").encoding
end
def test_binary
# Large blobs aren't loaded
large_blob = sample_blob("git.exe")
large_blob.instance_eval do
def data; end
end
assert large_blob.binary?
assert fixture_blob("Binary/git.deb").binary?
assert fixture_blob("Binary/git.exe").binary?
assert fixture_blob("Binary/hello.pbc").binary?
assert fixture_blob("Binary/linguist.gem").binary?
assert fixture_blob("Binary/octocat.ai").binary?
assert fixture_blob("Binary/octocat.png").binary?
assert fixture_blob("Binary/zip").binary?
assert !fixture_blob("Data/README").binary?
assert !sample_blob("Ruby/foo.rb").binary?
assert !sample_blob("Perl/script.pl").binary?
end
def test_all_binary
Samples.each do |sample|
blob = sample_blob(sample[:path])
assert ! (blob.likely_binary? || blob.binary?), "#{sample[:path]} is a binary file"
end
end
def test_text
assert fixture_blob("Data/README").text?
assert fixture_blob("Data/md").text?
assert sample_blob("Shell/script.sh").text?
assert fixture_blob("Data/txt").text?
end
def test_image
assert fixture_blob("Binary/octocat.gif").image?
assert fixture_blob("Binary/octocat.jpeg").image?
assert fixture_blob("Binary/octocat.jpg").image?
assert fixture_blob("Binary/octocat.png").image?
assert !fixture_blob("Binary/octocat.ai").image?
assert !fixture_blob("Binary/octocat.psd").image?
end
def test_solid
assert fixture_blob("Binary/cube.stl").solid?
assert fixture_blob("Data/cube.stl").solid?
end
def test_csv
assert fixture_blob("Data/cars.csv").csv?
end
def test_pdf
assert fixture_blob("Binary/foo.pdf").pdf?
end
def test_viewable
assert fixture_blob("Data/README").viewable?
assert sample_blob("Ruby/foo.rb").viewable?
assert sample_blob("Perl/script.pl").viewable?
assert !fixture_blob("Binary/linguist.gem").viewable?
assert !fixture_blob("Binary/octocat.ai").viewable?
assert !fixture_blob("Binary/octocat.png").viewable?
end
def test_generated
assert !fixture_blob("Data/README").generated?
# Xcode project files
assert !sample_blob("XML/MainMenu.xib").generated?
assert fixture_blob("Binary/MainMenu.nib").generated?
assert !sample_blob("XML/project.pbxproj").generated?
# Gemfile.lock is NOT generated
assert !sample_blob("Gemfile.lock").generated?
# Generated .NET Docfiles
assert sample_blob("XML/net_docfile.xml").generated?
# Long line
assert !sample_blob("JavaScript/uglify.js").generated?
# Inlined JS, but mostly code
assert !sample_blob("JavaScript/json2_backbone.js").generated?
# Minified JS
assert !sample_blob("JavaScript/jquery-1.6.1.js").generated?
assert sample_blob("JavaScript/jquery-1.6.1.min.js").generated?
assert sample_blob("JavaScript/jquery-1.4.2.min.js").generated?
# CoffeeScript-generated JS
# TODO
# TypeScript-generated JS
# TODO
# Composer generated composer.lock file
assert sample_blob("JSON/composer.lock").generated?
# PEG.js-generated parsers
assert sample_blob("JavaScript/parser.js").generated?
# Generated PostScript
assert !sample_blob("PostScript/sierpinski.ps").generated?
# These examples are too basic to tell
assert !sample_blob("JavaScript/hello.js").generated?
assert sample_blob("JavaScript/intro-old.js").generated?
assert sample_blob("JavaScript/classes-old.js").generated?
assert sample_blob("JavaScript/intro.js").generated?
assert sample_blob("JavaScript/classes.js").generated?
# Protocol Buffer generated code
assert sample_blob("C++/protocol-buffer.pb.h").generated?
assert sample_blob("C++/protocol-buffer.pb.cc").generated?
assert sample_blob("Java/ProtocolBuffer.java").generated?
assert sample_blob("Python/protocol_buffer_pb2.py").generated?
assert sample_blob("Go/api.pb.go").generated?
assert sample_blob("Go/embedded.go").generated?
# Apache Thrift generated code
assert sample_blob("Python/gen-py-linguist-thrift.py").generated?
assert sample_blob("Go/gen-go-linguist-thrift.go").generated?
assert sample_blob("Java/gen-java-linguist-thrift.java").generated?
assert sample_blob("JavaScript/gen-js-linguist-thrift.js").generated?
assert sample_blob("Ruby/gen-rb-linguist-thrift.rb").generated?
assert sample_blob("Objective-C/gen-cocoa-linguist-thrift.m").generated?
# Generated JNI
assert sample_blob("C/jni_layer.h").generated?
# Minified CSS
assert !sample_blob("CSS/bootstrap.css").generated?
assert sample_blob("CSS/bootstrap.min.css").generated?
# Generated VCR
assert sample_blob("YAML/vcr_cassette.yml").generated?
# Generated by Zephir
assert sample_blob("Zephir/filenames/exception.zep.c").generated?
assert sample_blob("Zephir/filenames/exception.zep.h").generated?
assert sample_blob("Zephir/filenames/exception.zep.php").generated?
assert !sample_blob("Zephir/Router.zep").generated?
assert sample_blob("node_modules/grunt/lib/grunt.js").generated?
# Godep saved dependencies
assert sample_blob("Godeps/Godeps.json").generated?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").generated?
# Cython-generated C/C++
assert sample_blob("C/sgd_fast.c").generated?
assert sample_blob("C++/wrapper_inner.cpp").generated?
# Unity3D-generated metadata
assert sample_blob("Unity3D Asset/Tiles.meta").generated?
end
def test_vendored
assert !fixture_blob("Data/README").vendored?
assert !sample_blob("ext/extconf.rb").vendored?
# Dependencies
assert sample_blob("dependencies/windows/headers/GL/glext.h").vendored?
# Node dependencies
assert sample_blob("node_modules/coffee-script/lib/coffee-script.js").vendored?
# Bower Components
assert sample_blob("bower_components/custom/custom.js").vendored?
assert sample_blob("app/bower_components/custom/custom.js").vendored?
assert sample_blob("vendor/assets/bower_components/custom/custom.js").vendored?
# Go dependencies
assert !sample_blob("Godeps/Godeps.json").vendored?
assert sample_blob("Godeps/_workspace/src/github.com/kr/s3/sign.go").vendored?
# Rails vendor/
assert sample_blob("vendor/plugins/will_paginate/lib/will_paginate.rb").vendored?
# Vendor/
assert sample_blob("Vendor/my_great_file.h").vendored?
# 'thirdparty' directory
assert sample_blob("thirdparty/lib/main.c").vendored?
# 'extern(al)' directory
assert sample_blob("extern/util/__init__.py").vendored?
assert sample_blob("external/jquery.min.js").vendored?
# C deps
assert sample_blob("deps/http_parser/http_parser.c").vendored?
assert sample_blob("deps/v8/src/v8.h").vendored?
assert sample_blob("tools/something/else.c").vendored?
# Chart.js
assert sample_blob("some/vendored/path/Chart.js").vendored?
assert !sample_blob("some/vendored/path/chart.js").vendored?
# Codemirror deps
assert sample_blob("codemirror/mode/blah.js").vendored?
assert sample_blob("codemirror/5.0/mode/blah.js").vendored?
# Debian packaging
assert sample_blob("debian/cron.d").vendored?
# Erlang
assert sample_blob("rebar").vendored?
# git config files
assert_predicate fixture_blob("some/path/.gitattributes"), :vendored?
assert_predicate fixture_blob(".gitignore"), :vendored?
assert_predicate fixture_blob("special/path/.gitmodules"), :vendored?
# Minified JavaScript and CSS
assert sample_blob("foo.min.js").vendored?
assert sample_blob("foo.min.css").vendored?
assert sample_blob("foo-min.js").vendored?
assert sample_blob("foo-min.css").vendored?
assert !sample_blob("foomin.css").vendored?
assert !sample_blob("foo.min.txt").vendored?
#.osx
assert sample_blob(".osx").vendored?
# Prototype
assert !sample_blob("public/javascripts/application.js").vendored?
assert sample_blob("public/javascripts/prototype.js").vendored?
assert sample_blob("public/javascripts/effects.js").vendored?
assert sample_blob("public/javascripts/controls.js").vendored?
assert sample_blob("public/javascripts/dragdrop.js").vendored?
# jQuery
assert sample_blob("jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.js").vendored?
assert sample_blob("public/javascripts/jquery.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.js").vendored?
assert sample_blob("public/javascripts/jquery-1.7.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.5.2.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.6.1.min.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.js").vendored?
assert sample_blob("public/javascripts/jquery-1.10.1.min.js").vendored?
assert !sample_blob("public/javascripts/jquery.github.menu.js").vendored?
# jQuery UI
assert sample_blob("themes/ui-lightness/jquery-ui.css").vendored?
assert sample_blob("themes/ui-lightness/jquery-ui-1.8.22.custom.css").vendored?
assert sample_blob("themes/ui-lightness/jquery.ui.accordion.css").vendored?
assert sample_blob("ui/i18n/jquery.ui.datepicker-ar.js").vendored?
assert sample_blob("ui/i18n/jquery-ui-i18n.js").vendored?
assert sample_blob("ui/jquery.effects.blind.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.custom.min.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.22.js").vendored?
assert sample_blob("ui/jquery-ui-1.8.js").vendored?
assert sample_blob("ui/jquery-ui.min.js").vendored?
assert sample_blob("ui/jquery.ui.accordion.js").vendored?
assert sample_blob("ui/minified/jquery.effects.blind.min.js").vendored?
assert sample_blob("ui/minified/jquery.ui.accordion.min.js").vendored?
# jQuery Gantt
assert sample_blob("web-app/jquery-gantt/js/jquery.fn.gantt.js").vendored?
# jQuery fancyBox
assert sample_blob("web-app/fancybox/jquery.fancybox.js").vendored?
# Fuel UX
assert sample_blob("web-app/fuelux/js/fuelux.js").vendored?
# jQuery File Upload
assert sample_blob("fileupload-9.0.0/jquery.fileupload-process.js").vendored?
# Slick
assert sample_blob("web-app/slickgrid/controls/slick.columnpicker.js").vendored?
# Leaflet plugins
assert sample_blob("leaflet-plugins/Leaflet.Coordinates-0.5.0.src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.draw-src.js").vendored?
assert sample_blob("leaflet-plugins/leaflet.spin.js").vendored?
# MooTools
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat.js").vendored?
assert sample_blob("public/javascripts/mootools-core-1.3.2-full-compat-yc.js").vendored?
# Dojo
assert sample_blob("public/javascripts/dojo.js").vendored?
# MochiKit
assert sample_blob("public/javascripts/MochiKit.js").vendored?
# YUI
assert sample_blob("public/javascripts/yahoo-dom-event.js").vendored?
assert sample_blob("public/javascripts/yahoo-min.js").vendored?
assert sample_blob("public/javascripts/yuiloader-dom-event.js").vendored?
# WYS editors
assert sample_blob("public/javascripts/ckeditor.js").vendored?
assert sample_blob("public/javascripts/tiny_mce.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_popup.js").vendored?
assert sample_blob("public/javascripts/tiny_mce_src.js").vendored?
# AngularJS
assert sample_blob("public/javascripts/angular.js").vendored?
assert sample_blob("public/javascripts/angular.min.js").vendored?
# D3.js
assert sample_blob("public/javascripts/d3.v3.js").vendored?
assert sample_blob("public/javascripts/d3.v3.min.js").vendored?
# Modernizr
assert sample_blob("public/javascripts/modernizr-2.7.1.js").vendored?
assert sample_blob("public/javascripts/modernizr.custom.01009.js").vendored?
# Fabric
assert sample_blob("fabfile.py").vendored?
# WAF
assert sample_blob("waf").vendored?
# Visual Studio IntelliSense
assert sample_blob("Scripts/jquery-1.7-vsdoc.js").vendored?
# Microsoft Ajax
assert sample_blob("Scripts/MicrosoftAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcAjax.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.debug.js").vendored?
assert sample_blob("Scripts/MicrosoftMvcValidation.js").vendored?
# jQuery validation plugin (MS bundles this with asp.net mvc)
assert sample_blob("Scripts/jquery.validate.js").vendored?
assert sample_blob("Scripts/jquery.validate.min.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.js").vendored?
assert sample_blob("Scripts/jquery.validate.unobtrusive.min.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.js").vendored?
assert sample_blob("Scripts/jquery.unobtrusive-ajax.min.js").vendored?
# NuGet Packages
assert sample_blob("packages/Modernizr.2.0.6/Content/Scripts/modernizr-2.0.6-development-only.js").vendored?
# Font Awesome
assert sample_blob("some/asset/path/font-awesome.min.css").vendored?
assert sample_blob("some/asset/path/font-awesome.css").vendored?
# Normalize
assert sample_blob("some/asset/path/normalize.css").vendored?
# Carthage
assert sample_blob('Carthage/blah').vendored?
# Cocoapods
assert sample_blob('Pods/blah').vendored?
# Html5shiv
assert sample_blob("Scripts/html5shiv.js").vendored?
assert sample_blob("Scripts/html5shiv.min.js").vendored?
# Test fixtures
assert sample_blob("test/fixtures/random.rkt").vendored?
assert sample_blob("Test/fixtures/random.rkt").vendored?
assert sample_blob("tests/fixtures/random.rkt").vendored?
# Cordova/PhoneGap
assert sample_blob("cordova.js").vendored?
assert sample_blob("cordova.min.js").vendored?
assert sample_blob("cordova-2.1.0.js").vendored?
assert sample_blob("cordova-2.1.0.min.js").vendored?
# Foundation js
assert sample_blob("foundation.js").vendored?
assert sample_blob("foundation.min.js").vendored?
assert sample_blob("foundation.abide.js").vendored?
# Vagrant
assert sample_blob("Vagrantfile").vendored?
# Gradle
assert sample_blob("gradlew").vendored?
assert sample_blob("gradlew.bat").vendored?
assert sample_blob("gradle/wrapper/gradle-wrapper.properties").vendored?
assert sample_blob("subproject/gradlew").vendored?
assert sample_blob("subproject/gradlew.bat").vendored?
assert sample_blob("subproject/gradle/wrapper/gradle-wrapper.properties").vendored?
# Octicons
assert sample_blob("octicons.css").vendored?
assert sample_blob("public/octicons.min.css").vendored?
assert sample_blob("public/octicons/sprockets-octicons.scss").vendored?
# Typesafe Activator
assert sample_blob("activator").vendored?
assert sample_blob("activator.bat").vendored?
assert sample_blob("subproject/activator").vendored?
assert sample_blob("subproject/activator.bat").vendored?
assert_predicate fixture_blob(".google_apis/bar.jar"), :vendored?
assert_predicate fixture_blob("foo/.google_apis/bar.jar"), :vendored?
# Sphinx docs
assert sample_blob("docs/_build/asset.doc").vendored?
assert sample_blob("docs/theme/file.css").vendored?
# Vagrant
assert sample_blob("puphpet/file.pp").vendored?
# Fabric.io
assert sample_blob("Fabric.framework/Fabric.h").vendored?
# Crashlytics
assert sample_blob("Crashlytics.framework/Crashlytics.h").vendored?
assert sample_blob("myapp/My Template.xctemplate/___FILEBASENAME___.h").vendored?
assert sample_blob("myapp/My Images.xcassets/some/stuff.imageset/Contents.json").vendored?
assert !sample_blob("myapp/MyData.json").vendored?
end
def test_documentation
assert_predicate fixture_blob("doc/foo.html"), :documentation?
assert_predicate fixture_blob("docs/foo.html"), :documentation?
refute_predicate fixture_blob("project/doc/foo.html"), :documentation?
refute_predicate fixture_blob("project/docs/foo.html"), :documentation?
assert_predicate fixture_blob("Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/Documentation/foo.md"), :documentation?
assert_predicate fixture_blob("project/documentation/foo.md"), :documentation?
assert_predicate fixture_blob("javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("project/javadoc/foo.html"), :documentation?
assert_predicate fixture_blob("man/foo.html"), :documentation?
refute_predicate fixture_blob("project/man/foo.html"), :documentation?
assert_predicate fixture_blob("README"), :documentation?
assert_predicate fixture_blob("README.md"), :documentation?
assert_predicate fixture_blob("README.txt"), :documentation?
assert_predicate fixture_blob("Readme"), :documentation?
assert_predicate fixture_blob("readme"), :documentation?
assert_predicate fixture_blob("foo/README"), :documentation?
assert_predicate fixture_blob("CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGE.md"), :documentation?
assert_predicate fixture_blob("CHANGE.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGE"), :documentation?
assert_predicate fixture_blob("CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGELOG.md"), :documentation?
assert_predicate fixture_blob("CHANGELOG.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGELOG"), :documentation?
assert_predicate fixture_blob("CHANGES"), :documentation?
assert_predicate fixture_blob("CHANGES.md"), :documentation?
assert_predicate fixture_blob("CHANGES.txt"), :documentation?
assert_predicate fixture_blob("foo/CHANGES"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.md"), :documentation?
assert_predicate fixture_blob("CONTRIBUTING.txt"), :documentation?
assert_predicate fixture_blob("foo/CONTRIBUTING"), :documentation?
assert_predicate fixture_blob("examples/some-file.pl"), :documentation?
assert_predicate fixture_blob("Examples/some-example-file.rb"), :documentation?
assert_predicate fixture_blob("LICENSE"), :documentation?
assert_predicate fixture_blob("LICENCE.md"), :documentation?
assert_predicate fixture_blob("License.txt"), :documentation?
assert_predicate fixture_blob("LICENSE.txt"), :documentation?
assert_predicate fixture_blob("foo/LICENSE"), :documentation?
assert_predicate fixture_blob("COPYING"), :documentation?
assert_predicate fixture_blob("COPYING.md"), :documentation?
assert_predicate fixture_blob("COPYING.txt"), :documentation?
assert_predicate fixture_blob("foo/COPYING"), :documentation?
assert_predicate fixture_blob("INSTALL"), :documentation?
assert_predicate fixture_blob("INSTALL.md"), :documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
assert_predicate fixture_blob("foo/INSTALL"), :documentation?
refute_predicate fixture_blob("foo.md"), :documentation?
# Samples
assert sample_blob("Samples/Ruby/foo.rb").documentation?
assert_predicate fixture_blob("INSTALL.txt"), :documentation?
end
def test_language
Samples.each do |sample|
blob = sample_blob(sample[:path])
assert blob.language, "No language for #{sample[:path]}"
assert_equal sample[:language], blob.language.name, blob.name
end
# Test language detection for files which shouldn't be used as samples
root = File.expand_path('../fixtures', __FILE__)
Dir.entries(root).each do |language|
next if language == '.' || language == '..' || language == 'Binary' ||
File.basename(language) == 'ace_modes.json'
# Each directory contains test files of a language
dirname = File.join(root, language)
Dir.entries(dirname).each do |filename|
# By default blob search the file in the samples;
# thus, we need to give it the absolute path
filepath = File.join(dirname, filename)
next unless File.file?(filepath)
blob = fixture_blob(filepath)
if language == 'Data'
assert blob.language.nil?, "A language was found for #{filepath}"
elsif language == 'Generated'
assert blob.generated?, "#{filepath} is not a generated file"
else
assert blob.language, "No language for #{filepath}"
assert_equal language, blob.language.name, blob.name
end
end
end
end
def test_minified_files_not_safe_to_highlight
assert !sample_blob("JavaScript/jquery-1.6.1.min.js").safe_to_colorize?
end
def test_empty
blob = Struct.new(:data) { include Linguist::BlobHelper }
assert blob.new("").empty?
assert blob.new(nil).empty?
refute blob.new(" ").empty?
refute blob.new("nope").empty?
end
def test_include_in_language_stats
vendored = sample_blob("bower_components/custom/custom.js")
assert_predicate vendored, :vendored?
refute_predicate vendored, :include_in_language_stats?
documentation = fixture_blob("README")
assert_predicate documentation, :documentation?
refute_predicate documentation, :include_in_language_stats?
generated = sample_blob("CSS/bootstrap.min.css")
assert_predicate generated, :generated?
refute_predicate generated, :include_in_language_stats?
data = sample_blob("Ant Build System/filenames/ant.xml")
assert_equal :data, data.language.type
refute_predicate data, :include_in_language_stats?
prose = sample_blob("Markdown/tender.md")
assert_equal :prose, prose.language.type
refute_predicate prose, :include_in_language_stats?
included = sample_blob("HTML/pages.html")
assert_predicate included, :include_in_language_stats?
end
end

View File

@@ -9,7 +9,6 @@ class TestGrammars < Minitest::Test
# This grammar has a nonstandard but acceptable license.
"vendor/grammars/gap-tmbundle",
"vendor/grammars/factor",
# These grammars have no license but have been grandfathered in. New grammars
# must have a license that allows redistribution.
@@ -81,7 +80,7 @@ class TestGrammars < Minitest::Test
end
def test_submodules_have_recognized_licenses
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::Project.new(k).license_file }
unrecognized = submodule_licenses.select { |k,v| v.nil? && Licensee::FSProject.new(k).license_file }
unrecognized.reject! { |k,v| PROJECT_WHITELIST.include?(k) }
message = "The following submodules have unrecognized licenses:\n* #{unrecognized.keys.join("\n* ")}\n"
message << "Please ensure that the project's LICENSE file contains the full text of the license."
@@ -132,7 +131,7 @@ class TestGrammars < Minitest::Test
# Given the path to a submodule, return its SPDX-compliant license key
def submodule_license(submodule)
# Prefer Licensee to detect a submodule's license
project = Licensee::Project.new(submodule)
project = Licensee::FSProject.new(submodule)
return project.license.key if project.license
# We know a license file exists, but Licensee wasn't able to detect the license,

View File

@@ -57,6 +57,7 @@ class TestLanguage < Minitest::Test
assert_equal Language['Shell'], Language.find_by_alias('sh')
assert_equal Language['Shell'], Language.find_by_alias('shell')
assert_equal Language['Shell'], Language.find_by_alias('zsh')
assert_equal Language['SuperCollider'], Language.find_by_alias('supercollider')
assert_equal Language['TeX'], Language.find_by_alias('tex')
assert_equal Language['TypeScript'], Language.find_by_alias('ts')
assert_equal Language['VimL'], Language.find_by_alias('vim')
@@ -119,6 +120,7 @@ class TestLanguage < Minitest::Test
assert_equal 'vim', Language['VimL'].search_term
assert_equal 'jsp', Language['Java Server Pages'].search_term
assert_equal 'rst', Language['reStructuredText'].search_term
assert_equal 'supercollider', Language['SuperCollider'].search_term
end
def test_popular
@@ -138,6 +140,7 @@ class TestLanguage < Minitest::Test
assert_equal :programming, Language['Ruby'].type
assert_equal :programming, Language['TypeScript'].type
assert_equal :programming, Language['Makefile'].type
assert_equal :programming, Language['SuperCollider'].type
end
def test_markup
@@ -227,7 +230,8 @@ class TestLanguage < Minitest::Test
"python" => "Python",
"python2" => "Python",
"python3" => "Python",
"sbcl" => "Common Lisp"
"sbcl" => "Common Lisp",
"sclang" => "SuperCollider"
}.each do |interpreter, language|
assert_equal [Language[language]], Language.find_by_interpreter(interpreter)
end
@@ -339,6 +343,7 @@ class TestLanguage < Minitest::Test
assert Language['Perl'].extensions.include?('.pl')
assert Language['Python'].extensions.include?('.py')
assert Language['Ruby'].extensions.include?('.rb')
assert Language['SuperCollider'].extensions.include?('.scd')
end
def test_primary_extension
@@ -349,6 +354,7 @@ class TestLanguage < Minitest::Test
assert_equal '.coffee', Language['CoffeeScript'].primary_extension
assert_equal '.t', Language['Turing'].primary_extension
assert_equal '.ts', Language['TypeScript'].primary_extension
assert_equal '.sc', Language['SuperCollider'].primary_extension
end
def test_eql

View File

@@ -9,7 +9,7 @@ class TestPedantic < Minitest::Test
assert_sorted LANGUAGES.keys
end
def test_extensions_are_sorted
def test_nonprimary_extensions_are_sorted
LANGUAGES.each do |name, language|
extensions = language['extensions']
assert_sorted extensions[1..-1].map(&:downcase) if extensions && extensions.size > 1

Some files were not shown because too many files have changed in this diff Show More