From 277731d011c54b85dcfca8bb7b3174630d98ce07 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 12:46:46 +0100 Subject: [PATCH 01/12] move nix to flake, ruby-nix --- .envrc | 4 +- .github/workflows/ci.yml | 8 +- .gitignore | 1 - Gemfile.lock | 184 +++++++++++++++++++++ flake.lock | 116 +++++++++++++ flake.nix | 84 ++++++++++ nix/gemset.nix => gemset.nix | 312 ++++++++++++++++++++++++----------- nix/.bundle/config | 3 - nix/Gemfile | 12 -- nix/Gemfile.lock | 172 ------------------- nix/sources.json | 14 -- nix/sources.nix | 194 ---------------------- nix/update-gemset.sh | 7 - rails_edge_test.gemspec | 2 +- shell.nix | 23 --- 15 files changed, 611 insertions(+), 525 deletions(-) create mode 100644 Gemfile.lock create mode 100644 flake.lock create mode 100644 flake.nix rename nix/gemset.nix => gemset.nix (62%) delete mode 100644 nix/.bundle/config delete mode 100644 nix/Gemfile delete mode 100644 nix/Gemfile.lock delete mode 100644 nix/sources.json delete mode 100644 nix/sources.nix delete mode 100755 nix/update-gemset.sh delete mode 100644 shell.nix diff --git a/.envrc b/.envrc index 699fce4..0426283 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,2 @@ -use nix -watch_file nix/gemset.nix +use flake +watch_file gemset.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f4c167..127bb01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Install Nix - uses: cachix/install-nix-action@v26 + uses: cachix/install-nix-action@v30 with: - nix_path: nixpkgs=channel:nixos-24.05 + github_access_token: ${{ secrets.GITHUB_TOKEN }} - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Run tests - run: nix-shell --run rspec + run: nix develop --command rspec diff --git a/.gitignore b/.gitignore index ddc9b71..26431bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .bundle/ /.yardoc -/Gemfile.lock /_yardoc/ /coverage/ /doc/ diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..26d97cd --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,184 @@ +PATH + remote: . + specs: + rails_edge_test (2.1.0) + actionpack (>= 5.2.0, < 7.1.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.8.6) + actionpack (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activesupport (= 7.0.8.6) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.8.6) + actionview (= 7.0.8.6) + activesupport (= 7.0.8.6) + rack (~> 2.0, >= 2.2.4) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.8.6) + actionpack (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.8.6) + activesupport (= 7.0.8.6) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.8.6) + activesupport (= 7.0.8.6) + globalid (>= 0.3.6) + activemodel (7.0.8.6) + activesupport (= 7.0.8.6) + activerecord (7.0.8.6) + activemodel (= 7.0.8.6) + activesupport (= 7.0.8.6) + activestorage (7.0.8.6) + actionpack (= 7.0.8.6) + activejob (= 7.0.8.6) + activerecord (= 7.0.8.6) + activesupport (= 7.0.8.6) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.8.6) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + builder (3.3.0) + concurrent-ruby (1.3.4) + crass (1.0.6) + date (3.4.0) + diff-lcs (1.5.1) + erubi (1.13.0) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + loofah (2.23.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + mini_portile2 (2.8.7) + minitest (5.25.1) + net-imap (0.5.1) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4) + nokogiri (1.16.7) + mini_portile2 (~> 2.8.2) + racc (~> 1.4) + racc (1.8.1) + rack (2.2.10) + rack-test (2.1.0) + rack (>= 1.3) + rails (7.0.8.6) + actioncable (= 7.0.8.6) + actionmailbox (= 7.0.8.6) + actionmailer (= 7.0.8.6) + actionpack (= 7.0.8.6) + actiontext (= 7.0.8.6) + actionview (= 7.0.8.6) + activejob (= 7.0.8.6) + activemodel (= 7.0.8.6) + activerecord (= 7.0.8.6) + activestorage (= 7.0.8.6) + activesupport (= 7.0.8.6) + bundler (>= 1.15.0) + railties (= 7.0.8.6) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.8.6) + actionpack (= 7.0.8.6) + activesupport (= 7.0.8.6) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rake (13.2.1) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-support (3.13.1) + sqlite3 (2.0.4) + mini_portile2 (~> 2.8.0) + thor (1.3.2) + timeout (0.4.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.18) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal (~> 2.3) + rails (>= 5.2, < 7.1.0) + rails_edge_test! + rake (~> 13.0) + rspec (~> 3.9) + sqlite3 (~> 2.0.4) + +BUNDLED WITH + 2.3.27 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a33cc2d --- /dev/null +++ b/flake.lock @@ -0,0 +1,116 @@ +{ + "nodes": { + "bundix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721093334, + "narHash": "sha256-5FghZ0HIETbc0TGcBV8uyixq5z4w/9PF5Puhujz3D1o=", + "owner": "inscapist", + "repo": "bundix", + "rev": "42c08846f7e5d91ef121239fd364feaeb22c0bbc", + "type": "github" + }, + "original": { + "owner": "inscapist", + "ref": "main", + "repo": "bundix", + "type": "github" + } + }, + "fu": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1731239293, + "narHash": "sha256-q2yjIWFFcTzp5REWQUOU9L6kHdCDmFDpqeix86SOvDc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9256f7c71a195ebe7a218043d9f93390d49e6884", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1678875422, + "narHash": "sha256-T3o6NcQPwXjxJMn2shz86Chch4ljXgZn746c2caGxd8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "126f49a01de5b7e35a43fd43f891ecf6d3a51459", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "bundix": "bundix", + "fu": "fu", + "nixpkgs": "nixpkgs", + "ruby-nix": "ruby-nix" + } + }, + "ruby-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1725677741, + "narHash": "sha256-CySXGzqycagfrWdcTwzM3Zo1MMm9uUtePYER9BvrW8s=", + "owner": "inscapist", + "repo": "ruby-nix", + "rev": "1f3756f8a713171bf891b39c0d3b1fe6d83a4a63", + "type": "github" + }, + "original": { + "owner": "inscapist", + "repo": "ruby-nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a1f1e18 --- /dev/null +++ b/flake.nix @@ -0,0 +1,84 @@ +{ + description = "dev env for rails_edge_test"; + + nixConfig = { + extra-substituters = "https://nixpkgs-ruby.cachix.org"; + extra-trusted-public-keys = "nixpkgs-ruby.cachix.org-1:vrcdi50fTolOxWCZZkw0jakOnUI1T19oYJ+PRYdK4SM="; + }; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + ruby-nix.url = "github:inscapist/ruby-nix"; + # a fork that supports platform dependant gem + bundix = { + url = "github:inscapist/bundix/main"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + fu.url = "github:numtide/flake-utils"; + }; + + outputs = + { + self, + nixpkgs, + fu, + ruby-nix, + bundix, + }: + with fu.lib; + eachDefaultSystem ( + system: + let + pkgs = import nixpkgs { inherit system; }; + rubyNix = ruby-nix.lib pkgs; + + gemset = if builtins.pathExists ./gemset.nix then import ./gemset.nix else { }; + + # If you want to override gem build config, see + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/ruby-modules/gem-config/default.nix + gemConfig = { }; + + ruby = pkgs.ruby_3_1; + + # Running bundix regenerate `gemset.nix` + bundixcli = bundix.packages.${system}.default; + + # Use these instead of the original `bundle ` commands + bundleLock = pkgs.writeShellScriptBin "bundle-lock" '' + export BUNDLE_PATH=vendor/bundle + bundle lock + ''; + bundleUpdate = pkgs.writeShellScriptBin "bundle-update" '' + export BUNDLE_PATH=vendor/bundle + bundle lock --update + ''; + in + rec { + inherit + (rubyNix { + inherit gemset ruby; + name = "rails_edge_test"; + gemConfig = pkgs.defaultGemConfig // gemConfig; + }) + env + ; + + devShells = rec { + default = dev; + dev = pkgs.mkShell { + buildInputs = ( + (with pkgs; [ + sqlite + ]) + ++ [ + env + bundixcli + bundleLock + bundleUpdate + ] + ); + }; + }; + } + ); +} diff --git a/nix/gemset.nix b/gemset.nix similarity index 62% rename from nix/gemset.nix rename to gemset.nix index b765674..ad8a268 100644 --- a/nix/gemset.nix +++ b/gemset.nix @@ -5,10 +5,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "001cwsb6496wp8g0nkyjqxgmii63aljydq132yb2ksdp8ml5zlgj"; + sha256 = "0ms0196bp8gzlghfj32q2qdzszb7hsgg96v3isrv5ysd87w0z2zl"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; actionmailbox = { dependencies = ["actionpack" "activejob" "activerecord" "activestorage" "activesupport" "mail" "net-imap" "net-pop" "net-smtp"]; @@ -16,10 +18,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0d990xy3jin8qa4l989r43kl5ykmi2kdlxqpnla10n5c7xp7xmci"; + sha256 = "0mw8casnlqgj3vwqv7qk3d4q3bjszlpmbs9ldpc9gz1qdvafx7cg"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; actionmailer = { dependencies = ["actionpack" "actionview" "activejob" "activesupport" "mail" "net-imap" "net-pop" "net-smtp" "rails-dom-testing"]; @@ -27,10 +31,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "033981lhbq0vl8ppfpamqpqj3sq15x759899hvwli2imp3yw49r5"; + sha256 = "07gpm15k5c0y84q99zipnhcdgq93bwralyjpj252prvqwfjmiw73"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; actionpack = { dependencies = ["actionview" "activesupport" "rack" "rack-test" "rails-dom-testing" "rails-html-sanitizer"]; @@ -38,10 +44,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0w717izq6k7wl2j6zn4516kg2iwg3zgdzja6b6gpk6y5nccr04hw"; + sha256 = "19ywl4jp77b51c01hsyzwia093fnj73pw1ipgyj4pk3h2b9faj5n"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; actiontext = { dependencies = ["actionpack" "activerecord" "activestorage" "activesupport" "globalid" "nokogiri"]; @@ -49,10 +57,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0bcpjhhbq6gl4h7hq2fianfz8vpdxf53gsj1ng04bkh5bxxrmrc1"; + sha256 = "1j8b29764nbiqz6d7ra42j2i6wf070lbms1fhpq3cl9azbgijb16"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; actionview = { dependencies = ["activesupport" "builder" "erubi" "rails-dom-testing" "rails-html-sanitizer"]; @@ -60,10 +70,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1z0xvdal339w7jvk7a5py0c1q5xh588vqrilgxizkvzm3hwf48a2"; + sha256 = "0girx71db1aq5b70ln3qq03z9d7xjdyp297v1a8rdal7k89y859c"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; activejob = { dependencies = ["activesupport" "globalid"]; @@ -71,10 +83,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "18gsxi7vlg8y8k2fbhq44zd0mivjpnn4nrlfj037c7wvq5h8367v"; + sha256 = "0gbc0wx9xal5bj0pbz8ygkr75wj4cm5i69hpwknf023psgixaybw"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; activemodel = { dependencies = ["activesupport"]; @@ -82,10 +96,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0cjbk1xl6jl2d6sczpxnr8da7zbmshmrghqhqdcwqqzl6chcy2si"; + sha256 = "1f6szahjsb4pr2xvlvk4kghk9291xh9c14s8cqwy6wwpm1vcglim"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; activerecord = { dependencies = ["activemodel" "activesupport"]; @@ -93,10 +109,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "04x0bz3051linhmi52cfg31nsm4sgg27m7wp9p0cxrxdwc7q0bjl"; + sha256 = "14qs1jc9hwnsm4dzvnai8b36bcq1d7rcqgjxy0dc6wza670lqapf"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; activestorage = { dependencies = ["actionpack" "activejob" "activerecord" "activesupport" "marcel" "mini_mime"]; @@ -104,10 +122,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0mg236x3rkmdargkk9y6j9gqhkajzbk852gwnp1crp0difk7a4r8"; + sha256 = "1nnvqnmc7mdhw2w55j4vnx4zmmdmmwmaf6ax2mbj9j5a48fw19vf"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; activesupport = { dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo"]; @@ -115,30 +135,49 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1c7k5i6531z5il4q1jnbrv7x7zcl3bgnxp5fzl71rzigk6zn53ym"; + sha256 = "0gj20cysajda05z3r7pl1g9y84nzsqak5dvk9nrz13jpy6297dj1"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; + }; + appraisal = { + dependencies = ["rake" "thor"]; + groups = ["development"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1knkxrjagaqf418lkgd7xvfb5rh143d19ld8vfq16y8jpqhr561n"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "2.5.0"; }; builder = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "045wzckxpwcqzrjr353cxnyaxgf0qg22jh00dcx7z38cys5g1jlr"; + sha256 = "0pw3r2lyagsxkm71bf44v5b74f7l9r7di22brbyji9fwz791hya9"; + target = "ruby"; type = "gem"; }; - version = "3.2.4"; + targets = []; + version = "3.3.0"; }; concurrent-ruby = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0krcwb6mn0iklajwngwsg850nk8k9b35dhmc2qkbdqvmifdi2y9q"; + sha256 = "0chwfdq2a6kbj6xz9l6zrdfnyghnh32si82la1dnpa5h75ir5anl"; + target = "ruby"; type = "gem"; }; - version = "1.2.2"; + targets = []; + version = "1.3.4"; }; crass = { groups = ["default" "development"]; @@ -146,8 +185,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "0pfl5c0pyqaparxaqxi6s4gfl21bdldwiawrc0aknyvflli60lfw"; + target = "ruby"; type = "gem"; }; + targets = []; version = "1.0.6"; }; date = { @@ -155,30 +196,36 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "03skfikihpx37rc27vr3hwrb057gxnmdzxhmzd4bf4jpkl0r55w1"; + sha256 = "04d7l3xdmkybrd20gayf8s38pgfld0hf8m726lz9np32xnnsszrf"; + target = "ruby"; type = "gem"; }; - version = "3.3.3"; + targets = []; + version = "3.4.0"; }; diff-lcs = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0rwvjahnp7cpmracd8x732rjgnilqv2sx7d1gfrysslc3h039fa9"; + sha256 = "1znxccz83m4xgpd239nyqxlifdb7m8rlfayk6s259186nkgj6ci7"; + target = "ruby"; type = "gem"; }; - version = "1.5.0"; + targets = []; + version = "1.5.1"; }; erubi = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "08s75vs9cxlc4r1q2bjg4br8g9wc5lc5x5vl0vv4zq5ivxsdpgi7"; + sha256 = "0qnd6ff4az22ysnmni3730c41b979xinilahzg86bn7gv93ip9pw"; + target = "ruby"; type = "gem"; }; - version = "1.12.0"; + targets = []; + version = "1.13.0"; }; globalid = { dependencies = ["activesupport"]; @@ -186,10 +233,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0kqm5ndzaybpnpxqiqkc41k4ksyxl41ln8qqr6kb130cdxsf2dxk"; + sha256 = "1sbw6b66r7cwdx3jhs46s4lr991969hvigkjpbdl7y3i31qpdgvh"; + target = "ruby"; type = "gem"; }; - version = "1.1.0"; + targets = []; + version = "1.2.1"; }; i18n = { dependencies = ["concurrent-ruby"]; @@ -197,10 +246,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1yk33slipi3i1kydzrrchbi7cgisaxym6pgwlzx7ir8vjk6wl90x"; + sha256 = "0k31wcgnvcvd14snz0pfqj976zv6drfsnq6x8acz10fiyms9l8nw"; + target = "ruby"; type = "gem"; }; - version = "1.13.0"; + targets = []; + version = "1.14.6"; }; loofah = { dependencies = ["crass" "nokogiri"]; @@ -208,10 +259,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1p744kjpb5zk2ihklbykzii77alycjc04vpnm2ch2f3cp65imlj3"; + sha256 = "0ppp2cgli5avzk0z3dwnah6y65ymyr793yja28p2fs9vrci7986h"; + target = "ruby"; type = "gem"; }; - version = "2.21.3"; + targets = []; + version = "2.23.1"; }; mail = { dependencies = ["mini_mime" "net-imap" "net-pop" "net-smtp"]; @@ -220,8 +273,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "1bf9pysw1jfgynv692hhaycfxa8ckay1gjw5hz3madrbrynryfzc"; + target = "ruby"; type = "gem"; }; + targets = []; version = "2.8.1"; }; marcel = { @@ -229,50 +284,60 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0kky3yiwagsk8gfbzn3mvl2fxlh3b39v6nawzm4wpjs6xxvvc4x0"; + sha256 = "190n2mk8m1l708kr88fh6mip9sdsh339d2s6sgrik3sbnvz4jmhd"; + target = "ruby"; type = "gem"; }; - version = "1.0.2"; + targets = []; + version = "1.0.4"; }; method_source = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1pnyh44qycnf9mzi1j6fywd5fkskv3x7nmsqrrws0rjn5dd4ayfp"; + sha256 = "1igmc3sq9ay90f8xjvfnswd1dybj1s3fi0dwd53inwsvqk4h24qq"; + target = "ruby"; type = "gem"; }; - version = "1.0.0"; + targets = []; + version = "1.1.0"; }; mini_mime = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0lbim375gw2dk6383qirz13hgdmxlan0vc5da2l072j3qw6fqjm5"; + sha256 = "1vycif7pjzkr29mfk4dlqv3disc5dn0va04lkwajlpr1wkibg0c6"; + target = "ruby"; type = "gem"; }; - version = "1.1.2"; + targets = []; + version = "1.1.5"; }; mini_portile2 = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0z7f38iq37h376n9xbl4gajdrnwzq284c9v1py4imw3gri2d5cj6"; + sha256 = "1q1f2sdw3y3y9mnym9dhjgsjr72sq975cfg5c4yx7gwv8nmzbvhk"; + target = "ruby"; type = "gem"; }; - version = "2.8.2"; + targets = []; + version = "2.8.7"; }; minitest = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0ic7i5z88zcaqnpzprf7saimq2f6sad57g5mkkqsrqrcd6h3mx06"; + sha256 = "1n1akmc6bibkbxkzm1p1wmfb4n9vv397knkgz0ffykb3h1d7kdix"; + target = "ruby"; type = "gem"; }; - version = "5.18.0"; + targets = []; + version = "5.25.1"; }; net-imap = { dependencies = ["date" "net-protocol"]; @@ -280,10 +345,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1d996zf3g8xz244791b0qsl9vr7zg4lqnnmf9k2kshr9lki5jam8"; + sha256 = "1mrqr1xknw4z1nzjvdaff1gd504fkwaqdb6ibqfhixsrhifvikn0"; + target = "ruby"; type = "gem"; }; - version = "0.3.4"; + targets = []; + version = "0.5.1"; }; net-pop = { dependencies = ["net-protocol"]; @@ -292,8 +359,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "1wyz41jd4zpjn0v1xsf9j778qx1vfrl24yc20cpmph8k42c4x2w4"; + target = "ruby"; type = "gem"; }; + targets = []; version = "0.1.2"; }; net-protocol = { @@ -302,10 +371,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0dxckrlw4q1lcn3qg4mimmjazmg9bma5gllv72f8js3p36fb3b91"; + sha256 = "1a32l4x73hz200cm587bc29q8q9az278syw3x6fkc9d1lv5y0wxa"; + target = "ruby"; type = "gem"; }; - version = "0.2.1"; + targets = []; + version = "0.2.2"; }; net-smtp = { dependencies = ["net-protocol"]; @@ -313,20 +384,24 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1c6md06hm5bf6rv53sk54dl2vg038pg8kglwv3rayx0vk2mdql9x"; + sha256 = "0amlhz8fhnjfmsiqcjajip57ici2xhw089x7zqyhpk51drg43h2z"; + target = "ruby"; type = "gem"; }; - version = "0.3.3"; + targets = []; + version = "0.5.0"; }; nio4r = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0w9978zwjf1qhy3amkivab0f9syz6a7k0xgydjidaf7xc831d78f"; + sha256 = "1a9www524fl1ykspznz54i0phfqya4x45hqaz67in9dvw1lfwpfr"; + target = "ruby"; type = "gem"; }; - version = "2.5.9"; + targets = []; + version = "2.7.4"; }; nokogiri = { dependencies = ["mini_portile2" "racc"]; @@ -334,30 +409,36 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1mr2ibfk874ncv0qbdkynay738w2mfinlkhnbd5lyk5yiw5q1p10"; + sha256 = "15gysw8rassqgdq3kwgl4mhqmrgh7nk2qvrcqp4ijyqazgywn6gq"; + target = "ruby"; type = "gem"; }; - version = "1.15.2"; + targets = []; + version = "1.16.7"; }; racc = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "09jgz6r0f7v84a7jz9an85q8vvmp743dqcsdm3z9c8rqcqv6pljq"; + sha256 = "0byn0c9nkahsl93y9ln5bysq4j31q8xkf2ws42swighxd4lnjzsa"; + target = "ruby"; type = "gem"; }; - version = "1.6.2"; + targets = []; + version = "1.8.1"; }; rack = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "16w217k9z02c4hqizym8dkj6bqmmzx4qdvqpnskgzf174a5pwdxk"; + sha256 = "0ax778fsfvlhj7c11n0d1wdcb8bxvkb190a9lha5d91biwzyx9g4"; + target = "ruby"; type = "gem"; }; - version = "2.2.7"; + targets = []; + version = "2.2.10"; }; rack-test = { dependencies = ["rack"]; @@ -366,8 +447,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "1ysx29gk9k14a14zsp5a8czys140wacvp91fja8xcja0j1hzqq8c"; + target = "ruby"; type = "gem"; }; + targets = []; version = "2.1.0"; }; rails = { @@ -376,21 +459,25 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1zip0qhk7pp6cvrir77p6v76wj68zaqik875qr5rapqz9am2pvsp"; + sha256 = "1s42lyl19h74xlqkb6ffl67h688q0slp1lhnd05g09a46z7wapri"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; rails-dom-testing = { - dependencies = ["activesupport" "nokogiri"]; + dependencies = ["activesupport" "minitest" "nokogiri"]; groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1lfq2a7kp2x64dzzi5p4cjcbiv62vxh9lyqk2f0rqq3fkzrw8h5i"; + sha256 = "0fx9dx1ag0s1lr6lfr34lbx5i1bvn3bhyf3w3mx6h7yz90p725g5"; + target = "ruby"; type = "gem"; }; - version = "2.0.3"; + targets = []; + version = "2.2.0"; }; rails-html-sanitizer = { dependencies = ["loofah" "nokogiri"]; @@ -399,30 +486,47 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "1pm4z853nyz1bhhqr7fzl44alnx4bjachcr6rh6qjj375sfz3sc6"; + target = "ruby"; type = "gem"; }; + targets = []; version = "1.6.0"; }; + rails_edge_test = { + dependencies = ["actionpack"]; + groups = ["default"]; + platforms = []; + source = { + path = "."; + type = "path"; + }; + targets = []; + version = "2.1.0"; + }; railties = { dependencies = ["actionpack" "activesupport" "method_source" "rake" "thor" "zeitwerk"]; groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0kn3cx00jnb7bjnh1k2q0dxk0r7nl1a0krgyk5ykxw1wcac81wyw"; + sha256 = "1fcn0ix814074gqicc0k1178f7ahmysiv3pfq8g00phdwj0p3w0g"; + target = "ruby"; type = "gem"; }; - version = "7.0.5"; + targets = []; + version = "7.0.8.6"; }; rake = { groups = ["development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w"; + sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6"; + target = "ruby"; type = "gem"; }; - version = "13.0.6"; + targets = []; + version = "13.2.1"; }; rspec = { dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"]; @@ -430,10 +534,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "171rc90vcgjl8p1bdrqa92ymrj8a87qf6w20x05xq29mljcigi6c"; + sha256 = "14xrp8vq6i9zx37vh0yp4h9m0anx9paw200l1r5ad9fmq559346l"; + target = "ruby"; type = "gem"; }; - version = "3.12.0"; + targets = []; + version = "3.13.0"; }; rspec-core = { dependencies = ["rspec-support"]; @@ -441,10 +547,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0l95bnjxdabrn79hwdhn2q1n7mn26pj7y1w5660v5qi81x458nqm"; + sha256 = "001kazj244cb6fbkmh7ap74csbr78717qaskqzqpir1q8xpdmywl"; + target = "ruby"; type = "gem"; }; - version = "3.12.2"; + targets = []; + version = "3.13.2"; }; rspec-expectations = { dependencies = ["diff-lcs" "rspec-support"]; @@ -452,10 +560,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "05j44jfqlv7j2rpxb5vqzf9hfv7w8ba46wwgxwcwd8p0wzi1hg89"; + sha256 = "0n3cyrhsa75x5wwvskrrqk56jbjgdi2q1zx0irllf0chkgsmlsqf"; + target = "ruby"; type = "gem"; }; - version = "3.12.3"; + targets = []; + version = "3.13.3"; }; rspec-mocks = { dependencies = ["diff-lcs" "rspec-support"]; @@ -463,20 +573,24 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1hfm17xakfvwya236graj6c2arr4sb9zasp35q5fykhyz8mhs0w2"; + sha256 = "1vxxkb2sf2b36d8ca2nq84kjf85fz4x7wqcvb8r6a5hfxxfk69r3"; + target = "ruby"; type = "gem"; }; - version = "3.12.5"; + targets = []; + version = "3.13.2"; }; rspec-support = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "12y52zwwb3xr7h91dy9k3ndmyyhr3mjcayk0nnarnrzz8yr48kfx"; + sha256 = "03z7gpqz5xkw9rf53835pa8a9vgj4lic54rnix9vfwmp2m7pv1s8"; + target = "ruby"; type = "gem"; }; - version = "3.12.0"; + targets = []; + version = "3.13.1"; }; sqlite3 = { dependencies = ["mini_portile2"]; @@ -484,30 +598,36 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0h95kr5529qv786mfk8r2jjdsdi6v7v3k3dpz69mrcc9i0vpdd37"; + sha256 = "12li43jlzp2gpb9slrl2vzwnayxngxpyqgaxwaifycir5fq5dkma"; + target = "ruby"; type = "gem"; }; - version = "1.6.3"; + targets = []; + version = "2.0.4"; }; thor = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0k7j2wn14h1pl4smibasw0bp66kg626drxb59z7rzflch99cd4rg"; + sha256 = "1nmymd86a0vb39pzj2cwv57avdrl6pl3lf5bsz58q594kqxjkw7f"; + target = "ruby"; type = "gem"; }; - version = "1.2.2"; + targets = []; + version = "1.3.2"; }; timeout = { groups = ["default" "development"]; platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "1pfddf51n5fnj4f9ggwj3wbf23ynj0nbxlxqpz12y1gvl9g7d6r6"; + sha256 = "06fcniirx82hrljzfn5wb3634n8648v8qgy006jzgclfz5gjvjla"; + target = "ruby"; type = "gem"; }; - version = "0.3.2"; + targets = []; + version = "0.4.2"; }; tzinfo = { dependencies = ["concurrent-ruby"]; @@ -516,8 +636,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "16w2g84dzaf3z13gxyzlzbf748kylk5bdgg3n1ipvkvvqy685bwd"; + target = "ruby"; type = "gem"; }; + targets = []; version = "2.0.6"; }; websocket-driver = { @@ -526,10 +648,12 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0a3bwxd9v3ghrxzjc4vxmf4xa18c6m4xqy5wb0yk5c6b9psc7052"; + sha256 = "1nyh873w4lvahcl8kzbjfca26656d5c6z3md4sbqg5y1gfz0157n"; + target = "ruby"; type = "gem"; }; - version = "0.7.5"; + targets = []; + version = "0.7.6"; }; websocket-extensions = { groups = ["default" "development"]; @@ -537,8 +661,10 @@ source = { remotes = ["https://rubygems.org"]; sha256 = "0hc2g9qps8lmhibl5baa91b4qx8wqw872rgwagml78ydj8qacsqw"; + target = "ruby"; type = "gem"; }; + targets = []; version = "0.1.5"; }; zeitwerk = { @@ -546,9 +672,11 @@ platforms = []; source = { remotes = ["https://rubygems.org"]; - sha256 = "0ck6bj7wa73dkdh13735jl06k6cfny98glxjkas82aivlmyzqqbk"; + sha256 = "10cpfdswql21vildiin0q7drg5zfzf2sahnk9hv3nyzzjqwj2bdx"; + target = "ruby"; type = "gem"; }; - version = "2.6.8"; + targets = []; + version = "2.6.18"; }; -} +} \ No newline at end of file diff --git a/nix/.bundle/config b/nix/.bundle/config deleted file mode 100644 index d28c833..0000000 --- a/nix/.bundle/config +++ /dev/null @@ -1,3 +0,0 @@ ---- -BUNDLE_PATH: "vendor/bundle" -BUNDLE_CACHE_ALL: "true" diff --git a/nix/Gemfile b/nix/Gemfile deleted file mode 100644 index f2a603c..0000000 --- a/nix/Gemfile +++ /dev/null @@ -1,12 +0,0 @@ -# this is a copy of the dependencies listed in the gemspec, -# since bundix doesn't support reading the gemspec itself. -source 'https://rubygems.org' - -gem 'actionpack', '~> 7.0' - -group :development do - gem 'rails', '~> 7.0' - gem 'sqlite3', '~> 1.6.3' - gem 'rake', '~> 13.0' - gem 'rspec', '~> 3.12' -end diff --git a/nix/Gemfile.lock b/nix/Gemfile.lock deleted file mode 100644 index 6e44de5..0000000 --- a/nix/Gemfile.lock +++ /dev/null @@ -1,172 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actioncable (7.0.5) - actionpack (= 7.0.5) - activesupport (= 7.0.5) - nio4r (~> 2.0) - websocket-driver (>= 0.6.1) - actionmailbox (7.0.5) - actionpack (= 7.0.5) - activejob (= 7.0.5) - activerecord (= 7.0.5) - activestorage (= 7.0.5) - activesupport (= 7.0.5) - mail (>= 2.7.1) - net-imap - net-pop - net-smtp - actionmailer (7.0.5) - actionpack (= 7.0.5) - actionview (= 7.0.5) - activejob (= 7.0.5) - activesupport (= 7.0.5) - mail (~> 2.5, >= 2.5.4) - net-imap - net-pop - net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.5) - actionview (= 7.0.5) - activesupport (= 7.0.5) - rack (~> 2.0, >= 2.2.4) - rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.5) - actionpack (= 7.0.5) - activerecord (= 7.0.5) - activestorage (= 7.0.5) - activesupport (= 7.0.5) - globalid (>= 0.6.0) - nokogiri (>= 1.8.5) - actionview (7.0.5) - activesupport (= 7.0.5) - builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.5) - activesupport (= 7.0.5) - globalid (>= 0.3.6) - activemodel (7.0.5) - activesupport (= 7.0.5) - activerecord (7.0.5) - activemodel (= 7.0.5) - activesupport (= 7.0.5) - activestorage (7.0.5) - actionpack (= 7.0.5) - activejob (= 7.0.5) - activerecord (= 7.0.5) - activesupport (= 7.0.5) - marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.5) - concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 1.6, < 2) - minitest (>= 5.1) - tzinfo (~> 2.0) - builder (3.2.4) - concurrent-ruby (1.2.2) - crass (1.0.6) - date (3.3.3) - diff-lcs (1.5.0) - erubi (1.12.0) - globalid (1.1.0) - activesupport (>= 5.0) - i18n (1.13.0) - concurrent-ruby (~> 1.0) - loofah (2.21.3) - crass (~> 1.0.2) - nokogiri (>= 1.12.0) - mail (2.8.1) - mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.2) - minitest (5.18.0) - net-imap (0.3.4) - date - net-protocol - net-pop (0.1.2) - net-protocol - net-protocol (0.2.1) - timeout - net-smtp (0.3.3) - net-protocol - nio4r (2.5.9) - nokogiri (1.15.2) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - racc (1.6.2) - rack (2.2.7) - rack-test (2.1.0) - rack (>= 1.3) - rails (7.0.5) - actioncable (= 7.0.5) - actionmailbox (= 7.0.5) - actionmailer (= 7.0.5) - actionpack (= 7.0.5) - actiontext (= 7.0.5) - actionview (= 7.0.5) - activejob (= 7.0.5) - activemodel (= 7.0.5) - activerecord (= 7.0.5) - activestorage (= 7.0.5) - activesupport (= 7.0.5) - bundler (>= 1.15.0) - railties (= 7.0.5) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) - nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) - loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.0.5) - actionpack (= 7.0.5) - activesupport (= 7.0.5) - method_source - rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) - rake (13.0.6) - rspec (3.12.0) - rspec-core (~> 3.12.0) - rspec-expectations (~> 3.12.0) - rspec-mocks (~> 3.12.0) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.5) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-support (3.12.0) - sqlite3 (1.6.3) - mini_portile2 (~> 2.8.0) - thor (1.2.2) - timeout (0.3.2) - tzinfo (2.0.6) - concurrent-ruby (~> 1.0) - websocket-driver (0.7.5) - websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.5) - zeitwerk (2.6.8) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 7.0) - rails (~> 7.0) - rake (~> 13.0) - rspec (~> 3.12) - sqlite3 (~> 1.6.3) - -BUNDLED WITH - 2.3.7 diff --git a/nix/sources.json b/nix/sources.json deleted file mode 100644 index aa2a6f9..0000000 --- a/nix/sources.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "nixpkgs": { - "branch": "release-22.11", - "description": "A read-only mirror of NixOS/nixpkgs tracking the released channels. Send issues and PRs to", - "homepage": "https://github.com/NixOS/nixpkgs", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "bf27e9a40d779f034e340a6758fec1a841e23acd", - "sha256": "1n5g7yyrj7kz570vyhd0lcvpzljqw65d9r12hjdr69ydj7r699d8", - "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/bf27e9a40d779f034e340a6758fec1a841e23acd.tar.gz", - "url_template": "https://github.com///archive/.tar.gz" - } -} diff --git a/nix/sources.nix b/nix/sources.nix deleted file mode 100644 index 9a01c8a..0000000 --- a/nix/sources.nix +++ /dev/null @@ -1,194 +0,0 @@ -# This file has been generated by Niv. - -let - - # - # The fetchers. fetch_ fetches specs of type . - # - - fetch_file = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchurl { inherit (spec) url sha256; name = name'; } - else - pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; - - fetch_tarball = pkgs: name: spec: - let - name' = sanitizeName name + "-src"; - in - if spec.builtin or true then - builtins_fetchTarball { name = name'; inherit (spec) url sha256; } - else - pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; - - fetch_git = name: spec: - let - ref = - if spec ? ref then spec.ref else - if spec ? branch then "refs/heads/${spec.branch}" else - if spec ? tag then "refs/tags/${spec.tag}" else - abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; - submodules = if spec ? submodules then spec.submodules else false; - submoduleArg = - let - nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0; - emptyArgWithWarning = - if submodules == true - then - builtins.trace - ( - "The niv input \"${name}\" uses submodules " - + "but your nix's (${builtins.nixVersion}) builtins.fetchGit " - + "does not support them" - ) - {} - else {}; - in - if nixSupportsSubmodules - then { inherit submodules; } - else emptyArgWithWarning; - in - builtins.fetchGit - ({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg); - - fetch_local = spec: spec.path; - - fetch_builtin-tarball = name: throw - ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=tarball -a builtin=true''; - - fetch_builtin-url = name: throw - ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. - $ niv modify ${name} -a type=file -a builtin=true''; - - # - # Various helpers - # - - # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 - sanitizeName = name: - ( - concatMapStrings (s: if builtins.isList s then "-" else s) - ( - builtins.split "[^[:alnum:]+._?=-]+" - ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) - ) - ); - - # The set of packages used when specs are fetched using non-builtins. - mkPkgs = sources: system: - let - sourcesNixpkgs = - import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; - hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; - hasThisAsNixpkgsPath = == ./.; - in - if builtins.hasAttr "nixpkgs" sources - then sourcesNixpkgs - else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then - import {} - else - abort - '' - Please specify either (through -I or NIX_PATH=nixpkgs=...) or - add a package called "nixpkgs" to your sources.json. - ''; - - # The actual fetching function. - fetch = pkgs: name: spec: - - if ! builtins.hasAttr "type" spec then - abort "ERROR: niv spec ${name} does not have a 'type' attribute" - else if spec.type == "file" then fetch_file pkgs name spec - else if spec.type == "tarball" then fetch_tarball pkgs name spec - else if spec.type == "git" then fetch_git name spec - else if spec.type == "local" then fetch_local spec - else if spec.type == "builtin-tarball" then fetch_builtin-tarball name - else if spec.type == "builtin-url" then fetch_builtin-url name - else - abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; - - # If the environment variable NIV_OVERRIDE_${name} is set, then use - # the path directly as opposed to the fetched source. - replace = name: drv: - let - saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; - ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; - in - if ersatz == "" then drv else - # this turns the string into an actual Nix path (for both absolute and - # relative paths) - if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; - - # Ports of functions for older nix versions - - # a Nix version of mapAttrs if the built-in doesn't exist - mapAttrs = builtins.mapAttrs or ( - f: set: with builtins; - listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) - ); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 - range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 - stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); - - # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 - stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); - concatMapStrings = f: list: concatStrings (map f list); - concatStrings = builtins.concatStringsSep ""; - - # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 - optionalAttrs = cond: as: if cond then as else {}; - - # fetchTarball version that is compatible between all the versions of Nix - builtins_fetchTarball = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchTarball; - in - if lessThan nixVersion "1.12" then - fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchTarball attrs; - - # fetchurl version that is compatible between all the versions of Nix - builtins_fetchurl = { url, name ? null, sha256 }@attrs: - let - inherit (builtins) lessThan nixVersion fetchurl; - in - if lessThan nixVersion "1.12" then - fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) - else - fetchurl attrs; - - # Create the final "sources" from the config - mkSources = config: - mapAttrs ( - name: spec: - if builtins.hasAttr "outPath" spec - then abort - "The values in sources.json should not have an 'outPath' attribute" - else - spec // { outPath = replace name (fetch config.pkgs name spec); } - ) config.sources; - - # The "config" used by the fetchers - mkConfig = - { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null - , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) - , system ? builtins.currentSystem - , pkgs ? mkPkgs sources system - }: rec { - # The sources, i.e. the attribute set of spec name to spec - inherit sources; - - # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers - inherit pkgs; - }; - -in -mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } diff --git a/nix/update-gemset.sh b/nix/update-gemset.sh deleted file mode 100755 index ce1da87..0000000 --- a/nix/update-gemset.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p zlib sqlite libiconv bundix - -SCRIPT=`realpath $0` -CWD=`dirname $SCRIPT` - -cd $CWD && bundix -m --ruby=ruby_3_1 diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index e6bba9e..07e8e21 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -24,7 +24,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "actionpack", ">= 5.2.0", "< 7.1.0" spec.add_development_dependency "rails", ">= 5.2", "< 7.1.0" - spec.add_development_dependency "sqlite3", "~> 1.4.0" + spec.add_development_dependency "sqlite3", "~> 2.0.4" spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.9" spec.add_development_dependency "appraisal", "~> 2.3" diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 7db945d..0000000 --- a/shell.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ ... }: -let - sources = import ./nix/sources.nix { }; - nixpkgs = import sources.nixpkgs { }; - gems = nixpkgs.bundlerEnv { - name = "rails_edge_test"; - gemfile = nix/Gemfile; - lockfile = nix/Gemfile.lock; - ruby = nixpkgs.ruby_3_1; - gemdir = ./nix; - }; -in -with nixpkgs; -stdenv.mkDerivation { - FREEDESKTOP_MIME_TYPES_PATH = "${pkgs.shared-mime-info}/share/mime/packages/freedesktop.org.xml"; - name = "rails_edge_test"; - buildInputs = [ - gems - gems.wrappedRuby - # nixpkgs.ruby_3_1 - nixpkgs.sqlite - ]; -} From 0687710730ebce3dae9d84327362ac9e866d5f5b Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:06:34 +0100 Subject: [PATCH 02/12] add required ruby version --- rails_edge_test.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index 07e8e21..73b52b3 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -22,6 +22,7 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_runtime_dependency "actionpack", ">= 5.2.0", "< 7.1.0" + spec.required_ruby_version = '>= 3.0.0' spec.add_development_dependency "rails", ">= 5.2", "< 7.1.0" spec.add_development_dependency "sqlite3", "~> 2.0.4" From 793219ba3cb5c16ae2e0e17c5ad616343f80e886 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:06:55 +0100 Subject: [PATCH 03/12] add rubocop --- .github/workflows/ci.yml | 3 + .rubocop.yml | 43 ++++ .rubocop_todo.yml | 525 +++++++++++++++++++++++++++++++++++++++ Gemfile | 4 + Gemfile.lock | 30 +++ gemset.nix | 161 ++++++++++++ 6 files changed, 766 insertions(+) create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 127bb01..4ad6766 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,3 +26,6 @@ jobs: - name: Run tests run: nix develop --command rspec + + - name: Run rubocop + run: nix develop --command rubocop diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..abfc48c --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,43 @@ +inherit_from: .rubocop_todo.yml +AllCops: + NewCops: enable + SuggestExtensions: + rubocop-rails: false + TargetRubyVersion: 3.0 + +require: + - rubocop-rspec + - rubocop-rake + +# This prevents us from inlining code, which we think +# is often better then having lots if out-of-order method calls +Metrics/AbcSize: + Enabled: false + +# This prevents us from co-locating functional code, which we think +# is often better then having lots of stateless files. +Metrics/ClassLength: + Enabled: false + +# This prevents us from inlining code, which we think +# is often better then having lots if out-of-order method calls +Metrics/MethodLength: + Enabled: false + +# This prevents us from inlining code, which we think +# is often better then having lots if out-of-order method calls +Metrics/ModuleLength: + Enabled: false + +# This prevents us from inlining which we like. We like inlining! +RSpec/ExampleLength: + Enabled: False + +# We believe that inlining is valuable and expecting one expectation +# forces us to avoid inlining. +RSpec/MultipleExpectations: + Enabled: False + +# explicit makes specs easier to read +RSpec/DescribedClass: + EnforcedStyle: explicit diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..4d3187f --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,525 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1000 --no-auto-gen-timestamp` +# using RuboCop version 1.68.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Include. +# Include: **/*.gemspec +Gemspec/AddRuntimeDependency: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 5 +# Configuration parameters: EnforcedStyle, AllowedGems, Include. +# SupportedStyles: Gemfile, gems.rb, gemspec +# Include: **/*.gemspec, **/Gemfile, **/gems.rb +Gemspec/DevelopmentDependencies: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Severity, Include. +# Include: **/*.gemspec +Gemspec/RequireMFA: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterMagicComment: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLines: + Exclude: + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + - 'spec/support/test_app/Gemfile' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: around, only_before +Layout/EmptyLinesAroundAccessModifier: + Exclude: + - 'lib/rails_edge_test.rb' + - 'lib/rails_edge_test/runner.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'lib/rails_edge_test/dsl.rb' + - 'lib/rails_edge_test/dsl/edge.rb' + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLinesAroundMethodBody: + Exclude: + - 'lib/rails_edge_test/printers/boring.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/support/test_app/bin/setup' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# URISchemes: http, https +Layout/LineLength: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/SpaceAfterComma: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceAroundEqualsInParameterDefault: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. +# SupportedStylesForExponentOperator: space, no_space +# SupportedStylesForRationalLiterals: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/runner.rb' + - 'rails_edge_test.gemspec' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + +# Offense count: 40 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + - 'spec/support/test_app/app/controllers/application_controller.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +Lint/DeprecatedClassMethods: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/RedundantDirGlobSort: + Exclude: + - 'lib/rails_edge_test/runner.rb' + +# Offense count: 2 +# Configuration parameters: AllowComments, AllowNil. +Lint/SuppressedException: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + +# Offense count: 1 +RSpec/AnyInstance: + Exclude: + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: be, be_nil +RSpec/BeNil: + Exclude: + - 'spec/rails_edge_test_spec.rb' + +# Offense count: 8 +RSpec/BeforeAfterAll: + Exclude: + - '**/spec/spec_helper.rb' + - '**/spec/rails_helper.rb' + - '**/spec/support/**/*.rb' + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 1 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterHook: + Exclude: + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. +# DisallowedExamples: works +RSpec/ExampleWording: + Exclude: + - 'spec/rails_edge_test/dsl_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ExcessiveDocstringSpacing: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + +# Offense count: 2 +RSpec/RepeatedExample: + Exclude: + - 'spec/rails_edge_test/runner_spec.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. +# RedundantRestArgumentNames: args, arguments +# RedundantKeywordRestArgumentNames: kwargs, options, opts +# RedundantBlockArgumentNames: blk, block, proc +Style/ArgumentsForwarding: + Exclude: + - 'lib/rails_edge_test/dsl/action.rb' + - 'lib/rails_edge_test/dsl/edge.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# AllowedMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + +# Offense count: 7 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'lib/rails_edge_test/dsl/action.rb' + - 'lib/rails_edge_test/dsl/controller.rb' + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/dsl/let_handler.rb' + - 'lib/rails_edge_test/printers/boring.rb' + - 'lib/rails_edge_test/printers/silent.rb' + - 'lib/rails_edge_test/printers/tree.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: Keywords, RequireColon. +# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE +Style/CommentAnnotation: + Exclude: + - 'lib/rails_edge_test.rb' + +# Offense count: 8 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Exclude: + - 'spec/**/*' + - 'test/**/*' + - 'lib/rails_edge_test.rb' + - 'lib/rails_edge_test/configuration.rb' + - 'lib/rails_edge_test/dsl.rb' + - 'lib/rails_edge_test/dsl/let_handler.rb' + - 'lib/rails_edge_test/printers/boring.rb' + - 'lib/rails_edge_test/printers/silent.rb' + - 'lib/rails_edge_test/printers/tree.rb' + - 'lib/rails_edge_test/runner.rb' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'lib/rails_edge_test/printers/boring.rb' + - 'lib/rails_edge_test/printers/silent.rb' + - 'lib/rails_edge_test/printers/tree.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/Encoding: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 11 +# This cop supports safe autocorrection (--autocorrect). +Style/ExpandPathArguments: + Exclude: + - 'rails_edge_test.gemspec' + - 'spec/support/test_app/Rakefile' + - 'spec/support/test_app/bin/bundle' + - 'spec/support/test_app/bin/rails' + - 'spec/support/test_app/bin/rake' + - 'spec/support/test_app/bin/setup' + - 'spec/support/test_app/config.ru' + - 'spec/support/test_app/config/application.rb' + - 'spec/support/test_app/config/boot.rb' + - 'spec/support/test_app/config/environment.rb' + +# Offense count: 53 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'Appraisals' + - 'Gemfile' + - 'Rakefile' + - 'bin/console' + - 'exe/generate_edges' + - 'lib/rails_edge_test.rb' + - 'lib/rails_edge_test/configuration.rb' + - 'lib/rails_edge_test/dsl.rb' + - 'lib/rails_edge_test/dsl/action.rb' + - 'lib/rails_edge_test/dsl/controller.rb' + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/dsl/let_handler.rb' + - 'lib/rails_edge_test/printers/boring.rb' + - 'lib/rails_edge_test/printers/silent.rb' + - 'lib/rails_edge_test/printers/tree.rb' + - 'lib/rails_edge_test/runner.rb' + - 'lib/rails_edge_test/version.rb' + - 'rails_edge_test.gemspec' + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + - 'spec/rails_edge_test_spec.rb' + - 'spec/rails_helper.rb' + - 'spec/spec_helper.rb' + - 'spec/support/test_app/Gemfile' + - 'spec/support/test_app/Rakefile' + - 'spec/support/test_app/app/controllers/application_controller.rb' + - 'spec/support/test_app/bin/bundle' + - 'spec/support/test_app/bin/rails' + - 'spec/support/test_app/bin/rake' + - 'spec/support/test_app/bin/setup' + - 'spec/support/test_app/bin/spring' + - 'spec/support/test_app/config.ru' + - 'spec/support/test_app/config/application.rb' + - 'spec/support/test_app/config/boot.rb' + - 'spec/support/test_app/config/environment.rb' + - 'spec/support/test_app/config/environments/development.rb' + - 'spec/support/test_app/config/environments/production.rb' + - 'spec/support/test_app/config/environments/test.rb' + - 'spec/support/test_app/config/initializers/backtrace_silencers.rb' + - 'spec/support/test_app/config/initializers/cookies_serializer.rb' + - 'spec/support/test_app/config/initializers/filter_parameter_logging.rb' + - 'spec/support/test_app/config/initializers/inflections.rb' + - 'spec/support/test_app/config/initializers/mime_types.rb' + - 'spec/support/test_app/config/initializers/session_store.rb' + - 'spec/support/test_app/config/initializers/to_time_preserves_timezone.rb' + - 'spec/support/test_app/config/initializers/wrap_parameters.rb' + - 'spec/support/test_app/config/routes.rb' + - 'spec/support/test_app/db/seeds.rb' + - 'spec/support/test_app/edge/another_edge.rb' + - 'spec/support/test_app/edge/example_edge.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. +Style/GuardClause: + Exclude: + - 'exe/generate_edges' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +# SupportedShorthandSyntax: always, never, either, consistent, either_consistent +Style/HashSyntax: + Exclude: + - 'Rakefile' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/dsl/let_handler.rb' + +# Offense count: 2 +Style/MixinUsage: + Exclude: + - 'spec/support/test_app/edge/another_edge.rb' + - 'spec/support/test_app/edge/example_edge.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'lib/rails_edge_test/version.rb' + +# Offense count: 14 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowedMethods. +# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with +Style/NestedParenthesizedCalls: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantConstantBase: + Exclude: + - 'spec/support/test_app/config.ru' + - 'spec/support/test_app/config/environments/production.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantPercentQ: + Exclude: + - 'rails_edge_test.gemspec' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'spec/rails_edge_test/dsl/edge_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/SelfAssignment: + Exclude: + - 'spec/rails_edge_test/configuration_spec.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: only_raise, only_fail, semantic +Style/SignalException: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/dsl/let_handler.rb' + +# Offense count: 4 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + +# Offense count: 188 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'Rakefile' + - 'bin/console' + - 'lib/rails_edge_test.rb' + - 'lib/rails_edge_test/dsl/edge.rb' + - 'lib/rails_edge_test/printers/boring.rb' + - 'lib/rails_edge_test/printers/tree.rb' + - 'lib/rails_edge_test/runner.rb' + - 'lib/rails_edge_test/version.rb' + - 'rails_edge_test.gemspec' + - 'spec/rails_edge_test/configuration_spec.rb' + - 'spec/rails_edge_test/dsl/edge_spec.rb' + - 'spec/rails_edge_test/dsl/let_handler_spec.rb' + - 'spec/rails_edge_test/dsl_spec.rb' + - 'spec/rails_edge_test/runner_spec.rb' + - 'spec/rails_edge_test_spec.rb' + - 'spec/rails_helper.rb' + - 'spec/spec_helper.rb' + - 'spec/support/test_app/bin/setup' + - 'spec/support/test_app/bin/spring' + - 'spec/support/test_app/edge/another_edge.rb' + - 'spec/support/test_app/edge/example_edge.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. +# AllowedMethods: define_method +Style/SymbolProc: + Exclude: + - 'lib/rails_edge_test/configuration.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'spec/rails_edge_test/configuration_spec.rb' diff --git a/Gemfile b/Gemfile index 3869cbe..142be2e 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,7 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rails_edge_test.gemspec gemspec + +gem 'rubocop' +gem 'rubocop-rake' +gem 'rubocop-rspec' diff --git a/Gemfile.lock b/Gemfile.lock index 26d97cd..58c831c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -76,6 +76,7 @@ GEM bundler rake thor (>= 0.14.0) + ast (2.4.2) builder (3.3.0) concurrent-ruby (1.3.4) crass (1.0.6) @@ -86,6 +87,8 @@ GEM activesupport (>= 6.1) i18n (1.14.6) concurrent-ruby (~> 1.0) + json (2.8.1) + language_server-protocol (3.17.0.3) loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -112,6 +115,10 @@ GEM nokogiri (1.16.7) mini_portile2 (~> 2.8.2) racc (~> 1.4) + parallel (1.26.3) + parser (3.3.6.0) + ast (~> 2.4.1) + racc racc (1.8.1) rack (2.2.10) rack-test (2.1.0) @@ -144,7 +151,9 @@ GEM rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) + rainbow (3.1.1) rake (13.2.1) + regexp_parser (2.9.2) rspec (3.13.0) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -158,12 +167,30 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.1) + rubocop (1.68.0) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.4, < 3.0) + rubocop-ast (>= 1.32.2, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.35.0) + parser (>= 3.3.1.0) + rubocop-rake (0.6.0) + rubocop (~> 1.0) + rubocop-rspec (3.2.0) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) sqlite3 (2.0.4) mini_portile2 (~> 2.8.0) thor (1.3.2) timeout (0.4.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) + unicode-display_width (2.6.0) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -178,6 +205,9 @@ DEPENDENCIES rails_edge_test! rake (~> 13.0) rspec (~> 3.9) + rubocop + rubocop-rake + rubocop-rspec sqlite3 (~> 2.0.4) BUNDLED WITH diff --git a/gemset.nix b/gemset.nix index ad8a268..7ef2faf 100644 --- a/gemset.nix +++ b/gemset.nix @@ -155,6 +155,18 @@ targets = []; version = "2.5.0"; }; + ast = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "2.4.2"; + }; builder = { groups = ["default" "development"]; platforms = []; @@ -253,6 +265,30 @@ targets = []; version = "1.14.6"; }; + json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ap2ks9yfzr9d0ig50wanws36lpkh3if5favl5pplv7gqaj8qkj0"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "2.8.1"; + }; + language_server-protocol = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "3.17.0.3"; + }; loofah = { dependencies = ["crass" "nokogiri"]; groups = ["default" "development"]; @@ -416,6 +452,31 @@ targets = []; version = "1.16.7"; }; + parallel = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1vy7sjs2pgz4i96v5yk9b7aafbffnvq7nn419fgvw55qlavsnsyq"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "1.26.3"; + }; + parser = { + dependencies = ["ast" "racc"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0fxw738al3qxa4s4ghqkxb908sav03i3h7xflawwmxzhqiyfdm15"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "3.3.6.0"; + }; racc = { groups = ["default" "development"]; platforms = []; @@ -516,6 +577,18 @@ targets = []; version = "7.0.8.6"; }; + rainbow = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "3.1.1"; + }; rake = { groups = ["development"]; platforms = []; @@ -528,6 +601,18 @@ targets = []; version = "13.2.1"; }; + regexp_parser = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ik40vcv7mqigsfpqpca36hpmnx0536xa825ai5qlkv3mmkyf9ss"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "2.9.2"; + }; rspec = { dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"]; groups = ["development"]; @@ -592,6 +677,70 @@ targets = []; version = "3.13.1"; }; + rubocop = { + dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rubocop-ast" "ruby-progressbar" "unicode-display_width"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ay1lrz3ffrznjfr65c6xvkinb6m4l7h68cd9qbrf7nq0j2m1pq7"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "1.68.0"; + }; + rubocop-ast = { + dependencies = ["parser"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0czjszwmb1m7f88bhr7ji437rdy3whcn37p7mhb38yyf8xxnfjhf"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "1.35.0"; + }; + rubocop-rake = { + dependencies = [ "rubocop" ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; + sha256 = "1nyq07sfb3vf3ykc6j2d5yq824lzq1asb474yka36jxgi4hz5djn"; + target = "ruby"; + type = "gem"; + }; + targets = [ ]; + version = "0.6.0"; + }; + rubocop-rspec = { + dependencies = [ "rubocop" ]; + groups = [ "default" ]; + platforms = [ ]; + source = { + remotes = [ "https://rubygems.org" ]; + sha256 = "1pj3n8pdws62f26pv32xna7j92p7cwq3nw0c73fn5awhfy65dj6j"; + target = "ruby"; + type = "gem"; + }; + targets = [ ]; + version = "3.2.0"; + }; + ruby-progressbar = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "1.13.0"; + }; sqlite3 = { dependencies = ["mini_portile2"]; groups = ["development"]; @@ -642,6 +791,18 @@ targets = []; version = "2.0.6"; }; + unicode-display_width = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0nkz7fadlrdbkf37m0x7sw8bnz8r355q3vwcfb9f9md6pds9h9qj"; + target = "ruby"; + type = "gem"; + }; + targets = []; + version = "2.6.0"; + }; websocket-driver = { dependencies = ["websocket-extensions"]; groups = ["default" "development"]; From fbe747878e848052c06e3f54a297144a7cc9ad4e Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:42:48 +0100 Subject: [PATCH 04/12] add formatter and run nix fmt --- .github/workflows/ci.yml | 3 + flake.nix | 5 +- gemset.nix | 868 +++++++++++++++++++++++++-------------- 3 files changed, 576 insertions(+), 300 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ad6766..b335e79 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,3 +29,6 @@ jobs: - name: Run rubocop run: nix develop --command rubocop + + - name: Run nix formatter + run: nix fmt -- --check . diff --git a/flake.nix b/flake.nix index a1f1e18..7d412de 100644 --- a/flake.nix +++ b/flake.nix @@ -63,13 +63,12 @@ env ; + formatter = pkgs.nixfmt-rfc-style; devShells = rec { default = dev; dev = pkgs.mkShell { buildInputs = ( - (with pkgs; [ - sqlite - ]) + (with pkgs; [ sqlite ]) ++ [ env bundixcli diff --git a/gemset.nix b/gemset.nix index 7ef2faf..aaead37 100644 --- a/gemset.nix +++ b/gemset.nix @@ -1,706 +1,962 @@ { actioncable = { - dependencies = ["actionpack" "activesupport" "nio4r" "websocket-driver"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "activesupport" + "nio4r" + "websocket-driver" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ms0196bp8gzlghfj32q2qdzszb7hsgg96v3isrv5ysd87w0z2zl"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; actionmailbox = { - dependencies = ["actionpack" "activejob" "activerecord" "activestorage" "activesupport" "mail" "net-imap" "net-pop" "net-smtp"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "activejob" + "activerecord" + "activestorage" + "activesupport" + "mail" + "net-imap" + "net-pop" + "net-smtp" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0mw8casnlqgj3vwqv7qk3d4q3bjszlpmbs9ldpc9gz1qdvafx7cg"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; actionmailer = { - dependencies = ["actionpack" "actionview" "activejob" "activesupport" "mail" "net-imap" "net-pop" "net-smtp" "rails-dom-testing"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "actionview" + "activejob" + "activesupport" + "mail" + "net-imap" + "net-pop" + "net-smtp" + "rails-dom-testing" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "07gpm15k5c0y84q99zipnhcdgq93bwralyjpj252prvqwfjmiw73"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; actionpack = { - dependencies = ["actionview" "activesupport" "rack" "rack-test" "rails-dom-testing" "rails-html-sanitizer"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionview" + "activesupport" + "rack" + "rack-test" + "rails-dom-testing" + "rails-html-sanitizer" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "19ywl4jp77b51c01hsyzwia093fnj73pw1ipgyj4pk3h2b9faj5n"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; actiontext = { - dependencies = ["actionpack" "activerecord" "activestorage" "activesupport" "globalid" "nokogiri"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "activerecord" + "activestorage" + "activesupport" + "globalid" + "nokogiri" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1j8b29764nbiqz6d7ra42j2i6wf070lbms1fhpq3cl9azbgijb16"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; actionview = { - dependencies = ["activesupport" "builder" "erubi" "rails-dom-testing" "rails-html-sanitizer"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "activesupport" + "builder" + "erubi" + "rails-dom-testing" + "rails-html-sanitizer" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0girx71db1aq5b70ln3qq03z9d7xjdyp297v1a8rdal7k89y859c"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; activejob = { - dependencies = ["activesupport" "globalid"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "activesupport" + "globalid" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0gbc0wx9xal5bj0pbz8ygkr75wj4cm5i69hpwknf023psgixaybw"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; activemodel = { - dependencies = ["activesupport"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "activesupport" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1f6szahjsb4pr2xvlvk4kghk9291xh9c14s8cqwy6wwpm1vcglim"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; activerecord = { - dependencies = ["activemodel" "activesupport"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "activemodel" + "activesupport" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "14qs1jc9hwnsm4dzvnai8b36bcq1d7rcqgjxy0dc6wza670lqapf"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; activestorage = { - dependencies = ["actionpack" "activejob" "activerecord" "activesupport" "marcel" "mini_mime"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "activejob" + "activerecord" + "activesupport" + "marcel" + "mini_mime" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1nnvqnmc7mdhw2w55j4vnx4zmmdmmwmaf6ax2mbj9j5a48fw19vf"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; activesupport = { - dependencies = ["concurrent-ruby" "i18n" "minitest" "tzinfo"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "concurrent-ruby" + "i18n" + "minitest" + "tzinfo" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0gj20cysajda05z3r7pl1g9y84nzsqak5dvk9nrz13jpy6297dj1"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; appraisal = { - dependencies = ["rake" "thor"]; - groups = ["development"]; - platforms = []; + dependencies = [ + "rake" + "thor" + ]; + groups = [ "development" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1knkxrjagaqf418lkgd7xvfb5rh143d19ld8vfq16y8jpqhr561n"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.5.0"; }; ast = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.4.2"; }; builder = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0pw3r2lyagsxkm71bf44v5b74f7l9r7di22brbyji9fwz791hya9"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.3.0"; }; concurrent-ruby = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0chwfdq2a6kbj6xz9l6zrdfnyghnh32si82la1dnpa5h75ir5anl"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.3.4"; }; crass = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0pfl5c0pyqaparxaqxi6s4gfl21bdldwiawrc0aknyvflli60lfw"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.0.6"; }; date = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "04d7l3xdmkybrd20gayf8s38pgfld0hf8m726lz9np32xnnsszrf"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.4.0"; }; diff-lcs = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1znxccz83m4xgpd239nyqxlifdb7m8rlfayk6s259186nkgj6ci7"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.5.1"; }; erubi = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0qnd6ff4az22ysnmni3730c41b979xinilahzg86bn7gv93ip9pw"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.13.0"; }; globalid = { - dependencies = ["activesupport"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "activesupport" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1sbw6b66r7cwdx3jhs46s4lr991969hvigkjpbdl7y3i31qpdgvh"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.2.1"; }; i18n = { - dependencies = ["concurrent-ruby"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "concurrent-ruby" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0k31wcgnvcvd14snz0pfqj976zv6drfsnq6x8acz10fiyms9l8nw"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.14.6"; }; json = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ap2ks9yfzr9d0ig50wanws36lpkh3if5favl5pplv7gqaj8qkj0"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.8.1"; }; language_server-protocol = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.17.0.3"; }; loofah = { - dependencies = ["crass" "nokogiri"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "crass" + "nokogiri" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ppp2cgli5avzk0z3dwnah6y65ymyr793yja28p2fs9vrci7986h"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.23.1"; }; mail = { - dependencies = ["mini_mime" "net-imap" "net-pop" "net-smtp"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "mini_mime" + "net-imap" + "net-pop" + "net-smtp" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1bf9pysw1jfgynv692hhaycfxa8ckay1gjw5hz3madrbrynryfzc"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.8.1"; }; marcel = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "190n2mk8m1l708kr88fh6mip9sdsh339d2s6sgrik3sbnvz4jmhd"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.0.4"; }; method_source = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1igmc3sq9ay90f8xjvfnswd1dybj1s3fi0dwd53inwsvqk4h24qq"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.1.0"; }; mini_mime = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1vycif7pjzkr29mfk4dlqv3disc5dn0va04lkwajlpr1wkibg0c6"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.1.5"; }; mini_portile2 = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1q1f2sdw3y3y9mnym9dhjgsjr72sq975cfg5c4yx7gwv8nmzbvhk"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.8.7"; }; minitest = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1n1akmc6bibkbxkzm1p1wmfb4n9vv397knkgz0ffykb3h1d7kdix"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "5.25.1"; }; net-imap = { - dependencies = ["date" "net-protocol"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "date" + "net-protocol" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1mrqr1xknw4z1nzjvdaff1gd504fkwaqdb6ibqfhixsrhifvikn0"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.5.1"; }; net-pop = { - dependencies = ["net-protocol"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "net-protocol" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1wyz41jd4zpjn0v1xsf9j778qx1vfrl24yc20cpmph8k42c4x2w4"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.1.2"; }; net-protocol = { - dependencies = ["timeout"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "timeout" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1a32l4x73hz200cm587bc29q8q9az278syw3x6fkc9d1lv5y0wxa"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.2.2"; }; net-smtp = { - dependencies = ["net-protocol"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "net-protocol" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0amlhz8fhnjfmsiqcjajip57ici2xhw089x7zqyhpk51drg43h2z"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.5.0"; }; nio4r = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1a9www524fl1ykspznz54i0phfqya4x45hqaz67in9dvw1lfwpfr"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.7.4"; }; nokogiri = { - dependencies = ["mini_portile2" "racc"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "mini_portile2" + "racc" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "15gysw8rassqgdq3kwgl4mhqmrgh7nk2qvrcqp4ijyqazgywn6gq"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.16.7"; }; parallel = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1vy7sjs2pgz4i96v5yk9b7aafbffnvq7nn419fgvw55qlavsnsyq"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.26.3"; }; parser = { - dependencies = ["ast" "racc"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "ast" + "racc" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0fxw738al3qxa4s4ghqkxb908sav03i3h7xflawwmxzhqiyfdm15"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.3.6.0"; }; racc = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0byn0c9nkahsl93y9ln5bysq4j31q8xkf2ws42swighxd4lnjzsa"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.8.1"; }; rack = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ax778fsfvlhj7c11n0d1wdcb8bxvkb190a9lha5d91biwzyx9g4"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.2.10"; }; rack-test = { - dependencies = ["rack"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "rack" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1ysx29gk9k14a14zsp5a8czys140wacvp91fja8xcja0j1hzqq8c"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.1.0"; }; rails = { - dependencies = ["actioncable" "actionmailbox" "actionmailer" "actionpack" "actiontext" "actionview" "activejob" "activemodel" "activerecord" "activestorage" "activesupport" "railties"]; - groups = ["development"]; - platforms = []; + dependencies = [ + "actioncable" + "actionmailbox" + "actionmailer" + "actionpack" + "actiontext" + "actionview" + "activejob" + "activemodel" + "activerecord" + "activestorage" + "activesupport" + "railties" + ]; + groups = [ "development" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1s42lyl19h74xlqkb6ffl67h688q0slp1lhnd05g09a46z7wapri"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; rails-dom-testing = { - dependencies = ["activesupport" "minitest" "nokogiri"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "activesupport" + "minitest" + "nokogiri" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0fx9dx1ag0s1lr6lfr34lbx5i1bvn3bhyf3w3mx6h7yz90p725g5"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.2.0"; }; rails-html-sanitizer = { - dependencies = ["loofah" "nokogiri"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "loofah" + "nokogiri" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1pm4z853nyz1bhhqr7fzl44alnx4bjachcr6rh6qjj375sfz3sc6"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.6.0"; }; rails_edge_test = { - dependencies = ["actionpack"]; - groups = ["default"]; - platforms = []; + dependencies = [ "actionpack" ]; + groups = [ "default" ]; + platforms = [ ]; source = { path = "."; type = "path"; }; - targets = []; + targets = [ ]; version = "2.1.0"; }; railties = { - dependencies = ["actionpack" "activesupport" "method_source" "rake" "thor" "zeitwerk"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "actionpack" + "activesupport" + "method_source" + "rake" + "thor" + "zeitwerk" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1fcn0ix814074gqicc0k1178f7ahmysiv3pfq8g00phdwj0p3w0g"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "7.0.8.6"; }; rainbow = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.1.1"; }; rake = { - groups = ["development"]; - platforms = []; + groups = [ "development" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "13.2.1"; }; regexp_parser = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ik40vcv7mqigsfpqpca36hpmnx0536xa825ai5qlkv3mmkyf9ss"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.9.2"; }; rspec = { - dependencies = ["rspec-core" "rspec-expectations" "rspec-mocks"]; - groups = ["development"]; - platforms = []; + dependencies = [ + "rspec-core" + "rspec-expectations" + "rspec-mocks" + ]; + groups = [ "development" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "14xrp8vq6i9zx37vh0yp4h9m0anx9paw200l1r5ad9fmq559346l"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.13.0"; }; rspec-core = { - dependencies = ["rspec-support"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "rspec-support" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "001kazj244cb6fbkmh7ap74csbr78717qaskqzqpir1q8xpdmywl"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.13.2"; }; rspec-expectations = { - dependencies = ["diff-lcs" "rspec-support"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "diff-lcs" + "rspec-support" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0n3cyrhsa75x5wwvskrrqk56jbjgdi2q1zx0irllf0chkgsmlsqf"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.13.3"; }; rspec-mocks = { - dependencies = ["diff-lcs" "rspec-support"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ + "diff-lcs" + "rspec-support" + ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1vxxkb2sf2b36d8ca2nq84kjf85fz4x7wqcvb8r6a5hfxxfk69r3"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.13.2"; }; rspec-support = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "03z7gpqz5xkw9rf53835pa8a9vgj4lic54rnix9vfwmp2m7pv1s8"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "3.13.1"; }; rubocop = { - dependencies = ["json" "language_server-protocol" "parallel" "parser" "rainbow" "regexp_parser" "rubocop-ast" "ruby-progressbar" "unicode-display_width"]; - groups = ["default"]; - platforms = []; + dependencies = [ + "json" + "language_server-protocol" + "parallel" + "parser" + "rainbow" + "regexp_parser" + "rubocop-ast" + "ruby-progressbar" + "unicode-display_width" + ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0ay1lrz3ffrznjfr65c6xvkinb6m4l7h68cd9qbrf7nq0j2m1pq7"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.68.0"; }; rubocop-ast = { - dependencies = ["parser"]; - groups = ["default"]; - platforms = []; + dependencies = [ "parser" ]; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0czjszwmb1m7f88bhr7ji437rdy3whcn37p7mhb38yyf8xxnfjhf"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.35.0"; }; rubocop-rake = { @@ -730,114 +986,132 @@ version = "3.2.0"; }; ruby-progressbar = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.13.0"; }; sqlite3 = { - dependencies = ["mini_portile2"]; - groups = ["development"]; - platforms = []; + dependencies = [ "mini_portile2" ]; + groups = [ "development" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "12li43jlzp2gpb9slrl2vzwnayxngxpyqgaxwaifycir5fq5dkma"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.0.4"; }; thor = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1nmymd86a0vb39pzj2cwv57avdrl6pl3lf5bsz58q594kqxjkw7f"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "1.3.2"; }; timeout = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "06fcniirx82hrljzfn5wb3634n8648v8qgy006jzgclfz5gjvjla"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.4.2"; }; tzinfo = { - dependencies = ["concurrent-ruby"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "concurrent-ruby" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "16w2g84dzaf3z13gxyzlzbf748kylk5bdgg3n1ipvkvvqy685bwd"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.0.6"; }; unicode-display_width = { - groups = ["default"]; - platforms = []; + groups = [ "default" ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0nkz7fadlrdbkf37m0x7sw8bnz8r355q3vwcfb9f9md6pds9h9qj"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.6.0"; }; websocket-driver = { - dependencies = ["websocket-extensions"]; - groups = ["default" "development"]; - platforms = []; + dependencies = [ "websocket-extensions" ]; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "1nyh873w4lvahcl8kzbjfca26656d5c6z3md4sbqg5y1gfz0157n"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.7.6"; }; websocket-extensions = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "0hc2g9qps8lmhibl5baa91b4qx8wqw872rgwagml78ydj8qacsqw"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "0.1.5"; }; zeitwerk = { - groups = ["default" "development"]; - platforms = []; + groups = [ + "default" + "development" + ]; + platforms = [ ]; source = { - remotes = ["https://rubygems.org"]; + remotes = [ "https://rubygems.org" ]; sha256 = "10cpfdswql21vildiin0q7drg5zfzf2sahnk9hv3nyzzjqwj2bdx"; target = "ruby"; type = "gem"; }; - targets = []; + targets = [ ]; version = "2.6.18"; }; -} \ No newline at end of file +} From 9da601526222a385ca102257938e54c83300fe15 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:23:16 +0100 Subject: [PATCH 05/12] rubocop -A --- .rubocop_todo.yml | 438 ------------------ Appraisals | 2 + Gemfile | 2 + Rakefile | 8 +- bin/console | 7 +- exe/generate_edges | 10 +- lib/rails_edge_test.rb | 25 +- lib/rails_edge_test/configuration.rb | 14 +- lib/rails_edge_test/dsl.rb | 4 +- lib/rails_edge_test/dsl/action.rb | 78 ++-- lib/rails_edge_test/dsl/controller.rb | 44 +- lib/rails_edge_test/dsl/edge.rb | 225 ++++----- lib/rails_edge_test/dsl/let_handler.rb | 30 +- lib/rails_edge_test/printers/boring.rb | 54 +-- lib/rails_edge_test/printers/silent.rb | 30 +- lib/rails_edge_test/printers/tree.rb | 81 ++-- lib/rails_edge_test/runner.rb | 13 +- lib/rails_edge_test/version.rb | 4 +- rails_edge_test.gemspec | 38 +- spec/rails_edge_test/configuration_spec.rb | 79 ++-- spec/rails_edge_test/dsl/edge_spec.rb | 101 ++-- spec/rails_edge_test/dsl/let_handler_spec.rb | 55 +-- spec/rails_edge_test/dsl_spec.rb | 86 ++-- spec/rails_edge_test/runner_spec.rb | 37 +- spec/rails_edge_test_spec.rb | 8 +- spec/rails_helper.rb | 4 +- spec/spec_helper.rb | 8 +- spec/support/test_app/Gemfile | 3 +- spec/support/test_app/Rakefile | 4 +- .../app/controllers/application_controller.rb | 4 +- spec/support/test_app/bin/bundle | 4 +- spec/support/test_app/bin/rails | 6 +- spec/support/test_app/bin/rake | 4 +- spec/support/test_app/bin/setup | 18 +- spec/support/test_app/bin/spring | 3 +- spec/support/test_app/config.ru | 4 +- spec/support/test_app/config/application.rb | 4 +- spec/support/test_app/config/boot.rb | 4 +- spec/support/test_app/config/environment.rb | 4 +- .../config/environments/development.rb | 2 + .../config/environments/production.rb | 4 +- .../test_app/config/environments/test.rb | 2 + .../initializers/backtrace_silencers.rb | 2 + .../config/initializers/cookies_serializer.rb | 2 + .../initializers/filter_parameter_logging.rb | 2 + .../config/initializers/inflections.rb | 2 + .../config/initializers/mime_types.rb | 2 + .../config/initializers/session_store.rb | 2 + .../to_time_preserves_timezone.rb | 2 + .../config/initializers/wrap_parameters.rb | 2 + spec/support/test_app/config/routes.rb | 2 + spec/support/test_app/db/seeds.rb | 2 + spec/support/test_app/edge/another_edge.rb | 4 +- spec/support/test_app/edge/example_edge.rb | 4 +- 54 files changed, 617 insertions(+), 966 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 4d3187f..f840f63 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Include. -# Include: **/*.gemspec -Gemspec/AddRuntimeDependency: - Exclude: - - 'rails_edge_test.gemspec' - # Offense count: 5 # Configuration parameters: EnforcedStyle, AllowedGems, Include. # SupportedStyles: Gemfile, gems.rb, gemspec @@ -22,72 +14,6 @@ Gemspec/DevelopmentDependencies: Exclude: - 'rails_edge_test.gemspec' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. -# Include: **/*.gemspec -Gemspec/OrderedDependencies: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Severity, Include. -# Include: **/*.gemspec -Gemspec/RequireMFA: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLineAfterMagicComment: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLines: - Exclude: - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - - 'spec/support/test_app/Gemfile' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: around, only_before -Layout/EmptyLinesAroundAccessModifier: - Exclude: - - 'lib/rails_edge_test.rb' - - 'lib/rails_edge_test/runner.rb' - -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: empty_lines, no_empty_lines -Layout/EmptyLinesAroundBlockBody: - Exclude: - - 'lib/rails_edge_test/dsl.rb' - - 'lib/rails_edge_test/dsl/edge.rb' - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLinesAroundMethodBody: - Exclude: - - 'lib/rails_edge_test/printers/boring.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/support/test_app/bin/setup' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. @@ -96,67 +22,6 @@ Layout/LineLength: Exclude: - 'rails_edge_test.gemspec' -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/SpaceAfterComma: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, no_space -Layout/SpaceAroundEqualsInParameterDefault: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator, EnforcedStyleForRationalLiterals. -# SupportedStylesForExponentOperator: space, no_space -# SupportedStylesForRationalLiterals: space, no_space -Layout/SpaceAroundOperators: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/runner.rb' - - 'rails_edge_test.gemspec' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceBeforeBlockBraces: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - -# Offense count: 40 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideHashLiteralBraces: - Exclude: - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - - 'spec/support/test_app/app/controllers/application_controller.rb' - -# Offense count: 14 -# This cop supports safe autocorrection (--autocorrect). -Lint/DeprecatedClassMethods: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Lint/RedundantDirGlobSort: - Exclude: - - 'lib/rails_edge_test/runner.rb' - # Offense count: 2 # Configuration parameters: AllowComments, AllowNil. Lint/SuppressedException: @@ -169,14 +34,6 @@ RSpec/AnyInstance: Exclude: - 'spec/rails_edge_test/dsl_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: be, be_nil -RSpec/BeNil: - Exclude: - - 'spec/rails_edge_test_spec.rb' - # Offense count: 8 RSpec/BeforeAfterAll: Exclude: @@ -195,72 +52,11 @@ RSpec/ContextWording: Exclude: - 'spec/rails_edge_test/dsl_spec.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowConsecutiveOneLiners. -RSpec/EmptyLineAfterHook: - Exclude: - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: CustomTransform, IgnoredWords, DisallowedExamples. -# DisallowedExamples: works -RSpec/ExampleWording: - Exclude: - - 'spec/rails_edge_test/dsl_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/ExcessiveDocstringSpacing: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - # Offense count: 2 RSpec/RepeatedExample: Exclude: - 'spec/rails_edge_test/runner_spec.rb' -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames. -# RedundantRestArgumentNames: args, arguments -# RedundantKeywordRestArgumentNames: kwargs, options, opts -# RedundantBlockArgumentNames: blk, block, proc -Style/ArgumentsForwarding: - Exclude: - - 'lib/rails_edge_test/dsl/action.rb' - - 'lib/rails_edge_test/dsl/edge.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. -# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces -# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object -# FunctionalMethods: let, let!, subject, watch -# AllowedMethods: lambda, proc, it -Style/BlockDelimiters: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - -# Offense count: 7 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: nested, compact -Style/ClassAndModuleChildren: - Exclude: - - 'lib/rails_edge_test/dsl/action.rb' - - 'lib/rails_edge_test/dsl/controller.rb' - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/dsl/let_handler.rb' - - 'lib/rails_edge_test/printers/boring.rb' - - 'lib/rails_edge_test/printers/silent.rb' - - 'lib/rails_edge_test/printers/tree.rb' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Keywords, RequireColon. @@ -284,242 +80,8 @@ Style/Documentation: - 'lib/rails_edge_test/printers/tree.rb' - 'lib/rails_edge_test/runner.rb' -# Offense count: 11 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AutoCorrect, EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: - Exclude: - - 'lib/rails_edge_test/printers/boring.rb' - - 'lib/rails_edge_test/printers/silent.rb' - - 'lib/rails_edge_test/printers/tree.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/Encoding: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 11 -# This cop supports safe autocorrection (--autocorrect). -Style/ExpandPathArguments: - Exclude: - - 'rails_edge_test.gemspec' - - 'spec/support/test_app/Rakefile' - - 'spec/support/test_app/bin/bundle' - - 'spec/support/test_app/bin/rails' - - 'spec/support/test_app/bin/rake' - - 'spec/support/test_app/bin/setup' - - 'spec/support/test_app/config.ru' - - 'spec/support/test_app/config/application.rb' - - 'spec/support/test_app/config/boot.rb' - - 'spec/support/test_app/config/environment.rb' - -# Offense count: 53 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, always_true, never -Style/FrozenStringLiteralComment: - Exclude: - - 'Appraisals' - - 'Gemfile' - - 'Rakefile' - - 'bin/console' - - 'exe/generate_edges' - - 'lib/rails_edge_test.rb' - - 'lib/rails_edge_test/configuration.rb' - - 'lib/rails_edge_test/dsl.rb' - - 'lib/rails_edge_test/dsl/action.rb' - - 'lib/rails_edge_test/dsl/controller.rb' - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/dsl/let_handler.rb' - - 'lib/rails_edge_test/printers/boring.rb' - - 'lib/rails_edge_test/printers/silent.rb' - - 'lib/rails_edge_test/printers/tree.rb' - - 'lib/rails_edge_test/runner.rb' - - 'lib/rails_edge_test/version.rb' - - 'rails_edge_test.gemspec' - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - - 'spec/rails_edge_test_spec.rb' - - 'spec/rails_helper.rb' - - 'spec/spec_helper.rb' - - 'spec/support/test_app/Gemfile' - - 'spec/support/test_app/Rakefile' - - 'spec/support/test_app/app/controllers/application_controller.rb' - - 'spec/support/test_app/bin/bundle' - - 'spec/support/test_app/bin/rails' - - 'spec/support/test_app/bin/rake' - - 'spec/support/test_app/bin/setup' - - 'spec/support/test_app/bin/spring' - - 'spec/support/test_app/config.ru' - - 'spec/support/test_app/config/application.rb' - - 'spec/support/test_app/config/boot.rb' - - 'spec/support/test_app/config/environment.rb' - - 'spec/support/test_app/config/environments/development.rb' - - 'spec/support/test_app/config/environments/production.rb' - - 'spec/support/test_app/config/environments/test.rb' - - 'spec/support/test_app/config/initializers/backtrace_silencers.rb' - - 'spec/support/test_app/config/initializers/cookies_serializer.rb' - - 'spec/support/test_app/config/initializers/filter_parameter_logging.rb' - - 'spec/support/test_app/config/initializers/inflections.rb' - - 'spec/support/test_app/config/initializers/mime_types.rb' - - 'spec/support/test_app/config/initializers/session_store.rb' - - 'spec/support/test_app/config/initializers/to_time_preserves_timezone.rb' - - 'spec/support/test_app/config/initializers/wrap_parameters.rb' - - 'spec/support/test_app/config/routes.rb' - - 'spec/support/test_app/db/seeds.rb' - - 'spec/support/test_app/edge/another_edge.rb' - - 'spec/support/test_app/edge/example_edge.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals. -Style/GuardClause: - Exclude: - - 'exe/generate_edges' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. -# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys -# SupportedShorthandSyntax: always, never, either, consistent, either_consistent -Style/HashSyntax: - Exclude: - - 'Rakefile' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/IfUnlessModifier: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/dsl/let_handler.rb' - # Offense count: 2 Style/MixinUsage: Exclude: - 'spec/support/test_app/edge/another_edge.rb' - 'spec/support/test_app/edge/example_edge.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: literals, strict -Style/MutableConstant: - Exclude: - - 'lib/rails_edge_test/version.rb' - -# Offense count: 14 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedMethods. -# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with -Style/NestedParenthesizedCalls: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: PreferredDelimiters. -Style/PercentLiteralDelimiters: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantConstantBase: - Exclude: - - 'spec/support/test_app/config.ru' - - 'spec/support/test_app/config/environments/production.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantPercentQ: - Exclude: - - 'rails_edge_test.gemspec' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. -# AllowedMethods: present?, blank?, presence, try, try! -Style/SafeNavigation: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/SelfAssignment: - Exclude: - - 'spec/rails_edge_test/configuration_spec.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: only_raise, only_fail, semantic -Style/SignalException: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/dsl/let_handler.rb' - -# Offense count: 4 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Mode. -Style/StringConcatenation: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - -# Offense count: 188 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'Rakefile' - - 'bin/console' - - 'lib/rails_edge_test.rb' - - 'lib/rails_edge_test/dsl/edge.rb' - - 'lib/rails_edge_test/printers/boring.rb' - - 'lib/rails_edge_test/printers/tree.rb' - - 'lib/rails_edge_test/runner.rb' - - 'lib/rails_edge_test/version.rb' - - 'rails_edge_test.gemspec' - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - - 'spec/rails_edge_test_spec.rb' - - 'spec/rails_helper.rb' - - 'spec/spec_helper.rb' - - 'spec/support/test_app/bin/setup' - - 'spec/support/test_app/bin/spring' - - 'spec/support/test_app/edge/another_edge.rb' - - 'spec/support/test_app/edge/example_edge.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: MinSize. -# SupportedStyles: percent, brackets -Style/SymbolArray: - EnforcedStyle: brackets - -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: AllowMethodsWithArguments, AllowedMethods, AllowedPatterns, AllowComments. -# AllowedMethods: define_method -Style/SymbolProc: - Exclude: - - 'lib/rails_edge_test/configuration.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInArrayLiteral: - Exclude: - - 'spec/rails_edge_test/configuration_spec.rb' diff --git a/Appraisals b/Appraisals index 111e0bc..5fc4f3f 100644 --- a/Appraisals +++ b/Appraisals @@ -1,3 +1,5 @@ +# frozen_string_literal: true + appraise 'rails-5.2' do gem 'rails', '~> 5.2.0' end diff --git a/Gemfile b/Gemfile index 142be2e..11cccf1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in rails_edge_test.gemspec diff --git a/Rakefile b/Rakefile index b7e9ed5..82bb534 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,8 @@ -require "bundler/gem_tasks" -require "rspec/core/rake_task" +# frozen_string_literal: true + +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) -task :default => :spec +task default: :spec diff --git a/bin/console b/bin/console index cf3fd70..8c0f358 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,8 @@ #!/usr/bin/env ruby +# frozen_string_literal: true -require "bundler/setup" -require "rails_edge_test" +require 'bundler/setup' +require 'rails_edge_test' # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. @@ -10,5 +11,5 @@ require "rails_edge_test" # require "pry" # Pry.start -require "irb" +require 'irb' IRB.start(__FILE__) diff --git a/exe/generate_edges b/exe/generate_edges index ca3c293..cf63fc5 100755 --- a/exe/generate_edges +++ b/exe/generate_edges @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'open3' require 'rails_edge_test' @@ -12,11 +13,10 @@ def find_gemfile_dir(path) else new_path = File.expand_path('..', path) - if path == new_path - raise 'Could not find directory with Gemfile' - else - find_gemfile_dir(new_path) - end + raise 'Could not find directory with Gemfile' if path == new_path + + find_gemfile_dir(new_path) + end end diff --git a/lib/rails_edge_test.rb b/lib/rails_edge_test.rb index a737a6f..c3ec65a 100644 --- a/lib/rails_edge_test.rb +++ b/lib/rails_edge_test.rb @@ -1,17 +1,20 @@ -require "rails_edge_test/version" -require "rails_edge_test/dsl" -require "rails_edge_test/dsl/controller" -require "rails_edge_test/dsl/action" -require "rails_edge_test/dsl/edge" -require "rails_edge_test/dsl/let_handler" -require "rails_edge_test/configuration" -require "rails_edge_test/runner" -require "rails_edge_test/printers/boring" -require "rails_edge_test/printers/silent" -require "rails_edge_test/printers/tree" +# frozen_string_literal: true + +require 'rails_edge_test/version' +require 'rails_edge_test/dsl' +require 'rails_edge_test/dsl/controller' +require 'rails_edge_test/dsl/action' +require 'rails_edge_test/dsl/edge' +require 'rails_edge_test/dsl/let_handler' +require 'rails_edge_test/configuration' +require 'rails_edge_test/runner' +require 'rails_edge_test/printers/boring' +require 'rails_edge_test/printers/silent' +require 'rails_edge_test/printers/tree' module RailsEdgeTest module_function + def configure(&block) block.call configuration end diff --git a/lib/rails_edge_test/configuration.rb b/lib/rails_edge_test/configuration.rb index 5947d32..646450e 100644 --- a/lib/rails_edge_test/configuration.rb +++ b/lib/rails_edge_test/configuration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest class Configuration attr_accessor :elm_path, :edge_root_path, :printer @@ -35,23 +37,17 @@ def after_each(&block) end def wrap_suite_execution(&block) - @before_suite_blocks.each do |before_suit_block| - before_suit_block.call - end + @before_suite_blocks.each(&:call) block.call end def wrap_edge_execution(&edge) - @before_each_blocks.each do |before_each_block| - before_each_block.call - end + @before_each_blocks.each(&:call) edge.call - @after_each_blocks.each do |after_each_block| - after_each_block.call - end + @after_each_blocks.each(&:call) end end end diff --git a/lib/rails_edge_test/dsl.rb b/lib/rails_edge_test/dsl.rb index 9210d7a..9cef329 100644 --- a/lib/rails_edge_test/dsl.rb +++ b/lib/rails_edge_test/dsl.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest module Dsl def controller(controller_class, &block) @@ -16,7 +18,6 @@ def execute! printer.begin_suite RailsEdgeTest.configuration.wrap_suite_execution do - @controllers.each do |controller| printer.begin_controller(controller) @@ -40,7 +41,6 @@ def execute! printer.end_controller end - end printer.end_suite end diff --git a/lib/rails_edge_test/dsl/action.rb b/lib/rails_edge_test/dsl/action.rb index 5969c97..a673605 100644 --- a/lib/rails_edge_test/dsl/action.rb +++ b/lib/rails_edge_test/dsl/action.rb @@ -1,49 +1,53 @@ -module RailsEdgeTest::Dsl - Action = Struct.new(:name, :controller) do - def initialize(*args) - super - @edges = {} - @let_handler = LetHandler.new - end +# frozen_string_literal: true - def edge(description, &block) - edge = Edge.new(description, self) - @edges[edge] = block - end +module RailsEdgeTest + module Dsl + Action = Struct.new(:name, :controller) do + def initialize(*args) + super + @edges = {} + @let_handler = LetHandler.new + end - def let(title, &block) - @let_handler.add_definition(title, &block) - end + def edge(description, &block) + edge = Edge.new(description, self) + @edges[edge] = block + end - def generate(title, &block) - @let_handler.add_definition("generate_#{title}", &block) - end + def let(title, &block) + @let_handler.add_definition(title, &block) + end - def __edges - @edges - end + def generate(title, &block) + @let_handler.add_definition("generate_#{title}", &block) + end - def __let_handler - @let_handler - end + def __edges + @edges + end - def controller_class - controller.controller_class - end + def __let_handler + @let_handler + end - # support calling methods defined in controller - def method_missing(method_name, *arguments, &block) - if controller.respond_to?(method_name) - controller.public_send(method_name, *arguments, &block) - else - super + def controller_class + controller.controller_class + end + + # support calling methods defined in controller + def method_missing(method_name, ...) + if controller.respond_to?(method_name) + controller.public_send(method_name, ...) + else + super + end end - end - # always define respond_to_missing? when defining method_missing: - # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding - def respond_to_missing?(method_name, include_private = false) - controller.respond_to?(method_name) || super + # always define respond_to_missing? when defining method_missing: + # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding + def respond_to_missing?(method_name, include_private = false) + controller.respond_to?(method_name) || super + end end end end diff --git a/lib/rails_edge_test/dsl/controller.rb b/lib/rails_edge_test/dsl/controller.rb index 0049583..f173a62 100644 --- a/lib/rails_edge_test/dsl/controller.rb +++ b/lib/rails_edge_test/dsl/controller.rb @@ -1,27 +1,31 @@ -module RailsEdgeTest::Dsl - Controller = Struct.new(:controller_class) do - def initialize(*args) - super - @actions = [] - @let_handler = LetHandler.new - end +# frozen_string_literal: true - def action(name, &block) - new_action = Action.new(name, self) - new_action.instance_exec(&block) - @actions << new_action - end +module RailsEdgeTest + module Dsl + Controller = Struct.new(:controller_class) do + def initialize(*args) + super + @actions = [] + @let_handler = LetHandler.new + end - def let(title, &block) - @let_handler.add_definition(title, &block) - end + def action(name, &block) + new_action = Action.new(name, self) + new_action.instance_exec(&block) + @actions << new_action + end - def __actions - @actions - end + def let(title, &block) + @let_handler.add_definition(title, &block) + end + + def __actions + @actions + end - def __let_handler - @let_handler + def __let_handler + @let_handler + end end end end diff --git a/lib/rails_edge_test/dsl/edge.rb b/lib/rails_edge_test/dsl/edge.rb index b2bf5bc..8a25943 100644 --- a/lib/rails_edge_test/dsl/edge.rb +++ b/lib/rails_edge_test/dsl/edge.rb @@ -1,146 +1,147 @@ +# frozen_string_literal: true + require 'action_dispatch' require 'action_controller' require 'action_controller/test_case' -module RailsEdgeTest::Dsl - Edge = Struct.new(:description, :action) do - - def initialize(*args) - super - @let_cache = {} - end - - delegate :controller_class, to: :action - delegate :session, to: :request - - def request - @request ||= ActionController::TestRequest.create(controller_class) - end - - # In the context of the edge, we want `controller` to be the rails controller - # instead of our own RailsEdgeTest::Dsl::Controller. In this way the user can - # directly access the rails controller within their edge. - def controller - @controller ||= controller_class.new - end - - def response - @response - end +module RailsEdgeTest + module Dsl + Edge = Struct.new(:description, :action) do + def initialize(*args) + super + @let_cache = {} + end - def perform_get(parameters={}) - process(parameters) - end + delegate :controller_class, to: :action + delegate :session, to: :request - def perform_post(parameters={}) - request.instance_variable_set(:@method, "POST") - request.env['REQUEST_METHOD'] = "POST" - process(parameters) - end + def request + @request ||= ActionController::TestRequest.create(controller_class) + end - def perform_delete(parameters={}) - request.instance_variable_set(:@method, "DELETE") - request.env['REQUEST_METHOD'] = "DELETE" - process(parameters) - end + # In the context of the edge, we want `controller` to be the rails controller + # instead of our own RailsEdgeTest::Dsl::Controller. In this way the user can + # directly access the rails controller within their edge. + def controller + @controller ||= controller_class.new + end - def set_authenticity_token - r = request - controller.instance_eval { @_request = r } - request.headers['X-CSRF-Token'] = controller.send :form_authenticity_token - end + def response + @response + end - def process(parameters={}) - request.assign_parameters( - ::Rails.application.routes, - controller_class.controller_path, - action.name.to_s, - parameters.stringify_keys!, - '', - '' - ) - - response = ActionDispatch::Response.new.tap do |res| - res.request = request + def perform_get(parameters = {}) + process(parameters) end - @response = controller.dispatch(action.name, request, response) - end + def perform_post(parameters = {}) + request.instance_variable_set(:@method, 'POST') + request.env['REQUEST_METHOD'] = 'POST' + process(parameters) + end - def produce_elm_file(module_name, ivar: nil) - json = produce_json(ivar: ivar) - json = json.gsub("\\", "\\\\\\\\") # unbelievably, this replaces \ with \\ + def perform_delete(parameters = {}) + request.instance_variable_set(:@method, 'DELETE') + request.env['REQUEST_METHOD'] = 'DELETE' + process(parameters) + end - filepath = File.join( - RailsEdgeTest.configuration.elm_path, - 'Edge', - controller_class.name.gsub('::','/') - ) + def set_authenticity_token + r = request + controller.instance_eval { @_request = r } + request.headers['X-CSRF-Token'] = controller.send :form_authenticity_token + end - full_module_name = - "#{controller_class.name.gsub('::','.')}.#{module_name}" + def process(parameters = {}) + request.assign_parameters( + ::Rails.application.routes, + controller_class.controller_path, + action.name.to_s, + parameters.stringify_keys!, + '', + '' + ) + + response = ActionDispatch::Response.new.tap do |res| + res.request = request + end + + @response = controller.dispatch(action.name, request, response) + end - data = <<~ELM - module Edge.#{full_module_name} exposing (json) + def produce_elm_file(module_name, ivar: nil) + json = produce_json(ivar: ivar) + json = json.gsub('\\', '\\\\\\\\') # unbelievably, this replaces \ with \\ + filepath = File.join( + RailsEdgeTest.configuration.elm_path, + 'Edge', + controller_class.name.gsub('::', '/') + ) - json : String - json = - """ - #{json} - """ - ELM + full_module_name = + "#{controller_class.name.gsub('::', '.')}.#{module_name}" - write_file(filepath, module_name+'.elm', data) - end + data = <<~ELM + module Edge.#{full_module_name} exposing (json) - private - def produce_json(ivar: nil) - unless response - fail "Must perform a request (for example `perform_get`) before attempting to produce a json file." - end + json : String + json = + """ + #{json} + """ + ELM - if response.is_a?(Array) && response[0] >= 300 - fail "Request did not result in a successful (2xx) response!" + write_file(filepath, "#{module_name}.elm", data) end - ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false - if ivar - value = controller.send(:instance_variable_get, ivar) - JSON.pretty_unparse(value.as_json) - elsif response[1]['Content-Type']&.starts_with?('application/json') - value = JSON.parse(response[2].body) - JSON.pretty_unparse(value) - else - response[2].body + private + + def produce_json(ivar: nil) + unless response + raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' + end + + raise 'Request did not result in a successful (2xx) response!' if response.is_a?(Array) && response[0] >= 300 + + ActiveSupport::JSON::Encoding.escape_html_entities_in_json = false + if ivar + value = controller.send(:instance_variable_get, ivar) + JSON.pretty_unparse(value.as_json) + elsif response[1]['Content-Type']&.starts_with?('application/json') + value = JSON.parse(response[2].body) + JSON.pretty_unparse(value) + else + response[2].body + end end - end - def write_file(filepath, filename, data) - FileUtils.mkdir_p(filepath) + def write_file(filepath, filename, data) + FileUtils.mkdir_p(filepath) - filepath = File.join(filepath, filename) + filepath = File.join(filepath, filename) - File.open(filepath, 'w') do |f| - f.write(data) - f.flush + File.open(filepath, 'w') do |f| + f.write(data) + f.flush + end end - end - # support calling methods defined in action - def method_missing(method_name, *arguments, &block) - if action.respond_to?(method_name) - action.public_send(method_name, *arguments, &block) - else - super + # support calling methods defined in action + def method_missing(method_name, ...) + if action.respond_to?(method_name) + action.public_send(method_name, ...) + else + super + end end - end - # always define respond_to_missing? when defining method_missing: - # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding - def respond_to_missing?(method_name, include_private = false) - action.respond_to?(method_name) || super + # always define respond_to_missing? when defining method_missing: + # https://thoughtbot.com/blog/always-define-respond-to-missing-when-overriding + def respond_to_missing?(method_name, include_private = false) + action.respond_to?(method_name) || super + end end end end diff --git a/lib/rails_edge_test/dsl/let_handler.rb b/lib/rails_edge_test/dsl/let_handler.rb index 529770a..c318662 100644 --- a/lib/rails_edge_test/dsl/let_handler.rb +++ b/lib/rails_edge_test/dsl/let_handler.rb @@ -1,22 +1,24 @@ -module RailsEdgeTest::Dsl - class LetHandler - attr_reader :let_blocks +# frozen_string_literal: true - def initialize - @let_blocks = {} - end +module RailsEdgeTest + module Dsl + class LetHandler + attr_reader :let_blocks - def add_definition(title, &block) - @let_blocks[title] = block - end + def initialize + @let_blocks = {} + end - def execute(title) - block = @let_blocks[title] - unless block - fail NoMethodError, "no method or let block defined with name #{title}" + def add_definition(title, &block) + @let_blocks[title] = block end - block.call + def execute(title) + block = @let_blocks[title] + raise NoMethodError, "no method or let block defined with name #{title}" unless block + + block.call + end end end end diff --git a/lib/rails_edge_test/printers/boring.rb b/lib/rails_edge_test/printers/boring.rb index 518ee57..cf99c78 100644 --- a/lib/rails_edge_test/printers/boring.rb +++ b/lib/rails_edge_test/printers/boring.rb @@ -1,39 +1,39 @@ -module RailsEdgeTest::Printers - class Boring - def initialize - @count = 0 - end +# frozen_string_literal: true - def begin_suite - puts "" - end +module RailsEdgeTest + module Printers + class Boring + def initialize + @count = 0 + end - def end_suite - puts "\n#{@count} edge specs executed." - end + def begin_suite + puts '' + end - def begin_controller(_controller) - print "." - end + def end_suite + puts "\n#{@count} edge specs executed." + end - def end_controller + def begin_controller(_controller) + print '.' + end - end + def end_controller; end - def begin_action(_action) - print "." - end - - def end_action + def begin_action(_action) + print '.' + end - end + def end_action; end - def begin_edge(_edge) - print "." - end + def begin_edge(_edge) + print '.' + end - def end_edge - @count += 1 + def end_edge + @count += 1 + end end end end diff --git a/lib/rails_edge_test/printers/silent.rb b/lib/rails_edge_test/printers/silent.rb index 858c588..5ca2e91 100644 --- a/lib/rails_edge_test/printers/silent.rb +++ b/lib/rails_edge_test/printers/silent.rb @@ -1,27 +1,23 @@ -module RailsEdgeTest::Printers - class Silent - def begin_suite - end +# frozen_string_literal: true - def end_suite - end +module RailsEdgeTest + module Printers + class Silent + def begin_suite; end - def begin_controller(_controller) - end + def end_suite; end - def end_controller - end + def begin_controller(_controller); end - def begin_action(_action) - end + def end_controller; end - def end_action - end + def begin_action(_action); end - def begin_edge(_edge) - end + def end_action; end + + def begin_edge(_edge); end - def end_edge + def end_edge; end end end end diff --git a/lib/rails_edge_test/printers/tree.rb b/lib/rails_edge_test/printers/tree.rb index 169bade..ecdbb41 100644 --- a/lib/rails_edge_test/printers/tree.rb +++ b/lib/rails_edge_test/printers/tree.rb @@ -1,42 +1,45 @@ -module RailsEdgeTest::Printers - class Tree - def initialize - @count = 0 - end - - def begin_suite - puts "" - puts "Generating Edges..." - puts "-------------------" - puts "" - end - - def end_suite - puts "\n#{@count} edge specs executed." - end - - def begin_controller(controller) - puts controller.controller_class.name - end - - def end_controller - puts "" - end - - def begin_action(action) - puts " #{action.name}" - end - - def end_action - end - - def begin_edge(edge) - print " #{edge.description}" - end - - def end_edge - puts " ... done" - @count += 1 +# frozen_string_literal: true + +module RailsEdgeTest + module Printers + class Tree + def initialize + @count = 0 + end + + def begin_suite + puts '' + puts 'Generating Edges...' + puts '-------------------' + puts '' + end + + def end_suite + puts "\n#{@count} edge specs executed." + end + + def begin_controller(controller) + puts controller.controller_class.name + end + + def end_controller + puts '' + end + + def begin_action(action) + puts " #{action.name}" + end + + def end_action; end + + def begin_edge(edge) + print " #{edge.description}" + end + + def end_edge + puts ' ... done' + @count += 1 + end end end end diff --git a/lib/rails_edge_test/runner.rb b/lib/rails_edge_test/runner.rb index f340560..b037623 100644 --- a/lib/rails_edge_test/runner.rb +++ b/lib/rails_edge_test/runner.rb @@ -1,9 +1,12 @@ +# frozen_string_literal: true + module RailsEdgeTest module Runner module_function + def go!(args = []) unless Rails.env.test? - puts "Failure! Unable to set Rails environment to test." + puts 'Failure! Unable to set Rails environment to test.' exit end @@ -19,7 +22,7 @@ def go!(args = []) ) end - Dir.glob(paths_to_load).sort.each do |file| + Dir.glob(paths_to_load).each do |file| load file end @@ -27,13 +30,13 @@ def go!(args = []) end def load_rails_environment!(rails_root) - ENV["RAILS_ENV"]="test" - rails_app_path = File.join(rails_root, "config/application") + ENV['RAILS_ENV'] = 'test' + rails_app_path = File.join(rails_root, 'config/application') require rails_app_path Rails.application.require_environment! - require "rake" + require 'rake' Rails.application.load_tasks end end diff --git a/lib/rails_edge_test/version.rb b/lib/rails_edge_test/version.rb index c056d94..0079dd4 100644 --- a/lib/rails_edge_test/version.rb +++ b/lib/rails_edge_test/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RailsEdgeTest - VERSION = "2.1.0" + VERSION = '2.1.0' end diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index 73b52b3..a828fec 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -1,32 +1,34 @@ -# coding: utf-8 -lib = File.expand_path('../lib', __FILE__) +# frozen_string_literal: true + +lib = File.expand_path('lib', __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_edge_test/version' Gem::Specification.new do |spec| - spec.name = "rails_edge_test" + spec.name = 'rails_edge_test' spec.version = RailsEdgeTest::VERSION - spec.authors = ["Joshua Leven", "Ju Liu"] - spec.email = ["josh@noredink.com"] + spec.authors = ['Joshua Leven', 'Ju Liu'] + spec.email = ['josh@noredink.com'] - spec.summary = %q{Generate json for front-end testing using your rails backend.} - spec.description = %q{Keep your backend and front-end specs in sync! The rails_edge_test gem provides a dsl and rake task that uses your Rails app to generate json and appropriate wrapper files for use in your front-end testing.} - spec.homepage = "https://github.com/NoRedInk/rails_edge_test" - spec.license = "MIT" + spec.summary = 'Generate json for front-end testing using your rails backend.' + spec.description = 'Keep your backend and front-end specs in sync! The rails_edge_test gem provides a dsl and rake task that uses your Rails app to generate json and appropriate wrapper files for use in your front-end testing.' + spec.homepage = 'https://github.com/NoRedInk/rails_edge_test' + spec.license = 'MIT' spec.files = `git ls-files -z`.split("\x0").reject do |f| f.match(%r{^(test|spec|features)/}) end - spec.bindir = "exe" - spec.executables << "generate_edges" - spec.require_paths = ["lib"] + spec.bindir = 'exe' + spec.executables << 'generate_edges' + spec.require_paths = ['lib'] - spec.add_runtime_dependency "actionpack", ">= 5.2.0", "< 7.1.0" + spec.add_dependency 'actionpack', '>= 5.2.0', '< 7.1.0' spec.required_ruby_version = '>= 3.0.0' - spec.add_development_dependency "rails", ">= 5.2", "< 7.1.0" - spec.add_development_dependency "sqlite3", "~> 2.0.4" - spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "~> 3.9" - spec.add_development_dependency "appraisal", "~> 2.3" + spec.add_development_dependency 'appraisal', '~> 2.3' + spec.add_development_dependency 'rails', '>= 5.2', '< 7.1.0' + spec.add_development_dependency 'rake', '~> 13.0' + spec.add_development_dependency 'rspec', '~> 3.9' + spec.add_development_dependency 'sqlite3', '~> 2.0.4' + spec.metadata['rubygems_mfa_required'] = 'true' end diff --git a/spec/rails_edge_test/configuration_spec.rb b/spec/rails_edge_test/configuration_spec.rb index d08f653..b8e60f0 100644 --- a/spec/rails_edge_test/configuration_spec.rb +++ b/spec/rails_edge_test/configuration_spec.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + require 'rails_helper' module Namespace class ConfigurationController < ActionController::Base def simple - render json: {my: 'response'} + render json: { my: 'response' } end end end @@ -14,6 +16,7 @@ def simple get 'test/simple' => 'namespace/edge#simple' end end + after(:all) do Rails.application.reload_routes! end @@ -22,14 +25,13 @@ def simple RailsEdgeTest::Dsl.reset! end - - describe "#include(mod)" do - it "makes module callable from helper functions" do + describe '#include(mod)' do + it 'makes module callable from helper functions' do count = 0 increment_module = Module.new do define_method :increment_count do - count = count + 1 + count += 1 end end @@ -46,7 +48,7 @@ def action_increment increment_count end - edge "increment twice" do + edge 'increment twice' do controller_increment action_increment end @@ -63,7 +65,7 @@ def action_increment expect(count).to eq 2 end - it "includes the module in each edge" do + it 'includes the module in each edge' do meant_to = nil nicki = Module.new do @@ -77,7 +79,7 @@ def action_increment controller Namespace::ConfigurationController do action :simple do - edge "blast off" do + edge 'blast off' do starships end end @@ -94,8 +96,8 @@ def action_increment end end - describe "#before_suite(&block)" do - it "executes the before_suite blocks before the edges" do + describe '#before_suite(&block)' do + it 'executes the before_suite blocks before the edges' do count_down = 3 RailsEdgeTest.configure do |config| @@ -111,7 +113,7 @@ def action_increment controller Namespace::ConfigurationController do action :simple do - edge "t minus" do + edge 't minus' do count_down -= 1 end end @@ -124,8 +126,8 @@ def action_increment end end - describe "#before_each(&block)" do - it "executes the before_each blocks before each edge" do + describe '#before_each(&block)' do + it 'executes the before_each blocks before each edge' do count_down = 7 RailsEdgeTest.configure do |config| @@ -141,13 +143,13 @@ def action_increment controller Namespace::ConfigurationController do action :simple do - edge "first" do + edge 'first' do count_down -= 1 end end action :simple do - edge "second" do + edge 'second' do count_down -= 1 count_down -= 1 end @@ -161,8 +163,8 @@ def action_increment end end - describe "#after_each(&block)" do - it "executes the before_each blocks before each edge" do + describe '#after_each(&block)' do + it 'executes the before_each blocks before each edge' do count_down = 7 RailsEdgeTest.configure do |config| @@ -178,13 +180,13 @@ def action_increment controller Namespace::ConfigurationController do action :simple do - edge "first" do + edge 'first' do count_down -= 1 end end action :simple do - edge "second" do + edge 'second' do count_down -= 1 count_down -= 1 end @@ -198,8 +200,8 @@ def action_increment end end - describe "before and after blocks" do - it "execute in the correct order" do + describe 'before and after blocks' do + it 'execute in the correct order' do order = [] RailsEdgeTest.configure do |config| @@ -231,13 +233,13 @@ def action_increment controller Namespace::ConfigurationController do action :simple do - edge "first" do + edge 'first' do order << :first_edge end end action :simple do - edge "second" do + edge 'second' do order << :second_edge end end @@ -246,23 +248,22 @@ def action_increment RailsEdgeTest::Dsl.execute! - expect(order).to eq [ - :first_before_suite, - :second_before_suite, - - :first_before_each, - :second_before_each, - :first_edge, - :first_after_each, - :second_after_each, - - :first_before_each, - :second_before_each, - :second_edge, - :first_after_each, - :second_after_each, + expect(order).to eq %i[ + first_before_suite + second_before_suite + + first_before_each + second_before_each + first_edge + first_after_each + second_after_each + + first_before_each + second_before_each + second_edge + first_after_each + second_after_each ] - end end end diff --git a/spec/rails_edge_test/dsl/edge_spec.rb b/spec/rails_edge_test/dsl/edge_spec.rb index a3f5382..986fd91 100644 --- a/spec/rails_edge_test/dsl/edge_spec.rb +++ b/spec/rails_edge_test/dsl/edge_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' module Namespace @@ -9,15 +11,15 @@ def as_json class EdgeController < ActionController::Base def simple - render json: {my: 'response'} + render json: { my: 'response' } end def escape - render json: {escape: 'this "string" please'} + render json: { escape: 'this "string" please' } end def ivar - @page_data = {to: 'be embedded'} + @page_data = { to: 'be embedded' } head :ok end @@ -31,7 +33,6 @@ class EdgeController2 < EdgeController end end - RSpec.describe RailsEdgeTest::Dsl::Edge do before(:all) do Rails.application.routes.draw do @@ -41,6 +42,7 @@ class EdgeController2 < EdgeController get 'test/ivar_requires_as_json' => 'namespace/edge#ivar_requires_as_json' end end + after(:all) do Rails.application.reload_routes! end @@ -59,28 +61,27 @@ class EdgeController2 < EdgeController end end - let(:elm_path) { File.expand_path('../../tmp', File.dirname(__FILE__)) } - describe "#produce_elm_file(module_name, ivar: nil)" do - let(:expected_filepath) { + describe '#produce_elm_file(module_name, ivar: nil)' do + let(:expected_filepath) do File.join( elm_path, 'Edge/Namespace/EdgeController/', - module_name+'.elm' + "#{module_name}.elm" ) - } + end let(:module_name) { 'MyResponse' } - it "creates a file in the expected location" do - expect(File.exists? expected_filepath).to be false + it 'creates a file in the expected location' do + expect(File.exist?(expected_filepath)).to be false Module.new do extend RailsEdgeTest::Dsl controller Namespace::EdgeController do action :simple do - edge "elm" do + edge 'elm' do perform_get produce_elm_file('MyResponse') end @@ -90,16 +91,16 @@ class EdgeController2 < EdgeController RailsEdgeTest::Dsl.execute! - expect(File.exists? expected_filepath).to be true + expect(File.exist?(expected_filepath)).to be true end - it "creates a file with the expected contents" do + it 'creates a file with the expected contents' do Module.new do extend RailsEdgeTest::Dsl controller Namespace::EdgeController do action :simple do - edge "elm" do + edge 'elm' do perform_get produce_elm_file('MyResponse') end @@ -124,13 +125,13 @@ module Edge.Namespace.EdgeController.MyResponse exposing (json) ELM end - it "properly escapes the json string" do + it 'properly escapes the json string' do Module.new do extend RailsEdgeTest::Dsl controller Namespace::EdgeController do action :escape do - edge "elm" do + edge 'elm' do perform_get produce_elm_file('MyResponse') end @@ -155,13 +156,13 @@ module Edge.Namespace.EdgeController.MyResponse exposing (json) ELM end - it "can grab the json out of an instance variable" do + it 'can grab the json out of an instance variable' do Module.new do extend RailsEdgeTest::Dsl controller Namespace::EdgeController do action :ivar do - edge "elm" do + edge 'elm' do perform_get produce_elm_file('MyResponse', ivar: :@page_data) end @@ -186,13 +187,13 @@ module Edge.Namespace.EdgeController.MyResponse exposing (json) ELM end - it "can correctly renders ivars containing objects that define as_json " do + it 'can correctly renders ivars containing objects that define as_json' do Module.new do extend RailsEdgeTest::Dsl controller Namespace::EdgeController do action :ivar_requires_as_json do - edge "elm" do + edge 'elm' do perform_get produce_elm_file('MyResponse', ivar: :@page_data) end @@ -220,8 +221,8 @@ module Edge.Namespace.EdgeController.MyResponse exposing (json) end end - describe "a method defined within an action block" do - it "is callable within an edge block inside that action block" do + describe 'a method defined within an action block' do + it 'is callable within an edge block inside that action block' do test_value = nil Module.new do @@ -233,7 +234,7 @@ def christina 'genie in a bottle' end - edge "call method" do + edge 'call method' do test_value = christina end end @@ -245,7 +246,7 @@ def christina expect(test_value).to eq 'genie in a bottle' end - it "is callable with arguments and optional block" do + it 'is callable with arguments and optional block' do test_value = nil block_test_value = nil @@ -255,11 +256,11 @@ def christina controller Namespace::EdgeController do action :simple do def christina(what, &block) - block.call(what) if block + block&.call(what) "#{what} in a bottle" end - edge "call method" do + edge 'call method' do # verify it works without a block christina('genie') @@ -278,7 +279,7 @@ def christina(what, &block) expect(block_test_value).to eq 'genie' end - it "is not callable within a different action block" do + it 'is not callable within a different action block' do Module.new do extend RailsEdgeTest::Dsl @@ -288,24 +289,24 @@ def christina 'genie in a bottle' end - edge "call method" do + edge 'call method' do christina end end action :simple do - edge "invalid" do + edge 'invalid' do christina end end end end - expect { + expect do RailsEdgeTest::Dsl.execute! - }.to raise_error(NameError, /christina/) + end.to raise_error(NameError, /christina/) end - it "is callable from a let block" do + it 'is callable from a let block' do test_value = nil Module.new do @@ -319,7 +320,7 @@ def christina let(:gaga) { christina.gsub('genie', 'dance') } - edge "callable from let" do + edge 'callable from let' do test_value = gaga end end @@ -332,8 +333,8 @@ def christina end end - describe "a method defined within a controller block" do - it "is callable within an edge block inside that controller block" do + describe 'a method defined within a controller block' do + it 'is callable within an edge block inside that controller block' do test_value = nil Module.new do @@ -345,7 +346,7 @@ def christina end action :simple do - edge "call method" do + edge 'call method' do test_value = christina end end @@ -357,7 +358,7 @@ def christina expect(test_value).to eq 'genie in a bottle' end - it "allows to be called from multiple actions" do + it 'allows to be called from multiple actions' do first_result = second_result = nil Module.new do @@ -369,13 +370,13 @@ def christina end action :first do - edge "call method" do + edge 'call method' do first_result = christina end end action :second do - edge "call method" do + edge 'call method' do second_result = christina end end @@ -388,7 +389,7 @@ def christina expect(second_result).to eq 'genie in a bottle' end - it "allows to be overridden by a method defined in the action" do + it 'allows to be overridden by a method defined in the action' do test_value = nil Module.new do @@ -404,7 +405,7 @@ def christina 'genie in a lamp' end - edge "call let" do + edge 'call let' do test_value = christina end end @@ -416,7 +417,7 @@ def christina expect(test_value).to eq 'genie in a lamp' end - it "allows let blocks inside an action to reference methods inside a controller" do + it 'allows let blocks inside an action to reference methods inside a controller' do test_value = nil Module.new do @@ -428,9 +429,9 @@ def christina end action :first do - let(:christie) { christina + ' and a lamp' } + let(:christie) { "#{christina} and a lamp" } - edge "call method" do + edge 'call method' do test_value = christie end end @@ -455,14 +456,14 @@ def christina controller Namespace::EdgeController2 do action :first do - edge "call method" do + edge 'call method' do christina end end end end - expect{ RailsEdgeTest::Dsl.execute! }.to raise_error(NameError, /christina/) + expect { RailsEdgeTest::Dsl.execute! }.to raise_error(NameError, /christina/) end it "can't be referenced across actions" do @@ -476,20 +477,20 @@ def christina 'genie in a bottle' end - edge "call method" do + edge 'call method' do test_value = christina end end action :second do - edge "call method with failure" do + edge 'call method with failure' do christina end end end end - expect{ RailsEdgeTest::Dsl.execute! }.to raise_error(NameError, /christina/) + expect { RailsEdgeTest::Dsl.execute! }.to raise_error(NameError, /christina/) expect(test_value).to eq('genie in a bottle') end end diff --git a/spec/rails_edge_test/dsl/let_handler_spec.rb b/spec/rails_edge_test/dsl/let_handler_spec.rb index f391b7f..8f92112 100644 --- a/spec/rails_edge_test/dsl/let_handler_spec.rb +++ b/spec/rails_edge_test/dsl/let_handler_spec.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + require 'rails_helper' class LetHandlerController < ActionController::Base def simple - render json: {my: 'response'} + render json: { my: 'response' } end end @@ -12,6 +14,7 @@ def simple get 'test/simple' => 'let_handler#simple' end end + after(:all) do Rails.application.reload_routes! end @@ -20,8 +23,8 @@ def simple RailsEdgeTest::Dsl.reset! end - describe "a let block defined within an action block" do - it "is callable within an edge block inside that action block" do + describe 'a let block defined within an action block' do + it 'is callable within an edge block inside that action block' do test_value = nil Module.new do @@ -30,7 +33,7 @@ def simple controller LetHandlerController do action :simple do let(:christina) { 'genie in a bottle' } - edge "call let" do + edge 'call let' do test_value = christina end end @@ -42,31 +45,31 @@ def simple expect(test_value).to eq 'genie in a bottle' end - it "is not callable within a different action block" do + it 'is not callable within a different action block' do Module.new do extend RailsEdgeTest::Dsl controller LetHandlerController do action :simple do let(:christina) { 'genie in a bottle' } - edge "call let" do + edge 'call let' do christina end end action :simple do - edge "invalid" do + edge 'invalid' do christina end end end end - expect { + expect do RailsEdgeTest::Dsl.execute! - }.to raise_error(NameError, /christina/) + end.to raise_error(NameError, /christina/) end - it "is callable from another let block" do + it 'is callable from another let block' do test_value = nil Module.new do @@ -76,7 +79,7 @@ def simple action :simple do let(:christina) { 'genie in the dark' } let(:gaga) { christina.gsub('genie', 'dance') } - edge "cascade let" do + edge 'cascade let' do test_value = gaga end end @@ -88,7 +91,7 @@ def simple expect(test_value).to eq 'dance in the dark' end - it "is executed on the first call and then cached" do + it 'is executed on the first call and then cached' do test_value_one = nil test_value_two = nil value = 5 @@ -99,7 +102,7 @@ def simple controller LetHandlerController do action :simple do let(:christina) { value *= 5 } - edge "call let twice" do + edge 'call let twice' do test_value_one = christina test_value_two = christina end @@ -115,8 +118,8 @@ def simple end end - describe "a let block defined within a controller block" do - it "is callable within an edge block inside that controller block" do + describe 'a let block defined within a controller block' do + it 'is callable within an edge block inside that controller block' do test_value = nil Module.new do @@ -125,7 +128,7 @@ def simple controller LetHandlerController do let(:christina) { 'genie in a bottle' } action :simple do - edge "call let" do + edge 'call let' do test_value = christina end end @@ -137,7 +140,7 @@ def simple expect(test_value).to eq 'genie in a bottle' end - it "allows to be called from multiple actions" do + it 'allows to be called from multiple actions' do first_result = second_result = nil Module.new do @@ -146,12 +149,12 @@ def simple controller LetHandlerController do let(:christina) { 'genie in a bottle' } action :first do - edge "call let" do + edge 'call let' do first_result = christina end end action :second do - edge "call let" do + edge 'call let' do second_result = christina end end @@ -164,7 +167,7 @@ def simple expect(second_result).to eq 'genie in a bottle' end - it "allows to be overridden by a let defined in the action" do + it 'allows to be overridden by a let defined in the action' do test_value = nil Module.new do @@ -174,7 +177,7 @@ def simple let(:christina) { 'genie in a bottle' } action :first do let(:christina) { 'genie in a lamp' } - edge "call let" do + edge 'call let' do test_value = christina end end @@ -186,7 +189,7 @@ def simple expect(test_value).to eq 'genie in a lamp' end - it "allows let blocks inside an action to reference let blocks inside a controller" do + it 'allows let blocks inside an action to reference let blocks inside a controller' do test_value = nil Module.new do @@ -195,8 +198,8 @@ def simple controller LetHandlerController do let(:christina) { 'genie in a bottle' } action :first do - let(:christie) { christina + ' and a lamp' } - edge "call let" do + let(:christie) { "#{christina} and a lamp" } + edge 'call let' do test_value = christie end end @@ -209,7 +212,7 @@ def simple end end - describe "a generate block" do + describe 'a generate block' do it "is the same as a let block, but prefixed by 'generate_' when called" do test_value = nil @@ -219,7 +222,7 @@ def simple controller LetHandlerController do action :simple do generate(:duet) { 'do what you want' } - edge "call generate" do + edge 'call generate' do test_value = generate_duet end end diff --git a/spec/rails_edge_test/dsl_spec.rb b/spec/rails_edge_test/dsl_spec.rb index 0c78dbe..d351fb4 100644 --- a/spec/rails_edge_test/dsl_spec.rb +++ b/spec/rails_edge_test/dsl_spec.rb @@ -1,30 +1,32 @@ +# frozen_string_literal: true + require 'rails_helper' class MyController < ActionController::Base def simple - render json: {my: 'response'} + render json: { my: 'response' } end def complex if request.xhr? - render json: {local: 'info', params: params, session: session.to_h} + render json: { local: 'info', params: params, session: session.to_h } else redirect_to '/' end end def post_action - render json: {hello: 'world'} + render json: { hello: 'world' } end def delete_action - render json: {this: 'deletes'} + render json: { this: 'deletes' } end end AnotherController = Class.new ActionController::Base do def another - render json: {another: 'response'} + render json: { another: 'response' } end end @@ -39,6 +41,7 @@ def another get 'test/another' => 'another#another' end end + after(:all) do Rails.application.reload_routes! end @@ -47,9 +50,8 @@ def another RailsEdgeTest::Dsl.reset! end - context "within an edge" do - - it "has access to an instance of the specific controller" do + context 'within an edge' do + it 'has access to an instance of the specific controller' do test_value = nil Module.new do @@ -57,7 +59,7 @@ def another controller MyController do action :simple do - edge "do very little" do + edge 'do very little' do test_value = controller end end @@ -69,7 +71,7 @@ def another expect(test_value).to be_a MyController end - it "has access to a Request object" do + it 'has access to a Request object' do test_value = nil Module.new do @@ -77,7 +79,7 @@ def another controller MyController do action :simple do - edge "do very little" do + edge 'do very little' do test_value = request end end @@ -89,7 +91,7 @@ def another expect(test_value).to be_a ActionController::TestRequest end - it "has access to a Session object" do + it 'has access to a Session object' do test_value = nil Module.new do @@ -97,7 +99,7 @@ def another controller MyController do action :simple do - edge "set the session" do + edge 'set the session' do test_value = session session[:beyonce] = 'run the world' end @@ -111,7 +113,7 @@ def another expect(test_value[:beyonce]).to eq 'run the world' end - it "can perform a get request" do + it 'can perform a get request' do test_value = nil Module.new do @@ -119,7 +121,7 @@ def another controller MyController do action :simple do - edge "get :simple" do + edge 'get :simple' do test_value = perform_get end end @@ -131,10 +133,10 @@ def another expect(test_value[0]).to eq 200 expect(test_value[1]).to be_a Hash expect(test_value[2]).to be_a ActionDispatch::Response::RackBody - expect(test_value[2].body).to eq({my: 'response'}.to_json) + expect(test_value[2].body).to eq({ my: 'response' }.to_json) end - it "can perform a post request" do + it 'can perform a post request' do test_value = nil Module.new do @@ -142,7 +144,7 @@ def another controller MyController do action :post_action do - edge "post :post_action" do + edge 'post :post_action' do test_value = perform_post end end @@ -154,10 +156,10 @@ def another expect(test_value[0]).to eq 200 expect(test_value[1]).to be_a Hash expect(test_value[2]).to be_a ActionDispatch::Response::RackBody - expect(test_value[2].body).to eq({hello: 'world'}.to_json) + expect(test_value[2].body).to eq({ hello: 'world' }.to_json) end - it "can perform a delete request" do + it 'can perform a delete request' do test_value = nil Module.new do @@ -165,7 +167,7 @@ def another controller MyController do action :delete_action do - edge "delete :delete_action" do + edge 'delete :delete_action' do test_value = perform_delete end end @@ -177,10 +179,10 @@ def another expect(test_value[0]).to eq 200 expect(test_value[1]).to be_a Hash expect(test_value[2]).to be_a ActionDispatch::Response::RackBody - expect(test_value[2].body).to eq({this: 'deletes'}.to_json) + expect(test_value[2].body).to eq({ this: 'deletes' }.to_json) end - it "can set authenticity token for the request" do + it 'can set authenticity token for the request' do test_request = nil Module.new do @@ -188,7 +190,7 @@ def another controller MyController do action :simple do - edge "set the authenticity token" do + edge 'set the authenticity token' do test_request = request set_authenticity_token @@ -203,12 +205,12 @@ def another expect(test_request.headers['X-CSRF-Token']).to eq 'a_test_token' end - it "can incorporate request, session, and params when making a request" do + it 'can incorporate request, session, and params when making a request' do test_value = nil expected_value = { local: 'info', - params: {adele: 'hello', controller: 'my', action: 'complex'}, - session: {britney: 'toxic'} + params: { adele: 'hello', controller: 'my', action: 'complex' }, + session: { britney: 'toxic' } } Module.new do @@ -216,8 +218,8 @@ def another controller MyController do action :complex do - edge "get :complex" do - request.headers["HTTP_X_REQUESTED_WITH"] = "XMLHttpRequest" + edge 'get :complex' do + request.headers['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest' session[:britney] = 'toxic' test_value = perform_get(adele: 'hello') end @@ -233,7 +235,7 @@ def another expect(test_value[2].body).to eq(expected_value.to_json) end - it "will execute multiple edges on the same action" do + it 'executes multiple edges on the same action' do test_value_one = nil test_value_two = nil @@ -242,11 +244,11 @@ def another controller MyController do action :simple do - edge "get :simple" do + edge 'get :simple' do test_value_one = perform_get end - edge "just looking" do + edge 'just looking' do test_value_two = controller end end @@ -255,11 +257,11 @@ def another RailsEdgeTest::Dsl.execute! - expect(test_value_one[2].body).to eq({my: 'response'}.to_json) + expect(test_value_one[2].body).to eq({ my: 'response' }.to_json) expect(test_value_two).to be_a MyController end - it "will execute multiple edges on different actions" do + it 'executes multiple edges on different actions' do test_value_one = nil test_value_two = nil @@ -268,13 +270,13 @@ def another controller MyController do action :simple do - edge "get :simple" do + edge 'get :simple' do test_value_one = perform_get end end action :complex do - edge "redirecting" do + edge 'redirecting' do test_value_two = perform_get end end @@ -283,11 +285,11 @@ def another RailsEdgeTest::Dsl.execute! - expect(test_value_one[2].body).to eq({my: 'response'}.to_json) + expect(test_value_one[2].body).to eq({ my: 'response' }.to_json) expect(test_value_two[0]).to eq 302 end - it "will execute multiple edges on different controllers" do + it 'executes multiple edges on different controllers' do test_value_one = nil test_value_two = nil @@ -296,7 +298,7 @@ def another controller MyController do action :simple do - edge "get :simple" do + edge 'get :simple' do test_value_one = perform_get end end @@ -308,7 +310,7 @@ def another controller AnotherController do action :another do - edge "get :another" do + edge 'get :another' do test_value_two = perform_get end end @@ -317,8 +319,8 @@ def another RailsEdgeTest::Dsl.execute! - expect(test_value_one[2].body).to eq({my: 'response'}.to_json) - expect(test_value_two[2].body).to eq({another: 'response'}.to_json) + expect(test_value_one[2].body).to eq({ my: 'response' }.to_json) + expect(test_value_two[2].body).to eq({ another: 'response' }.to_json) end end end diff --git a/spec/rails_edge_test/runner_spec.rb b/spec/rails_edge_test/runner_spec.rb index 0cccb79..1ef6bdd 100644 --- a/spec/rails_edge_test/runner_spec.rb +++ b/spec/rails_edge_test/runner_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe RailsEdgeTest::Runner do @@ -18,15 +20,14 @@ end end - - it "creates the files with the expected contents" do - expect(File.exists? expected_home_filepath).to be false - expect(File.exists? expected_other_filepath).to be false + it 'creates the files with the expected contents' do + expect(File.exist?(expected_home_filepath)).to be false + expect(File.exist?(expected_other_filepath)).to be false RailsEdgeTest::Runner.go! - expect(File.exists? expected_home_filepath).to be true - expect(File.exists? expected_other_filepath).to be true + expect(File.exist?(expected_home_filepath)).to be true + expect(File.exist?(expected_other_filepath)).to be true elm = File.open(expected_home_filepath, 'r').read(nil) expect(elm).to eq(<<~ELM) @@ -43,15 +44,15 @@ module Edge.ApplicationController.Home exposing (json) ELM end - it "only creates files that match the args" do - expect(File.exists? expected_home_filepath).to be false - expect(File.exists? expected_other_filepath).to be false + it 'only creates files that match the args' do + expect(File.exist?(expected_home_filepath)).to be false + expect(File.exist?(expected_other_filepath)).to be false # Provide filepath relative to edge_root_path - RailsEdgeTest::Runner.go!(["spec/support/test_app/edge/another_edge.rb"]) + RailsEdgeTest::Runner.go!(['spec/support/test_app/edge/another_edge.rb']) - expect(File.exists? expected_home_filepath).to be false - expect(File.exists? expected_other_filepath).to be true + expect(File.exist?(expected_home_filepath)).to be false + expect(File.exist?(expected_other_filepath)).to be true elm = File.open(expected_other_filepath, 'r').read(nil) expect(elm).to eq(<<~ELM) @@ -68,15 +69,15 @@ module Edge.ApplicationController.Another exposing (json) ELM end - it "allows full paths for creating files" do - expect(File.exists? expected_home_filepath).to be false - expect(File.exists? expected_other_filepath).to be false + it 'allows full paths for creating files' do + expect(File.exist?(expected_home_filepath)).to be false + expect(File.exist?(expected_other_filepath)).to be false # Provide full filepath relative to root - RailsEdgeTest::Runner.go!(["spec/support/test_app/edge/another_edge.rb"]) + RailsEdgeTest::Runner.go!(['spec/support/test_app/edge/another_edge.rb']) - expect(File.exists? expected_home_filepath).to be false - expect(File.exists? expected_other_filepath).to be true + expect(File.exist?(expected_home_filepath)).to be false + expect(File.exist?(expected_other_filepath)).to be true elm = File.open(expected_other_filepath, 'r').read(nil) expect(elm).to eq(<<~ELM) diff --git a/spec/rails_edge_test_spec.rb b/spec/rails_edge_test_spec.rb index 1d9d277..9d5639b 100644 --- a/spec/rails_edge_test_spec.rb +++ b/spec/rails_edge_test_spec.rb @@ -1,7 +1,9 @@ -require "spec_helper" +# frozen_string_literal: true + +require 'spec_helper' RSpec.describe RailsEdgeTest do - it "has a version number" do - expect(RailsEdgeTest::VERSION).not_to be nil + it 'has a version number' do + expect(RailsEdgeTest::VERSION).not_to be_nil end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 2b3116d..1b8ac86 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + # This file (and the related Rails app) constructed with the help of # https://stackoverflow.com/a/33929321 -ENV["RAILS_ENV"] = 'test' +ENV['RAILS_ENV'] = 'test' require 'support/test_app/config/environment' require 'spec_helper' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9d01ddc..57db00d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,11 @@ -require "bundler/setup" -require "rails_edge_test" +# frozen_string_literal: true + +require 'bundler/setup' +require 'rails_edge_test' RSpec.configure do |config| # Enable flags like --only-failures and --next-failure - config.example_status_persistence_file_path = ".rspec_status" + config.example_status_persistence_file_path = '.rspec_status' config.expect_with :rspec do |c| c.syntax = :expect diff --git a/spec/support/test_app/Gemfile b/spec/support/test_app/Gemfile index 37f6384..11143f2 100644 --- a/spec/support/test_app/Gemfile +++ b/spec/support/test_app/Gemfile @@ -1,5 +1,6 @@ -source 'https://rubygems.org' +# frozen_string_literal: true +source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.0' diff --git a/spec/support/test_app/Rakefile b/spec/support/test_app/Rakefile index ba6b733..e51cf0e 100644 --- a/spec/support/test_app/Rakefile +++ b/spec/support/test_app/Rakefile @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require File.expand_path('config/application', __dir__) Rails.application.load_tasks diff --git a/spec/support/test_app/app/controllers/application_controller.rb b/spec/support/test_app/app/controllers/application_controller.rb index 569253d..a16321e 100644 --- a/spec/support/test_app/app/controllers/application_controller.rb +++ b/spec/support/test_app/app/controllers/application_controller.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception def home - render json: {example: 'data'} + render json: { example: 'data' } end end diff --git a/spec/support/test_app/bin/bundle b/spec/support/test_app/bin/bundle index 66e9889..2dbb717 100755 --- a/spec/support/test_app/bin/bundle +++ b/spec/support/test_app/bin/bundle @@ -1,3 +1,5 @@ #!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +# frozen_string_literal: true + +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle') diff --git a/spec/support/test_app/bin/rails b/spec/support/test_app/bin/rails index 0138d79..3504c3f 100755 --- a/spec/support/test_app/bin/rails +++ b/spec/support/test_app/bin/rails @@ -1,9 +1,11 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + begin - load File.expand_path('../spring', __FILE__) + load File.expand_path('spring', __dir__) rescue LoadError => e raise unless e.message.include?('spring') end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/spec/support/test_app/bin/rake b/spec/support/test_app/bin/rake index d87d5f5..1fe6cf0 100755 --- a/spec/support/test_app/bin/rake +++ b/spec/support/test_app/bin/rake @@ -1,6 +1,8 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + begin - load File.expand_path('../spring', __FILE__) + load File.expand_path('spring', __dir__) rescue LoadError => e raise unless e.message.include?('spring') end diff --git a/spec/support/test_app/bin/setup b/spec/support/test_app/bin/setup index acdb2c1..0a3b26f 100755 --- a/spec/support/test_app/bin/setup +++ b/spec/support/test_app/bin/setup @@ -1,16 +1,18 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + require 'pathname' # path to your application root. -APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +APP_ROOT = Pathname.new File.expand_path('..', __dir__) Dir.chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file: - puts "== Installing dependencies ==" - system "gem install bundler --conservative" - system "bundle check || bundle install" + puts '== Installing dependencies ==' + system 'gem install bundler --conservative' + system 'bundle check || bundle install' # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") @@ -18,12 +20,12 @@ Dir.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system "bin/rake db:setup" + system 'bin/rake db:setup' puts "\n== Removing old logs and tempfiles ==" - system "rm -f log/*" - system "rm -rf tmp/cache" + system 'rm -f log/*' + system 'rm -rf tmp/cache' puts "\n== Restarting application server ==" - system "touch tmp/restart.txt" + system 'touch tmp/restart.txt' end diff --git a/spec/support/test_app/bin/spring b/spec/support/test_app/bin/spring index fb2ec2e..9bd27ec 100755 --- a/spec/support/test_app/bin/spring +++ b/spec/support/test_app/bin/spring @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true # This file loads spring without using Bundler, in order to be fast. # It gets overwritten when you run the `spring binstub` command. @@ -8,7 +9,7 @@ unless defined?(Spring) require 'bundler' lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) - spring = lockfile.specs.detect { |spec| spec.name == "spring" } + spring = lockfile.specs.detect { |spec| spec.name == 'spring' } if spring Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path gem 'spring', spring.version diff --git a/spec/support/test_app/config.ru b/spec/support/test_app/config.ru index bd83b25..afd13e2 100644 --- a/spec/support/test_app/config.ru +++ b/spec/support/test_app/config.ru @@ -1,4 +1,6 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require File.expand_path('config/environment', __dir__) run Rails.application diff --git a/spec/support/test_app/config/application.rb b/spec/support/test_app/config/application.rb index 6e47915..4b42719 100644 --- a/spec/support/test_app/config/application.rb +++ b/spec/support/test_app/config/application.rb @@ -1,4 +1,6 @@ -require File.expand_path('../boot', __FILE__) +# frozen_string_literal: true + +require File.expand_path('boot', __dir__) require 'rails/all' diff --git a/spec/support/test_app/config/boot.rb b/spec/support/test_app/config/boot.rb index 6b750f0..30e594e 100644 --- a/spec/support/test_app/config/boot.rb +++ b/spec/support/test_app/config/boot.rb @@ -1,3 +1,5 @@ -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +# frozen_string_literal: true + +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/spec/support/test_app/config/environment.rb b/spec/support/test_app/config/environment.rb index ee8d90d..32d57aa 100644 --- a/spec/support/test_app/config/environment.rb +++ b/spec/support/test_app/config/environment.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + # Load the Rails application. -require File.expand_path('../application', __FILE__) +require File.expand_path('application', __dir__) # Initialize the Rails application. Rails.application.initialize! diff --git a/spec/support/test_app/config/environments/development.rb b/spec/support/test_app/config/environments/development.rb index b55e214..b67a201 100644 --- a/spec/support/test_app/config/environments/development.rb +++ b/spec/support/test_app/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/spec/support/test_app/config/environments/production.rb b/spec/support/test_app/config/environments/production.rb index 5c1b32e..254b7c2 100644 --- a/spec/support/test_app/config/environments/production.rb +++ b/spec/support/test_app/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. @@ -72,7 +74,7 @@ config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false diff --git a/spec/support/test_app/config/environments/test.rb b/spec/support/test_app/config/environments/test.rb index 1c19f08..2e26201 100644 --- a/spec/support/test_app/config/environments/test.rb +++ b/spec/support/test_app/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/spec/support/test_app/config/initializers/backtrace_silencers.rb b/spec/support/test_app/config/initializers/backtrace_silencers.rb index 59385cd..4b63f28 100644 --- a/spec/support/test_app/config/initializers/backtrace_silencers.rb +++ b/spec/support/test_app/config/initializers/backtrace_silencers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. diff --git a/spec/support/test_app/config/initializers/cookies_serializer.rb b/spec/support/test_app/config/initializers/cookies_serializer.rb index 7f70458..0a23b25 100644 --- a/spec/support/test_app/config/initializers/cookies_serializer.rb +++ b/spec/support/test_app/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. Rails.application.config.action_dispatch.cookies_serializer = :json diff --git a/spec/support/test_app/config/initializers/filter_parameter_logging.rb b/spec/support/test_app/config/initializers/filter_parameter_logging.rb index 4a994e1..7a4f47b 100644 --- a/spec/support/test_app/config/initializers/filter_parameter_logging.rb +++ b/spec/support/test_app/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/spec/support/test_app/config/initializers/inflections.rb b/spec/support/test_app/config/initializers/inflections.rb index ac033bf..dc84742 100644 --- a/spec/support/test_app/config/initializers/inflections.rb +++ b/spec/support/test_app/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/spec/support/test_app/config/initializers/mime_types.rb b/spec/support/test_app/config/initializers/mime_types.rb index dc18996..be6fedc 100644 --- a/spec/support/test_app/config/initializers/mime_types.rb +++ b/spec/support/test_app/config/initializers/mime_types.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/spec/support/test_app/config/initializers/session_store.rb b/spec/support/test_app/config/initializers/session_store.rb index 438994f..751554c 100644 --- a/spec/support/test_app/config/initializers/session_store.rb +++ b/spec/support/test_app/config/initializers/session_store.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_test_app_session' diff --git a/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb b/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb index 8674be3..e1e6c75 100644 --- a/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb +++ b/spec/support/test_app/config/initializers/to_time_preserves_timezone.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Preserve the timezone of the receiver when calling to `to_time`. diff --git a/spec/support/test_app/config/initializers/wrap_parameters.rb b/spec/support/test_app/config/initializers/wrap_parameters.rb index 33725e9..246168a 100644 --- a/spec/support/test_app/config/initializers/wrap_parameters.rb +++ b/spec/support/test_app/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/spec/support/test_app/config/routes.rb b/spec/support/test_app/config/routes.rb index ac139c0..9f11b47 100644 --- a/spec/support/test_app/config/routes.rb +++ b/spec/support/test_app/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Rails.application.routes.draw do root to: 'application#home' end diff --git a/spec/support/test_app/db/seeds.rb b/spec/support/test_app/db/seeds.rb index 4edb1e8..1e7cc80 100644 --- a/spec/support/test_app/db/seeds.rb +++ b/spec/support/test_app/db/seeds.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # diff --git a/spec/support/test_app/edge/another_edge.rb b/spec/support/test_app/edge/another_edge.rb index 9c3535e..a256168 100644 --- a/spec/support/test_app/edge/another_edge.rb +++ b/spec/support/test_app/edge/another_edge.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + include RailsEdgeTest::Dsl controller ApplicationController do action :home do - edge "write elm file" do + edge 'write elm file' do perform_get produce_elm_file('Another') end diff --git a/spec/support/test_app/edge/example_edge.rb b/spec/support/test_app/edge/example_edge.rb index 118804f..4c6b0b3 100644 --- a/spec/support/test_app/edge/example_edge.rb +++ b/spec/support/test_app/edge/example_edge.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + include RailsEdgeTest::Dsl controller ApplicationController do action :home do - edge "write elm file" do + edge 'write elm file' do perform_get produce_elm_file('Home') end From a2c8cc01052128b2dc44aabf316f24d73828a94b Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:06:31 +0100 Subject: [PATCH 06/12] resolve Gemspec/DevelopmentDependencies --- .rubocop_todo.yml | 8 -------- Gemfile | 5 +++++ rails_edge_test.gemspec | 5 ----- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f840f63..af631e4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,14 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 5 -# Configuration parameters: EnforcedStyle, AllowedGems, Include. -# SupportedStyles: Gemfile, gems.rb, gemspec -# Include: **/*.gemspec, **/Gemfile, **/gems.rb -Gemspec/DevelopmentDependencies: - Exclude: - - 'rails_edge_test.gemspec' - # Offense count: 1 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. diff --git a/Gemfile b/Gemfile index 11cccf1..795bd5a 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,11 @@ source 'https://rubygems.org' # Specify your gem's dependencies in rails_edge_test.gemspec gemspec +gem 'appraisal', '~> 2.3' +gem 'rails', '>= 5.2', '< 7.1.0' +gem 'rake', '~> 13.0' +gem 'rspec', '~> 3.9' gem 'rubocop' gem 'rubocop-rake' gem 'rubocop-rspec' +gem 'sqlite3', '~> 2.0.4' diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index a828fec..a338767 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -25,10 +25,5 @@ Gem::Specification.new do |spec| spec.add_dependency 'actionpack', '>= 5.2.0', '< 7.1.0' spec.required_ruby_version = '>= 3.0.0' - spec.add_development_dependency 'appraisal', '~> 2.3' - spec.add_development_dependency 'rails', '>= 5.2', '< 7.1.0' - spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec', '~> 3.9' - spec.add_development_dependency 'sqlite3', '~> 2.0.4' spec.metadata['rubygems_mfa_required'] = 'true' end From 56491cb0c13ff08cf8bac8eae1d9ee5ababc9c80 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:11:14 +0100 Subject: [PATCH 07/12] resolve Lint/SuppressedException --- .rubocop_todo.yml | 7 ------- spec/rails_edge_test/dsl/edge_spec.rb | 5 +---- spec/rails_edge_test/runner_spec.rb | 5 +---- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index af631e4..88f8153 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,13 +14,6 @@ Layout/LineLength: Exclude: - 'rails_edge_test.gemspec' -# Offense count: 2 -# Configuration parameters: AllowComments, AllowNil. -Lint/SuppressedException: - Exclude: - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/runner_spec.rb' - # Offense count: 1 RSpec/AnyInstance: Exclude: diff --git a/spec/rails_edge_test/dsl/edge_spec.rb b/spec/rails_edge_test/dsl/edge_spec.rb index 986fd91..f13e4c5 100644 --- a/spec/rails_edge_test/dsl/edge_spec.rb +++ b/spec/rails_edge_test/dsl/edge_spec.rb @@ -55,10 +55,7 @@ class EdgeController2 < EdgeController end # ensure the elm_path directory always starts empty - begin - FileUtils.remove_entry_secure(File.join(elm_path, 'Edge')) - rescue Errno::ENOENT - end + FileUtils.rm_rf(File.join(elm_path, 'Edge')) end let(:elm_path) { File.expand_path('../../tmp', File.dirname(__FILE__)) } diff --git a/spec/rails_edge_test/runner_spec.rb b/spec/rails_edge_test/runner_spec.rb index 1ef6bdd..f960eba 100644 --- a/spec/rails_edge_test/runner_spec.rb +++ b/spec/rails_edge_test/runner_spec.rb @@ -14,10 +14,7 @@ end # ensure the elm_path directory always starts empty - begin - FileUtils.remove_entry_secure(File.join(elm_path, 'Edge')) - rescue Errno::ENOENT - end + FileUtils.rm_rf(elm_path.join('Edge')) end it 'creates the files with the expected contents' do From 00d6d32998ea0dcb977670bb3a93088ce1741eac Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:30:01 +0100 Subject: [PATCH 08/12] inline rspec/anyinstance todo --- .rubocop_todo.yml | 5 ----- spec/rails_edge_test/dsl_spec.rb | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 88f8153..15b2595 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,11 +14,6 @@ Layout/LineLength: Exclude: - 'rails_edge_test.gemspec' -# Offense count: 1 -RSpec/AnyInstance: - Exclude: - - 'spec/rails_edge_test/dsl_spec.rb' - # Offense count: 8 RSpec/BeforeAfterAll: Exclude: diff --git a/spec/rails_edge_test/dsl_spec.rb b/spec/rails_edge_test/dsl_spec.rb index d351fb4..cabfea2 100644 --- a/spec/rails_edge_test/dsl_spec.rb +++ b/spec/rails_edge_test/dsl_spec.rb @@ -199,7 +199,7 @@ def another end end - allow_any_instance_of(MyController).to receive(:form_authenticity_token).and_return('a_test_token') + allow_any_instance_of(MyController).to receive(:form_authenticity_token).and_return('a_test_token') # rubocop:disable RSpec/AnyInstance RailsEdgeTest::Dsl.execute! expect(test_request.headers['X-CSRF-Token']).to eq 'a_test_token' From 73909abdb5aa1f9b476217ab7e5977494fc8704f Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:32:35 +0100 Subject: [PATCH 09/12] inline RSpec/BeforeAfterAll --- .rubocop_todo.yml | 11 ----------- spec/rails_edge_test/configuration_spec.rb | 2 ++ spec/rails_edge_test/dsl/edge_spec.rb | 2 ++ spec/rails_edge_test/dsl/let_handler_spec.rb | 2 ++ spec/rails_edge_test/dsl_spec.rb | 2 ++ 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 15b2595..863de28 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,17 +14,6 @@ Layout/LineLength: Exclude: - 'rails_edge_test.gemspec' -# Offense count: 8 -RSpec/BeforeAfterAll: - Exclude: - - '**/spec/spec_helper.rb' - - '**/spec/rails_helper.rb' - - '**/spec/support/**/*.rb' - - 'spec/rails_edge_test/configuration_spec.rb' - - 'spec/rails_edge_test/dsl/edge_spec.rb' - - 'spec/rails_edge_test/dsl/let_handler_spec.rb' - - 'spec/rails_edge_test/dsl_spec.rb' - # Offense count: 1 # Configuration parameters: Prefixes, AllowedPatterns. # Prefixes: when, with, without diff --git a/spec/rails_edge_test/configuration_spec.rb b/spec/rails_edge_test/configuration_spec.rb index b8e60f0..c2cb6f7 100644 --- a/spec/rails_edge_test/configuration_spec.rb +++ b/spec/rails_edge_test/configuration_spec.rb @@ -11,6 +11,7 @@ def simple end RSpec.describe RailsEdgeTest::Configuration do + # rubocop:disable RSpec/BeforeAfterAll before(:all) do Rails.application.routes.draw do get 'test/simple' => 'namespace/edge#simple' @@ -20,6 +21,7 @@ def simple after(:all) do Rails.application.reload_routes! end + # rubocop:enable RSpec/BeforeAfterAll before do RailsEdgeTest::Dsl.reset! diff --git a/spec/rails_edge_test/dsl/edge_spec.rb b/spec/rails_edge_test/dsl/edge_spec.rb index f13e4c5..60d0363 100644 --- a/spec/rails_edge_test/dsl/edge_spec.rb +++ b/spec/rails_edge_test/dsl/edge_spec.rb @@ -34,6 +34,7 @@ class EdgeController2 < EdgeController end RSpec.describe RailsEdgeTest::Dsl::Edge do + # rubocop:disable RSpec/BeforeAfterAll before(:all) do Rails.application.routes.draw do get 'test/simple' => 'namespace/edge#simple' @@ -46,6 +47,7 @@ class EdgeController2 < EdgeController after(:all) do Rails.application.reload_routes! end + # rubocop:enable RSpec/BeforeAfterAll before do RailsEdgeTest::Dsl.reset! diff --git a/spec/rails_edge_test/dsl/let_handler_spec.rb b/spec/rails_edge_test/dsl/let_handler_spec.rb index 8f92112..8260b41 100644 --- a/spec/rails_edge_test/dsl/let_handler_spec.rb +++ b/spec/rails_edge_test/dsl/let_handler_spec.rb @@ -9,6 +9,7 @@ def simple end RSpec.describe RailsEdgeTest::Dsl::LetHandler do + # rubocop:disable RSpec/BeforeAfterAll before(:all) do Rails.application.routes.draw do get 'test/simple' => 'let_handler#simple' @@ -18,6 +19,7 @@ def simple after(:all) do Rails.application.reload_routes! end + # rubocop:enable RSpec/BeforeAfterAll before do RailsEdgeTest::Dsl.reset! diff --git a/spec/rails_edge_test/dsl_spec.rb b/spec/rails_edge_test/dsl_spec.rb index cabfea2..b69b7a8 100644 --- a/spec/rails_edge_test/dsl_spec.rb +++ b/spec/rails_edge_test/dsl_spec.rb @@ -31,6 +31,7 @@ def another end RSpec.describe RailsEdgeTest::Dsl do + # rubocop:disable RSpec/BeforeAfterAll before(:all) do Rails.application.routes.draw do get 'test/simple' => 'my#simple' @@ -45,6 +46,7 @@ def another after(:all) do Rails.application.reload_routes! end + # rubocop:enable RSpec/BeforeAfterAll before do RailsEdgeTest::Dsl.reset! From 8b39986e28a346ff7e3548ddc96b407f2caf6edb Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:39:29 +0100 Subject: [PATCH 10/12] resolve a number of other todos --- .rubocop_todo.yml | 31 +++++----------------- lib/rails_edge_test.rb | 4 --- lib/rails_edge_test/dsl/edge.rb | 4 +-- spec/rails_edge_test/dsl_spec.rb | 2 +- spec/rails_edge_test/runner_spec.rb | 25 ----------------- spec/support/test_app/edge/another_edge.rb | 2 +- spec/support/test_app/edge/example_edge.rb | 2 +- 7 files changed, 10 insertions(+), 60 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 863de28..24c982e 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,34 +6,15 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 1 +# Offense count: 2 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. # URISchemes: http, https Layout/LineLength: Exclude: + - 'lib/rails_edge_test/dsl/edge.rb' - 'rails_edge_test.gemspec' -# Offense count: 1 -# Configuration parameters: Prefixes, AllowedPatterns. -# Prefixes: when, with, without -RSpec/ContextWording: - Exclude: - - 'spec/rails_edge_test/dsl_spec.rb' - -# Offense count: 2 -RSpec/RepeatedExample: - Exclude: - - 'spec/rails_edge_test/runner_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Keywords, RequireColon. -# Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE -Style/CommentAnnotation: - Exclude: - - 'lib/rails_edge_test.rb' - # Offense count: 8 # Configuration parameters: AllowedConstants. Style/Documentation: @@ -49,8 +30,8 @@ Style/Documentation: - 'lib/rails_edge_test/printers/tree.rb' - 'lib/rails_edge_test/runner.rb' -# Offense count: 2 -Style/MixinUsage: +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: Exclude: - - 'spec/support/test_app/edge/another_edge.rb' - - 'spec/support/test_app/edge/example_edge.rb' + - 'lib/rails_edge_test/dsl/edge.rb' diff --git a/lib/rails_edge_test.rb b/lib/rails_edge_test.rb index c3ec65a..f59bc15 100644 --- a/lib/rails_edge_test.rb +++ b/lib/rails_edge_test.rb @@ -23,7 +23,3 @@ def configuration @configuration ||= Configuration.new end end - -# TODO: -# - Flesh out the README -# - Refactor LetHelper to define a Module, and include it when necessary diff --git a/lib/rails_edge_test/dsl/edge.rb b/lib/rails_edge_test/dsl/edge.rb index 8a25943..5e2c2dc 100644 --- a/lib/rails_edge_test/dsl/edge.rb +++ b/lib/rails_edge_test/dsl/edge.rb @@ -99,9 +99,7 @@ module Edge.#{full_module_name} exposing (json) private def produce_json(ivar: nil) - unless response - raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' - end + raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' unless response raise 'Request did not result in a successful (2xx) response!' if response.is_a?(Array) && response[0] >= 300 diff --git a/spec/rails_edge_test/dsl_spec.rb b/spec/rails_edge_test/dsl_spec.rb index b69b7a8..a32211d 100644 --- a/spec/rails_edge_test/dsl_spec.rb +++ b/spec/rails_edge_test/dsl_spec.rb @@ -52,7 +52,7 @@ def another RailsEdgeTest::Dsl.reset! end - context 'within an edge' do + context 'when within an edge' do it 'has access to an instance of the specific controller' do test_value = nil diff --git a/spec/rails_edge_test/runner_spec.rb b/spec/rails_edge_test/runner_spec.rb index f960eba..7f21fa0 100644 --- a/spec/rails_edge_test/runner_spec.rb +++ b/spec/rails_edge_test/runner_spec.rb @@ -41,31 +41,6 @@ module Edge.ApplicationController.Home exposing (json) ELM end - it 'only creates files that match the args' do - expect(File.exist?(expected_home_filepath)).to be false - expect(File.exist?(expected_other_filepath)).to be false - - # Provide filepath relative to edge_root_path - RailsEdgeTest::Runner.go!(['spec/support/test_app/edge/another_edge.rb']) - - expect(File.exist?(expected_home_filepath)).to be false - expect(File.exist?(expected_other_filepath)).to be true - - elm = File.open(expected_other_filepath, 'r').read(nil) - expect(elm).to eq(<<~ELM) - module Edge.ApplicationController.Another exposing (json) - - - json : String - json = - """ - { - "example": "data" - } - """ - ELM - end - it 'allows full paths for creating files' do expect(File.exist?(expected_home_filepath)).to be false expect(File.exist?(expected_other_filepath)).to be false diff --git a/spec/support/test_app/edge/another_edge.rb b/spec/support/test_app/edge/another_edge.rb index a256168..39cae1a 100644 --- a/spec/support/test_app/edge/another_edge.rb +++ b/spec/support/test_app/edge/another_edge.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -include RailsEdgeTest::Dsl +include RailsEdgeTest::Dsl # rubocop:disable Style/MixinUsage controller ApplicationController do action :home do diff --git a/spec/support/test_app/edge/example_edge.rb b/spec/support/test_app/edge/example_edge.rb index 4c6b0b3..d7edd50 100644 --- a/spec/support/test_app/edge/example_edge.rb +++ b/spec/support/test_app/edge/example_edge.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -include RailsEdgeTest::Dsl +include RailsEdgeTest::Dsl # rubocop:disable Style/MixinUsage controller ApplicationController do action :home do From 01c71523e4373f3140c29a8059d746097682f2dd Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Wed, 13 Nov 2024 11:42:20 +0100 Subject: [PATCH 11/12] resolve line length --- .rubocop_todo.yml | 15 --------------- lib/rails_edge_test/dsl/edge.rb | 4 +++- rails_edge_test.gemspec | 4 +++- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 24c982e..d79a5b0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -6,15 +6,6 @@ # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. -# URISchemes: http, https -Layout/LineLength: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' - - 'rails_edge_test.gemspec' - # Offense count: 8 # Configuration parameters: AllowedConstants. Style/Documentation: @@ -29,9 +20,3 @@ Style/Documentation: - 'lib/rails_edge_test/printers/silent.rb' - 'lib/rails_edge_test/printers/tree.rb' - 'lib/rails_edge_test/runner.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -Style/IfUnlessModifier: - Exclude: - - 'lib/rails_edge_test/dsl/edge.rb' diff --git a/lib/rails_edge_test/dsl/edge.rb b/lib/rails_edge_test/dsl/edge.rb index 5e2c2dc..8a25943 100644 --- a/lib/rails_edge_test/dsl/edge.rb +++ b/lib/rails_edge_test/dsl/edge.rb @@ -99,7 +99,9 @@ module Edge.#{full_module_name} exposing (json) private def produce_json(ivar: nil) - raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' unless response + unless response + raise 'Must perform a request (for example `perform_get`) before attempting to produce a json file.' + end raise 'Request did not result in a successful (2xx) response!' if response.is_a?(Array) && response[0] >= 300 diff --git a/rails_edge_test.gemspec b/rails_edge_test.gemspec index a338767..01e406d 100644 --- a/rails_edge_test.gemspec +++ b/rails_edge_test.gemspec @@ -11,7 +11,9 @@ Gem::Specification.new do |spec| spec.email = ['josh@noredink.com'] spec.summary = 'Generate json for front-end testing using your rails backend.' - spec.description = 'Keep your backend and front-end specs in sync! The rails_edge_test gem provides a dsl and rake task that uses your Rails app to generate json and appropriate wrapper files for use in your front-end testing.' + spec.description = 'Keep your backend and front-end specs in sync! The rails_edge_test gem provides a dsl and ' \ + 'rake task that uses your Rails app to generate json and appropriate wrapper files for use in ' \ + 'your front-end testing.' spec.homepage = 'https://github.com/NoRedInk/rails_edge_test' spec.license = 'MIT' From 71a8631322cab1ee1c0342e978d269fcf00bee67 Mon Sep 17 00:00:00 2001 From: Michael Glass Date: Tue, 12 Nov 2024 16:41:23 +0100 Subject: [PATCH 12/12] update readme to nudge towards nix --- README.md | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9e47b87..9583af6 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,16 @@ # RailsEdgeTest There is a particular type of integration testing that we have found very fruitful. We: -- load up our front-end with its virtual dom, -- assert expectations by querying the virtual dom, and +- load up our front-end with its virtual dom, +- assert expectations by querying the virtual dom, and - interact with our application by simulating events on elements in the virtual dom We have found these browser-less integration tests to be orders of magnitude faster than typical capybara integration tests, with minimal downsides. One of the biggest drawbacks to this approach is that we must maintain the json we expect from the backend in a form that is available to these tests, typically a json file (or Elm file with a json blob). Maintaining the blob causes two problems: -1. The blob can easily become out-of-sync with our backend, and +1. The blob can easily become out-of-sync with our backend, and 2. There is no specification for how to recreate it when things do become out-of-sync. This gem aims to solve these problems. The rails_edge_test gem allows us to: -- use Ruby code to explicitly specify each json blob our front-end tests require, +- use Ruby code to explicitly specify each json blob our front-end tests require, - re-generate these files, as needed, with a simple rake task. We write what we call "edge specs," Ruby files that specify the json edge between our front- and back-end by using our Rails models and controller actions directly. These are written using a DSL evocative of an RSpec spec. They allow us to generate json blob files which we commit to our repo, and access from our front-end integration tests. Over time, as our APIs develop, we can simply rerun our edge specs in order to update these json blobs based on existing specifications. @@ -44,22 +44,22 @@ include RailsEdgeTest::Dsl controller HomeController do action :show do let(:user) { create :user } - + edge "first time user" do user perform_get - + # generates Edge.HomeController.Show.FirstTimeUser with `json` function - produce_elm_file('FirstTimeUser') + produce_elm_file('FirstTimeUser') end - + edge "returning user" do user create :post, user: user perform_get - + # generates Edge.HomeController.Show.ReturningUser with `json` function - produce_elm_file('ReturningUser') + produce_elm_file('ReturningUser') end end end @@ -122,19 +122,35 @@ require Rails.root.join('edge', 'spec', 'edge_helper') ## Development +This project uses nix to manage the dev environment. + +This project additionally uses +- [direnv](https://github.com/direnv/direnv) +- flakes + +If you don't have flakes enabled, you can enable them by adding `experimental-features = flakes` to your `~/.config/nix/nix.conf` file. +(or running ) + +typing `direnv allow` loads the dev environment including a compatible ruby, sqlite, and gems. + +To modify gem dependencies, use the bundle wrappers +- `bundle-lock` to update the lockfile +- `bundle-update` to update gems & the lockfile +then run `bundix` to update the `gemset.nix` file. + +### Usage Without Nix + +Usage without nix is unsupported but may work anyways. Try the following: + 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. To install this gem onto your local machine, run `bundle exec rake install`. -To release a new version, follow the instructions in [PUBLISHING.md](PUBLISHING.md). - -### Nix support +Note: We only support adding gems and dependencies using nix. -In order to get Nix working you need to have [direnv](https://github.com/direnv/direnv) installed. You will have to `direnv allow` to load the current `.envrc`. You can then run from the top level folder: +### Publishing -``` -./nix/update-gemset.sh -``` +To release a new version, follow the instructions in [PUBLISHING.md](PUBLISHING.md). ## Contributing @@ -144,4 +160,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/NoRedI ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). -