From 4b3b1a80f663851e625a7ddbf142a972c9370e76 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 09:02:51 -0500 Subject: [PATCH 01/11] Rearrange docs --- CONTRIBUTING.md | 75 ++++++++++++++------ README.md | 184 ++++-------------------------------------------- 2 files changed, 68 insertions(+), 191 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 697f2b2f..4afdd473 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,33 +1,68 @@ -## Contributing +# Contributing -The majority of contributions won't need to touch any Ruby code at all. The [master language list][languages] is just a YAML configuration file. +The majority of contributions won't need to touch any Ruby code at all. Linguist defines a list of all languages known to GitHub in [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). -Almost all bug fixes or new language additions should come with some additional code samples. Just drop them under [`samples/`][samples] in the correct subdirectory and our test suite will automatically test them. In most cases you shouldn't need to add any new assertions. +Most languages are detected by their file extension. For disambiguating between files with common extensions, we first apply some common-sense heuristics to pick out obvious languages. After that, we use a [statistical classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb). This process can help us tell the difference between, for example, `.h` files which could be either C, C++, or Obj-C. -### My code is detected as the wrong language +## Adding a language -This can usually be solved either by adding a new filename or file name extension to the language's entry in [`languages.yml`][languages] or adding more [samples][samples] for your language to the repository to make Linguist's classifier smarter. +We try only to add languages once they have some usage on GitHub. In most cases we prefer that languages be in use in hundreds of repositories before supporting them in Linguist. -### Syntax highlighting looks wrong - -Assuming your code is being detected as the right language (see above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report. - -You can also try to fix the bug yourself and submit a Pull Request. [This piece from TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://lightshow.githubapp.com). - -Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub. - -### I want to add support for the `X` programming language - -Great! You'll need to: +To add support for a new language: 0. Add an entry for your language to [`languages.yml`][languages]. 0. Add a grammar for your language. Please only add grammars that have a license that permits redistribution. - 0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`. - 0. Add your grammar to [`grammars.yml`][grammars] by running `script/download-grammars --add vendor/grammars/MyGrammar`. -0. Add samples for your language to the [samples directory][samples]. + 0. Add your grammar as a submodule: `git submodule add https://github.com/JaneSmith/MyGrammar vendor/grammars/MyGrammar`. + 0. Add your grammar to [`grammars.yml`][grammars] by running `script/download-grammars --add vendor/grammars/MyGrammar`. +0. Add samples for your language 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. -We try only to add languages once they have some usage on GitHub, so please note in-the-wild usage examples in your pull request. In most cases we prefer that languages already be in use in hundreds of repositories before supporting them in Linguist. +## Fixing syntax highlighting + +Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. + +Assuming your code is being detected as the right language (see [Language Detection](#language-detection) above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report. + +You can also try to fix the bug yourself and submit a Pull Request. [TextMate's documentation](http://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars. You can test grammars using [Lightshow](https://lightshow.githubapp.com). + +Once the bug has been fixed upstream, please let us know and we'll pick it up for GitHub. + +## Testing + +For development you are going to want to checkout out the source. To get it, clone the repo and run [Bundler](http://gembundler.com/) to install its dependencies. + + git clone https://github.com/github/linguist.git + cd linguist/ + script/bootstrap + +To run the tests: + + bundle exec rake test + +Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. + +Here's our current build status: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) + +## Releasing + +If you are the current maintainer of this gem: + +0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx` +0. Make sure your local dependencies are up to date: `script/bootstrap` +0. Ensure that samples are updated: `bundle exec rake samples` +0. Ensure that tests are green: `bundle exec rake test` +0. Bump gem version in `lib/linguist/version.rb`, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985). +0. Make a PR to github/linguist, [like this](https://github.com/github/linguist/pull/1238). +0. Build a local gem: `bundle exec rake build_gem` +0. Test the gem: + 0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem + 0. Install the new gem locally + 0. Test behavior locally, branch deploy, whatever needs to happen +0. Merge github/linguist PR +0. Tag and push: `git tag vx.xx.xx; git push --tags` +0. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem` [grammars]: /grammars.yml [languages]: /lib/linguist/languages.yml [samples]: /samples +[new-issue]: https://github.com/github/linguist/issues/new diff --git a/README.md b/README.md index c2c803a8..9fded07d 100644 --- a/README.md +++ b/README.md @@ -1,196 +1,38 @@ # Linguist -We use this library at GitHub to detect blob languages, ignore binary files, suppress generated files in diffs, and generate language breakdown graphs. +This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs. -Tips for filing issues and creating pull requests can be found in [`CONTRIBUTING.md`](/CONTRIBUTING.md). +See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](/CONTRIBUTING.md) before filing an issue or creating a pull request. -## Features +## Troubleshooting -### Language detection +### My repository is detected as the wrong language -Linguist defines a list of all languages known to GitHub in a [yaml file](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). +![language stats bar](https://cloud.githubusercontent.com/assets/173/5562290/48e24654-8ddf-11e4-8fe7-735b0ce3a0d3.png) -Most languages are detected by their file extension. For disambiguating between files with common extensions, we first apply some common-sense heuristics to pick out obvious languages. After that, we use a -[statistical -classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb). -This process can help us tell the difference between, for example, `.h` files which could be either C, C++, or Obj-C. +The Language stats bar is built by aggregating the languages of each file in that repository. If it is reporting a language that you don't expect, click on the name of the language and to see a list of the files that are identified as that language. If there are files in your repository -```ruby +consider moving the files into one of the -Linguist::FileBlob.new("lib/linguist.rb").language.name #=> "Ruby" - -Linguist::FileBlob.new("bin/linguist").language.name #=> "Ruby" -``` - -See [lib/linguist/language.rb](https://github.com/github/linguist/blob/master/lib/linguist/language.rb) and [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). - -### Syntax Highlighting - -Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. - -Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. **When adding a new language to Linguist, please add its corresponding scope too (assuming there's an existing TextMate bundle, Sublime Text package, or Atom package) so syntax highlighting works for it**. - -### Stats - -The Language stats bar that you see on every repository is built by aggregating the languages of each file in that repository. The top language in the graph determines the project's primary language. - -The repository stats API, accessed through `#languages`, can be used on a directory: - -***API UPDATE*** - -Since [Version 3.0.0](https://github.com/github/linguist/releases/tag/v3.0.0) Linguist expects a git repository (in the form of a [Rugged::Repository](https://github.com/libgit2/rugged#repositories)) to be passed when initializing `Linguist::Repository`. - - -```ruby -require 'rugged' -require 'linguist' - -repo = Rugged::Repository.new('.') -project = Linguist::Repository.new(repo, repo.head.target_id) -project.language #=> "Ruby" -project.languages #=> { "Ruby" => 119387 } -``` - -These stats are also printed out by the `linguist` binary. You can use the -`--breakdown` flag, and the binary will also output the breakdown of files by language. - -You can try running `linguist` on the root directory in this repository itself: - - $ bundle exec linguist --breakdown - - 100.00% Ruby - - Ruby: - Gemfile - Rakefile - bin/linguist - github-linguist.gemspec - lib/linguist.rb - lib/linguist/blob_helper.rb - lib/linguist/classifier.rb - lib/linguist/file_blob.rb - lib/linguist/generated.rb - lib/linguist/heuristics.rb - lib/linguist/language.rb - lib/linguist/lazy_blob.rb - lib/linguist/md5.rb - lib/linguist/repository.rb - lib/linguist/samples.rb - lib/linguist/tokenizer.rb - lib/linguist/version.rb - test/test_blob.rb - test/test_classifier.rb - test/test_heuristics.rb - test/test_language.rb - test/test_md5.rb - test/test_pedantic.rb - test/test_repository.rb - test/test_samples.rb - test/test_tokenizer.rb - -#### Ignore vendored files - -Checking other code 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. We are able to identify some of these files and directories and exclude them. - -```ruby -Linguist::FileBlob.new("vendor/plugins/foo.rb").vendored? # => true -``` - -See [Linguist::BlobHelper#vendored?](https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb) and [lib/linguist/vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml). - -#### Generated file detection - -Not all plain text files are true source files. Generated files like minified js and compiled CoffeeScript can be detected and excluded from language stats. As an extra bonus, these files are suppressed in diffs. - -```ruby -Linguist::FileBlob.new("underscore.min.js").generated? # => true -``` - -See [Linguist::Generated#generated?](https://github.com/github/linguist/blob/master/lib/linguist/generated.rb). +See [Overrides](#overrides) ## Overrides -Linguist supports custom overrides for language definitions and vendored paths. Add a `.gitattributes` file to your project using the keys `linguist-language` and `linguist-vendored` with the standard git-style path matchers for the files you want to override. +Linguist supports custom overrides for language definitions and vendored paths. Please note that the overrides currently only affect the language statistics for a repository and not the syntax-highlighting of files. -Please note that the overrides currently only affect the language statistics for a repository and not the syntax-highlighting of files. +Commit a `.gitattributes` file to your project and use standard git-style path matchers for the files you want to override to set `linguist-language` and `linguist-vendored`. ``` $ cat .gitattributes *.rb linguist-language=Java - -$ linguist --breakdown -100.00% Java - -Java: -ruby_file.rb ``` -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. +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. ``` $ cat .gitattributes special-vendored-path/* linguist-vendored jquery.js linguist-vendored=false ``` - -## Installation - -Github.com is usually running the latest version of the `github-linguist` gem that is released on [RubyGems.org](http://rubygems.org/gems/github-linguist). - -But for development you are going to want to checkout out the source. To get it, clone the repo and run [Bundler](http://gembundler.com/) to install its dependencies. - - git clone https://github.com/github/linguist.git - cd linguist/ - script/bootstrap - -To run the tests: - - bundle exec rake test - -### A note on language extensions - -Linguist has a number of methods available to it for identifying the language of a particular file. The initial lookup is based upon the extension of the file, possible file extensions are defined in an array called `extensions`. Take a look at this example for example for `Perl`: - -``` -Perl: - type: programming - ace_mode: perl - color: "#0298c3" - extensions: - - .pl - - .PL - - .perl - - .ph - - .plx - - .pm - - .pod - - .psgi - interpreters: - - perl -``` -Any of the extensions defined are valid but the first in this array should be the most popular. - -### Testing - -Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience. It's okay: be lazy and let our build bot [Travis](http://travis-ci.org/#!/github/linguist) run the tests for you. Just open a pull request and the bot will start cranking away. - -Here's our current build status, which is hopefully green: [![Build Status](https://secure.travis-ci.org/github/linguist.png?branch=master)](http://travis-ci.org/github/linguist) - -### Releasing - -If you are the current maintainer of this gem: - - 0. Create a branch for the release: `git checkout -b cut-release-vxx.xx.xx` - 0. Make sure your local dependencies are up to date: `script/bootstrap` - 0. Ensure that samples are updated: `bundle exec rake samples` - 0. Ensure that tests are green: `bundle exec rake test` - 0. Bump gem version in `lib/linguist/version.rb`. For example, [like this](https://github.com/github/linguist/commit/8d2ea90a5ba3b2fe6e1508b7155aa4632eea2985). - 0. Make a PR to github/linguist. For example, [#1238](https://github.com/github/linguist/pull/1238). - 0. Build a local gem: `bundle exec rake build_gem` - 0. Testing: - 0. Bump the Gemfile and Gemfile.lock versions for an app which relies on this gem - 0. Install the new gem locally - 0. Test behavior locally, branch deploy, whatever needs to happen - 0. Merge github/linguist PR - 0. Tag and push: `git tag vx.xx.xx; git push --tags` - 0. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem` From b56671c20dc194d7544d3dc6d8c26125eadc93e1 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 10:15:47 -0500 Subject: [PATCH 02/11] Lists are easier to follow than walls of text --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9fded07d..e711c659 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Linguist +[issues]: https://github.com/github/linguist/issues +[new-issue]: https://github.com/github/linguist/issues/new + This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs. See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](/CONTRIBUTING.md) before filing an issue or creating a pull request. @@ -10,11 +13,12 @@ See [Troubleshooting](#troubleshooting) and [`CONTRIBUTING.md`](/CONTRIBUTING.md ![language stats bar](https://cloud.githubusercontent.com/assets/173/5562290/48e24654-8ddf-11e4-8fe7-735b0ce3a0d3.png) -The Language stats bar is built by aggregating the languages of each file in that repository. If it is reporting a language that you don't expect, click on the name of the language and to see a list of the files that are identified as that language. If there are files in your repository +The Language stats bar is built by aggregating the languages of each file in that repository. If it is reporting a language that you don't expect: -consider moving the files into one of the - -See [Overrides](#overrides) +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](https://github.com/github/linguist/blob/master/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 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 @@ -27,7 +31,7 @@ $ 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. +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. From 3886c406abe7eaf56e451c3eca1f8358bb9b2cc9 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 16 Jan 2015 10:28:09 -0500 Subject: [PATCH 03/11] Add section on fixing misclassifications --- CONTRIBUTING.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7256579..ade8bffd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,6 @@ # Contributing -The majority of contributions won't need to touch any Ruby code at all. Linguist defines a list of all languages known to GitHub in [lib/linguist/languages.yml](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml). - -Most languages are detected by their file extension. For disambiguating between files with common extensions, we first apply some common-sense heuristics to pick out obvious languages. After that, we use a [statistical classifier](https://github.com/github/linguist/blob/master/lib/linguist/classifier.rb). This process can help us tell the difference between, for example, `.h` files which could be either C, C++, or Obj-C. +The majority of contributions won't need to touch any Ruby code at all. ## Adding a language @@ -25,9 +23,15 @@ In addition, if your new language defines an extension that's already listed in Remember, the goal here is to try and avoid false positives! +## Fixing a misclassified language + +Most languages are detected by their file extension defined in [languages.yml][languages]. For disambiguating between files with common extensions, linguist applies some [heuristics](/lib/linguist/heuristics.rb) and a [statistical classifier](lib/linguist/classifier.rb). This process can help differentiate between, for example, `.h` files which could be either C, C++, or Obj-C. + +Misclassifications can often be solved by either adding a new filename or extension for the language or adding more [samples][samples] to make the classifier smarter. + ## Fixing syntax highlighting -Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in `languages.yml` is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. +Syntax highlighting in GitHub is performed using TextMate-compatible grammars. These are the same grammars that TextMate, Sublime Text and Atom use. Every language in [languages.yml][languages] is mapped to its corresponding TM `scope`. This scope will be used when picking up a grammar for highlighting. Assuming your code is being detected as the right language (see [Language Detection](#language-detection) above), in most cases this is due to a bug in the language grammar rather than a bug in Linguist. [`grammars.yml`][grammars] lists all the grammars we use for syntax highlighting on github.com. Find the one corresponding to your code's programming language and submit a bug report upstream. If you can, try to reproduce the highlighting problem in the text editor that the grammar is designed for (TextMate, Sublime Text, or Atom) and include that information in your bug report. From a664b9dd0cb2980e2545c11e5ab428bb7ffb13b6 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 4 Feb 2015 21:26:42 +0100 Subject: [PATCH 04/11] Sample for Inno Setup --- samples/Inno Setup/expat.iss | 69 ++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 samples/Inno Setup/expat.iss diff --git a/samples/Inno Setup/expat.iss b/samples/Inno Setup/expat.iss new file mode 100644 index 00000000..4ccdbf2c --- /dev/null +++ b/samples/Inno Setup/expat.iss @@ -0,0 +1,69 @@ +; Basic setup script for the Inno Setup installer builder. For more +; information on the free installer builder, see www.jrsoftware.org. +; +; This script was contributed by Tim Peters. +; It was designed for Inno Setup 2.0.19 but works with later versions as well. + +[Setup] +AppName=Expat +AppId=expat +AppVersion=2.1.0 +AppVerName=Expat 2.1.0 +AppCopyright=Copyright 1998-2012 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers +AppPublisher=The Expat Developers +AppPublisherURL=http://www.libexpat.org/ +AppSupportURL=http://www.libexpat.org/ +AppUpdatesURL=http://www.libexpat.org/ +UninstallDisplayName=Expat XML Parser 2.1.0 +VersionInfoVersion=2.1.0 + +DefaultDirName={pf}\Expat 2.1.0 +UninstallFilesDir={app}\Uninstall + +Compression=lzma +SolidCompression=yes +SourceDir=.. +OutputDir=win32 +DisableStartupPrompt=yes +AllowNoIcons=yes +DisableProgramGroupPage=yes +DisableReadyPage=yes + +[Files] +Flags: ignoreversion; Source: win32\bin\Release\xmlwf.exe; DestDir: "{app}\Bin" +Flags: ignoreversion; Source: win32\MANIFEST.txt; DestDir: "{app}" +Flags: ignoreversion; Source: Changes; DestDir: "{app}"; DestName: Changes.txt +Flags: ignoreversion; Source: COPYING; DestDir: "{app}"; DestName: COPYING.txt +Flags: ignoreversion; Source: README; DestDir: "{app}"; DestName: README.txt +Flags: ignoreversion; Source: doc\*.html; DestDir: "{app}\Doc" +Flags: ignoreversion; Source: doc\*.css; DestDir: "{app}\Doc" +Flags: ignoreversion; Source: doc\*.png; DestDir: "{app}\Doc" +Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin" +Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin" +Flags: ignoreversion; Source: expat.dsw; DestDir: "{app}\Source" +Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source" +Flags: ignoreversion; Source: bcb5\*.bp*; DestDir: "{app}\Source\bcb5" +Flags: ignoreversion; Source: bcb5\*.mak; DestDir: "{app}\Source\bcb5" +Flags: ignoreversion; Source: bcb5\*.def; DestDir: "{app}\Source\bcb5" +Flags: ignoreversion; Source: bcb5\*.txt; DestDir: "{app}\Source\bcb5" +Flags: ignoreversion; Source: bcb5\*.bat; DestDir: "{app}\Source\bcb5" +Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Source\lib" +Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib" +Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib" +Flags: ignoreversion; Source: lib\*.dsp; DestDir: "{app}\Source\lib" +Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples" +Flags: ignoreversion; Source: examples\*.dsp; DestDir: "{app}\Source\examples" +Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests" +Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests" +Flags: ignoreversion; Source: tests\*.h; DestDir: "{app}\Source\tests" +Flags: ignoreversion; Source: tests\README.txt; DestDir: "{app}\Source\tests" +Flags: ignoreversion; Source: tests\benchmark\*.c; DestDir: "{app}\Source\tests\benchmark" +Flags: ignoreversion; Source: tests\benchmark\*.ds*; DestDir: "{app}\Source\tests\benchmark" +Flags: ignoreversion; Source: tests\benchmark\README.txt; DestDir: "{app}\Source\tests\benchmark" +Flags: ignoreversion; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf" +Flags: ignoreversion; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf" +Flags: ignoreversion; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf" + +[Messages] +WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard +WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process. From 2e76ce740e7d64be7d19b07fbc23b35bbaa155c5 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Wed, 4 Feb 2015 21:28:36 +0100 Subject: [PATCH 05/11] Grammar for Inno Setup from Sublime Text package --- .gitmodules | 3 +++ grammars.yml | 2 ++ lib/linguist/languages.yml | 2 +- vendor/grammars/InnoSetup | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 160000 vendor/grammars/InnoSetup diff --git a/.gitmodules b/.gitmodules index 4e72920d..bb4871bd 100644 --- a/.gitmodules +++ b/.gitmodules @@ -594,3 +594,6 @@ [submodule "vendor/grammars/ec.tmbundle"] path = vendor/grammars/ec.tmbundle url = https://github.com/ecere/ec.tmbundle +[submodule "vendor/grammars/InnoSetup"] + path = vendor/grammars/InnoSetup + url = https://github.com/idleberg/InnoSetup-Sublime-Text diff --git a/grammars.yml b/grammars.yml index 00f2c9b1..d7dd24de 100644 --- a/grammars.yml +++ b/grammars.yml @@ -51,6 +51,8 @@ vendor/grammars/Handlebars: - text.html.handlebars vendor/grammars/IDL-Syntax: - source.webidl +vendor/grammars/InnoSetup/: +- source.inno vendor/grammars/Isabelle.tmbundle: - source.isabelle.root - source.isabelle.theory diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index e899046e..28fdae5a 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1346,7 +1346,7 @@ Inform 7: Inno Setup: extensions: - .iss - tm_scope: none + tm_scope: source.inno ace_mode: text Io: diff --git a/vendor/grammars/InnoSetup b/vendor/grammars/InnoSetup new file mode 160000 index 00000000..875ba96c --- /dev/null +++ b/vendor/grammars/InnoSetup @@ -0,0 +1 @@ +Subproject commit 875ba96c32df269f5be92bd366d20260f811d844 From 201b0ba53c2f7744c12ffc8e9bc78c9a41716ced Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Fri, 6 Feb 2015 08:41:37 -0600 Subject: [PATCH 06/11] Making modelines case-insensitive --- lib/linguist/strategy/modeline.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linguist/strategy/modeline.rb b/lib/linguist/strategy/modeline.rb index f8d8d52a..e77597f4 100644 --- a/lib/linguist/strategy/modeline.rb +++ b/lib/linguist/strategy/modeline.rb @@ -1,8 +1,8 @@ module Linguist module Strategy class Modeline - EmacsModeline = /-\*-\s*mode:\s*(\w+);?\s*-\*-/ - VimModeline = /\/\*\s*vim:\s*set\s*(?:ft|filetype)=(\w+):\s*\*\// + EmacsModeline = /-\*-\s*mode:\s*(\w+);?\s*-\*-/i + VimModeline = /\/\*\s*vim:\s*set\s*(?:ft|filetype)=(\w+):\s*\*\//i # Public: Detects language based on Vim and Emacs modelines # From 0db1d1c8ca2267f0e30c26ae31af773044056897 Mon Sep 17 00:00:00 2001 From: Arfon Smith Date: Fri, 6 Feb 2015 08:48:59 -0600 Subject: [PATCH 07/11] Modifying some modeline fixtures to test case InSeNsItivitY --- test/fixtures/Data/Modelines/iamphp.inc | 2 +- test/fixtures/Data/Modelines/not_perl.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/Data/Modelines/iamphp.inc b/test/fixtures/Data/Modelines/iamphp.inc index 14370309..9e67098e 100644 --- a/test/fixtures/Data/Modelines/iamphp.inc +++ b/test/fixtures/Data/Modelines/iamphp.inc @@ -1 +1 @@ -; -*- mode: php;-*- +; -*- MoDe: PhP;-*- diff --git a/test/fixtures/Data/Modelines/not_perl.pl b/test/fixtures/Data/Modelines/not_perl.pl index df8e9fc5..39e38958 100644 --- a/test/fixtures/Data/Modelines/not_perl.pl +++ b/test/fixtures/Data/Modelines/not_perl.pl @@ -1,3 +1,3 @@ -/* vim: set filetype=prolog: */ +/* vim: set filEtype=pRoloG: */ # I am Prolog From 462a570d3c683557b12e3473e93be3fda072ab76 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 6 Feb 2015 16:04:32 -0500 Subject: [PATCH 08/11] Friendly welcome --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ade8bffd..31021753 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ # Contributing -The majority of contributions won't need to touch any Ruby code at all. +Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. The majority of contributions won't need to touch any Ruby code at all. ## Adding a language From 5c29ce06959695ceeda3597b51ed5e7fd12583b2 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 6 Feb 2015 16:26:55 -0500 Subject: [PATCH 09/11] Add usage and link to contributing --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index 215aaf52..84b53b62 100644 --- a/README.md +++ b/README.md @@ -55,3 +55,44 @@ vim: set ft=cpp: Emacs -*- mode: php;-*- ``` + +## Usage + +Install the gem: + +``` +$ gem install github-linguist +``` + +Then use it in your application: + +```ruby +require 'rugged' +require 'linguist' + +repo = Rugged::Repository.new('.') +project = Linguist::Repository.new(repo, repo.head.target_id) +project.language #=> "Ruby" +project.languages #=> { "Ruby" => 119387 } +``` + +These stats are also printed out by the `linguist` executable. You can use the +`--breakdown` flag, and the binary will also output the breakdown of files by language. + +You can try running `linguist` on the root directory in this repository itself: + +$ bundle exec linguist --breakdown + +100.00% Ruby + +Ruby: +Gemfile +Rakefile +bin/linguist +github-linguist.gemspec +lib/linguist.rb +… + +## Contributing + +Please check out our [contributing guidelines](CONTRIBUTING.md). From 107a27aa2560f5a8114b19e9fd3ec0d88553aef4 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 6 Feb 2015 16:41:57 -0500 Subject: [PATCH 10/11] Fix formatting of example --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 84b53b62..4a7ea415 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ These stats are also printed out by the `linguist` executable. You can use the You can try running `linguist` on the root directory in this repository itself: +``` $ bundle exec linguist --breakdown 100.00% Ruby @@ -92,7 +93,10 @@ bin/linguist github-linguist.gemspec lib/linguist.rb … +``` ## Contributing Please check out our [contributing guidelines](CONTRIBUTING.md). + +## From a08f0da30d4147e1625130fe02ab9ad813704328 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Sat, 7 Feb 2015 19:58:49 +0100 Subject: [PATCH 11/11] Grammar for Mediawiki from TextMate bundle --- .gitmodules | 3 +++ grammars.yml | 2 ++ lib/linguist/languages.yml | 2 +- vendor/grammars/mediawiki.tmbundle | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) create mode 160000 vendor/grammars/mediawiki.tmbundle diff --git a/.gitmodules b/.gitmodules index bb4871bd..73029e34 100644 --- a/.gitmodules +++ b/.gitmodules @@ -597,3 +597,6 @@ [submodule "vendor/grammars/InnoSetup"] path = vendor/grammars/InnoSetup url = https://github.com/idleberg/InnoSetup-Sublime-Text +[submodule "vendor/grammars/mediawiki.tmbundle"] + path = vendor/grammars/mediawiki.tmbundle + url = https://github.com/textmate/mediawiki.tmbundle diff --git a/grammars.yml b/grammars.yml index d7dd24de..b4a9c6e7 100644 --- a/grammars.yml +++ b/grammars.yml @@ -338,6 +338,8 @@ vendor/grammars/matlab.tmbundle: - source.octave vendor/grammars/maven.tmbundle: - text.xml.pom +vendor/grammars/mediawiki.tmbundle/: +- text.html.mediawiki vendor/grammars/mercury-tmlanguage: - source.mercury vendor/grammars/monkey.tmbundle: diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 28fdae5a..9b197fd3 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1807,7 +1807,7 @@ MediaWiki: wrap: true extensions: - .mediawiki - tm_scope: none + tm_scope: text.html.mediawiki ace_mode: text Mercury: diff --git a/vendor/grammars/mediawiki.tmbundle b/vendor/grammars/mediawiki.tmbundle new file mode 160000 index 00000000..f8dead50 --- /dev/null +++ b/vendor/grammars/mediawiki.tmbundle @@ -0,0 +1 @@ +Subproject commit f8dead507a1aed539376b9fcfde877a855842e8e