Authentication OmniAuth (https://github.com/intridea/omniauth ...

groanaberrantInternet και Εφαρμογές Web

2 Φεβ 2013 (πριν από 4 χρόνια και 4 μήνες)

177 εμφανίσεις

Rails Gems : Must Have List

9/8/2011 9:16:00 PM

» Authentication



OmniAuth (
https://github.com/intridea/omniauth
)



Devise (
https://github.com/plataformatec/devise
)

The above two are really amazing gems for speeding up your authentication.
Yes, I love both of them in different cases: ideally, OmniAuth is better for
applications which want to support multi
-
provider external auth
entication,
which is why I've just added OmniAuth into the RefactorMyCode Rails 3
branch to take advantage of its auth benefits. Devise is totally powerful
enough for the classic authentication case. However, if you have too much
business logic inside your

login/registration/auth flow, you definitely need to
make your own authentication.


» Access Control



CanCan (
https://github.com/ryanb/cancan
)



declarative_authorization
(
https://github.com/stffn/declarative_authorization
)

Ryan

is a star in the Rails world, so naturally his CanCan gem is really
popular, but with good reason: it does really powerful autho
rization.
However, declarative_authorization is also a good option. In fact, Ryan
mentioned CanCan was inspired by declarative_authorization.


» Views/Page and Admin Scaffold



compass (
https://github
.com/chriseppstein/compass
)



haml (
https://github.com/nex3/haml
)



sanitize (
https://github.com/rgrove/sanitize
)



rails_admin (
https://github.com/sferik/rails_admin
)



web
-
app
-
theme (
https://github.com/andreferraro/web
-
app
-
theme
)

From a front
-
end perspective, I suggest you might want to try the above
gems

to speed up and simplify your UI design process. For example,
rails_admin gives you a nice interface to manage your application's data.


» Quick SNS



acts
-
as
-
taggable
-
on (
https://github.com/mbl
eigh/acts
-
as
-
taggable
-
on
)



has_friends
-
rails3 (
https://github.com/rrouse/has_friends
)



acts
as
favable (
https://github.com/yorzi/acts_as_favable
)



thumbs_up (
https://github.com/brady8/thumbs_up
)



acts
as
commentable
(
https://github.com/jackdempsey/acts_as_commentable
)



profanity_filter (
https://github.com/intridea/profanity_filter
)

These gems will allow you to prototype the basic functionality of your
application quickly without having to worry about creating everything from
scr
atch
-

so you can focus more attention on the meat of your application
instead of the nuts and bolts.


» Form and Related Tools



simple_form (
https://github.com/plataformatec/simple_form
)



formtas
tic (
https://github.com/justinfrench/formtastic
)



formtastic
datepicker
inputs
(
https://github.com/demersus/formtastic_datepick
er_inputs
)



tiny_mce (
https://github.com/kete/tiny_mce
)



paperclip (
https://github.com/thoughtbot/paperclip
)



carrierwave (
https://github.com/jnicklas/carrierwave
)

Most of the above gems are famous through
RailsCasts
. There are two pairs
of options here: simple_form and formtastic or paperclip and carrierwave.
I
like all these solutions, and you should pick the one that fits your project. If
you want to know the differences between each pair, get more details on
their wiki :) tiny_mce is an HUGE gem for rich editing; I list it here to remind
you that it exists,
but I recommend you get the WYSWYG via a JS lib like
CLEditor

-

it works gracefully.


» Search Solutions



meta_seach (
https://github.com/ernie/meta_sea
rch
)



meta_where (
https://github.com/ernie/meta_where
)



thinking
-
sphinx (
https://github.com/freelancing
-
god/thinking
-
sphinx
)



acts
at
indexed

(
https://github.com/dougal/acts_as_indexed
)



sunspot (
https://github.com/outoftime/sunspot
)

In regards to search in Rails, I bet there are some s
trong opinions out there.
I want to split these gems into two types: Object
-
based searching and Full
-
Text searching. I highly recommend you use meta_search and/or
meta_where for object
-
based searching because it can convert your form
params directly to a s
earch solution which is super convenient. Full
-
Test
searching depends on your use
-
case, but all these three gems (thinking
-
sphinx, acts_as_indexed, sunspot) are great.


