Skip to content

Commit

Permalink
Import rails-bin to internal tools/
Browse files Browse the repository at this point in the history
Co-authored-by: zzak <[email protected]>
  • Loading branch information
zzak authored and rafaelfranca committed Sep 13, 2023
1 parent 11aa3fd commit 5c2a112
Show file tree
Hide file tree
Showing 33 changed files with 2,656 additions and 13 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,16 @@ jobs:
uses: actions/setup-python@v3
with:
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install codespell==2.1.0
- name: Check spelling with codespell
run: codespell --ignore-words=codespell.txt --skip="./vendor/bundle,./actionview/test/ujs/public/vendor/qunit.js,./actiontext/app/assets/javascripts/trix.js,./yarn.lock" || exit 1

- uses: actions/checkout@v4
with:
repository: skipkayhil/rails-bin
ref: 748f4673a5fe5686b5859e89f814166280e51781
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- uses: actions/checkout@v4
with:
path: rails
- run: bin/check-changelogs ./rails
- run: bin/check-config-docs ./rails
- run: tools/railspect changelogs .
- run: tools/railspect configuration .

- uses: zzak/action-discord@v8
continue-on-error: true
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/rail_inspector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Rail Inspector

on:
pull_request:
paths:
- "tools/rail_inspector/**"
push:
paths:
- "tools/rail_inspector/**"

permissions:
contents: read

jobs:
rail_inspector:
name: rail_inspector tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- run: cd tools/rail_inspector && bundle exec rake
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ AllCops:
- 'actionmailbox/test/dummy/**/*'
- 'activestorage/test/dummy/**/*'
- 'actiontext/test/dummy/**/*'
- 'tools/rail_inspector/test/fixtures/*'
- '**/node_modules/**/*'
- '**/CHANGELOG.md'
- '**/2_*_release_notes.md'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ gem "json", ">= 2.0.0"
# Workaround until Ruby ships with cgi version 0.3.6 or higher.
gem "cgi", ">= 0.3.6", require: false

group :lint do
gem "syntax_tree", "6.1.1", require: false
end

group :rubocop do
gem "rubocop", ">= 1.25.1", require: false
gem "rubocop-minitest", require: false
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ GEM
ast (~> 2.4.1)
path_expander (1.1.1)
pg (1.5.3)
prettier_print (1.2.1)
propshaft (0.6.4)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
Expand Down Expand Up @@ -513,6 +514,8 @@ GEM
stringio (3.0.7)
sucker_punch (3.1.0)
concurrent-ruby (~> 1.0)
syntax_tree (6.1.1)
prettier_print (>= 1.2.0)
tailwindcss-rails (2.0.21)
railties (>= 6.0.0)
tailwindcss-rails (2.0.21-x86_64-darwin)
Expand Down Expand Up @@ -631,6 +634,7 @@ DEPENDENCIES
stackprof
stimulus-rails
sucker_punch
syntax_tree (= 6.1.1)
tailwindcss-rails
terser (>= 1.1.4)
trilogy (>= 2.5.0)
Expand Down
1 change: 1 addition & 0 deletions tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ They aren't used by Rails apps directly.

* `console` drops you in irb and loads local Rails repos
* `profile` profiles `Kernel#require` to help reduce startup time
* `railspect` provides commands to run internal linters
* `line_statistics` provides CodeTools module and LineStatistics class to count lines
* `test` is loaded by every major component of Rails to simplify testing, for example:
`cd ./actioncable; bin/test ./path/to/actioncable_test_with_line_number.rb:5`
21 changes: 21 additions & 0 deletions tools/rail_inspector/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Hartley McGuire

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 11 additions & 0 deletions tools/rail_inspector/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

require "bundler/gem_tasks"
require "minitest/test_task"
require "rubocop/rake_task"

Minitest::TestTask.create

RuboCop::RakeTask.new

task default: [:test, :rubocop]
15 changes: 15 additions & 0 deletions tools/rail_inspector/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require_relative "../lib/rail_inspector"

# 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.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
28 changes: 28 additions & 0 deletions tools/rail_inspector/lib/rail_inspector.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

require_relative "rail_inspector/version"

# MIT License
#
# Copyright (c) Hartley McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

module RailInspector
end
Loading

0 comments on commit 5c2a112

Please sign in to comment.