Code Monkey home page Code Monkey logo

paths_of_glory's Introduction

Paths of Glory

Paths of Glory sets you on the road to achievements!

In short, it's a re-usable model for creating an achievement system.

It's extracted from http://peertester.com and inspired by: http://stackoverflow.com/questions/885277/how-to-implement-an-achievement-system-in-ror

Installation

Paths of Glory is easy to install.

As a plugin:

./script/plugin install git://github.com/paulca/paths_of_glory.git

Or as a gem. Add this to your environment.rb:

gem install paths_of_glory

config.gem 'paths_of_glory', :lib => false

Then generate the migration:

./script/generate paths_of_glory

And run the migration:

rake db:migrate

This creates the tables.

Then, in your User model:

class User < ActiveRecord::Base
  include Achievements
end

and in config/environment.rb, add app/models/achievements to your load path:

config.load_paths += %W( #{RAILS_ROOT}/app/models/achievements )

Basic Usage

Paths of Glory gives you access to a DSL to generate achievements. Achievements can have multiple levels or can just be standalone achievements.

The pattern is basically:

Create an achievement:

./script/generate achievement Glory

This gives you app/models/achievements/glory.rb and app/models/achievements/glory_observer.rb with some bootstrapped code.

You're on your own after that. Have fun!

Running the tests

You can run the tests by checking out the code into vendor/plugins of a Rails app and running:

rake

About me

I'm Paul Campbell. I'm an avid Ruby on Rails web developer. Follow my ramblings at http://www.pabcas.com

Follow me on Twitter http://twitter.com/paulca

Copyright (c) 2010 Paul Campbell, released under the MIT license

paths_of_glory's People

Contributors

paulca avatar citizen428 avatar

Stargazers

Qi He avatar

Watchers

Qi He avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.