GithubHelp home page GithubHelp logo

neodelf / lecter Goto Github PK

View Code? Open in Web Editor NEW
94.0 4.0 7.0 194 KB

:boom: Show executable code by request

License: MIT License

Ruby 48.46% HTML 51.21% Shell 0.33%
debugger-visualizer tool lecter rails ruby code-analyzer

lecter's Introduction

Lecter Logo

Lecter shows an executed code by a URL request.
Debug an unknown code in SECONDS!

Gem Version Ruby Style Guide CircleCI Test Coverage Maintainability All Contributors

Quid pro quo. I tell you things, you tell me things. Not about this case, though. About yourself.
-- Hannibal Lecter / The Silence of the Lambs


Table of contents

๐Ÿšจ Problems

  1. Developers don't know how their app works.
  2. Reading code is a long process.
  3. Memorizing many lines of code is difficult.

๐Ÿš€ Solutions

  1. The main purpose of this gem is to help developers understand which code is executed by a request.

  2. Gem's purpose could be compared to visiting a doctor: You give the symptoms of your disease and receive a diagnosis.
    You give the parameters of a request and receive executable code.

  3. You don't have to work with debuggers, read and remember many lines of code.
    Just give & receive!

โ€ผ๏ธ Requirements

Please use a multithreading server such as a puma server with more than 1 worker.
For more information about how to tune a puma server, please visit this link.

๐Ÿ› ๏ธ Installation

Installing is a very simple process.

  1. Add the gem to your Gemfile:

    gem 'lecter'
  2. Execute in a terminal in your app's directory:

    bundle install
  3. Add routes to your config/routes.rb:

    mount Lecter::Engine => '/lecter' if Rails.env.development?

๐Ÿ•น๏ธ Usage

Follow two simple steps:

  1. Go to /lecter

  2. Fill in the form fields with request parameters:

    HTTP method - request's method
    Endpoint - use absolute route like localhost:3000/blogs
    Headers - request's headers Body(raw) - request's parameters

๐Ÿ‘จโ€๐Ÿ’ป Examples

Here is an example with a POST request:

  1. Go to localhost:3000/lecter

  2. Fill in the form with:

    HTTP method - POST
    Endpoint - localhost:3000/posts
    Headers - content_type=text/html,accept=*/*
    Body(raw) - "post"=>{"title"=>"New title", "description"=>"Desciption"}

    lecter example post form
  3. Submit the form

  4. Review the result

    lecter post form result

โค๏ธ Sponsors

Evrone Logo

๐Ÿ–ฅ๏ธ Contributing & Contributors

  1. Bug reports and pull requests are welcome.
  2. There are many issues as a proposal to improve this library. If you have any ideas, please feel free to write your thoughts in a new issue.
  3. Choose what you like to fix or improve on the issues list. You can ask any questions in the comments.
  4. โ€ผ๏ธ Mention of each contributor will be on the README file.

Thanks goes to these wonderful people:


Aleksey Glukhov

๐Ÿ’ป ๐Ÿ“–

Alisha Taylor

๐Ÿ“–

Vitaliy Emeliyantsev

๐Ÿ“–

Oskar Janusz

๐Ÿ’ป

๐Ÿ—ƒ๏ธ License

The gem is available as open source under the terms of the MIT License.

lecter's People

Contributors

allcontributors[bot] avatar atayl16 avatar dependabot[bot] avatar gambala avatar neodelf avatar oskaror avatar pineapplethief avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lecter's Issues

Design

If you want to propose your design ideas our pages - welcome!

Parameters as form

Now we have the field parameters. User has to fill that field in an awkward format:
"post"=>{"title"=>"New title", "description"=>"Description"}

I think it is not comfortable so I propose to add dynamic fields that will consist of a parameter.

What do you think?

Improve frontend performance on diagnosis page

Tested this lib in one of my production ready project, and for some reason I see 1163 files on diagnosis page. Overall page performance (scrolling and interacting with file collapsing nodes) can be improved โ€“ by reducing amount of DOM nodes, CSS repaint hacks, removing heavy js events, etc

Development / Ideas

Hi there!
Please leave your ideas and proposal in the comments below. This discussion will help us to create new features and developing the lecter.

Update README

Describe the bug
Change in the README localhost:3000/lecter/diagnosis/new to localhost:3000/lecter

Additional context
We have to do it according to the changes #73

Remove mount namespace from routes

According to documentation, we work with routes that start with /lecter/diagnosis. Its quite a long path, so I propose to remove /diagnosis part from routes. In the end, it will be only /lecter and we have routes like /lecter/new, /lecter and so on.

Update summary

Please update the summary and description at the lecter.gemspec file

Add a headers parameter to the form

Is your feature request related to a problem? Please describe.
The form accepts a path, method and body parameters. There is not possible to set the headers of a request.

Describe the solution you'd like
It would be great to add a headers parameter to the form.

Additional context
I think it could be helpful to have a text field for the headers parameter. They could be divided by symbol, for example ;.

Options (will be extended)

Some options could be added to a request:

  1. How many lines would you see before and after an executable line
  2. Excluded folder: in the app and external gems
  3. Include/Exclude lines that contain definitions of classes, methods, initializing of constants
  4. ...

Add configuring inspecting files

Now all inspecting files are hardcoded in lecter/lib/lecter/rack.rb.
I propose that the user be able to specify those lines in config.
Something like that:

Lecter.config do |config|
  config.paths: {
    include: %w[Rails.root.to_s],
    exclude: %w[/app/views /app/helpers]
  }
end

Also it leds to fix a code smell.

Remove rails dependency

Guys, now the gem has rails dependency. It helps with developing some general features. But if we remove it, we will be able to work with all Rack-oriented applications. So here we can discuss that removing process.
Please feel free to ask any questions!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.