diff --git a/script/list-grammars b/script/list-grammars index b573c7ed..1e82d78d 100755 --- a/script/list-grammars +++ b/script/list-grammars @@ -99,4 +99,8 @@ class GrammarList end list = GrammarList.new -list.update_readme() +if ARGV.include? "--print" + puts list.to_markdown +else + list.update_readme +end diff --git a/test/test_grammars.rb b/test/test_grammars.rb index 14f4199e..80550acb 100644 --- a/test/test_grammars.rb +++ b/test/test_grammars.rb @@ -90,7 +90,7 @@ class TestGrammars < Minitest::Test message << unlisted_submodules.sort.join("\n") end - assert nonexistent_submodules.empty? && unlisted_submodules.empty?, message + assert nonexistent_submodules.empty? && unlisted_submodules.empty?, message.sub(/\.\Z/, "") end def test_local_scopes_are_in_sync @@ -106,18 +106,24 @@ class TestGrammars < Minitest::Test end end + def test_readme_file_is_in_sync + current_data = File.read("#{ROOT}/vendor/README.md").to_s.sub(/\A.+?\n/ms, "") + updated_data = `script/list-grammars --print` + assert_equal current_data, updated_data, "Grammar list is out-of-date. Run `script/list-grammars`" + end + def test_submodules_have_recognized_licenses 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." + message << "Please ensure that the project's LICENSE file contains the full text of the license" assert_equal Hash.new, unrecognized, message end def test_submodules_have_licenses unlicensed = submodule_licenses.select { |k,v| v.nil? }.reject { |k,v| PROJECT_WHITELIST.include?(k) } message = "The following submodules don't have licenses:\n* #{unlicensed.keys.join("\n* ")}\n" - message << "Please ensure that the project has a LICENSE file, and that the LICENSE file contains the full text of the license." + message << "Please ensure that the project has a LICENSE file, and that the LICENSE file contains the full text of the license" assert_equal Hash.new, unlicensed, message end @@ -127,14 +133,14 @@ class TestGrammars < Minitest::Test HASH_WHITELIST.include?(v) } .map { |k,v| "#{k}: #{v}"} message = "The following submodules have unapproved licenses:\n* #{unapproved.join("\n* ")}\n" - message << "The license must be added to the LICENSE_WHITELIST in /test/test_grammars.rb once approved." + message << "The license must be added to the LICENSE_WHITELIST in /test/test_grammars.rb once approved" assert_equal [], unapproved, message end def test_whitelisted_submodules_dont_have_licenses licensed = submodule_licenses.reject { |k,v| v.nil? }.select { |k,v| PROJECT_WHITELIST.include?(k) } message = "The following whitelisted submodules have a license:\n* #{licensed.keys.join("\n* ")}\n" - message << "Please remove them from the project whitelist." + message << "Please remove them from the project whitelist" assert_equal Hash.new, licensed, message end @@ -142,7 +148,7 @@ class TestGrammars < Minitest::Test used_hashes = submodule_licenses.values.reject { |v| v.nil? || LICENSE_WHITELIST.include?(v) } unused_hashes = HASH_WHITELIST - used_hashes message = "The following whitelisted license hashes are unused:\n* #{unused_hashes.join("\n* ")}\n" - message << "Please remove them from the hash whitelist." + message << "Please remove them from the hash whitelist" assert_equal Array.new, unused_hashes, message end diff --git a/vendor/README.md b/vendor/README.md index 36108711..cd6373fb 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -9,6 +9,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **ABNF:** [sanssecours/ABNF.tmbundle](https://github.com/sanssecours/ABNF.tmbundle) - **ActionScript:** [simongregory/actionscript3-tmbundle](https://github.com/simongregory/actionscript3-tmbundle) - **Ada:** [textmate/ada.tmbundle](https://github.com/textmate/ada.tmbundle) +- **Adobe Font Metrics:** [Alhadis/language-fontforge](https://github.com/Alhadis/language-fontforge) - **Agda:** [mokus0/Agda.tmbundle](https://github.com/mokus0/Agda.tmbundle) - **AGS Script:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **Alloy:** [macekond/Alloy.tmbundle](https://github.com/macekond/Alloy.tmbundle) @@ -123,6 +124,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **Genshi:** [genshi.edgewall.org/query](https://genshi.edgewall.org/query) - **Gentoo Ebuild:** [atom/language-shellscript](https://github.com/atom/language-shellscript) - **Gentoo Eclass:** [atom/language-shellscript](https://github.com/atom/language-shellscript) +- **Gerber Image:** [Alhadis/language-pcb](https://github.com/Alhadis/language-pcb) - **Gettext Catalog:** [textmate/gettext.tmbundle](https://github.com/textmate/gettext.tmbundle) - **Gherkin:** [cucumber/cucumber-tmbundle](https://github.com/cucumber/cucumber-tmbundle) - **GLSL:** [euler0/sublime-glsl](https://github.com/euler0/sublime-glsl) @@ -225,6 +227,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **MTML:** [textmate/html.tmbundle](https://github.com/textmate/html.tmbundle) - **mupad:** [ccreutzig/sublime-MuPAD](https://github.com/ccreutzig/sublime-MuPAD) - **NCL:** [rpavlick/language-ncl](https://github.com/rpavlick/language-ncl) +- **Nearley:** [Hardmath123/sublime-nearley](https://github.com/Hardmath123/sublime-nearley) - **Nemerle:** [textmate/nemerle.tmbundle](https://github.com/textmate/nemerle.tmbundle) - **nesC:** [cdwilson/nesC.tmbundle](https://github.com/cdwilson/nesC.tmbundle) - **NetLinx:** [amclain/sublime-netlinx](https://github.com/amclain/sublime-netlinx) @@ -387,6 +390,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **XCompose:** [samcv/language-xcompose](https://github.com/samcv/language-xcompose) - **XML:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) - **Xojo:** [angryant0007/VBDotNetSyntax](https://github.com/angryant0007/VBDotNetSyntax) +- **XPages:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) - **XPM:** [textmate/c.tmbundle](https://github.com/textmate/c.tmbundle) - **XProc:** [textmate/xml.tmbundle](https://github.com/textmate/xml.tmbundle) - **XQuery:** [wcandillon/language-jsoniq](https://github.com/wcandillon/language-jsoniq)