Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pier_console_detective

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pier_console_detective

  • 0.3.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

PierConsoleDetective Console DetectiveCodacy BadgeCodacy BadgeMIT licenseMaintenance

A gem to track commands typed in rails console along with tagging in realtime. The tags can be used to identify users. This works with IRB and rails console using IRB. The values for tag, logger, and memoization requirements are configurable.

IRB provide options for recording history. It has a few disadvantages:

  1. It is not possible to get the logs in realtime.
  2. There are no tagging options available.
  3. There is no way to know the time when the command was fired.
  4. If we're connecting to the console using ssh, the logs will be lost if the connection is disconnected since the logs are only written only when we exit the session.

pier_console_detective overcomes such disadvantages.

Installation

Add this line to your application's Gemfile:

gem 'pier_console_detective'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pier_console_detective

Usage

There are meaningful defaults for the config. If you are using rails, run rails console. Otherwise, irb -rpier_console_detective will load the respective consoles with pier_console_detective loaded. You can also modify ~/.irbrc with require pier_console_detective to load the pier_console_detective by default.

demo_pier_console_detective

The configs can be overridden by creating a file named pier_console_detective.rb with following code.

require 'pier_console_detective'

PierConsoleDetective.setup do |config|
  # logger is a logger
  # default value is Logger.new(STDOUT)
  config.logger             = Rails.logger

  # log_tag is a lambda outputting the tag to tag the log entry
  # default value is the ENV['USER']
  config.log_tag           = -> { ENV['USER'] }

  # tag_memoization is a boolean to mention if the tag should be memoized or not.
  # default is true
  config.tag_memoization    = true
end

If you are using rails, place this file in config/initializers folder and run rails console. Otherwise, irb -r ./pier_console_detective.rb will load the respective consoles with pier_console_detective loaded with modified config. You can also modify ~/.irbrc with require pier_console_detective.rb to load the modified config by default.

Development

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. bin/console will run in IRB.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/arunn/pier_console_detective.

FAQs

Package last updated on 24 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc