New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commento

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commento

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Commento

Commento provides DSL for Ruby on Rails application for working with database comments.

Installation

Add this line to your application's Gemfile:

gem 'commento'

And then execute:

$ bundle install

Gem configuration

Initializer

Add configuration line to config/initializers/commento.rb:

ActiveRecord
require 'commento/adapters/active_record'

Commento.configure do |config|
  config.adapter = Commento::Adapters::ActiveRecord.new
  config.include_folders = %w[app lib] # folder for searching commento comments
  config.exclude_folders = ['app/assets'] # folder for excluding searching commento comments
  config.skip_table_names = %w[ar_internal_metadata schema_migrations] # ignoring tables
  config.skip_column_names = %w[id uuid created_at updated_at] # ignoring columns
end

Rake tasks

Generating reports

You can generate different types of reports (right now only html) with rake task

rails "commento:generate_report[html]"

Health check

You can check amount of missing comments for tables and columns with console report

rails commento:health
Снимок экрана 2024-09-13 в 10 11 12

Generating migration for adding comments to tables and columns

You can generate migration with adding comments for table and columns

rails g commento:active_record

Usage

Commento provides helpers for models for setting and getting comments.

Models configuration

Update your application model

class ApplicationRecord < ActiveRecord::Base
  include Commento::Helpers
end

Set table's comment

User.set_table_comment('Users table')

or reset comment by skiping value

User.set_table_comment

Read table's comment

User.fetch_table_comment

Set column's comment

User.set_column_comment(:email, 'Required field for user authentication')

or reset comment by skiping value

User.set_column_comment(:email)

Read column's comment

User.fetch_column_comment(:email)

License

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

FAQs

Package last updated on 13 Sep 2024

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