Alfred – the unobtrusive butler who takes care of the uninvited guests

Travis is an attempt to create an open-source, distributed build system for the Ruby community that:

1. allows open-source projects to register their repository and have their test-suites run on demand 2. allows users to contribute build capacities by connecting a VM that runs a build agent somewhere on their underused servers

Contact

Documentation

Preview

Without Alfred, and with much mess:


# app/models/user.rb
class User < ActiveRecord::Base
  attr_accessible :email, :password, :password_confirmation
  attr_accessible :email, :password, :password_confirmation, :username, as: :admin
  attr_accessible :email, :password, :password_confirmation, :username, as: :on_create
end

Have to use a special role:


# app/controllers/users_controlelr.rb
class UsersController < ApplicationController
  def create
    @user = User.create(params[:user], as: :on_create)
  end
end

With Alfred and no hassles:


# app/models/user.rb
class User < ActiveRecord::Base
  alfred_accessible :email, :password
  alfred_accessible :username, as: :admin
  alfred_accessible :username, on: :create
end

Nothing special here:


# app/controllers/users_controlelr.rb
class UsersController < ApplicationController
  def create
    @user = User.create(params[:user])
  end
end

Usage

alfred_accessible and alfred_protected behaves just like attr_accessible and attr_protected on steroids.

accessible and protected


  class User < ActiveRecord::Base
    alfred_accessible :a, :b
    alfred_protected :c, :d
  end

roles

Custom inherits from default role:


  class User < ActiveRecord::Base
    alfred_accessible :a, :b
    alfred_accessible :c, :d, as: :custom
  end

custom inheritance


  class User < ActiveRecord::Base
    alfred_accessible :a, :b
    alfred_accessible :c, :d, as: :custom
    alfred_accessible :e, :f, as: :custom2, inherit: :custom
  end

events


  class User < ActiveRecord::Base
    alfred_accessible :a, :b
    alfred_accessible :c, :d, on: :create
    alfred_accessible :e, :f, on: :update
  end

passwords

password_confirmation will automatically added by default.


  class User < ActiveRecord::Base
    alfred_accessible :password
  end

Requirements