sorbet-struct-comparable 1.0.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +47 -51
  3. data/.gitignore +3 -0
  4. data/CHANGELOG.md +13 -0
  5. data/Gemfile +3 -8
  6. data/README.md +2 -2
  7. data/lib/sorbet-struct-comparable/version.rb +1 -1
  8. data/lib/t/struct/acts_as_comparable.rb +17 -12
  9. data/nix/sources.json +14 -0
  10. data/nix/sources.nix +174 -0
  11. data/run_ci.sh +6 -0
  12. data/shell.nix +20 -0
  13. data/sorbet/config +2 -0
  14. data/sorbet/rbi/gems/ast@2.4.2.rbi +54 -0
  15. data/sorbet/rbi/gems/byebug@11.1.3.rbi +1568 -0
  16. data/sorbet/rbi/gems/coderay@1.1.3.rbi +1005 -0
  17. data/sorbet/rbi/gems/diff-lcs@1.4.4.rbi +8 -0
  18. data/sorbet/rbi/gems/docile@1.4.0.rbi +54 -0
  19. data/sorbet/rbi/gems/method_source@1.0.0.rbi +72 -0
  20. data/sorbet/rbi/gems/parser@3.0.2.0.rbi +1188 -0
  21. data/sorbet/rbi/gems/pry-byebug@3.9.0.rbi +461 -0
  22. data/sorbet/rbi/gems/{pry.rbi → pry@0.13.1.rbi} +2308 -1706
  23. data/sorbet/rbi/gems/{rake.rbi → rake@13.0.6.rbi} +575 -424
  24. data/sorbet/rbi/gems/rbi@0.0.6.rbi +1405 -0
  25. data/sorbet/rbi/gems/{rspec-core.rbi → rspec-core@3.10.1.rbi} +2308 -1783
  26. data/sorbet/rbi/gems/{rspec-expectations.rbi → rspec-expectations@3.10.1.rbi} +1149 -698
  27. data/sorbet/rbi/gems/{rspec-mocks.rbi → rspec-mocks@3.10.2.rbi} +1299 -936
  28. data/sorbet/rbi/gems/rspec-support@3.10.2.rbi +509 -0
  29. data/sorbet/rbi/gems/rspec@3.10.0.rbi +38 -0
  30. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +89 -0
  31. data/sorbet/rbi/gems/simplecov@0.21.2.rbi +577 -0
  32. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.3.rbi +8 -0
  33. data/sorbet/rbi/gems/spoom@1.1.5.rbi +1241 -0
  34. data/sorbet/rbi/gems/tapioca@0.5.2.rbi +949 -0
  35. data/sorbet/rbi/gems/thor@1.1.0.rbi +839 -0
  36. data/sorbet/rbi/gems/unparser@0.6.0.rbi +8 -0
  37. data/sorbet-struct-comparable.gemspec +1 -1
  38. metadata +38 -30
  39. data/.ruby-version +0 -1
  40. data/sorbet/rbi/gems/byebug.rbi +0 -1041
  41. data/sorbet/rbi/gems/coderay.rbi +0 -92
  42. data/sorbet/rbi/gems/docile.rbi +0 -32
  43. data/sorbet/rbi/gems/listen.rbi +0 -324
  44. data/sorbet/rbi/gems/method_source.rbi +0 -64
  45. data/sorbet/rbi/gems/pry-byebug.rbi +0 -155
  46. data/sorbet/rbi/gems/rspec-support.rbi +0 -280
  47. data/sorbet/rbi/gems/rspec.rbi +0 -15
  48. data/sorbet/rbi/gems/simplecov-html.rbi +0 -35
  49. data/sorbet/rbi/gems/simplecov.rbi +0 -361
  50. data/sorbet/rbi/hidden-definitions/errors.txt +0 -5231
  51. data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -7739
  52. data/sorbet/rbi/todo.rbi +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6cdc3f402081351e1da4c84bc5dc767f59d288b781763ba64be2b1f4e6d77768
