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