Merge head
[selectricity-live] / README
1 ===============================================
2 === Depedendencies ============================
3 ===============================================
4
5 To use Selectricity, you'll need to install the following gems in
6 addition to rails and its dependencies:
7
8  * rmagick
9  * gruff (http://nubyonrails.com/pages/gruff)
10  * sparklines (http://nubyonrails.com/pages/sparklines)
11
12 To use Selectricity in development mode, you'll need to install the
13 following gems:
14
15  * ruby-debug
16
17 Also, you will need install the other applications installed first:
18
19  * imagemagick (http://www.imagemagick.org/)
20
21 On Ubuntu, you can install install the dependencies with: 
22   apt-get install imagemagick libmagick9-dev ruby1.8-dev libwmf-bin
23
24
25 ===============================================
26 === Contributors to Selectricity Include ======
27 ===============================================
28
29  * Benjamin Mako Hill <mako@atdot.cc>
30  * John Dong          <jdong@ubuntu.com>
31  * Justin Sharps      <jlsharps@mit.edu>
32
33 ===============================================
34 === Log =======================================
35 ===============================================
36
37 07/31/07
38 jlsharps: I've added a user authentication system known as
39 "acts_as_authenticated" to the code. The plugin is the the vendor/plugins 
40 directory. The two most noticeable changes are the AccountController and a 
41 redone User model. I've left the UserController in place for now, but the 
42 AccountController works in a different manner, so am switching over to that 
43 gradually. I saved the 5 lines or so in the old User model, overwrote 
44 it with the authenticated generator and then recopied the old stuff back in: 
45 has_many :elections and the name() method. The generator also creates its own 
46 migration file, but since we are using a create.sql file I adopted the 
47 migration file into a new users table in the create.sql file. I have yet to 
48 delete the old table because I haven't fully combed through the code yet and 
49 determined how many of the old attributes (such as first_name, last_name) may 
50 need to be retained. 
51 http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated is the 
52 best site for documentation regarding acts_as_authenticaed. Also, currently
53 it only stores the user_id in the session, but i just found a guide to help 
54 me make it store the entire user object, so I'll do that while my battery 
55 charges.
56
57 08/03/07
58 Handy trick: use the command 'gem_server' from a shell to create a server at 
59 http://localhost:8008 that is an easy to navigate locally-hosted website with 
60 all the documentation on local gems you have in a easy to read format.
61
62 jlsharps: I added the Gruff plug-in today, which is viewable under the folder
63 vender/plugins/gruff.  I installed it directly using the Gruff plug-in and
64 included controller generate utility. The version 0.1.2, which doesn't seem to
65 be the latest version. I've looked into it and it see and it seems that the
66 latest version is 0.2.8. However, I wasn't sure how including a gem w/o a plugin 
67 would function in end-game rails so I just what I used for now. If you guys 
68 (mako of john) know how to do it, it'd probably be better to upgrade, but it 
69 didn't seem like the best use of my time right now.  I got the plug-in here:
70 http://topfunky.net/svn/plugins/gruff. You can get the gruff gem v 0.2.8 by 
71 typing "sudo gem install gruff", I believe it's also hosted on RubyForge. 
72
73 I created the GraphsController for Gruff methods to use. In Pollarize I put them 
74 in the ApplicationContorller file, so they would be accessible to all. While 
75 that it also an option here, it would also mean there wouldn't be much room for 
76 playing around because everything in the Application file has to be perfect or 
77 it seems to throw Error Code 500 (basically everything breaks). The show() 
78 is a sample sample provided with Gruff. 
79
80 Documentation is here:http://gruff.rubyforge.org/  Alternately, if you have the 
81 gem installed, you can use the ri command, or the above mentioned gem_server. 
82
83 If you guys want more helpful stuff here, let me know.
84
85 ======================================
86 === XML-RPC INFO                    ==
87 ======================================
88
89 The XML-RPC API is still under development, but is somewhat functional already:
90
91 To instantiate a client in Ruby, try something like:
92 client=ActionWebService::Client::XmlRpc.new(SelectricityAPI,"http://localhost:3000/selectricity_service/vote")
93
94
95 Getting the results of a quickvote is quite simple:
96 ?> client.get_quickvote_results("test")
97 => #<VoteResultStruct:0x336f92c @approval_winners=[1, 2], @borda_winners=[1], @plurality_winners=[1], @ssd_winners=[1], @errors=[], @condorcet_winners=[1]>
98
99 Casting a quickvote:
100 client.cast_quickvote("test",1,[[1,2]])
101
102 To figure out what you're voting for:
103 >> client.get_quickvote_candidate_map("test")=> #<CandidateMap:0x335bbc0 @errors=[], @candidate_names=["test", "test2"], @candidate_ids=[1, 2]>
104
105
106
107
108

Benjamin Mako Hill || Want to submit a patch?