4
- data.tar.gz: c336b74f657fb64e7b29e024ceb10c02e555a82f89283f758e9984aeb6c65b5e
3
+ metadata.gz: 250d183579edd0b3cec7a62398e1eb966c30d1cadf2bde41ea1f860680342d75
4
+ data.tar.gz: a7e47b96f4d5680bb3d099b47db1d55c2efca2f4fa7dfc6cf3670151367b3077
5
5
  SHA512:
6
- metadata.gz: a505ab5eed81e5f80280e6c7f2ae68c619d561c2c4ef13ec0866249083e7092ada08d961502d4d7fdb7f289a07849fdf044eb58121e2bd8c2a802c12c8f14121
7
- data.tar.gz: f3958b00820ff24401823af78c8b91d789fd2da090e117c15699a0a1bbb125f1770c1b1eaa32111650a8fae319ee1e3232052da12cbebf89c3cd136c754ae670
6
+ metadata.gz: 9bf7a867ac5245cdb856ab66a2254e12882f445bfb4ab08723b1289f2c40559b15e6a864bfe0811b74eccab0023703c36a19773d20c9a87f4767ab229efad115
7
+ data.tar.gz: c37da47bfddd23095bcc91f78564008038296cea1fcf439b84ce5e5592c2153c88c8da1177fed847f43b4abbc25cdc9afd20bbb7fc2b6aa52af4a677baaa2fb5
@@ -1,52 +1,48 @@
1
1
  ---
2
- name: Continuous Integration
3
- on:
4
- push:
5
- branches-ignore:
6
- - refs/tags/*_staging
7
- - refs/tags/*_production
8
- jobs:
9
- build:
10
- runs-on: ubuntu-18.04
11
- steps:
12
- - name: Checkout branch
13
- uses: actions/checkout@v2
14
- - name: Extract branch name
15
- shell: bash
16
- run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
17
- id: extract_branch
18
- - name: Set up Ruby
19
- uses: actions/setup-ruby@v1.1.1
20
- with:
21
- ruby-version: 2.7.1
22
- - name: Cache gems
23
- uses: actions/cache@v1
24
- with:
25
- path: vendor/bundle
26
- key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/sorbet-struct-comparable.gemspec')
27
- }}"
28
- restore-keys: "${{ runner.OS }}-gem-cache-\n"
29
- - name: Install bundler
30
- run: (bundler -v | grep "2.1.4") || gem install bundler:2.1.4
31
- - name: Install gems
32
- run: bundle install --jobs $(nproc) --retry 3 --without metrics --path vendor/bundle
33
- - name: Create cache directory
34
- run: mkdir -p tmp/cache
35
- - name: Typecheck with Sorbet
36
- run: bundle exec srb tc . --ignore=/vendor
37
- - name: Run RSpec test suite
38
- run: bundle exec rspec spec
39
- env:
40
- METRICS: '1'
41
- - name: Post to Slack if build fails
42
- if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/stable')
43
- uses: pullreminders/slack-action@master
44
- env:
45
- SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
46
- with:
47
- args: '{\"channel\":\"C33574SJJ\",\"text\":\"* ${{ github.repository }} BUILD
48
- FAILURE*\", \"attachments\": [{ \"fallback\": \"Failure summary\", \"color\":
49
- \"#ff0000\", \"fields\": [{\"title\": \"Branch\", \"value\":\"${{ steps.extract_branch.outputs.branch
50
- }}\"}, {\"title\": \"Who broke it\", \"value\":\"${{ github.actor }}\"},
51
- { \"title\": \"Build output\", \"value\": \"https://github.com/${{ github.repository
52
- }}/commit/${{ github.sha }}/checks\", \"short\": false }]}]}'
2
+ name: Continuous Integration
3
+ on:
4
+ push:
5
+ branches-ignore:
6
+ - refs/tags/*_staging
7
+ - refs/tags/*_production
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-18.04
11
+ steps:
12
+ - name: Checkout branch
13
+ uses: actions/checkout@v2
14
+ - name: Extract branch name
15
+ shell: bash
16
+ run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
17
+ id: extract_branch
18
+ - name: Cache gems
19
+ uses: actions/cache@v2
20
+ with:
21
+ path: vendor/bundle
22
+ key: "${{ runner.OS }}-gem-cache-${{ hashFiles('**/*.gemspec')
23
+ }}"
24
+ restore-keys: "${{ runner.OS }}-gem-cache-\n"
25
+ - uses: "cachix/install-nix-action@8d6d5e949675fbadb765c6b1a975047fa5f09b27"
26
+ with:
27
+ extra_nix_config: |
28
+ post-build-hook = /etc/nix/upload-to-cache.sh
29
+ substituters = https://cache.nixos.org/
30
+ trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
31
+ nix_path: nixpkgs=channel:nixos-21.05
32
+ - name: Run CI through nix-shell
33
+ env:
34
+ GEMFURY_DEPLOY_TOKEN: ${{ secrets.GEMFURY_DEPLOY_TOKEN }}
35
+ run: nix-shell --run "chmod 755 ./run_ci.sh && ./run_ci.sh"
36
+ - name: Post to Slack if build fails
37
+ if: failure() && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
38
+ || github.ref == 'refs/heads/stable')
39
+ uses: pullreminders/slack-action@a5a262c896a1cc80dcbae59ba95513e2dfb21439
40
+ env:
41
+ SLACK_BOT_TOKEN: "${{ secrets.SLACK_BOT_TOKEN }}"
42
+ with:
43
+ args: '{\"channel\":\"C33574SJJ\",\"text\":\"* ${{ github.repository }} BUILD
44
+ FAILURE*\", \"attachments\": [{ \"fallback\": \"Failure summary\", \"color\":
45
+ \"#ff0000\", \"fields\": [{\"title\": \"Branch\", \"value\":\"${{ steps.extract_branch.outputs.branch
46
+ }}\"}, {\"title\": \"Who broke it\", \"value\":\"${{ github.actor }}\"},
47
+ { \"title\": \"Build output\", \"value\": \"https://github.com/${{ github.repository
48
+ }}/commit/${{ github.sha }}/checks\", \"short\": false }]}]}'
data/.gitignore CHANGED
@@ -10,3 +10,6 @@
10
10
 
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
+ .envrc
14
+ .direnv
15
+ vendor
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Releases
2
2
 
