{"id":19557175,"url":"https://github.com/gingray/rshade","last_synced_at":"2025-04-26T22:33:23.084Z","repository":{"id":34984275,"uuid":"193523877","full_name":"gingray/rshade","owner":"gingray","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-11T15:18:34.000Z","size":220,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-17T19:36:50.536Z","etag":null,"topics":["debug","ruby","trace"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gingray.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-24T14:42:20.000Z","updated_at":"2025-01-11T15:15:57.000Z","dependencies_parsed_at":"2022-08-08T03:15:39.175Z","dependency_job_id":null,"html_url":"https://github.com/gingray/rshade","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gingray%2Frshade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gingray%2Frshade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gingray%2Frshade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gingray%2Frshade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gingray","download_url":"https://codeload.github.com/gingray/rshade/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251063667,"owners_count":21530837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debug","ruby","trace"],"created_at":"2024-11-11T04:40:40.012Z","updated_at":"2025-04-26T22:33:18.061Z","avatar_url":"https://github.com/gingray.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RShade  \n \n![warcraft shade](https://github.com/gingray/rshade/raw/master/shade.jpg)\n\nRShade is a debugging/code exploration tool based on `TracePoint` functionality. \nRecent years I've working with relatively huge legacy code and I need a tool which can help me to figure out what is going on due execution. \nLuckely Ruby have build in functionality to achieve it, but it's pretty low level. It was my motivation to create `RShade` it helps me to save tons of time \nwhen I face with something not trivial or a good start point to create dependency map when I do refactoring or bugfix. Tool still in beta and it's possible that there\nis some bugs, but it's do the job.  \n\n## How it works?\n```shell\ngem install rshade\n```\nSimple wrap code that you want to check in to block and it will pretty print all of the calls which was made in this block with pointing line of executions, variables what was pass\ninside methods and variables what was return\n```ruby\nRShade::Trace.reveal do  \n  #your code here\nend.show\n```\nDue that tool create a detailed log with all of the steps of execution it's hard to read (it's can easelly be 20 - 30k lines because it's shows not only your custom code but also\ncode in gems that are involved in execution). `RShade` have filters to tackle this problem. Default filter is illiminate all code related to gems and only expose app code itself. You can \nchange this behaviour or add your own filter. Even when some piece of code are not shown due filtration order of calls and execution still shown in correct way.\n\n## Table of Contents\n - [Configuration](#configuration)\n - [Filters](#filters)\n   - [Filter by path include](#filter-by-path-include)\n   - [Filter by path exclude](#filter-by-path-exclude)\n   - [Filter by variable name or value](#filter-by-variable-name-or-value)\n - [Examples](#examples)\n\n### Configuration\n```ruby\nconfig = ::RShade::Config.default\n\nRShade::Trace.reveal(config) do\nend.show\n```\n### Filters\nFilters by default represent by expression `(include_path or variable_match) or (not exclude_path)`\nFilters can be chained like:\n```ruby\nconfig = ::RShade::Config.default.include_paths { |paths| paths \u003c\u003c /devise/ }\n                                  .exclude_paths { |paths| paths \u003c\u003c /warden/ } \n                                  .match_variable { |name, value| name == :current_user }\n```\n#### Filter by path include\n`paths` - is array which accept regex or string\n```ruby\nconfig = ::RShade::Config.default.include_paths { |paths| paths \u003c\u003c /devise/ }\n\nRShade::Trace.reveal(config) do\n   #your code\nend.show\n\n```\n#### Filter by path exclude\n`paths` - is array which accept regex or string\n```ruby\nconfig = ::RShade::Config.default.exclude_paths { |paths| paths \u003c\u003c /devise/ }\n\nRShade::Trace.reveal(config) do\n   #your code\nend.show\n```\n\n#### Filter by variable name or value\n`name` - represent variable name as symbol\n`value` - actual variable value\n```ruby\nconfig = ::RShade::Config.default.match_variable { |name, value| name == :current_user }\n\nRShade::Trace.reveal(config) do\n   #your code\nend.show\n```\n\n## Examples\nI've took example from https://github.com/spree/spree code base. Wrap code to take a look what code is in use when you save variant.\nOn such huge codebase as spree it's helpful to know what callbacks are triggered and so on.\n```ruby\n  context '#cost_currency' do\n    context 'when cost currency is nil' do\n      before { variant.cost_currency = nil }\n\n      it 'populates cost currency with the default value on save' do\n         RShade::Trace.reveal do\n          variant.save!\n        end\n        expect(variant.cost_currency).to eql 'USD'\n      end\n    end\n  end\n```\n\nBelow is example how output will look like.\nAs you can see all code that have been in use is printed.\n[![asciicast](https://asciinema.org/a/MR5KL7TmHmYRUhwBUWQjBI373.svg)](https://asciinema.org/a/MR5KL7TmHmYRUhwBUWQjBI373)\n\n## TODO  \nUse stack to keep connections between current method and caller  \ntake a look on https://github.com/matugm/visual-call-graph  \n  \n## Contributing  \n  \nBug reports and pull requests are welcome on GitHub at https://github.com/gingray/rshade.  \n  \n## License  \n  \nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgingray%2Frshade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgingray%2Frshade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgingray%2Frshade/lists"}