» Pagination



kaminari (
https://gi
thub.com/amatsuda/kaminari
)



kaminari_themes (
https://github.com/amatsuda/kaminari_themes
)

Yeah, you can use will_paginate in Rails 3, but I will suggest you should give
kaminari a try, that's real
ly cool.


» Background Work



delayed_job (
https://github.com/collectiveidea/delayed_job
)



resque (
https://github.com/defunkt/resque
)

These are two projects that accomplish basically the same thing. There is a
post that introduces resque clearly
here
. In the post, the Github staff
mentions their brief history of doing backgro
und jobs and they do a good job
at highlighting the differences between the two.


» Status Machine



workflow (
https://github.com/geekq/workflow
)



state_machine (
https://github.com/pluginaweek/state_machine
)

I like to use workflow a bit more than state_machine, since it's more natural
to me. You definitely need one status machine to control your stable flow
stuff, such as a registration flow status o
r a wizard
-
like features.


» Rack API framework

grape (
https://github.com/intridea/grape
)

This gem is for adding REST
-
like APIs to your Rails/Sinatra application.
Michael

gave an awesome
presentation at RubyConf2010

on Grape; I
recommend watching it to see the greatness of Grape for

yourself. I believe
you will fall in love with it.


» Memcached Client



memcache
-
client (
https://github.com/mperham/memcache
-
client
)



dalli (
https://
github.com/mperham/dalli
)

These two gems are actually mainly written by one same author
Mike
Perham
. He mentioned that Dalli is a high performance pure Ruby client for
accessing memcached servers. It works with me
mcached 1.4+ only as it
uses the newer binary protocol. It should be considered a replacement for
the memcache
-
client gem. The API tries to be mostly compatible with
memcache
-
client with the goal being to make it a drop
-
in replacement for
Rails.


» Deploym
ent and Monitoring



capistrano (
https://github.com/capistrano/capistrano
)



cap
-
recipes (
https://github.com/nesquena/cap
-
recipes
)



god (
https://github.com/mojombo/god
)

I am not a system administrator, so I can't speak with any authority on this.
That said, I do find these three gems come in handy with deployments and
monitoring.


» Cron job and Backup a
s a Pro



whenever (
https://github.com/javan/whenever
)



backup (
https://github.com/meskyanichi/backup
)

These two gems are my favorites! Before I knew about these, I had to write
complex and stupid scripts to do backups that I was not familiar with. Cron
job is also a pain if you are not a system administrator. Now time changes
and you, as a Ruby programmer,

can do the cron job and backup in the
Ruby way, surely as a PRO. :)


» Testing Gracefully



rspec
-
rails (
https://github.com/dchelimsky/rspec
-
rails
)



factory
girl
rails (
https://github.com/thoughtbot/factory_girl_rails
)



faker (
https://github.com/yyyc514/faker
)



watchr (
https://github.com/mynyml/watchr
)



autowatchr (
https://github.com/viking/autowatchr
)



database_cleaner (
https://github.com/bmabey/database_cleaner
)



mail_safe (
https://github.com/myronmarston/mail_safe
)

Testing is always important, and with the popularity of testing practices like
TDD and BDD you have to own your super gun to play. These gems
can help
you out, although I didn't cover all the different levels of testing with these
gems. But I will say, rspec is my favorite framework for testing, and
factory_girl

and
faker

are good supports. Anyway, test by your own way.


» Toolkit



ruby
-
debug (
https://github.com/mark
-
moseley/ruby
-
debug
)



hirb (
https://github.com/cldwalker/hirb
)



cheat (
https://
github.com/defunkt/cheat
)



rails
-
settings
-
cached (
https://github.com/huacnlee/rails
-
settings
-
cached
)

There are many handy gems which will give you convenience and power.
Take the above four a
s examples: "Ruby
-
Debug" lets you easily check your
running application's context at specific program points; "Hirb" displays your
AR items conveniently in a table view in console; "Cheat" brings tons of
other gems' manuals into your terminal window for ea
sy reference and;
"Rails
-
Settings
-
Cached" is for global configurations in Rails 3 applications.
Yeah, throwing the brick out is to meet your GEMS.



9/8/2011 9:16:00 PM



9/8/2011 9:16:00 PM