3
+ 1.3.0
4
+
5
+ * Add support for eql? so that Array.uniq properly dedupes ([PR #6](https://github.com/bellroy/sorbet-struct-comparable/pull/6))
6
+
7
+ 1.2.0
8
+
9
+ * Add `#hash` ([PR #5](https://github.com/bellroy/sorbet-struct-comparable/pull/5))
10
+
11
+ 1.1.0
12
+
13
+ * Fixed `T::Struct`'s of different classes returning `-1`; now returning `nil` as is expected of incomparable objects
14
+ * Fixed incomparable attributes of different returning `-1` instead of `nil`
15
+
3
16
  1.0.0
4
17
 
5
18
  * Initial release: Extracted from [https://bellroy.com/](Bellroy) projects.
data/Gemfile CHANGED
@@ -4,19 +4,14 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development, :test do
7
- gem 'rake', '~> 12.0'
8
- gem 'rspec', '~> 3.0'
7
+ gem 'rake'
8
+ gem 'rspec'
9
9
  gem 'pry-byebug'
10
10
  gem 'sorbet'
11
11
  gem 'sorbet-runtime'
12
- end
13
-
14
- group :development do
15
- gem 'spring'
16
- gem 'spring-watcher-listen'
12
+ gem 'tapioca'
17
13
  end
18
14
 
19
15
  group :test do
20
16
  gem 'simplecov'
21
- gem 'spring-commands-rspec'
22
17
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ![Sorbet](https://user-images.githubusercontent.com/2643026/84757714-60be0600-afbc-11ea-8c0e-7da839ea1712.png)
2
2
 
3
- ![Continuous Integration](https://github.com/tricycle/sorbet-struct-comparable/workflows/Continuous%20Integration/badge.svg)
3
+ [![Gem Version](https://badge.fury.io/rb/sorbet-struct-comparable.svg)](https://badge.fury.io/rb/sorbet-struct-comparable) ![Continuous Integration](https://github.com/bellroy/sorbet-struct-comparable/workflows/Continuous%20Integration/badge.svg)
4
4
  # Making T::Struct's comparable since 2020
5
5
 
6
6
  If you just want some simple equality checking on your `T::Struct`'s then you've come to the right place.
@@ -67,4 +67,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
67
67
 
68
68
  ## Contributing
69
69
 
70
- Bug reports and pull requests are welcome on GitHub at https://github.com/tricycle/sorbet-struct-comparable.
70
+ Bug reports and pull requests are welcome on GitHub at https://github.com/bellroy/sorbet-struct-comparable.
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module SorbetStructComparable
5
- VERSION = '1.0.0'
5
+ VERSION = '1.3.0'
6
6
  end
@@ -7,24 +7,29 @@ module T
7
7
  extend T::Sig
8
8
  include ::Comparable
9
9
 
10
- LESS_THAN_OTHER = -1
11
10
  EQUAL = 0
11
+ NOT_COMPARABLE = nil
12
12
 
13
- sig { params(other: Object).returns(Integer) }
13
+ sig { params(other: Object).returns(T.nilable(Integer)) }
14
14
  def <=>(other)
15
- result = EQUAL
16
- return LESS_THAN_OTHER if other.class != T.unsafe(self).class
15
+ return NOT_COMPARABLE if other.class != T.unsafe(self).class
17
16
 
18
- T.unsafe(self).class.decorator.props.keys.map do |attribute_key|
17
+ T.unsafe(self).class.decorator.props.keys.each do |attribute_key|
19
18
  compare_result = T.unsafe(self).send(attribute_key) <=> other.send(attribute_key)
20
- result = if compare_result.nil?
21
- LESS_THAN_OTHER
22
- else
23
- T.cast(compare_result, Integer)
24
- end
25
- break if result != EQUAL
19
+ return T.cast(compare_result, T.nilable(Integer)) if compare_result != EQUAL
26
20
  end
27
- result
21
+
22
+ return EQUAL
23
+ end
24
+
25
+ sig { params(other: Object).returns(T::Boolean) }
26
+ def eql?(other)
27
+ self == other
28
+ end
29
+
30
+ sig { returns(Integer) }
31
+ def hash
32
+ T.unsafe(self).class.decorator.props.keys.map { |attribute_key| T.unsafe(self).send(attribute_key).hash }.hash
28
33
  end
29
34
  end
30
35
  end
data/nix/sources.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "nixpkgs": {
3
+ "branch": "nixos-21.05",
4
+ "description": "Nix packages collection",
5
+ "homepage": "https://github.com/NixOS/nixpkgs",
6
+ "owner": "NixOS",
7
+ "repo": "nixpkgs",
8
+ "rev": "e85f0175e3effe9ba191d66c09e8f1b7d6362d5e",
9
+ "sha256": "1qr2hmymbzwj8jrz6smcgc04scgwp2v5070x22k4fvh261g1n4zw",
10
+ "type": "tarball",
11
+ "url": "https://github.com/NixOS/nixpkgs/archive/e85f0175e3effe9ba191d66c09e8f1b7d6362d5e.tar.gz",
12
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13
+ }
14
+ }
data/nix/sources.nix ADDED
@@ -0,0 +1,174 @@
1
+ # This file has been generated by Niv.
2
+
3
+ let
4
+
5
+ #
6
+ # The fetchers. fetch_<type> fetches specs of type <type>.
7
+ #
8
+
9
+ fetch_file = pkgs: name: spec:
10
+ let
11
+ name' = sanitizeName name + "-src";
12
+ in
13
+ if spec.builtin or true then
14
+ builtins_fetchurl { inherit (spec) url sha256; name = name'; }
15
+ else
16
+ pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
17
+
18
+ fetch_tarball = pkgs: name: spec:
19
+ let
20
+ name' = sanitizeName name + "-src";
21
+ in
22
+ if spec.builtin or true then
23
+ builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
24
+ else
25
+ pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
26
+
27
+ fetch_git = name: spec:
28
+ let
29
+ ref =
30
+ if spec ? ref then spec.ref else
31
+ if spec ? branch then "refs/heads/${spec.branch}" else
32
+ if spec ? tag then "refs/tags/${spec.tag}" else
33
+ abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
34
+ in
35
+ builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
36
+
37
+ fetch_local = spec: spec.path;
38
+
39
+ fetch_builtin-tarball = name: throw
40
+ ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
41
+ $ niv modify ${name} -a type=tarball -a builtin=true'';
42
+
43
+ fetch_builtin-url = name: throw
44
+ ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
45
+ $ niv modify ${name} -a type=file -a builtin=true'';
46
+
47
+ #
48
+ # Various helpers
49
+ #
50
+
51
+ # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
52
+ sanitizeName = name:
53
+ (
54
+ concatMapStrings (s: if builtins.isList s then "-" else s)
55
+ (
56
+ builtins.split "[^[:alnum:]+._?=-]+"
57
+ ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
58
+ )
59
+ );
60
+
61
+ # The set of packages used when specs are fetched using non-builtins.
62
+ mkPkgs = sources: system:
63
+ let
64
+ sourcesNixpkgs =
65
+ import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
66
+ hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
67
+ hasThisAsNixpkgsPath = <nixpkgs> == ./.;
68
+ in
69
+ if builtins.hasAttr "nixpkgs" sources
70
+ then sourcesNixpkgs
71
+ else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
72
+ import <nixpkgs> {}
73
+ else
74
+ abort
75
+ ''
76
+ Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
77
+ add a package called "nixpkgs" to your sources.json.
78
+ '';
79
+
80
+ # The actual fetching function.
81
+ fetch = pkgs: name: spec:
82
+
83
+ if ! builtins.hasAttr "type" spec then
84
+ abort "ERROR: niv spec ${name} does not have a 'type' attribute"
85
+ else if spec.type == "file" then fetch_file pkgs name spec
86
+ else if spec.type == "tarball" then fetch_tarball pkgs name spec
87
+ else if spec.type == "git" then fetch_git name spec
88
+ else if spec.type == "local" then fetch_local spec
89
+ else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
90
+ else if spec.type == "builtin-url" then fetch_builtin-url name
91
+ else
92
+ abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
93
+
94
+ # If the environment variable NIV_OVERRIDE_${name} is set, then use
95
+ # the path directly as opposed to the fetched source.
96
+ replace = name: drv:
97
+ let
98
+ saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
99
+ ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
100
+ in
101
+ if ersatz == "" then drv else
102
+ # this turns the string into an actual Nix path (for both absolute and
103
+ # relative paths)
104
+ if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
105
+
106
+ # Ports of functions for older nix versions
107
+
108
+ # a Nix version of mapAttrs if the built-in doesn't exist
109
+ mapAttrs = builtins.mapAttrs or (
110
+ f: set: with builtins;
111
+ listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
112
+ );
113
+
114
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
115
+ range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
116
+
117
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
118
+ stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
119
+
120
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
121
+ stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
122
+ concatMapStrings = f: list: concatStrings (map f list);
123
+ concatStrings = builtins.concatStringsSep "";
124
+
125
+ # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
126
+ optionalAttrs = cond: as: if cond then as else {};
127
+
128
+ # fetchTarball version that is compatible between all the versions of Nix
129
+ builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
130
+ let
131
+ inherit (builtins) lessThan nixVersion fetchTarball;
132
+ in
133
+ if lessThan nixVersion "1.12" then
134
+ fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
135
+ else
136
+ fetchTarball attrs;
137
+
138
+ # fetchurl version that is compatible between all the versions of Nix
139
+ builtins_fetchurl = { url, name ? null, sha256 }@attrs:
140
+ let
141
+ inherit (builtins) lessThan nixVersion fetchurl;
142
+ in
143
+ if lessThan nixVersion "1.12" then
144
+ fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
145
+ else
146
+ fetchurl attrs;
147
+
148
+ # Create the final "sources" from the config
149
+ mkSources = config:
150
+ mapAttrs (
151
+ name: spec:
152
+ if builtins.hasAttr "outPath" spec
153
+ then abort
154
+ "The values in sources.json should not have an 'outPath' attribute"
155
+ else
156
+ spec // { outPath = replace name (fetch config.pkgs name spec); }
157
+ ) config.sources;
158
+
159
+ # The "config" used by the fetchers
160
+ mkConfig =
161
+ { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
162
+ , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
163
+ , system ? builtins.currentSystem
164
+ , pkgs ? mkPkgs sources system
165
+ }: rec {
166
+ # The sources, i.e. the attribute set of spec name to spec
167
+ inherit sources;
168
+
169
+ # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
170
+ inherit pkgs;
171
+ };
172
+
173
+ in
174
+ mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
data/run_ci.sh ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+ rm -f Gemfile.lock
4
+ bundle install
5
+ bundle exec srb tc
6
+ METRICS=1 bundle exec rspec spec
data/shell.nix ADDED
@@ -0,0 +1,20 @@
1
+ { sources ? import ./nix/sources.nix }:
2
+ let
3
+ nixpkgs = import sources.nixpkgs { };
4
+ in
5
+ nixpkgs.mkShell {
6
+ name = "bellroy-gem-env";
7
+ buildInputs = with nixpkgs; [
8
+ bundler
9
+ libnotify
10
+ niv
11
+ pkg-config
12
+ readline
13
+ ruby_2_7
14
+ zlib
15
+ ]
16
+ ++ (if stdenv.hostPlatform.isDarwin then [ libiconv darwin.apple_sdk.frameworks.CoreServices ] else [ ]);
17
+ shellHook = ''
18
+ bundle config --local path "$PWD/vendor/bundle"
19
+ '';
20
+ }
data/sorbet/config CHANGED
@@ -1,2 +1,4 @@
1
1
  --dir
2
2
  .
3
+ --ignore
4
+ vendor
@@ -0,0 +1,54 @@
1
+ # DO NOT EDIT MANUALLY
2
+ # This is an autogenerated file for types exported from the `ast` gem.
3
+ # Please instead update this file by running `bin/tapioca gem ast`.
4
+
5
+ # typed: true
6
+
7
+ module AST; end
8
+
9
+ class AST::Node
10
+ def initialize(type, children = T.unsafe(nil), properties = T.unsafe(nil)); end
11
+
12
+ def +(array); end
13
+ def <<(element); end
14
+ def ==(other); end
15
+ def append(element); end
16
+ def children; end
17
+ def clone; end
18
+ def concat(array); end
19
+ def deconstruct; end
20
+ def dup; end
21
+ def eql?(other); end
22
+ def hash; end
23
+ def inspect(indent = T.unsafe(nil)); end
24
+ def to_a; end
25
+ def to_ast; end
26
+ def to_s(indent = T.unsafe(nil)); end
27
+ def to_sexp(indent = T.unsafe(nil)); end
28
+ def to_sexp_array; end
29
+ def type; end
30
+ def updated(type = T.unsafe(nil), children = T.unsafe(nil), properties = T.unsafe(nil)); end
31
+
32
+ protected
33
+
34
+ def assign_properties(properties); end
35
+ def fancy_type; end
36
+
37
+ private
38
+
39
+ def original_dup; end
40
+ end
41
+
42
+ class AST::Processor
43
+ include ::AST::Processor::Mixin
44
+ end
45
+
46
+ module AST::Processor::Mixin
47
+ def handler_missing(node); end
48
+ def process(node); end
49
+ def process_all(nodes); end
50
+ end
51
+
52
+ module AST::Sexp
53
+ def s(type, *children); end
54
+ end