linguists_field_guide 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae061f63a71b6d42eb73abb18fdae1f52a5eecab99bc7ca1883555bebf69b984
4
- data.tar.gz: 02bb01e96a9fc5be28d974d960e30a3facd69ff689b93f9ac78011030459881a
3
+ metadata.gz: 532c20c1f701a06f5b7a65ad45fd1f4b3f8a0f1a3c2b4a2dbd585fba718c03fa
4
+ data.tar.gz: 95d2a8b50e1ace52ba9f176c1095e3a824465463766108d992d1be5422985136
5
5
  SHA512:
6
- metadata.gz: 3ebc711be01aa1331122c2c76ee1efada429f1130f46f64ca613ccc48eaf64cdc836377f530d14bc39451152a3b23fa06b0a5478b1c2a41cf3777ee3fcccdb27
7
- data.tar.gz: 10d79ad8c3d828c3e461b5a318e03469c56e21f624956d109b00b2332d3d6abd4d4efa60d05e6257bcd3d6bb4e4d1e83a251f1673329d73964198d89f13e1373
6
+ metadata.gz: de2c42438ca6a7909629eca34a124acd63187e758f494b25164c722bf2a2929becab6df31186a26f909aa7049e8ba0856e443bdb9079645be20b1239d575c0db
7
+ data.tar.gz: 2ff13038a2b91d1d682be3f89872c95a0b34aa3b5e4bc99b08b82414967bf16bc8e2bd04756156010a1682ed41f11b8ba3813d04c03668cf4dcf1956f7dc650b
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # The MIT License (MIT)
2
2
 
