All Projects → nebulab → rails_console_toolkit

nebulab / rails_console_toolkit

Licence: MIT license
Configurable Rails Console Helpers

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to rails console toolkit

Bedops
🔬 BEDOPS: high-performance genomic feature operations
Stars: ✭ 215 (+1031.58%)
Mutual labels:  toolkit
Jfa Pwa Toolkit
⚡️ PWA Features to Any Website (very Fast & Easy)
Stars: ✭ 245 (+1189.47%)
Mutual labels:  toolkit
design-react-kit
A React toolkit that implements the Italia design system
Stars: ✭ 134 (+605.26%)
Mutual labels:  toolkit
Phonia
Phonia Toolkit is one of the most advanced toolkits to scan phone numbers using only free resources. The goal is to first gather standard information such as country, area, carrier and line type on any international phone numbers with a very good accuracy.
Stars: ✭ 221 (+1063.16%)
Mutual labels:  toolkit
Pk3ds
Pokémon (3DS) ROM Editor & Randomizer
Stars: ✭ 244 (+1184.21%)
Mutual labels:  toolkit
dt-utils
前端常用工具函数
Stars: ✭ 23 (+21.05%)
Mutual labels:  toolkit
Luminoth
Deep Learning toolkit for Computer Vision.
Stars: ✭ 2,386 (+12457.89%)
Mutual labels:  toolkit
Torch-Scope
A Toolkit for Training, Tracking, Saving Models and Syncing Results
Stars: ✭ 62 (+226.32%)
Mutual labels:  toolkit
Bioperl Live
Core BioPerl 1.x code
Stars: ✭ 244 (+1184.21%)
Mutual labels:  toolkit
VIZIA
A declarative GUI library written in Rust
Stars: ✭ 551 (+2800%)
Mutual labels:  toolkit
Xrtk Core
The Official Mixed Reality Framework for Unity
Stars: ✭ 219 (+1052.63%)
Mutual labels:  toolkit
Mercury
Mercury is a hacking tool used to collect information and use the information to further hurt the target
Stars: ✭ 236 (+1142.11%)
Mutual labels:  toolkit
blog
个人博客,关注前端工程化及移动端
Stars: ✭ 17 (-10.53%)
Mutual labels:  toolkit
Spiceypy
SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit.
Stars: ✭ 218 (+1047.37%)
Mutual labels:  toolkit
IMS-Toucan
Text-to-Speech Toolkit of the Speech and Language Technologies Group at the University of Stuttgart. Objectives of the development are simplicity, modularity, controllability and multilinguality.
Stars: ✭ 295 (+1452.63%)
Mutual labels:  toolkit
Libagar
Cross-Platform GUI Toolkit (stable)
Stars: ✭ 212 (+1015.79%)
Mutual labels:  toolkit
Framevuerk
Fast, Responsive, Multi Language, Both Direction Support and Configurable UI Framework based on Vue.js.
Stars: ✭ 252 (+1226.32%)
Mutual labels:  toolkit
cocol
Rapid blockchain prototyping
Stars: ✭ 19 (+0%)
Mutual labels:  toolkit
sinling
A collection of NLP tools for Sinhalese (සිංහල).
Stars: ✭ 38 (+100%)
Mutual labels:  toolkit
nightingale
NHS-Generic Frontend Framework.
Stars: ✭ 34 (+78.95%)
Mutual labels:  toolkit

RailsConsoleToolkit 🔧🧰

Configurable Rails Console Helpers

Find records faster, add custom helpers, improve your console life by 100%.

Build

Installation

Add this line to your application's Gemfile:

gem 'rails_console_toolkit'

And then generate the initializer:

$ bin/rails generate rails_console_toolkit:install

or write it manually:

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  # helper definitions go here...
  #
  # config.use_pack :aliases
  # config.use_pack :utils
  # config.use_pack :solidus if defined? Spree
end

Helper packs

Aliases

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.use_pack :aliases
end
> x # alias exit
> r # alias reload!

Utils

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.use_pack :utils
end
> benchmark("foo") { sleep 3 }
foo (3000.6ms)
=> 3

> bm # alias benchmark

Solidus

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.use_pack :solidus
end
> load_factories # will load solidus factories, useful to create dummy data in development
> product(...) # => will look for Spree::Product records by :id, :slug, :name
> variant(...) # => will look for Spree::Variant records by :id, :sku
> taxon(...)   # => will look for Spree::Taxon   records by :id, :permalink
> order(...)   # => will look for Spree::Order   records by :id, :number
> user(...)    # => will look for Spree::User    records by :id, :email
> country(...) # => will look for Spree::Country records by :id, :iso, :iso3, :iso_name, :name

Custom Helpers

Generic helpers

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.helper :foo do
    :bar
  end
end
# bin/rails console

> foo # => :bar

Aliases

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.alias :r, :reload!
end
# bin/rails console

> r # The same as typing "reload!"

Model helpers

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  config.model_helper 'Spree::Product', as: :product, by: %i[name slug]
end
# bin/rails console

> product('black-tshirt') # => #<Spree::Product id: 123, name: "Black T-Shirt", slug: "black-tshirt", …>
> product.slug            # => "black-tshirt"
> product 456             # => #<Spree::Product id: 456, name: "Red T-Shirt", slug: "red-tshirt", …>
> product.slug            # => "red-tshirt"

Removing unwanted helpers

# config/initializers/console.rb

RailsConsoleToolkit.configure do |config|
  # Will define an alias :x for "exit"
  config.use_pack :aliases
  config.remove_helper :x
end
# bin/rails console

> x # NameError (undefined local variable or method \`x' for main:Object)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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/elia/rails_console_toolkit.

License

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

About

Nebulab

This project is funded and maintained by the Nebulab team.

We firmly believe in the power of open-source. Contact us if you like our work and you need help with your project design or development.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].