常用gem列表 - tianlu1677/tianlu1677.github.io GitHub Wiki

列出所用的gem,并且简单介绍他的功能,这样方便检索

  1. rails

web应用开发框架

  1. Devise

用于快速构建用户功能,如:注册,登陆,个人设置,修改密码,用邮件找回密码

  1. kaminari

分页控件,属于在服务器段进行分页

  1. Carrierwave

    上传控件,它可以帮你处理上传图片,裁减,定义不同的图片尺寸,这个需要配合mini_magick 这个gem,来剪裁图片。 除此之外还可以上传其他类型的文件。

  2. cancancan

应用中会用到为不同用户设定不同功能的权限,制定一套完善的权限管理系统。

  1. activerecord-session_store

    rails中将session存储在服务器端上

  2. quiet_assets

quiet_assets 关闭了rails的asset pipeline 日志,意味着在你的开发日志中去掉了相关编译信息。

  1. annotate

根据schema,以注释的形式给当前的model列出相关表的字段

  1. 部署相关的gem

    capistrano-rails

    capistrano-rvm

    capistrano-scm-copy 以及

    net-ssh

    Net::SSH是用Ruby实现的SSH2客户端协议, 使用它可以用SSH2远程控制你的程序

  2. railroady

用来生成rails3 model(AcitveRecord, Mongoid, Datamapper)和controller UML图 作为 跨平台的.svg文件。

  1. rails的错误提示

    better_errors

    better_errors取代了原来的rails错误提示页面,更加的友好和实用。为了使用better errors更高级的特性,需要使用 binding_of_caller这个gem。

    Using binding_of_caller we can grab bindings from higher up the call stack and evaluate code in that > context. Allows access to bindings arbitrarily far up the call stack, not limited to just the immediate caller.

  2. 测试:rspec

BDD,行为测试驱动(Behaviour Driven Development for Ruby).

  1. 数据库适配器:pg

    在github上没找到

  2. inherited_resources

inherited_resources 让你的控制器继承了所有的restful的方法(即7个方法),在项目中是 GiftsController < ResourceController(里面继承了inherit_resources) < ApplicationController

inherited_resources 依赖于 has_scope,responders

  1. has_scope

Has scope allows you to easily create controller filters based on your resources named scopes

  1. responders 具体使用内容见博客,不常用

  2. simple_form

    简化rails表单填写

  3. nested_form

这个是用来在一个表单中嵌套多个model,对需要嵌套的model需加:`accepts_nested_attributes_for`,同时在rails4中
使用的是强参数, `params.require(:project).permit(:name, tasks_attributes: [:id, :name, :_destroy])`,结合   simple_form使用,就是 `simple_nested_form_for`了
  1. select2-rails

    此gem就是在rails的asset pipeline集成了select2插件,select2是取代了原来的选择框,具有检索、远程数据和无限滚动结果的功能

  2. rails_kindeditor

所见即所得编辑器
  1. bootstrap-sass

    bootstrap是有twitter开源的前端框架

  2. haml-rails

    haml官网是html的简写形式

  3. enumerize

    enumerize 一般用于在model中一个字段中多个中选择一个

  4. ransack

    ransack是基于对象的搜索,TA也可以用与高级搜索,后台表格检索使用

  5. awesome_nested_set ???

Awesome Nested Set is an implementation of the nested set pattern for ActiveRecord models

  1. friendly_id

friendly_id是为了更好的显示链接内容,这个需要在数据库设计字段,并且在cms中的permalink是使用friend_id

  1. simple_captcha2

    简单验证码

  2. settingslogic

将系统配置放在以下的文件下  # config/settings.yml
  1. sidekiq 类似的还有Resque 和 Delayed_job
有时候一些任务的执行会很慢,而这些任务我们并不要求需要马上返回结果 (比如:发送邮件,生成图片缩略图),那我们可以选择将这些任务放到后台执行,以便于页面不会长时间等待执行。
  1. sinatra

    en,轻量级Ruby web开发框架

  2. poseidon

    Poseidon is a Kafka client. Kafka是一个大规模的分布式信息系统。具体信息见官网

  3. exception_notification > The Exception Notification gem provides a set of notifiers for sending notifications when errors occur in > a Rack/Rails application.The built-in notifiers can deliver notifications by email, campfire rooms or via > webhooks.

这个用于上线系统,通过邮件接受系统错误信息
  1. faraday
> Simple, but flexible HTTP client library, with support for multiple backends.
  1. acts-as-taggable-on

    为动态内容建立标签

  2. spreadsheet

    读取xls内容

  3. paper_trail

> Track changes to your models' data. Good for auditing or versioning.
  1. stringex
> Some [hopefully] useful extensions to Ruby’s String class. It is made up of three libraries: ActsAsUrl  [permalink solution with better character translation], Unidecoder [Unicode to Ascii transliteration], and StringExtensions [miscellaneous helper methods for the String class].
  1. grape

    为rails写api

  2. factory_girl_rails

  3. database_cleaner