3
- **Copyright © 2020 Jessica Stokes**
3
+ **Copyright © 2021 Jessica Stokes**
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Linguist's Field Guide 📖
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/linguists_field_guide.svg)](https://rubygems.org/gems/linguists_field_guide) [![Ruby](https://github.com/ticky/linguists-field-guide/workflows/Ruby/badge.svg)](https://github.com/ticky/linguists-field-guide/actions?query=workflow%3ARuby)
3
+ [![Gem Version](https://badge.fury.io/rb/linguists_field_guide.svg)](https://rubygems.org/gems/linguists_field_guide) [![Ruby](https://github.com/ticky/linguists-field-guide/workflows/Ruby/badge.svg)](https://github.com/ticky/linguists-field-guide/actions?query=workflow%3ARuby) [![codecov](https://codecov.io/gh/ticky/linguists-field-guide/branch/develop/graph/badge.svg?token=LMD2XU2S6N)](https://codecov.io/gh/ticky/linguists-field-guide)
4
4
 
5
5
  Field guide for programming languages, based on the knowledge imparted by `github-linguist`.
6
6
 
@@ -25,10 +25,9 @@ gem install linguists_field_guide
25
25
  `LinguistsFieldGuide::Language` provides a subset of `Linguist::Language`;
26
26
 
27
27
  - An Array of all Languages can be retrieved by calling `LinguistsFieldGuide::Language.all`
28
+ - A specific Language can be found by using `LinguistsFieldGuide::Language.find_by_name`
28
29
  - Other `Linguist::Language` class methods (`find_by_alias`, `find_by_extension`, `find_by_filename`, etc.) are not currently provided.
29
30
  - `Language` instances contain readers for properties included in the version of `Linguist` it was built against, with these exceptions:
30
- - `Language` instances do not have a `group` property.
31
- If a given `Language` is a group, the `group_name` property will contain the `name` of the Language it is a child of.
32
31
  - Derived methods (`default_alias`, `escaped_name`, `hash`, etc.) are not currently provided.
33
32
 
34
33
  ### Example
@@ -39,7 +38,7 @@ require 'linguists_field_guide'
39
38
  languages_to_check = ["Rust", "Ruby", "JavaScript", "Bash"]
40
39
 
41
40
  languages_to_check.each do |language_name|
42
- if LinguistsFieldGuide::Language.all.any? { |lang| lang.name === language_name }
41
+ if LinguistsFieldGuide::Language.find_by_name(language_name)
43
42
  puts "⭕️ #{language_name} is a known language name"
44
43
  else
45
44
  puts "❌ #{language_name} isn't a known language name!"
@@ -1,3 +1,6 @@
1
+ # This file is generated by the build system.
2
+ # Please make any edits in lib/linguists_field_guide.rb instead.
3
+
1
4
  require 'json'
2
5
 
3
6
  module LinguistsFieldGuide
@@ -9,13 +12,13 @@ module LinguistsFieldGuide
9
12
  # class, with just enough information to use for reference.
10
13
  class Language
11
14
  @languages = []
15
+ @index = {}
16
+ @name_index = {}
12
17
 
13
18
  #See [github-linguist's documentation of `name`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#name-instance_method)
14
19
  attr_reader :name
15
20
  #See [github-linguist's documentation of `fs_name`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#fs_name-instance_method)
16
21
  attr_reader :fs_name
17
- #See [github-linguist's documentation of `type`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#type-instance_method)
18
- attr_reader :type
19
22
  #See [github-linguist's documentation of `color`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#color-instance_method)
20
23
  attr_reader :color
21
24
  #See [github-linguist's documentation of `aliases`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#aliases-instance_method)
@@ -38,30 +41,58 @@ module LinguistsFieldGuide
38
41
  attr_reader :interpreters
39
42
  #See [github-linguist's documentation of `filenames`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#filenames-instance_method)
40
43
  attr_reader :filenames
41
- #The name of the language this language should be grouped under
42
- attr_reader :group_name
43
44
 
44
45
  # Internal: Creates a Language object,
45
46
  # applies all the given attributes to instance variables,
46
47
  # and adds it to the `#all` list.
48
+ # @private
47
49
  def self.create(attributes)
48
50
  language = new(attributes)
49
51
 
50
52
  @languages << language
53
+
54
+ @index[language.name.downcase] = @name_index[language.name.downcase] = language
51
55
  end
52
56
 
53
57
  # Internal: Applies all the given attributes to instance variables.
58
+ # @private
54
59
  def initialize(attributes)
55
60
  attributes.each do |key, value|
56
61
  instance_variable_set(key, value)
57
62
  end
58
63
  end
59
64
 
60
- # Returns an Array of Languages
65
+ # @return [Array<Language>]
61
66
  def self.all
62
67
  @languages
63
68
  end
64
69
 
70
+ # Look up Language by its proper name.
71
+ #
72
+ # @param [String] name The proper name of a Language
73
+ def self.find_by_name(name)
74
+ @name_index[name&.downcase]
75
+ end
76
+
77
+ # Get Language group
78
+ #
79
+ # @return [Language] The Language group
80
+ def group
81
+ @group ||= if @group_name.nil?
82
+ self
83
+ else
84
+ Language.find_by_name(@group_name)
85
+ end
86
+ end
87
+
88
+ # Get type.
89
+ #
90
+ # @return [Symbol] One of the defined
91
+ # [`Linguist::Language::TYPES`](https://www.rubydoc.info/gems/github-linguist/Linguist/Language#TYPES-constant)
92
+ def type
93
+ @type.to_sym
94
+ end
95
+
65
96
  # Is it popular?
66
97
  def popular?
67
98
  @popular
@@ -1363,6 +1394,31 @@ module LinguistsFieldGuide
1363
1394
  "@popular": false,
1364
1395
  "@searchable": true
1365
1396
  },
1397
+ {
1398
+ "@name": "Browserslist",
1399
+ "@fs_name": null,
1400
+ "@type": "data",
1401
+ "@color": "#ffd539",
1402
+ "@aliases": [
1403
+ "browserslist"
1404
+ ],
1405
+ "@tm_scope": "text.browserslist",
1406
+ "@ace_mode": "text",
1407
+ "@codemirror_mode": null,
1408
+ "@codemirror_mime_type": null,
1409
+ "@wrap": false,
1410
+ "@language_id": 153503348,
1411
+ "@extensions": [
1412
+ ],
1413
+ "@interpreters": [
1414
+ ],
1415
+ "@filenames": [
1416
+ ".browserslistrc",
1417
+ "browserslist"
1418
+ ],
1419
+ "@popular": false,
1420
+ "@searchable": true
1421
+ },
1366
1422
  {
1367
1423
  "@name": "C",
1368
1424
  "@fs_name": null,
@@ -4983,7 +5039,8 @@ module LinguistsFieldGuide
4983
5039
  "@color": null,
4984
5040
  "@aliases": [
4985
5041
  "html+eex",
4986
- "eex"
5042
+ "eex",
5043
+ "leex"
4987
5044
  ],
4988
5045
  "@tm_scope": "text.html.elixir",
4989
5046
  "@ace_mode": "text",
@@ -4992,7 +5049,8 @@ module LinguistsFieldGuide
4992
5049
  "@wrap": false,
4993
5050
  "@language_id": 149,
4994
5051
  "@extensions": [
4995
- ".eex"
5052
+ ".eex",
5053
+ ".html.leex"
4996
5054
  ],
4997
5055
  "@interpreters": [
4998
5056
  ],
@@ -5853,6 +5911,7 @@ module LinguistsFieldGuide
5853
5911
  ".jscsrc",
5854
5912
  ".jshintrc",
5855
5913
  ".jslintrc",
5914
+ "devcontainer.json",
5856
5915
  "jsconfig.json",
5857
5916
  "language-configuration.json",
5858
5917
  "tsconfig.json",
@@ -6604,7 +6663,8 @@ module LinguistsFieldGuide
6604
6663
  "@wrap": false,
6605
6664
  "@language_id": 194,
6606
6665
  "@extensions": [
6607
- ".lvproj"
6666
+ ".lvproj",
6667
+ ".lvlib"
6608
6668
  ],
6609
6669
  "@interpreters": [
6610
6670
  ],
@@ -6613,6 +6673,31 @@ module LinguistsFieldGuide
6613
6673
  "@popular": false,
6614
6674
  "@searchable": true
6615
6675
  },
6676
+ {
6677
+ "@name": "Lark",
6678
+ "@fs_name": null,
6679
+ "@type": "data",
6680
+ "@color": "#0b130f",
6681
+ "@aliases": [
6682
+ "lark"
6683
+ ],
6684
+ "@tm_scope": "source.lark",
6685
+ "@ace_mode": "text",
6686
+ "@codemirror_mode": "ebnf",
6687
+ "@codemirror_mime_type": "text/x-ebnf",
6688
+ "@wrap": false,
6689
+ "@language_id": 758480799,
6690
+ "@extensions": [
6691
+ ".lark"
6692
+ ],
6693
+ "@interpreters": [
6694
+ ],
6695
+ "@filenames": [
6696
+ ],
6697
+ "@popular": false,
6698
+ "@searchable": true,
6699
+ "@group_name": "EBNF"
6700
+ },
6616
6701
  {
6617
6702
  "@name": "Lasso",
6618
6703
  "@fs_name": null,
@@ -8232,6 +8317,30 @@ module LinguistsFieldGuide
8232
8317
  "@popular": false,
8233
8318
  "@searchable": true
8234
8319
  },
8320
+ {
8321
+ "@name": "NWScript",
8322
+ "@fs_name": null,
8323
+ "@type": "programming",
8324
+ "@color": "#111522",
8325
+ "@aliases": [
8326
+ "nwscript"
8327
+ ],
8328
+ "@tm_scope": "source.c.nwscript",
8329
+ "@ace_mode": "c_cpp",
8330
+ "@codemirror_mode": "clike",
8331
+ "@codemirror_mime_type": "text/x-csrc",
8332
+ "@wrap": false,
8333
+ "@language_id": 731233819,
8334
+ "@extensions": [
8335
+ ".nss"
8336
+ ],
8337
+ "@interpreters": [
8338
+ ],
8339
+ "@filenames": [
8340
+ ],
8341
+ "@popular": false,
8342
+ "@searchable": true
8343
+ },
8235
8344
  {
8236
8345
  "@name": "Nearley",
8237
8346
  "@fs_name": null,
@@ -9046,7 +9155,8 @@ module LinguistsFieldGuide
9046
9155
  "@wrap": false,
9047
9156
  "@language_id": 598917541,
9048
9157
  "@extensions": [
9049
- ".plist"
9158
+ ".plist",
9159
+ ".glyphs"
9050
9160
  ],
9051
9161
  "@interpreters": [
9052
9162
  ],
@@ -9764,7 +9874,7 @@ module LinguistsFieldGuide
9764
9874
  "@aliases": [
9765
9875
  "pod-6"
9766
9876
  ],
9767
- "@tm_scope": "source.perl6fe",
9877
+ "@tm_scope": "source.raku",
9768
9878
  "@ace_mode": "perl",
9769
9879
  "@codemirror_mode": null,
9770
9880
  "@codemirror_mime_type": null,
@@ -10771,7 +10881,7 @@ module LinguistsFieldGuide
10771
10881
  "perl6",
10772
10882
  "perl-6"
10773
10883
  ],
10774
- "@tm_scope": "source.perl6fe",
10884
+ "@tm_scope": "source.raku",
10775
10885
  "@ace_mode": "perl",
10776
10886
  "@codemirror_mode": "perl",
10777
10887
  "@codemirror_mime_type": "text/x-perl",
@@ -10849,6 +10959,31 @@ module LinguistsFieldGuide
10849
10959
  "@popular": false,
10850
10960
  "@searchable": true
10851
10961
  },
10962
+ {
10963
+ "@name": "ReScript",
10964
+ "@fs_name": null,
10965
+ "@type": "programming",
10966
+ "@color": "#ed5051",
10967
+ "@aliases": [
10968
+ "rescript"
10969
+ ],
10970
+ "@tm_scope": "source.rescript",
10971
+ "@ace_mode": "rust",
10972
+ "@codemirror_mode": "rust",
10973
+ "@codemirror_mime_type": "text/x-rustsrc",
10974
+ "@wrap": false,
10975
+ "@language_id": 501875647,
10976
+ "@extensions": [
10977
+ ".res"
10978
+ ],
10979
+ "@interpreters": [
10980
+ "ocaml"
10981
+ ],
10982
+ "@filenames": [
10983
+ ],
10984
+ "@popular": false,
10985
+ "@searchable": true
10986
+ },
10852
10987
  {
10853
10988
  "@name": "Readline Config",
10854
10989
  "@fs_name": null,
@@ -13036,6 +13171,7 @@ module LinguistsFieldGuide
13036
13171
  "README.1ST",
13037
13172
  "README.me",
13038
13173
  "README.mysql",
13174
+ "README.nss",
13039
13175
  "click.me",
13040
13176
  "delete.me",
13041
13177
  "go.mod",
@@ -14209,6 +14345,7 @@ module LinguistsFieldGuide
14209
14345
  ".psc1",
14210
14346
  ".pt",
14211
14347
  ".rdf",
14348
+ ".res",
14212
14349
  ".resx",
14213
14350
  ".rss",
14214
14351
  ".sch",
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linguists_field_guide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jessica Stokes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2021-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.1.4
19
+ version: 12.3.3
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 2.1.4
26
+ version: 12.3.3
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 12.3.3
33
+ version: '3.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 12.3.3
40
+ version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: simplecov
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.0'
47
+ version: 0.21.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '3.0'
54
+ version: 0.21.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: github-linguist
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 7.11.1
61
+ version: 7.12.2
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 7.11.1
68
+ version: 7.12.2
69
69
  description: Field guide for programming languages, based on the knowledge imparted
70
70
  by github-linguist
71
71
  email: hello@jessicastokes.net
@@ -80,7 +80,7 @@ homepage: https://github.com/ticky/linguists-field-guide
80
80
  licenses:
81
81
  - MIT
82
82
  metadata: {}
83
- post_install_message:
83
+ post_install_message:
84
84
  rdoc_options: []
85
85
  require_paths:
86
86
  - lib
@@ -95,8 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  requirements: []
98
- rubygems_version: 3.1.4
99
- signing_key:
98
+ rubygems_version: 3.2.4
99
+ signing_key:
100
100
  specification_version: 4
101
101
  summary: Linguist's Field Guide
102
102
  test_files: []