ror 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 69ab7355212b3df712d74bd249a3c2740ef69c68c4d3f9ad48d90f5ab524ad02
4
+ data.tar.gz: 8a79f8f5081bc6bc3c1df561fd0b866e7a6b5fa17b9d4ac7ac31fbfcd3484662
5
+ SHA512:
6
+ metadata.gz: 4e6ff84aad2d95fdb2cd9d4d95ac956862591603b9c2447cb299f2c8cc2bac71fcba14f2b4ec0b0043cf57a286dc0aeb01243d37c6fca77cc9be7f8b92993033
7
+ data.tar.gz: 9c6f82e09e2c2f5c8f431e953a8c970ac881fe286b3853a02a0b155fa26c94652305d57aefad5722aa51e9ed1472e40061de608ba5e40b0ab18806e02d0ef2c8
data/.envrc ADDED
@@ -0,0 +1,3 @@
1
+ use nix
2
+ layout ruby
3
+
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in ror.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ror (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.5.0)
11
+ parallel (1.22.1)
12
+ parser (3.1.2.0)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.1.1)
15
+ rake (13.0.6)
16
+ regexp_parser (2.3.1)
17
+ rexml (3.2.5)
18
+ rspec (3.11.0)
19
+ rspec-core (~> 3.11.0)
20
+ rspec-expectations (~> 3.11.0)
21
+ rspec-mocks (~> 3.11.0)
22
+ rspec-core (3.11.0)
23
+ rspec-support (~> 3.11.0)
24
+ rspec-expectations (3.11.0)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.11.0)
27
+ rspec-mocks (3.11.1)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.11.0)
30
+ rspec-support (3.11.0)
31
+ rubocop (1.28.2)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.1.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml
37
+ rubocop-ast (>= 1.17.0, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.17.0)
41
+ parser (>= 3.1.1.0)
42
+ ruby-progressbar (1.11.0)
43
+ unicode-display_width (2.1.0)
44
+
45
+ PLATFORMS
46
+ x86_64-linux
47
+
48
+ DEPENDENCIES
49
+ rake (~> 13.0)
50
+ ror!
51
+ rspec (~> 3.0)
52
+ rubocop (~> 1.21)
53
+
54
+ BUNDLED WITH
55
+ 2.2.33
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Anthony Roman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Ror
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/ror`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ror'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ror
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ror.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ror"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ror
4
+ VERSION = "0.1.0"
5
+ end
data/lib/ror.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "ror/version"
4
+
5
+ module Ror
6
+ class Error < StandardError; end
7
+ # Your code goes here...
8
+ end
data/nix/sources.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "nixpkgs": {
3
+ "branch": "release-21.11",
4
+ "description": "Nix Packages collection",
5
+ "homepage": "",
6
+ "owner": "NixOS",
7
+ "repo": "nixpkgs",
8
+ "rev": "e41bd3eeadc4cab64f5de69f0c099058fa7d4127",
9
+ "sha256": "10g03pibbax7jykj67zyir0f75577zpxc78l38m7rdmv7pkahpir",
10
+ "type": "tarball",
11
+ "url": "https://github.com/NixOS/nixpkgs/archive/e41bd3eeadc4cab64f5de69f0c099058fa7d4127.tar.gz",
12
+ "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
13
+ }
14
+ }
data/nix/sources.nix ADDED
@@ -0,0 +1,176 @@
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
+ submodules = if spec ? submodules then spec.submodules else false;
35
+ in
36
+ builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }
37
+ // (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else {});
38
+
39
+ fetch_local = spec: spec.path;
40
+
41
+ fetch_builtin-tarball = name: throw
42
+ ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`.
43
+ $ niv modify ${name} -a type=tarball -a builtin=true'';
44
+
45
+ fetch_builtin-url = name: throw
46
+ ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`.
47
+ $ niv modify ${name} -a type=file -a builtin=true'';
48
+
49
+ #
50
+ # Various helpers
51
+ #
52
+
53
+ # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
54
+ sanitizeName = name:
55
+ (
56
+ concatMapStrings (s: if builtins.isList s then "-" else s)
57
+ (
58
+ builtins.split "[^[:alnum:]+._?=-]+"
59
+ ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
60
+ )
61
+ );
62
+
63
+ # The set of packages used when specs are fetched using non-builtins.
64
+ mkPkgs = sources: system:
65
+ let
66
+ sourcesNixpkgs =
67
+ import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; };
68
+ hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
69
+ hasThisAsNixpkgsPath = <nixpkgs> == ./.;
70
+ in
71
+ if builtins.hasAttr "nixpkgs" sources
72
+ then sourcesNixpkgs
73
+ else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
74
+ import <nixpkgs> {}
75
+ else
76
+ abort
77
+ ''
78
+ Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
79
+ add a package called "nixpkgs" to your sources.json.
80
+ '';
81
+
82
+ # The actual fetching function.
83
+ fetch = pkgs: name: spec:
84
+
85
+ if ! builtins.hasAttr "type" spec then
86
+ abort "ERROR: niv spec ${name} does not have a 'type' attribute"
87
+ else if spec.type == "file" then fetch_file pkgs name spec
88
+ else if spec.type == "tarball" then fetch_tarball pkgs name spec
89
+ else if spec.type == "git" then fetch_git name spec
90
+ else if spec.type == "local" then fetch_local spec
91
+ else if spec.type == "builtin-tarball" then fetch_builtin-tarball name
92
+ else if spec.type == "builtin-url" then fetch_builtin-url name
93
+ else
94
+ abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}";
95
+
96
+ # If the environment variable NIV_OVERRIDE_${name} is set, then use
97
+ # the path directly as opposed to the fetched source.
98
+ replace = name: drv:
99
+ let
100
+ saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
101
+ ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
102
+ in
103
+ if ersatz == "" then drv else
104
+ # this turns the string into an actual Nix path (for both absolute and
105
+ # relative paths)
106
+ if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
107
+
108
+ # Ports of functions for older nix versions
109
+
110
+ # a Nix version of mapAttrs if the built-in doesn't exist
111
+ mapAttrs = builtins.mapAttrs or (
112
+ f: set: with builtins;
113
+ listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set))
114
+ );
115
+
116
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
117
+ range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
118
+
119
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
120
+ stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
121
+
122
+ # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269
123
+ stringAsChars = f: s: concatStrings (map f (stringToCharacters s));
124
+ concatMapStrings = f: list: concatStrings (map f list);
125
+ concatStrings = builtins.concatStringsSep "";
126
+
127
+ # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
128
+ optionalAttrs = cond: as: if cond then as else {};
129
+
130
+ # fetchTarball version that is compatible between all the versions of Nix
131
+ builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
132
+ let
133
+ inherit (builtins) lessThan nixVersion fetchTarball;
134
+ in
135
+ if lessThan nixVersion "1.12" then
136
+ fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
137
+ else
138
+ fetchTarball attrs;
139
+
140
+ # fetchurl version that is compatible between all the versions of Nix
141
+ builtins_fetchurl = { url, name ? null, sha256 }@attrs:
142
+ let
143
+ inherit (builtins) lessThan nixVersion fetchurl;
144
+ in
145
+ if lessThan nixVersion "1.12" then
146
+ fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
147
+ else
148
+ fetchurl attrs;
149
+
150
+ # Create the final "sources" from the config
151
+ mkSources = config:
152
+ mapAttrs (
153
+ name: spec:
154
+ if builtins.hasAttr "outPath" spec
155
+ then abort
156
+ "The values in sources.json should not have an 'outPath' attribute"
157
+ else
158
+ spec // { outPath = replace name (fetch config.pkgs name spec); }
159
+ ) config.sources;
160
+
161
+ # The "config" used by the fetchers
162
+ mkConfig =
163
+ { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
164
+ , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
165
+ , system ? builtins.currentSystem
166
+ , pkgs ? mkPkgs sources system
167
+ }: rec {
168
+ # The sources, i.e. the attribute set of spec name to spec
169
+ inherit sources;
170
+
171
+ # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers
172
+ inherit pkgs;
173
+ };
174
+
175
+ in
176
+ mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
data/shell.nix ADDED
@@ -0,0 +1,8 @@
1
+ { sources ? import ./nix/sources.nix }:
2
+ let
3
+ pkgs = import sources.nixpkgs {};
4
+ in pkgs.mkShell {
5
+ buildInputs = [
6
+ pkgs.ruby_3_0
7
+ ];
8
+ }
data/sig/ror.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Ror
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,59 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ror
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Anthony Roman
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'NEXT: Write a longer description or delete this line.'
14
+ email:
15
+ - tonyromnet@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".envrc"
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - Gemfile
24
+ - Gemfile.lock
25
+ - LICENSE.txt
26
+ - README.md
27
+ - Rakefile
28
+ - bin/console
29
+ - bin/setup
30
+ - lib/ror.rb
31
+ - lib/ror/version.rb
32
+ - nix/sources.json
33
+ - nix/sources.nix
34
+ - shell.nix
35
+ - sig/ror.rbs
36
+ homepage:
37
+ licenses:
38
+ - MIT
39
+ metadata: {}
40
+ post_install_message:
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: 2.6.0
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubygems_version: 3.2.26
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: 'NEXT: Write a short summary, because RubyGems requires one.'
59
+ test_files: []