Rails plugins

From WhyNotWiki
(Difference between revisions)
Jump to: navigation, search
(TableauEngine {{section category|Rails Engines|Engines}}{{section category|Photo albums}})
Line 1,919: Line 1,919:
*script/plugin install http://svn.nfectio.us/plugins/query_analyzer
*script/plugin install http://svn.nfectio.us/plugins/query_analyzer
*Repository Path: http://svn.nfectio.us/plugins/query_analyzer
*Repository Path: http://svn.nfectio.us/plugins/query_analyzer
-
 
-
==TableauEngine  {{section category|Rails Engines|Engines}}{{section category|Photo album}}==
 
-
 
-
http://rubyfurnace.com/plugins/tableauengine
 
-
<blockquote>
 
-
TableauEngine is a AJAX-based photo album engine ported from the original Tableau photo album for rails, found at http://creativi.st/tableau.
 
-
</blockquote>
 
-
 
-
*http://rubyfurnace.com/plugins/tableauengine
 
-
*Repository Path: http://publicsvn.carpeliam.com/tableau_engine/
 
=Miscellaneous=
=Miscellaneous=
-
==TableauEngine  {{section category|Rails Engines|Engines}}{{section category|Photo albums}}==
+
==TableauEngine  {{section category|Rails Engines|Engines}}{{section category|Photo gallery}}==
http://rubyfurnace.com/plugins/tableauengine
http://rubyfurnace.com/plugins/tableauengine

Revision as of 06:37, 9 March 2007

Libraries/plugins/tools/extensions/engines for Rails. (You might also be interested in Ruby libraries.)


Rails plugins and libraries  edit   (Category  edit) .



Contents

[Ruby-level (category)] (Ruby features libraries that are packaged as Rails plugins (unfortunately))

ActiveSupport

...

star_full.gif star_empty.gif star_empty.gif Named Options

http://rubyfurnace.com/plugins/named_options

def user(*args)
  options = NamedOptions.new(:name, :age, args)
  options[:name] # => “maiha”
  options[:age] # => 14
end

Lets you call it using ordered arguments or with a hash of arguments/options...

user(“maiha”, 14)
user(:name => ‘maiha’, :age => 14)
user(“maiha”, :age => 14)

SandboxedMethods

http://rubyfurnace.com/plugins/sandboxed_methods

Avoid conflicting method and variable names between modules.

"We unconsciously prefer shorter names and tend to use well-conflictable method names such as ‘names’, ‘valid?’, ‘path’ for middle(internal) methods. Indeed it works sanely in your system, but how about outside of it?"

To use it, just change your module from this:

 1 module Foo
 2   def self.included(base)
 3     base.__send__ :include, InstanceMethods
 4   end
 5 
 6   module InstanceMethods
       ...
16   end
17 end

to this:

 1 module Foo
 2   def self.included(base)
 3     InstanceMethods.give(base, :foo)        # 1) use 'give' class methods
 4   end
 5 
 6   class InstanceMethods < SandboxedMethods  # 2) use SandboxedMethods class
       ...
16   end
17 end

It basically does this by prefixing each method with the name of the class ("class_name__method_name"?) and then delegating (?) all method calls...

http://wota.jp/svn/rails/plugins/trunk/sandboxed_methods/lib/sandboxed_methods.rb

    def give(base, *methods)
      target  = (methods.last.is_a?(Hash) && methods.pop[:class]) ? (class<<base; self end) : base
      methods = instance_methods - SandboxedMethods.instance_methods if methods.empty?
      methods << {:to=>"(@_#{name.underscore.gsub('/', '__')} ||= #{self}.new(self))"}
      target.delegate *methods
    end

[Ruby-level (category)]: Dates and times

interpolated_time_formats

http://rubyfurnace.com/plugins/interpolated_time_formats

This plugin adds support for the interpolation of time/date formats when generating strings with Time#strftime or Date#strftime.

Time::DATE_FORMATS[:fancy] = '#{day.ordinalize} of %B'
Time.parse('12/31/2006').to_s(:fancy)
=> "31st of December"

Date Finder

http://rubyfurnace.com/plugins/date_finder

Can find dates that match certain criteria. Eg: The next three Tuesdays: DateFinderBase.weekly.day(:tuesday).find(:max => 3) The last Monday for the next three months: DateFinderBase.monthly.day(:monday).day_occurrence(:last).find(:max => 3)

