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

Benjamin Mako Hill || Want to submit a patch?