diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2012-07-04 11:12:21 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2012-07-04 11:12:21 +0100 |
commit | 765d7fa16a428ec296d2278bc369d3680c7afaac (patch) | |
tree | 16d3ede6a3eb74bc90b4b1fe16126ef6f4f8a74f | |
parent | a9f1d84e7810936f7917c8a367b4713ea77554c9 (diff) | |
parent | d95a5eb0b6aaba3a0d88ab0f2fe4c948c051ecc9 (diff) |
Merge branch 'release/0.6.2'0.6.2
Conflicts:
doc/INSTALL.md
-rw-r--r-- | Gemfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 4 | ||||
-rw-r--r-- | app/models/public_body.rb | 2 | ||||
-rw-r--r-- | config/packages | 3 | ||||
-rw-r--r-- | db/migrate/112_add_api_key_to_public_bodies.rb | 47 | ||||
-rw-r--r-- | doc/CHANGES.md | 16 | ||||
-rw-r--r-- | doc/INSTALL.md | 22 |
7 files changed, 76 insertions, 20 deletions
@@ -32,7 +32,7 @@ gem 'test-unit', '~> 1.2.3' if RUBY_VERSION.to_f >= 1.9 gem 'vpim' gem 'will_paginate', '~> 2.3.11' # when 1.2.9 is released by the maintainer, we can stop using this fork: -gem 'xapian-full-alaveteli', '~> 1.2.9.4' +gem 'xapian-full-alaveteli', '~> 1.2.9.5' gem 'xml-simple' gem 'zip' diff --git a/Gemfile.lock b/Gemfile.lock index cf21dc0ce..0d9d5cc1d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -63,7 +63,7 @@ GEM ruby-ole (1.2.11.3) vpim (0.695) will_paginate (2.3.16) - xapian-full-alaveteli (1.2.9.4) + xapian-full-alaveteli (1.2.9.5) xml-simple (1.1.1) zip (2.0.2) @@ -96,6 +96,6 @@ DEPENDENCIES ruby-msg (~> 1.5.0) vpim will_paginate (~> 2.3.11) - xapian-full-alaveteli (~> 1.2.9.4) + xapian-full-alaveteli (~> 1.2.9.5) xml-simple zip diff --git a/app/models/public_body.rb b/app/models/public_body.rb index a372de435..bc8f084bb 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -95,7 +95,7 @@ class PublicBody < ActiveRecord::Base self.publication_scheme = "" if self.publication_scheme.nil? # Set an API key if there isn’t one - self.api_key = SecureRandom.base64(32) if self.api_key.nil? + self.api_key = SecureRandom.base64(33) if self.api_key.nil? end # like find_by_url_name but also search historic url_name if none found diff --git a/config/packages b/config/packages index b59c61b47..dcf1dc5b4 100644 --- a/config/packages +++ b/config/packages @@ -8,7 +8,7 @@ rdoc irb wv poppler-utils -pdftk (> 1.41+dfsg-1) | pdftk (< 1.41+dfsg-1) # that version has a non-functionining uncompress option +pdftk (>> 1.41+dfsg-1) | pdftk (<< 1.41+dfsg-1) # that version has a non-functionining uncompress option gs-gpl catdoc links @@ -32,5 +32,6 @@ libmagickwand-dev libpq-dev uuid-dev ruby1.8-dev +rubygems build-essential bundler diff --git a/db/migrate/112_add_api_key_to_public_bodies.rb b/db/migrate/112_add_api_key_to_public_bodies.rb index 24961612d..43dccb198 100644 --- a/db/migrate/112_add_api_key_to_public_bodies.rb +++ b/db/migrate/112_add_api_key_to_public_bodies.rb @@ -4,9 +4,50 @@ class AddApiKeyToPublicBodies < ActiveRecord::Migration def self.up add_column :public_bodies, :api_key, :string - PublicBody.find_each do |pb| - pb.api_key = SecureRandom.base64(32) - pb.save! + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + execute <<-SQL + update public_bodies + set api_key = encode(decode( + lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + ||lpad(to_hex(floor(random()*256) :: integer), 2, '0') + , 'hex'), 'base64') + SQL + else + PublicBody.find_each do |pb| + pb.api_key = SecureRandom.base64(33) + pb.save! + end end change_column_null :public_bodies, :api_key, false diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 920c397de..34959f924 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -1,8 +1,24 @@ +# Version 0.6.2 +## Highlighted features + +* This is a minor release to fix small bugs in documentation and install/upgrade process +* It also includes support for [Continuous Integration using Travis](http://travis-ci.org/) + +## Upgrade notes + +* No special action required -- just check out this version and run + `rails-post-deploy` as usual. + # Version 0.6.1 ## Highlighted features * Fixes important security bug [issue #515](https://github.com/sebbacon/alaveteli/issues/515) * Show admin nav bar when browsing main site +* A new API for adding requests and correspondence to an Alaveteli + instance, designed for use by public bodies that wish to use + Alaveteli as a disclosure log. See + [the wiki](https://github.com/sebbacon/alaveteli/wiki/API) for some + documentation. * [Full list of changes on github](https://github.com/sebbacon/alaveteli/issues?milestone=8&state=closed) ## Upgrade notes diff --git a/doc/INSTALL.md b/doc/INSTALL.md index af54da108..325ccfbdd 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -2,7 +2,7 @@ These instructions assume Debian Squeeze or Ubuntu 10.04 LTS. [Install instructions for OS X](https://github.com/sebbacon/alaveteli/wiki/OS-X-Quickstart) are under development. Debian Squeeze is the best supported deployment platform. - + Commands are intended to be run via the terminal or over ssh. As an aid to evaluation, there is an @@ -33,15 +33,17 @@ used to parse documents, host the site, etc. There are also packages that contain headers necessary to compile some of the gem dependencies in the next step. -If you are running Debian, you can use specially compiled mysociety -packages by adding the following to `/etc/apt/sources.list` and -running `apt-get update`: +If you are running Debian, add the following repositories to +`/etc/apt/sources.list` and run `apt-get update`: deb http://debian.mysociety.org squeeze main + deb http://ftp.debian.org/debian/ testing main non-free contrib -If you don't set up that mySociety Debian source (e.g. if you're -running Ubuntu), you should comment out `wkhtmltopdf-static` from -`config/packages`, as it won't install in the next step +The repositories above allow us to install the packages +`wkthmltopdf-static` and `bundler` using `apt`; so if you're running +Ubuntu, you won't be able to use the above repositories, and you will +need to comment out those two lines in `config/packages` before +following the next step (and install bundler manually). Now install the packages that are listed in config/packages using apt-get e.g.: @@ -54,7 +56,7 @@ Some of the files also have a version number listed in config/packages # Install Ruby dependencies -Install rubygems 1.6.1 (we're not using the Debian package because we +Install rubygems 1.6.2 (we're not using the Debian package because we need an older version; see "Troubleshooting" below for an explanation): @@ -471,8 +473,4 @@ various other things that can be automated for deployment. deployments), you may need to do something like: ln -s /usr/lib/ruby/gems/1.8/bin/rake /usr/local/bin/ - - Or (Debian): - - ln -s /usr/lib/ruby/gems/1.8/bin/rake /usr/local/bin/ |