Note: This appears to have nothing at all to do with ActiveRecord searching (kind of deceptive, if you ask me, since it's packaged as a Rails plugin). Rather, it actually returns Date instances as the results of its "searches".




[library-level (category)]

object_id_session: Lets you store ActiveRecord models in the session using their IDs

http://rubyfurnace.com/plugins/object_id_session

A very simple plugin that allows to store ActiveRecord models over session using their IDs transparently.

session[:user] = User.find(id)
# After this, your session will have :user => id and �__user_object_id_session� => User.

star_full.gif star_full.gif star_empty.gif [GnuPG (category)] plugin [API wrappers for command-line applications (category)]

passphrase = "uglydonkeys"

gnupg = GnuPG.new :binary=>"/opt/local/bin/gpg",
   :workdir=>workdir,
   :homedir_pub=>workdir,
   :homedir_sec=>workdir,
   :recipient=>"your uid"

plain_message = "my secret message"
encrypted_message = gnupg.encrypt(plain_message)

gnupg.load_key File.read("sec_key.asc")
decrypted_message = gnupg.decrypt(encrypted_message, passphrase)
gnupg.drop_key

RailMail

http://railmail.nullstyle.com/

Advantages:

  • Logs all outgoing e-mail to a database table. Much nicer to read/search than the log file, which is where it gets logged by default.
    • Why would you want to see what's been sent? Maybe if someone claims they never received an e-mail you sent, you could check the logs easily and see. (Even if it appears that you did already send it, this would make it easier to resend.)
  • Less dependencies on your development box. No need to set up outgoing mail on your box or even have an Internet connection. Just check the RailMail log to see if it went out.
  • Can test your application with addresses other than your own and not worry about bothering other people. (This could also be solved by using a much simpler plugin that just overrode ActionMailer to have it deliver all outgoing messages to you regardless of original recipient.)

Problems:

  • Don't fallaciously assume e-mail is going out successfully just because it is logged by RailMail. Manual testing of e-mails on live server will still be necessary.
  • Does having a message in the RailsMail log mean that it was sent? Apparently, you need to set railmail_settings[:passthrough] = :smtp in order for mail to actually be sent. So maybe it should log the value of passthrough for each logged message so you know if it was actually passed through to SMTP or not.

Conclusion: Seems like overkill to me. Maybe some applications would have more need of e-mail logging, but I probably typically wouldn't.



Permissions/Security

ModelSecurity

http://weblog.rubyonrails.com/2005/11/11/why-engines-and-components-are-not-evil-but-distracting McNewby, 2005-11-16 05:50:

However, from an infrastructural perspective, I like the thinking of ModelSecurity – in as much as permissions should at least begin in the Model (and hopefully ripple out to the UI). It should be possible to develop Rails such that permissions can be automatically ‘discovered’, e.g. for every attribute, there’s only three options: no access, read, write. Likewise for each method, there’s only two: can run, can’t run…

secure-action-plugin

http://rubyfurnace.com/plugins/secure_action_plugin

secure-action-plugin provides an easy to use interface for protecting your app against assumed logged in attacks



[ActiveRecord/database-level (category)]

ActiveWarehouse

http://activewarehouse.rubyforge.org/

redhillonrails_core

http://www.redhillconsulting.com.au/rails_plugins.html

http://www.redhillconsulting.com.au/rails_plugins.html#redhillonrails_core

The plugin provides two mechanisms for adding foreign keys as well as preserving foreign keys when performing a schema dump.
t.foreign_key :customer_id, :customers, :id

ActiveRecord Defaults

http://rubyfurnace.com/plugins/activerecord_defaults

Allow you to easily specify default values for attributes on new model objects.

How does this compare to having the defaults stored in the database?

[ActiveRecord/database-level (category)]: Migration

star_full.gif star_empty.gif star_empty.gif Migratory Shortcuts

Migrations are truly a great addition to Rails. That said, if you have a boat load of tables in your project it can be pretty tedious to keep repeating the same values [column specifications] again and again. Somewhere in the middle of doing this…

create_table :actors do |t|
  t.column "created_at", :datetime
  t.column "updated_at", :datetime
  t.column "deleted", :boolean, :null => false, :default => false
end

create_table :names do |t|
  t.column "name", :string, :null => false
  t.column "created_at", :datetime
  t.column "updated_at", :datetime
  t.column "created_by", :integer, :null => false
  t.column "updated_by", :integer, :null => false
  t.column "deleted", :boolean, :null => false, :default => false
end

create_table :actors_names do |t|
  t.column "actor_id", :integer, :null => false
  t.column "name_id", :integer, :null => false
  t.column "position", :integer, :null => false, :default => 0
  t.column "created_at", :datetime
  t.column "updated_at", :datetime
  t.column "created_by", :integer, :null => false
  t.column "updated_by", :integer, :null => false
  t.column "deleted", :boolean, :null => false, :default => false
end

for the tenth time, you begin to wonder if there is a better way.

Introducing.. a better way.

The above becomes this…

create_table :actors, :with => [:timestamps,:userstamps,:acts_as_paranoid]

create_table :names, :with => [:timestamps,:userstamps,:acts_as_paranoid] do |t|
    t.column "name", :string, :null => false
end

create_link_table :actors, :names, :with =>
    [:timestamps, :userstamps, :acts_as_paranoid, :acts_as_list]

This makes dealing with migrations just a bit more manageable, and you no longer need to remember all the “magic” column names. Just say “acts_as_list” and the “position” column is added for you.

Thus far the following options are supported:

  • acts_as_list
  • acts_as_tree
  • acts_as_nested_set
  • acts_as_paranoid
  • timestamps
  • userstamps


subverted_migrations

http://rubyfurnace.com/plugins/subverted_migrations

This plugin makes it easier to use Rails migrations with Subversion (when working with multiple branches). It has two main features:

  • Ensures unique version numbers across the trunk and branches
  • Keeps track of which migrations have been applied to the database, and applies new migrations when merged in to the branch.



[ActiveRecord/database-level (category)]: Searching / query building

acts_as_solr [full-text search (category)]

http://rubyfurnace.com/plugins/acts_as_solr: This plugin adds full text search capabilities using Solr to any Rails model.


Live search

(very "cool"!)

http://www.recentrambles.com/pragmatic/view/59

Query by example

http://blog.codahale.com/2006/02/04/a-rails-howto-query-by-example/

star_full.gif star_full.gif star_full.gif ez_where plugin

(very intuitive!)

http://brainspl.at/articles/2006/01/30/i-have-been-busy

./script/plugin install http://opensvn.csie.org/ezra/rails/plugins/dev/ez_where/

Squirrel

http://giantrobots.thoughtbot.com/2006/9/29/an-improvement-for-querying-in-rails

Query builder

http://rubyfurnace.com/plugins/query_builder

This plugin enables you to define finder methods that bypass the overhead of construct_finder_sql. Inside an ActiveRecord model definition,

define_finder query_name, query_type, options_hash

will create a SQL query method called query_name from a given options_hash. query_type can be :first or :all.

The plugin supports all options except :include, but ignores with_scope options.

Example:

class Recipe
  define_finder :find_all_of_user, :all,
                     :conditions => 'user = :user AND priv < :priv'
end

This defines a query method which can be called like so:

Recipe.find_all_of_user :user => 'martin', :priv => 1

This call is equivalent to

Recipe.find :all, :conditions =>
         ['user = :user AND priv < :priv', {:user => 'martin', :priv => 1}]


star_full.gif star_empty.gif star_empty.gif Condition Builder

http://rubyfurnace.com/plugins/condition_builder

Book.find(:all,
  :include => {:content_pointer => :invitees},
  :conditions => Condition.block { |c|
    c.and "invitees.user_id", self.id
    c.and "content_pointers.created_by_id", self.id
    c.and "content_pointers.company_id", company.id if company
  })

conditioner

http://www.bigbold.com/snippets/posts/show/2510

Converts arrays of this form:

[['user_id', 3], ['job_id', 4]

into ActiveRecord conditions form:

["user_id=? AND job_id=?", 3, 4]






[Model-level (category)]

Acts As Flaggable

http://rubyfurnace.com/plugins/acts_as_flaggable

Acts As Flaggable is a model modifier which allows flag records to be associated with records. Authors of community driven sites may find this useful for quickly adding the ability to mark records as "spam" or "inappropriate". It also facilities in a way to automatically take a specific action automatically if a record has been flagged a certain way too many times (Think auto-removing posts that have been marked as "spam").

Acts as Clusterable

http://rubyfurnace.com/plugins/acts_as_clusterable

This plugin makes it very easy to cluster active record objects. It can be used for grouping search results (see http://demo.carrot-search.com/carrot2-webapp/main). This plugin requires the clusterer Ruby gem. Add the following lines to your model:

acts_as_clusterable :fields  => ['title','text']

if no fields are given then it will use all text and string fields present in the model. Now, doing clustering is as easy as:

Joke.hierarchical_clustering()
Joke.kmeans_clustering()

:dependent => :protect option

http://rubyfurnace.com/plugins/%3Adependent_%3D%26gt__%3Aprotect_opti

Adds a new option :protect for the parameter :depends from has_many method. This option forbids destroying records with associated records in a association created with :dependent => :protect option, more or less like ON DELETE RESTRICT SQL statement. If you try to destroy a record with associated records it will raise a ActiveRecord::ReferentialIntegrityProtectionError (defined also in this plugin).

Acts As Sanitized [Input sanitization (category)]

http://rubyfurnace.com/plugins/acts_as_sanitized

Cleans up text data before it hits your database and, eventually, your users. The goal is to reduce Cross-Site Scripting (XSS) attacks. Install and forget. The plugin can figure out which fields it needs to sanitize, or you can specify fields manually. The former is highly recommended. Schemas change. An added bonus is that you don’t need to sanitize or strip_tags in your views, offering a lil’ performance boost.

[Data formats (category)][CSV (category)]: convertible_to_csv

http://rubyfurnace.com/plugins/convertible_to_csv

class Customer < ActiveRecord::Base
  acts_as_convertible_to_csv :header => true, 
                             :fields => %w(id firstname lastname email_address)
end
Customer.find(:all).to_csv
Customer.find(:first).to_csv

Comments:

  • Doesn't seem good that you have to / can only specify the list of fields to include once per model.

[Data formats (category)][CSV (category)]: to_csv

http://rubyfurnace.com/plugins/to_csv

This plugin provides support for responding to the CSV format, as well as exporting a collection of ActiveRecord objects to CSV. You can simply take a collection of ActiveRecord objects and apply the to_csv method to them:

@users = User.find(:all) @users.to_csv

ActsAsLocateable [searching (category)]

ActsAsLocateable is an easy way to give any model the ability to be found by location. For instance, say you have a model Store which is associated with a zip code indicating where that Store is located. To find all the stores within a specific radius of another ZipCode, you can do a

Store.find_within_radius(10, 12345) # Find all stores within 10 miles of zip code 12345

Based on: (heavily) on the ZipCodeSearch plugin

Acts as Activated

Basically the opposite of acts_as_paranoid, this plugin hides records until the is_active method returns true.

Acts As Activity Logged

http://rubyfurnace.com/plugins/acts_as_activity_logged

The plugin is designed to track the event that occurred on a model (create/update/destroy) and allow you to see what models were affected. So if you need “Jamie added a comment to ‘My First Post’” kind of functionality, then it’s easy to get with this plugin.


ZipCodeSearch [searching (category)]

http://zipcodesearch.rubyforge.org/

ZipCodeSearch is a Rails plugin that makes implementing location-based searches a cinch. If you've ever wondered how to do location-based radius searches in your snazzy new Web 2.0 application, then this plugin might save you some time. This plugin will create a ZipCode model, which contains all the code for calculating distances and searching. This plugin will also create a migration that adds a zip code table to your database, complete with 45,000 zip codes and with their lat/lon and city/state information. Finally, this plugin will generate a fully functional controller/view that contains a simple example of how to use the ZipCode model for your location searches.

Acts as Rated

http://rubyfurnace.com/plugins/acts_as_rated

Though similar to other rating plugins, this one has a ton of options to customize, while still making it very easy to use. And most important for my use, can cache the statistics of the ratings (total/count/average) in the model itself or an external statistics table, eliminating the need to call sum/count/avg on the ratings table itself.

acts_as_list for habtm relationships

There is a acts_as_habtm_list plugin, but I couldn't get it to work.

Perhaps better to convert the habtm's to has_many :through relationships.

http://www.archivesat.com/Ruby_on_Rails_developers_help/thread783283.htm


Acts as Favorite

http://rubyfurnace.com/plugins/acts_as_favorite

This plugin provides a simple way to track users favorites within the system using ActiveRecord models.

cached_model

http://seattlerb.rubyforge.org/cached_model/

CachedModel stores Rails ActiveRecord objects in memcache allowing for very fast retrievals. CachedModel uses the ActiveRecord::Locking to ensure that you don‘t perform multiple updates.
CachedModel only accelerates simple finds for single rows.


[Model-level (category)]: Pagination

Some might argue that this is a controller-level feature, but I don't think so. Half the challenge is getting it to limit your database query so that it returns the correct page of rows and only those rows...

paginating_find

http://rubyfurnace.com/plugins/paginating_find

Got 15,842 records that you'd like to export to a file? Using the standard Rails ActiveRecord::Base#find method will load all 15,842 into memory all at once and return them all in an array. If your app is running on a shared host, or if you�re keeping your app on a memory budget, this is a big problem for you. So you could load each record one by one, but that'll kill your DB server. Wouldn't it be sweet if #find could return an Enumerable that would load your records in batches of say 1,500 records? Well with my new nifty-jifty paginating_find plugin, it can.



[Model-level (category)]: Validation

Validates Unchangeable

http://rubyfurnace.com/plugins/validates_unchangeable

Sometimes you want to allow users to save data only once to a field. For example, Ebay only allows you to change the price of an item if there are no bids and it is within a certain date range. I created the validates_unchangeable for similar situations.

validates_email_format_of

http://rubyfurnace.com/plugins/validates_email_format_of

Validate email addresses against RFC 2822

Before Assignment: add a before_assignment callback to a belongs_to association

http://rubyfurnace.com/plugins/before_assignment

Plugin makes it possible to add a before_assignment callback to a belongs_to association, which enables things such as type and validity checking at the time of assignment instead of having to rely on later validation. The idea came up while researching the :conditions option for belongs_to. I realized that Rails doesn’t prevent you from assigning a bogus value—even worse, you will be confused when you try to retrieve it later and nothing is there. Some caboosers argued that this is not needed, because you can check the validity of the assignment as part of the validation rules for the model with the belongs_to association. To which I say: “Not always!” Sure, there might be cases where it makes sense to check the validity of an assignment to belongs_to as part of the validation routines of the model. But in cases where a wrong assignment is NOT a state that is reachable normally by the end user, then I believe that it is better to fail fast! If there is a programmer error or a hacker trying to breach my security, I want to know about it right away and in an explicit fashion. Example:

class Approvable < ActiveRecord::Base
  belongs_to :approver, :class_name => ‘User’, :foreign_key => ‘approver_id’, :conditions => [‘authorized_approver = ?’, true], :extend => CheckApproverExtension 
end
module CheckApproverExtension
  def before_assignment(approver) 
    raise UnauthorizedApproverException unless approver.authorized_approver 
  end
end

Note: Rails (as of rev 5523) supports extension (:extend =>) of a belongs_to association, but it isn’t documented. I believe that it’s perfectly valid to extend a belongs_to relationship, and that belongs_to should accept a block parameter for extension methods, exactly how other associations do.

[Model-level (category)]: Users / sign-up forms / user registration/enrollment

Name Nanny

http://rubyfurnace.com/plugins/name_nanny

I needed functionality to encourage user’s to be on their best behavior when they choosing a username or filling out a form. Bad behavior can come in many forms but specifically, I wanted to prevent people from registering usernames like “administrator”, “root”, “abuse”,”support” etc. I also didn’t want people to pick names like “whore” or even “hoar”,”h0ar”,”wh0r3” (you get the picture). It occurred to me that others would like this functionality too, so I created the name_nanny plug-in which can be employed in a couple of ways.




[model-level (category)]/[controller-level (category)]

star_full.gif star_full.gif star_empty.gif Acts As Image

This plugin takes a simple approach to saving images. It will scale images and save them to the file system, but it can’t be used to save other types of files. It can handle all the types of images that RMagick can, and will differentiate between normal images and animations, saving them as JPEG and GIF respectively. You can specify as many different sizes as you want and whether they will be scaled or cropped.

You can control which path the images will be written to, and what sizes the image will be resized to. Here’s an example model definition:

  class Image < ActiveRecord::Base

    acts_as_image #Must come first

    self.image_sizes = {
      :original => '100%x100%',
      :large => '>800x600',
      :medium => '>640x480',
      :small => '>320x200',
      :thumb => ['100x100!', :crop]
    }

    self.image_save_path = File.join(RAILS_ROOT, 'public', 'images', 'uploads')
    self.image_read_path = ['images', 'uploads'].join('/')

  end

[model-level (category)]/[controller-level (category)]: Web services / REST

rc-test

http://seattlerb.rubyforge.org/rc-rest/

This is an abstract class for creating wrappers for REST web service APIs.

PayPal plugin

http://www.elctech.com/ruby/paypal/README

Acts As Amazon

http://rubyfurnace.com/plugins/acts_as_amazon

ActsAsAmazon allows a developer to declare a mapping between an ActiveRecord model and a product listed on Amazon. It uses the Ruby/Amazon library to add functionality so that models can be created from a search (by ASIN) through the amazon e-commerce services and provides directives to describe how database fields map to the data in a Ruby/Amazon SearchResult object.

Maps: Google Maps

http://jystewart.net/process/archives/2006/09/abstracting-mapping-with-ym4r

http://thepochisuperstarmegashow.com/2006/06/02/ym4r-georuby-spatial-adapter-demo/

http://rubyfurnace.com/plugins/gmaps-on-rails Google Maps on Rails


[model-level (category)]/[controller-level (category)]: E-commerce

Overlaps with Web services? A little bit, perhaps...

Shopify=

http://shopify.com/ Shopify — "A shop in minutes, a business for life". Closed-source, but made using Rails. "Shopify is free to use. There are no signup and monthly fees. We charge a 3% commission on successful product sales."

Active Merchant

"Active Merchant is a payment abstraction library"

Direct payment gateways:

  • Moneris
  • Authorize.net
  • TrustCommerce
  • Psigate
  • Paypal Payments Pro

Offsite payment gateways:

  • Paypal
  • Chronopay
  • Nochex

[model-level (category)]/[controller-level (category)]: Authentication

acts_as_authenticated

Restful Authentication

http://rubyfurnace.com/plugins/restful_authentication

This is a basic restful authentication generator for rails, taken from acts as authenticated. Currently it requires Rails 1.2 (or edge). To use: ./script/generate authenticated user sessions The first parameter specifies the model that gets created in signup (typically a user or account model). A model with migration is created, as well as a basic controller with the create method. The second parameter specifies the sessions controller name. This is the controller that handles the actual login/logout function on the site. From here, you will need to add the resource routes in config/routes.rb. map.resources :users, :sessions

OpenID

...

acts_as_google_account

http://rubyfurnace.com/plugins/acts_as_google_account

A plugin for authenticating users objects against the Google Authentication API.

      class User < ActiveRecord::Base end

      acts_as_google_account

      def self.login(username, password)
        if username.include? "@gmail.com" then
            if self.GoogleLogin(username, password) then
                find_by_email(username)
            end
        else
            hashed_password = hash_password(password || "")
            find(:first, :conditions  => ["username = ? and hashed_password = ?", username, hashed_password])
        end
      end

      def try_to_login
        User.login(self.username, self.password)
      end



[Controller-level (category)]

double_submit_protection

http://rubyfurnace.com/plugins/double_submit_protection

This plugin prevents multiple submits by intercepting requests with identical parameters.

[Controller-level (category)]: Sessions/cookies

EdgesoftNoCookie [cookieless sessions (category)]

http://rubyfurnace.com/plugins/edgesoftnocookie

This plugin provides no-cookie session support for Rails applications.

[Controller-level (category)]: [Form processing (category)]

[Controller-level (category)]: [Form processing (category)]: [Input sanitization (category)]

WhiteList

http://rubyfurnace.com/plugins/whitelist

This White Listing helper will html encode all tags and strip all attributes that aren’t specifically allowed. It also strips href/src tags with invalid protocols, like javascript: especially. It does its best to counter any tricks that hackers may use, like throwing in unicode/ascii/hex values to get past the javascript: filters. Check out the extensive test suite. <%= white_list @article.body %> You can add or remove tags/attributes if you want to customize it a bit.

WhiteListHelper.tags += %w(table td th)
WhiteListHelper.tags -= %w(div span)

Add new tag with [allowed] attributes

WhiteListHelper.attributes['table'] = %w(cellpadding cellspacing)

Change allowed attributes for all tags

WhiteListHelper.attributes[nil] = %w(id class style)

[Controller-level (category)]: [Caching (category)]

fragment_cache_extensions

http://rubyfurnace.com/plugins/fragment_cache_extensions

The extended_fragment_cache plugin provides content interpolation and an in-process memory cache for fragment caching. It also integrates the features of Yan Pritzker's memcache_fragments plugin since they both operate on the same methods.

Versioned URLs

http://rubyfurnace.com/plugins/versioned_urls

Makes it easy to improve the cache-efficiency of a Rails website, completely eliminating repeat HTTP requests for things like javascript files and stylesheets until they actually change.

http://blog.dannyburkes.com/2006/11/2/versioned-urls-for-rails/

One of the great "for free" features in Rails is asset timestamping. This feature, built into most of the methods in ActionView::Helpers::AssetTagHelper, automatically appends the timestamp of the referenced asset to generated URLs. So, when you write something like

<%= javascript_include_tag 'application' %>

it actually generates something like this

<script src="/javascripts/application.js?1161807361" type="text/javascript"></script>

where the 1161807362 parameter is the file modification time for /javascripts/application.js.

The theory is that, as long as applicaiton.js remains unchanged, the timestamp and URL remain the same, and the browser caches application.js. When application.js changes, the timestamp and URL change, and the browser refetches application.js. But, in fact, this is just the theory- not the reality.

In reality, the browser only halfway caches application.js. When the browser encounters the next

<script src="/javascripts/application.js?1161807361" type="text/javascript"></script>

it will actually send an HTTP GET request for /javascripts/application.js?1161807361, but it will include an If-Modified-Since header to notify the server that it should only return the requested data if it has changed since it was last requested. If application.js hasn't changed, the server sends a 304 Not Modified response, with no response body.

This is all well and good in that it saves the download time for application.js, but we still pay the TCP setup and teardown time, even when the asset hasn't changed. For many web applications, the number of javascripts, stylesheets, images, etc., included via asset tags is quite large. Thus, the cumulative penalty we pay in TCP setup/teardown to request unchanged assets can grow to a significant (read- noticeable) amount.

...

[...] The main issue is that some browsers will not cache resources referenced by URLs that contain parameters (e.g.- ?1161807361). What we need is a way to move the asset version token into the path part of the URL. In other words, we need to produce code like this:

<script src="/javascripts/application.js.v1161807361" type="text/javascript"></script>

...

But, with versioned URLs, the server will receive requests for things like /javascripts/application.js.v1161807361, which it has no idea how to satisfy.

How can we solve this? We can use URL rewriting.

...

This tells lightty to interpret a request for /javascripts/application.js.v1161807361 as a request for /javascripts/application.js, so, everyone is happy again.

[Controller-level (category)]/[View-level (category)]

PDF Render

http://rubyfurnace.com/plugins/pdf_render

"Hierarchical Access" / PersistentCheckBox / PersistentOption

http://rubyfurnace.com/plugins/hierarchical_access

PersistentCheckBox appears to load its value from the session (session["#{option}::#{name}"]) and uses onClick to set the value using Ajax.

PersistentOption actually handles the creation of the the set_whatever action method of the controller that gets called by the checkbox's onClick.

WithHierarchicalAccess appears to simply be a helper module that lets you access the session (or any other Hash?) "hierarchically" -- session["level1::level2::key"]. Not sure why that's necessary, though, considering hashes can already be nested.


[View-level (category)]/[Controller-level (category)]: Graphics / graphing

See also: Ruby_libraries#Graphics

ZiYa

http://rubyfurnace.com/plugins/ziya

The ZiYa is a rails charting plugin that is easy to integrate with your existing rails app and provide for amazing charting capabilities.



[View-level (category)]/[Controller-level (category)]: User-interfaces/form helpers

Helpers for generating form elements for models, etc.

[user interface for associations (category)]: associated_list

http://rubyfurnace.com/plugins/associated_list

If you are producing a form for a rails model object and it has a has_many or has_and_belongs_to_many relationship of some other simple objects (which can be identified by name), then this plugin might be for you. It uses a select box to add items to the list, and delete buttons to remove them. It's all client side, using hidden fields, until you submit the form and it saves the relationships in your model.

[user interface for associations (category)]: star_full.gif star_empty.gif star_empty.gif Multiple Select Helper

http://rubyfurnace.com/plugins/multiple_select_helper Selecting multiple elements in a list is sometimes tricky. You may click inadvertently on one item of the list and lost all your previous selection. You are forced to use Ctrl (or Command) clicks to select more than one element.

Multiple Select Helper allows you to create an easy-to-use list for multiple selections from array, hashes, collections or trees. The list is built using checkboxes so you can click easily and you will not lost the elements you clicked before. As a drawback you lose the use of the keyboard in the “list”.

This multiple selections are very useful in many to many relationships (has_and_belongs_to_many or has_many :through with no obligatory fields) where a “add and remove” solution would be cumbersome.

Comments:

  • Probably a better (more robust; less finicky; less susceptible due to browser quirks) solution than what we implemented for the Mask (multi-select list box without using Ctrl-Click) — Tyler (2007-03-08 17:10)




[View-level (category)]/[Controller-level (category)]: Full user-interface solutions for tables/models

Fully-functional alternatives to Rails's scaffolds...

star_full.gif star_full.gif star_full.gif ActiveScaffold

http://code.google.com/p/activescaffold/

datepicker_engine [Engines (category)][Dates and times (category)]

http://rubyfurnace.com/plugins/datepicker_engine

DatepickerEngine is a collection of helpers for creating datepicker boxes in your views. You can create a datepicker popup box like this:

<%= datepicker_popup ‘person’, ‘birthday’, { :class => ‘date’, :field_title => ‘Birthday’, :button_title => ‘Show calendar’ }, { :firstDay => 1, :range => [1920, 1990], :step => 1, :showOthers => true, :cache => true } %>

Scaffolding Extensions

Adds limited has_and_belongs_to_many support.

Scaffolding Extensions Tutorial in Ruby on Rails

http://wiki.rubyonrails.org/rails/pages/Scaffolding+Extensions+Plugin

How to use Scaffolding Extensions as a generator

Toffee

http://rubyfurnace.com/plugins/toffee

Toffee is a Rails Plugin that allows management of Active Record models without the need for extra controllers/views. Say for example you had a very-normalized application, with dozens of simple tables with just a few simple fields or relations, then the last thing you want is dozens of controllers

Lance 2007-03-06:

It's neat that they don't need controllers to exist. But they have pretty limited use because of it - you can't customize the model presentation for different situations. It's purely for admin use, like the routing suggests.

Streamlined

http://streamlined.relevancellc.com/

Pretty nice, handles has_many relationships... But it's generated code.




[View-level (category)]

Presentation layer. Includes presentation logic. Includes layouts...

Redbox

http://rubyfurnace.com/plugins/redbox

Redbox is a very simple lightbox library, which is a way of displaying a modal popup window which may contain any HTML, while the rest of the page is faded out behind it.


NestedLayouts

Plugin allows to specify outer layouts for particular layout thus creating nested layouts. Let’s assume you have controller which action ‘hello’ just was called. Controller was set up to use ‘inner’ layout:

  app/controllers/hello_controller.rb

    class HelloController < ApplicationController
      layout 'inner'

      def hello
        render :text => 'Hello, world!'
      end
    end

  app/views/layouts/inner.rhtml

    <% inside_layout 'outer' do -%>
      <div class="hello">
        <h1>Greetings</h1>
        <%= yield %>
      </div>
    <% end -%>

  app/views/layouts/outer.rhtml

    <html>
    <body>
      <div class="content">
        <%= yield %>
      </div>
    </body>
    </html>

Result will look like this (formatted for better reading):

    <html>
    <body>
      <div class="content">
        <div class="hello">
          <h1>Greetings</h1>
          Hello, world!
        </div>
      </div>
    </body>
    </html>

Concept of layout nesting here is based on the assumption that every inner layout is used only to customize it’s outer layout and thus every inner layout is used only with one specific outer layout. With this in mind we can conclude that every layout must know its outer layout and thus information about outer layout must be embeded directly into inner layout. Controller doesn’t need to know about the whole stack of layouts, so you should just specify the most inner layout in it. Passing data

You can pass data from inner layout to outer one, e.g.:

  layouts/inner.rhtml

    <% content_for 'menu' do -%>
      <ul>
        <li><a href="about_us">About Us</a></li>
        <li><a href="products">Products</a></li>
      </ul>
    <% end -%>

    <% inside_layout 'outer' do -%>
      <% @other_data_for_outer_layout = 'foo' -%>
      <%= yield %>
    <% end -%>

  layouts/outer.rhtml

    <%= yield 'menu' %>
    <br/>
    The data was: <%= @other_data_for_outer_layout %>
    <br/>
    <%= yield %>

star_full.gif star_full.gif star_full.gif ErbBuffer: Painless Nested output buffering [ERb (category)]

<% @contents_surface = capture_buffer do %>
        Top level goodies
        <% @contents_shallow = capture_buffer do %>
                Mid level content
                <% @contents_deep = capture_buffer do %>
                        deeper deeper, i say, deepah
                <% end %>
        <% end %>
<% end %>

<%= @contents_surface %>
<%= @contents_shallow %>
<%= @contents_deep %>

star_full.gif star_empty.gif star_empty.gif Elemental: Call XHTML elements as methods in your ERb templates [ERb (category)]

http://rubyfurnace.com/plugins/elemental

Call XHTML elements as methods in your ERb templates:

<%= p @item.content %>
becomes
<p>Your Content</p>


<%= span "some content", :id => "54" %>
becomes
<span id="54">some content</span>


<% ul do ['one', 'two', 'three'].each do |item| %>
  <%= li item %>
<% end end %>

becomes

<ul>
  <li>one</li>
  <li>two</li>
  <li>three</li>
</ul>

[autocompletion (category)]: select_autocompleter

http://rubyfurnace.com/plugins/select_autocompleter

Similar to Autocompleter functionality except it pops up a listbox instead of a list. To do an incremental search on the ‘name’ field of the ‘product’ table: In your template:

<%= text_field_with_select_auto_complete :product, :name, {}, { :row_count => 4, :min_chars => 2, :redirect_url => {:action => ‘show’, :id => ’??’}} %>

In your controller:

select_auto_complete_for :product, :name

Simple Object Tag Generator

http://www.ahgsoftware.com/pages/simple_object

"works just like an ActionView helper, and generates my embed tags intelligently from the filetype that I pass in!"

# In a 'view', with just default parameters
simple_object_tag "/example.mp3"

# with some additional parameters, real ones, and crazy ones..
simple_object_tag "/flashgame.swf",:scale=>"tofit",:junk=>"shizzle"

[View-level (category)]: [Captchas (category)]

BrainBuster

http://rubyfurnace.com/plugins/brainbuster

BrainBuster is a logic captcha—a test to try and tell computers and humans apart via a simple logic puzzle, math problem, or word problem. The big benefit over typical image based captchas is that a logic captcha is fully accessible for visually-impaired users who use screen readers.


[View-level (category)]: JavaScript/RJS

MinusMOR: plain Javascript templates + embedded ERb

(...as opposed to Ruby code that generates Javascript. This makes writing Javascript more like writing HTML (plain HTML + embedded ERb).)

http://rubyfurnace.com/plugins/minusmor

For those who don’t quite buy the writing JavaScript in Ruby part of RJS and just want to write some real JavaScript. Here’s RJS minus the R. This tiny plugin simply adds .ejs templates accept normal JavaScript and ERB:

alert('No more silly Ruby in my JavaScript!');
$('thing').setStyle(<%=js @style_options %>);
$('boob').update(<%= partial('new_boob') %>);

RJS if/unless blocks

Allows you to generate (JavaScript) if/unless blocks in RJS templates

page.if page[element_id].visible do
  page[element_id].hide
end

[View-level (category)]: Alternative templating languages

HAML

http://unspace.ca/discover/haml

Quote:

!!!
%html
  %head
    %title Client Admin Site
    %meta{"http-equiv"=>"Content-Type", 
       :content=>"text/html; charset=utf-8"}/
    = stylesheet_link_tag 'tabbed'
    = javascript_include_tag 'tabbed'
  %body
    #application
      #header
        .container
          .statusbar
            .logo
              %strong Admin Interface
            .menu= link_to 'logout',  
               :controller => 'account', :action => 'logout'
          %br{:style=>"clear:both;"}/
          .tabs
            %ul.navigation
              %li= link_to 'Member Approval', member_admin_url
              %li= link_to 'User Management', user_admin_url, 
                 :class => 'selected'
              %li= link_to 'Pages', page_admin_url
              %li= link_to 'Reports', reports_url
              %li= link_to 'Help', '/'
      #page
        #content
          //These will only render if there is 
             a non-false value returned from the helper
          #errors= print_flash(:error)
          #notice= print_flash(:notice)
          = @content_for_layout
        #sidebar= @content_for_sidebar || false
        %hr/
      #footer
        %p= "Copyright Hampton Catlin 2006"

Markdown on Rails

Allows you to use `.text` files containing Markdown text as Rails views. ERb is supported.

Markaby

http://code.whytheluckystiff.net/markaby/

 html do
   head do
     title action_name
     stylesheet_link_tag 'scaffold'
   end

   body do
     p flash[:notice], :style => "color: green" 
     self << content_for_layout
   end
 end

Liquid

http://home.leetsoft.com/liquid Liquid Markup

RedCloth Template

http://rubyfurnace.com/plugins/redcloth_template

This plugin registers a template handler for *.red files, which will be run through ERB and RedCloth, and enables you to use [Textile (category)] and [Markdown (category)] syntax directly in your views.


[View-level (category)]: CSS repetition removers / pre-processors / with embedded Ruby

  • RCSS[1]: ERB, server-side constants, server-side classes and command line execution. No nesting as such, though server-side classes offer a form of inheritance.
  • DCSS[2] (written up here[3]): server-side constants, different syntax. Descendant selectors only.
  • Styleaby[4]: creates CSS with Ruby syntax. “An experimental, unauthorized mashup of Scott Barron’s stillborn Builder::CSS templates and Why The Lucky Stiff’s Markaby templates.”
  • {Dirt Simple .rcss Templates}[5] by Josh Susser. No nesting, just variables.


star_full.gif star_full.gif star_full.gif CSS Dryer

http://rubyfurnace.com/plugins/css_dryer

Eliminate Repetition In Your Stylesheets Cascading style sheets (CSS) are wonderful but repetitive. Rails strongly discourages repetition, the don’t repeat yourself (DRY) principle, so writing CSS feels ungainly in Rails. There are two sources of repetition in CSS:

  • nested selectors
  • lack of variables
Nested selectors lead to CSS like this:
div           { font-family: Verdana; }
div#content   { background-color: green; }
div#content p { color: red; }

Note the triple repetition of div and the double repetition of #content.

The lack of variables leads to CSS like this:

.sidebar { border: 1px solid #fefefe; }
.content { color: #fefefe; }

Note the repeated color #fefefe.

The CssDryer eliminates both of these sources allowing you to write DRY, pleasing stylesheets. The examples above become:

<% dark_grey = '#fefefe' %>

div {
  font-family: Verdana;
  #content {
    background-color: green;
    p { color: red; }
  }
}

.sidebar { border: 1 px solid <%= dark_grey %>; }
.content { color: <%= dark_grey %>; }


DCSS: CSS pre-processor

http://rubyfurnace.com/plugins/dcss

A pre-processor for css that allows you to reduce duplication and simplify your css files. DCSS is also available as a ruby gem.

http://myles.id.au/2006/11/20/introducing-dcss

[...] It becomes problematic as stylesheets start to get larger and more special cases are introduced:

body.home-page #archives h3, body.home-page #favorites h3 { text-align: center; font-family: Georgia, serif; }
body.home-page #archives li, body.home-page #favorites li { list-style: square; }
body.home-page #archives li a, body.home-page #favorites li a { color: green; }
body.home-page #archives li a:hover, body.home-page #favorites li a:hover { color: orange; }

In a situation like the above, adding a class to each element isn’t really an option as these styles should only apply to the home page (which has body element that looks like <body class="home-page">). Plus adding a class still doesn’t add any semantic meaning to the document, it’s a design issue, not a markup one.

DCSS is a small ruby library that solves this problem by extending the CSS syntax with a new construct: {{ }}

body.home-page { } {{
  #archives, #favorites { } {{
    h3 { text-align: center; font-family: Georgia, serif; }
    li { list-style: square; } {{
      a { color: green; }
      a:hover { color: orange; }
    }} 
  }}
}}


[View-level (category)]: Helpers=

confirmation_field

[View logic is okay sometimes (category)]

http://svn.ardes.com/rails_plugins/confirmation_field/init.rb

Moves the logic of dealing with confirmation fields into the view where it belongs. A confirmation field is a virtual attribute that is used with

  validates_confirmation_of :email

, :email_confirmation being the virtual attribute in the above example.

There's a small but annoying view logic issue with this, when you are presenting an update view of a model with a confirmation attribute, the confirmation field will initially be left blank. When the form is submitted, the above validation will fail, unless the user types in the confirmation field - very annoying for when you're only updating your phone number for example.

This means that you have to write some view logic to deal with this (a worse idea would be to change the *model* to deal with this view issue).

With this plugin you can do this in your views:

  <%= text_field :customer, :email %>
  <%= confirmation_text_field :customer, :email %>

  <%= password_field :customer, :pass %>
  <%= confirmation_password_field :customer, :pass %>

or

  <% form_for :customer, @customer do |f| %>  
    <%= f.text_field :email %>
    <%= f.confirmation_text_field :email %>
  <% end %>

Simply Helpful

Various helpers for views.

For example:

<% content_tag_for(:li, @person, :class => “bar”) %>
=>
<li>id=”person_123” class=”person bar”< /li>

[View-level (category)]: Themes/Skins=

Vision

http://vision.shopify.com/ Vision - A Designers toolkit for Shopify themes (proprietary)





[Timelines (category)]

Simile Timeline Helper

http://rubyfurnace.com/plugins/similetimelinerailshelper

The Simile Timeline for Rails project provides a set of tools for Ruby generally, and Rails specifically to generate Simile Timeline DHTML controls in pages, and produce and consume events for display within those timelines.




My tools

All of my shared Rails code can be found at http://svn.tylerrick.com/rails_shared/ .


Plugins for creating plugins / plugin tools / code generation

[Engines (category)]: more powerful plugins

http://rails-engines.org/

Rails Engines are a way of dropping in whole chunks of functionality into your existing application without affecting any of your existing code. They could also be described as application aspects, or vertical application slices – top-to-bottom units which provide full MVC coverage for a certain, specific application function.

Engines can be as lightweight as the simplest plugin, or as full-featured as your your imagination can conceive. They are a natural successor to Rails' original Generator mechanism, or alternatively, plugins with all the power you could ever hope for.

http://rails-engines.org/faq/components-vs-plugins-vs-engines/:

Engines are also useful when you have an entire 'subsystem' of a Rails application (such as managing users & permissions) where you have model objects, controllers to manipulate/administer those objects (updating, creating new ones) and a full set of views & helpers to display information about those objects. Engines are like a slice of an application from top (views/helpers) to bottom (models) which can be dropped into an existing application and appear as if they always existed in the normal /app directory. Developers can selectively override parts of Engines as they need to handle their application (such as changing the user/home view to display a silly name), without affecting the rest of the Engine).

Better than generators

http://rails-engines.org/faq/engines-vs-generators/:

The engines plugin extends Rails' own minimal plugin system just enough to allow you to include in your plugin almost any type of file you might find in a regular Rails application: controllers, views, helpers, libraries, models, schemas, tests, stylesheets and javascripts... anything you can think of, essentially.
These files are contained within a single directory inside /vendor/plugins, completely isolating them from the rest of your application and therefore making it trivial to update to new versions.
It is still crucial that you as the developer be allowed to alter the behaviour of this packaged code to suit the individual needs of your application. With this in mind, the Engines plugin allows you to override the behaviour of engine code in a simple and clear way:
  • single views can be provided which are automatically used instead of those provided with the engine
  • controller actions can be overridden individually in your application, isolating your custom code from the underlying default implementation
  • model and library code is normally provided as a ruby Module, making it simple to include in your own custom Models
Developing an engine is a much more natural process, compared to creating generators - there is no 'ERb translation step', and changes to an engine can be made and committed in one application and then propagated to another application with no intermediate stages. Engine code looks exactly like normal Rails application code, making it intuitive to skim when you are examining an engine's behavior.

Alternative to Engines: plugin_dependencies, loaded_plugins, plugin_migrations, plugin_assets, appable_plugins, and plugin_routing

http://www.pluginaweek.org/2006/12/14/rails-engines-vs-6-plugins/

Our plugins aren’t meant to altogether replace Engines. They are a means of appealing to those who don’t like Engines so that we can all continue to develop plugins that add migrations, models, controllers, helpers, etc. and everyone can use them, engine-lovers and engine-haters alike.
If you’ve come so far as to like each of our 6 plugins and use them all together, then this boils down to close to the same functionality that Engines offers.


plugin_migrations

http://rubyfurnace.com/plugins/plugin_migrations

This plugin adds the ability for all plugins to have and use migrations. It adds a new table to your database called plugin_schema_info. This helps it keep track of the migration version of each plugin. The plugin then adds two new tasks to your project.

db:migrate:plugins

Running db:migrate:plugins will run the migrations for every plugin that is loaded. You can also specify exactly which plugin you want to migrate. For example,

rake db:migrate:plugins # Migrates all loaded plugins
rake db:migrate:plugins PLUGIN=acts_as_commentable
rake db:migrate:plugins PLUGIN=acts_as_commentable VERSION=2

[Development tools (category)]: Subversion / Tools for dealing with Subversion repositories

http://svn.tylerrick.com/rails_shared/svnrails.rb (based on [6])

http://svn.tylerrick.com/rails_shared/tasks/subversion.rake (based on [7])

http://balloon.hobix.com/svn_configure

  • Adds all files
  • Ignores files in tmp/ and log/
  • Creates a sample database.yml and ignores the original
  • Sets permissions for log/ and public/dispatch.*
  • Tells subversion which files should be executable


[Development tools (category)]: Database

MySQL Tasks

http://rubyfurnace.com/plugins/mysql_tasks

Some rake tasks to automate common database tasks (create/destroy & backup/restore).

rake db:mysql:create # Create database (using database.yml config)
rake db:mysql:destroy # Destroy database (using database.yml config)
rake db:mysql:backup # Dump schema and data to an SQL file (/db/backup_YYYY_MM_DD.sql)
rake db:mysql:restore # Load schema and data from an SQL file (/db/restore.sql)

Comments:

  • I wrote some similar tasks for QualitySmith's "shared rake tasks" — Tyler (2007-03-08 15:27)

[Development tools (category)]: Deployment

Capistrano

http://manuals.rubyonrails.com/read/chapter/102

http://weblog.rubyonrails.com/2005/10/19/introducing-switchtower-distributed-deployment-for-rails/

http://glu.ttono.us/articles/2006/06/23/capistrano-mike-clark


[Development tools (category)]: Documentation

AnnotateModels

$ ruby script/plugin install http://svn.pragprog.com/Public/plugins/annotate_models

$ rake annotate_models

After this completes, each model source file will have a comment block that documents the columns in the corresponding database table.


[Development tools (category)]: Testing

Continuous testing tools

See Continuous testing tools

[Fixtures (category)]: FixtureScenarios

http://rubyfurnace.com/plugins/fixturescenarios

This plugin allows you to create “scenarios” which are collections of fixtures and ruby files that represent a context against which you can run tests.

  • Repository Path: svn://svn.cube6media.com/fixture_scenarios/trunk

HttpTest: HTML validation and link checking

http://rubyfurnace.com/plugins/http_test

A plugin for HTML validation and link checking over HTTP. Can be used for monitoring of production servers as well as acceptance testing against staging and development servers. Command-line:

Add validation to your controller or integration tests:
  • assert_tidy, assert_w3c, and assert_xmllint. assert_validates
Validate all requests in your controller, integration, and http tests by adding these lines to your RAILS_ROOT/test/test_helper.rb file: ApplicationController.validate_all = true ApplicationController.validators = [:tidy]

Helper tests

http://nubyonrails.topfunky.com/articles/2006/04/07/test-your-helpers

./script/plugin discover
./script/plugin install helper_test

Or, since plugin discover usually breaks for me, just give an explicit URL to install:

./script/plugin install --externals http://topfunky.net/svn/plugins/helper_test/

Add something like this to your test_helper.rb

require "vendor/plugins/helper_test/generators/helper_test/templates/helper_testcase.rb"
./script/generate helper_test Application

Cache Test [Caching (category)]

The page cache test plugin adds assertions to Test::Units::TestCase to check the caching and expiring of pages, actions and fragments in tests

Watir on Rails

http://rubyfurnace.com/plugins/watir_on_rails

Generate, develop, and run Watir tests from Rails. Access to fixtures and ActiveRecord from within your Watir tests. Decorate your Watir browser object with a site-specific language similar to Rails Integration Testing.

RSpec on Rails

http://blog.nicksieger.com/articles/2006/11/15/rspec-autotest-now-a-rails-plugin

Install RSpec on Rails, following the original instructions. As of RSpec 0.7.3, the specific version of ZenTest is no longer required. Also, diff-lcs is required to show unified diff output on should == failures.

gem install zentest -v 3.4.1
gem install diff-lcs
gem install rspec
script/plugin install svn://rubyforge.org/var/svn/rspec/tags/REL_0_7_2/vendor/rspec_on_rails/vendor/plugins/rspec

RSpec Autotest

Automatically add RSpec tests to your Rails project.

rake spec:autotest

Form Test Helper

http://rubyfurnace.com/plugins/form_test_helper

With the form_test_helper Rails plugin, your functional and integration tests can work more like the browser. No longer do you need to feed params to an action:

post :create, :name => ‘Pickaxe’, :category => 1, :out_of_print => 0 assert_response :success

... and then watch it silently break when you change your form but forget to change the test. With form_test_helper, you just call up the form, change the fields you want, and submit it.

get :new
submit_form do |form| form.name = ‘Pickaxe’ form.category = “Programming” form.out_of_print.uncheck end assert_response :success

...or simply:

submit_form :name => ‘Pickaxe’, :category => ‘Programming’, :out_of_print => false

This is advantageous because it uses the action and method of the form [that is, you don't have to duplicate it in your tests], verifies that the form and the fields you specify are present and not misspelled, and it preserves any hidden or default values that may be in the form [no need to duplicate them in your tests], like in form_spam_protection.

Features

  • Can select_form by dom_id or url—or call without arguments if there’s only one form
  • Specifying a field name that doesn’t exist raises an exception
  • Fields that are selects (dropdowns) won’t let you set a value that’s not in its options
  • Selects can set using the option label or the option value
  • Inspect/verify the options for selects and radio buttons
  • Works with RESTful links and forms – :method => :put, :delete…
  • Checks for the presence of a submit button when you submit the form
  • Works in functional and integration tests
  • Assert presence of and follow links

Comments:

  • Avoids duplication
  • Easier to write and read tests
  • Makes tests less brittle (prone to break due to minor changes in the System Under Test)

[Development tools (category)]: Debugging

star_full.gif star_empty.gif star_empty.gif RailsRemoteControl

http://seattlerb.rubyforge.org/RailsRemoteControl/

Rails Remote Control allows you to attach to running Rails processes using DRb and change the log level without restarts. Also, view actions handled per process.

Browser Logger

http://rubyfurnace.com/plugins/browser_logger

Appends just this request's logs to the end of the response. It’s a little more convenient than tailing a log, especially when you’re not logged in. For now, it’s ‘always on.’ Feel free to modify init.rb to incorporate whatever on/off switch you want.


[Development tools (category)]/[Post-deployment (category)]: Performance monitoring/improvements

Query Analyzer

http://rubyfurnace.com/plugins/query_analyzer

The Query Analyzer plugin will expand the usability of your log files by providing query analysis using the MySQL query execution plan. Each SQL select query will be ‘EXPLAIN’ed and added to the log files right below the original query. Using this plugin and a good understanding of the results, you will be able to analyze and optimize the queries your application is making. Refer to http://www.mysql.org/doc/refman/5.0/en/explain.html for more information on understanding the results. Here is a real life usage of the plugin that detected the omission of indexes on a table. In this case, it was a join table and the keys didn’t have indexes (silly me!) [I've done that! — Tyler (]. Names have been changed to protect the innocent (and make it fit 80 columns).

Miscellaneous

TableauEngine [Engines (category)][Photo gallery (category)]

http://rubyfurnace.com/plugins/tableauengine

TableauEngine is a AJAX-based photo album engine ported from the original Tableau photo album for rails, found at http://creativi.st/tableau.

gettext_localize [Localization (category)]

http://rubyfurnace.com/plugins/gettext_localize

Rails plugin to help you localize your rails app using Gettext, it doesn't try to cover localization, internationalization of models [?]. It should work with Rails 1.1.6 and has been tested with the following.


Pluralizer

http://nubyonrails.com/tools/pluralize

Acts as Enterprisey

[Humor (category)]

http://www.agilewebdevelopment.com/plugins/acts_as_enterprisey

Article meta

Article Metadata: Internal organization

This list is organized along the "core/internals"-"presentation/unimportant" continuum, referencing the Model-View-Controller paradigm where applicable. Things are organized roughly according to this order:

Of course, not everything fits neatly into that organization...

  • Some entries have cross-cutting (multiple) concerns, in which case it's okay to list them. But you still have to choose a primary organization.
  • If you can't decide which category should be the primary one, here are some (order of precedence) guidelines which probably won't be helpful at all.
    • [Testing (category)] comes before MVC categorization. So if something is a test for caching, then it should go under Testing / Caching before Caching / Testing...
    • [Ruby-level (category)] comes before topical categorization. So Ruby-level / Dates before Top-level / Dates...
    • Performance monitoring/improvements and Permissions/Security currently take precedence over more specific concerns, since these are fairly cross-cutting in their MVC concerns anyway.
    • It being a Development tool (rather than a production tool) trumps other factors. Development / Database over Database / Development.
    • Web services property (Google Maps API, etc.) trumps MVC.

†Most of this organization is inherited/parallel to the organization of Rails.

Article Metadata: Scope and purpose

Comparable in scope to http://rubyfurnace.com/ . Intended, of course, to be the best directory of plugins available.

How is it different/better than all the other many directories out there?

  • Will contain all the data that the others do and more
  • †Personalizable: can add your own notes and comments and examples; the others only let you keep your own favorites list ... if that.
  • †Categorized hierarchically: Makes it easy to browse to a category that interests you currently and just look at plugins in that category
  • †More categories/tags/metadata than most of the competition
  • †See more on one page (if you want -- well, currently you have no choice...but you will) -- multiple projects so it's easy to compare them -- don't have to click a bunch of times / open a bunch of windows to get the details and compare
    • Eventually you will be able to see a concise list and click "Details" to Ajax-load the details
  • †Hand-edited (by humans).
    • Selective. Only good plugins make it in there.
    • Quality editing. Descriptions only contain relevant information. No broken markup (&lt;).
  • Doesn't aim to be comprehensive, so the list is not cluttered with useless plugins.
  • Links to related things in other "areas" -- for example, "Testing" category will let you quickly jump over to see all Ruby (not Rails) testing libraries available. (Browse along different dimensions, not limiting you to stay only within Rails plugins.)
  • †Pulls from multiple sources -- combines the best information, descriptions, examples, metadata from each

† Traits inherited from parent topic, "Software projects database"

Article Metadata: To do
  • Start using a MediaWiki template to structure metadata (homepage URL, etc.)?
  • Tableize: Move data into software_projects table and pull from there.
  • Set it up to scrape [Repository URL, Homepage URL, Authors, License, Tags, install command] from rubyfurnace.com and store those values in software_projects table if !exist?() already.
Article Metadata: Fields

Fields:

  • †Repository URL
    • "install command" virtual attribute can be inferred from this. Can be used by a command line plugin browser/installer tool
  • †Homepage URL
  • †Authors
  • †License
  • †Tags (acts_as_taggable?)
  • †Rating (acts_as_ratable?)
  • gem URL / available as gem?

† Columns inherited from parent topic, "Software projects database"


Directories thereof

Article meta

Article Metadata: Internal organization

This list is organized along the "core/internals"-"presentation/unimportant" continuum, referencing the Model-View-Controller paradigm where applicable. Things are organized roughly according to this order:

Of course, not everything fits neatly into that organization...

  • Some entries have cross-cutting (multiple) concerns, in which case it's okay to list them. But you still have to choose a primary organization.
  • If you can't decide which category should be the primary one, here are some (order of precedence) guidelines which probably won't be helpful at all.
    • [Testing (category)] comes before MVC categorization. So if something is a test for caching, then it should go under Testing / Caching before Caching / Testing...
    • [Ruby-level (category)] comes before topical categorization. So Ruby-level / Dates before Top-level / Dates...
    • Performance monitoring/improvements and Permissions/Security currently take precedence over more specific concerns, since these are fairly cross-cutting in their MVC concerns anyway.
    • It being a Development tool (rather than a production tool) trumps other factors. Development / Database over Database / Development.
    • Web services property (Google Maps API, etc.) trumps MVC.

†Most of this organization is inherited/parallel to the organization of Rails.

Article Metadata: Scope and purpose

Comparable in scope to http://rubyfurnace.com/ . Intended, of course, to be the best directory of plugins available.

How is it different/better than all the other many directories out there?

  • Will contain all the data that the others do and more
  • †Personalizable: can add your own notes and comments and examples; the others only let you keep your own favorites list ... if that.
  • †Categorized hierarchically: Makes it easy to browse to a category that interests you currently and just look at plugins in that category
  • †More categories/tags/metadata than most of the competition
  • †See more on one page (if you want -- well, currently you have no choice...but you will) -- multiple projects so it's easy to compare them -- don't have to click a bunch of times / open a bunch of windows to get the details and compare
    • Eventually you will be able to see a concise list and click "Details" to Ajax-load the details
  • †Hand-edited. Only good plugins make it in there. Descriptions only contain relevant information. No broken markup.
  • Doesn't aim to be comprehensive, so the list is not cluttered with useless plugins.
  • Links to related things in other "areas" -- for example, "Testing" category will let you quickly jump over to see all Ruby (not Rails) testing libraries available. (Browse along different dimensions, not limiting you to stay only within Rails plugins.)
  • †Pulls from multiple sources -- combines the best information, descriptions, examples, metadata from each

† Traits inherited from parent topic, "Software projects database"

Article Metadata: To do
  • Start using a MediaWiki template to structure metadata (homepage URL, etc.)?
  • Tableize: Move data into software_projects table and pull from there.
  • Set it up to scrape [Repository URL, Homepage URL, Authors, License, Tags, install command] from rubyfurnace.com and store those values in software_projects table if !exist?() already.
Article Metadata: Fields

Fields:

  • †Repository URL
    • "install command" virtual attribute can be inferred from this. Can be used by a command line plugin browser/installer tool
  • †Homepage URL
  • †Authors
  • †License
  • †Tags (acts_as_taggable?)
  • †Rating (acts_as_ratable?)
  • gem URL / available as gem?

† Columns inherited from parent topic, "Software projects database"


Ads
Personal tools