aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tasks
Commit message (Collapse)AuthorAgeLines
* Allow RAILS_ENV to be set in sysvinit-thinhotfix/0.19.1hotfix/0.19.0.2Gareth Rees2014-08-29-1/+2
| | | | Install script on AWS uses development mode by default
* Fix typo in config_files:convert_init_scriptGareth Rees2014-08-07-1/+1
|
* Tidy config_files:convert_init_scriptGareth Rees2014-08-07-10/+11
|
* Merge branch 'stats_export_body_name_quoting' into rails-3-developGareth Rees2014-08-05-2/+2
|\
| * Quote body name in stats csv exportGareth Rees2014-08-04-2/+2
| | | | | | | | Some Public Body names contain commas (or other characters) which lead to a malformed CSV where parts of the body name are in later columns.
* | Use correct site name for alert tracks log and pidGareth Rees2014-07-15-3/+5
| | | | | | | | | | ENV[‘SITE’] can be specified for the crontab (and elsewhere) so allow the option here too.
* | Generate alert-tracks pid & log to default locationGareth Rees2014-07-15-2/+3
| | | | | | | | | | Deployment system should handle linking the original location to wherever necessary on the specific platform.
* | Minor tidying of alert-tracks generationGareth Rees2014-07-15-6/+10
|/
* Add MAILTO option to convert_crontab taskGareth Rees2014-06-25-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | Less manual editing for reinstallers. Existing backwards-compatibility: $ bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ VHOST_DIR=/home/vagrant/ \ VCSPATH=alaveteli \ SITE=alaveteli \ CRONTAB=config/crontab-example | grep 'MAILTO=' MAILTO=cron-alaveteli@mysociety.org New optional MAILTO option: $ bundle exec rake config_files:convert_crontab \ DEPLOY_USER=deploy \ VHOST_DIR=/home/vagrant/ \ VCSPATH=alaveteli \ SITE=alaveteli CRONTAB=config/crontab-example \ MAILTO=cron@example.org | grep 'MAILTO=' MAILTO=cron@example.org
* Rake task for cleaning up holding pen eventsLouise Crow2014-06-02-0/+20
|
* Remove Total Requests from quarterly statsGareth Rees2014-05-01-6/+6
| | | | | Was confusing what the number meant; easier to just sum numbers in the quartery columns to get totals.
* Add rake tasks for James Cheshire statsGareth Rees2014-05-01-0/+55
|
* Allow from_admin_message to take a name and email.Louise Crow2014-01-13-3/+4
| | | | | Previously it accepted a user, but for this usage we won't necessarily have one.
* Merge branch 'feature/less-destructive-themes-install' of ↵Louise Crow2013-12-09-59/+79
|\ | | | | | | ssh://git.mysociety.org/data/git/public/alaveteli into feature/less-destructive-themes-install
| * Make 'rake themes:install' safer for developersMark Longair2013-12-06-59/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the themes:install rake task would remove the existing theme with 'rm -rf' and re-clone the theme into place. This is unfortunate for a developer who has been making changes to a theme and then runs the rails-post-deploy script, since it calls the themes:install task which will wipe out those changes. In addition, when installing themes it would deliberately remove the .git directory of the theme, so if you do want to work in that theme you'd have to reinitialize the theme directory to be a git repository again. This commit changes the task so that now: - If a theme directory is present but it isn't a git repository, it's moved out of the way. - If there's no theme directory at the expected location after that step, the theme repository is cloned into place - The task ensures that the origin remote points to the theme's URL, and fetches from that remote. - If there are any uncommitted changes in the theme repository or the current commit appears not to have been pushed, the task exits with a helpful error. - The preferred branch or tag is checked out in the theme repository as before. (The uninstall, install and post_install hooks are run as before.) This shouldn't make a difference to deployed instances of Alaveteli but will be helpful for developers who want to work on developing a theme. Fixes #1111.
* | Fix the command-line CSV importer under Ruby 1.9Mark Longair2013-12-03-6/+6
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under Ruby 1.8.7, you can parse a CSV file with the following code (Example A): require 'csv' CSV.parse('foo.csv') do |row| puts "got row: #{row.inspect}" end Rather confusingly, under Ruby 1.8.7, CSV.parse can also take a string representation of the contents of the file as its parameter, so this also works (Example B): require 'csv' CSV.parse("1,hello,red\n2,goodbye,green") do |row| puts "got row: #{row.inspect}" end However under Ruby 1.9.3, CSV.parse only expects a string representation of the contents of the CSV file, so only Example B works; Example B fails silently (interpreting the filename as a single cell CSV file, typically). The import:import_csv rake task unfortunately relied on both A and B working. This commit fixes this by adding PublicBody.import_csv_from_file, and refactoring PublicBody.import_csv to use the newly added class method, and adds a test to check for any regression in this behaviour. (This means that the usage of import_csv in the admin public body controller's import_csv action could now be changed to use PublicBody.import_csv_from_file directly from the uploaded file, which would be more efficient and cope with larger files without using lots of memory.) Fixes #1229
* Try to uninstall the old theme from vendor/plugins and lib/themesMark Longair2013-12-03-8/+17
| | | | | | | | | | | The theme install task would fail if there's an old theme present in vendor/plugins, since it doesn't try to uninstall the plugin from that location, only the new location. Then when the install.rb in the new plugin runs, it'll complain that there's a public/alavetelitheme symlink already present. This commit changes themes:install to try to uninstall the plugin from both locations.
* Ensure that the lib/themes directory exists before installing to thereMark Longair2013-12-03-0/+1
| | | | | | (An alternative would have been to add an empty lib/themes/.gitkeep file to this directory, but that makes ignoring the installed themes more complicated.)
* Merge branch 'move-plugins-out-of-vendor-plugins' into rails-3-developMark Longair2013-12-03-3/+3
|\
| * Move themes from vendor/plugins to lib/themesMark Longair2013-12-03-3/+3
| | | | | | | | | | | | | | | | | | | | These are essentially required in exactly the same way as before, but from lib/themes rather than vendor/plugins. This is the simplest possible change in order make the themes work outside vendor/plugins, I think, but it's not necessarily ideal. It would be worth considering whether these should be changed to Rails engines, as described here: http://guides.rubyonrails.org/engines.html
* | Ruby 1.8 compatibility fixes.Louise Crow2013-11-25-3/+3
| |
* | Add a rake task to analyse the distribution of hits to requests.Louise Crow2013-11-25-284/+32
|/ | | | Also removes old temp tasks.
* Merge branch 'install-script' into rails-3-developMark Longair2013-11-07-6/+20
|\
| * Add a rake task to rewrite the crontab-example fileMark Longair2013-11-07-0/+18
| | | | | | | | | | | | As suggested by Louise Crow, this new rake task reuses the convert_ugly function to rewrite the crontab-example file into a usable crontab file.
| * Fix an undefined variable errorMark Longair2013-11-07-6/+2
| | | | | | | | | | I assume 'skip' must have been an argument to this function before it was introduced into our repository.
* | Merge branch 'rails-3-develop' of ↵Louise Crow2013-11-07-1/+5
|\ \ | | | | | | | | | ssh://git.mysociety.org/data/git/public/alaveteli into rails-3-develop
| * | Update the calculation of the numerator for percentage statisticsMark Longair2013-11-05-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | We have changed the denominator of the proportion-based statistics to only include requests that are both visible and not 'awaiting_description'. This would mean, however, that the numerator could be larger than the denominator. This commit updates the calculation of those statistics to also exclude any hidden or unclassified requests.
* | | Allow start and end dates to be supplied to stats:showLouise Crow2013-11-07-2/+8
|/ / | | | | | | This is in the service of #1173 and #1174.
* | Merge branch 'switch-theme-script' into rails-3-developMark Longair2013-10-30-1/+1
|\ \ | | | | | | | | | | | | Conflicts: config/initializers/alaveteli.rb
| * | Make theme URL to theme name mapping consistentMark Longair2013-10-15-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code that extracted the theme name from each entry in THEME_URLS (in order to require code from a directory whose leaf name is the theme name) only supported git URLs that ended in '.git'. However, the themes:install rake task usefully supports a wider range of git URLs - for example, all of the following were supported: /home/whoever/themes/blah-theme => blah-theme /home/whoever/themes/blah-theme/ => blah-theme git://wherever/blah-theme.git => blah-theme ssh://wherever/blah-theme.git// => blah-theme This commit factors out a theme_url_to_theme_name method, adds tests for it, and uses that method in both: lib/tasks/themes.rake config/initializers/theme_loader.rb ... so that a wider range of theme URLs are consistently supported.
* | Merge remote-tracking branch 'origin/command-line-csv-import' into ↵Louise Crow2013-10-30-0/+78
|\ \ | | | | | | | | | rails-3-develop
| * | Remove the confusing "time remaining" messageMark Longair2013-10-29-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The time estimates were confusing on two counts: - The messages mixed locales - The estimates were hugely inaccurate, since the import slows down as time goes on
| * | Make sure that the temporary file is closed before reading from itMark Longair2013-10-29-2/+5
| | | | | | | | | | | | Thanks to Louise Crow for pointing out this problem.
| * | Add a rake task to import public bodies from a CSV fileMark Longair2013-10-15-0/+86
| |/ | | | | | | | | | | | | | | For importing a very large number of public bodies, it's mostly likely less frustrating to import them from the CSV file using this rake task instead of using the form in the admin interface. Fixes #1132
* / Reduce the memory consumption of rake stats:update_public_bodies_statsMark Longair2013-10-23-2/+3
|/ | | | | | | | This task was taking a huge amount of memory, even when fetching the InfoRequest objects with find_each. With an additional find_each for public bodies (10 at a time) and reducing the batch size for info requests to 200 at a time, the memory size of this rake task is kept down to about 400MB.
* Add simple task for updating theme translations.Louise Crow2013-09-12-0/+26
|
* Remove unused task.Louise Crow2013-09-12-22/+0
|
* Don't save a public body version when updating the stats.Louise Crow2013-09-05-1/+3
|
* Don't re-index body when updating statsLouise Crow2013-09-05-0/+1
|
* Add a verbosity flag to public body stats taskLouise Crow2013-09-05-1/+3
|
* Merge branch 'hotfix/0.13.0.1' into rails-3-developLouise Crow2013-09-04-1/+1
|\
| * Fix wrong method name.hotfix/0.13.0.1Louise Crow2013-08-28-1/+1
| |
* | Merge branch 'body-statistics' into rails-3-developLouise Crow2013-09-04-0/+21
|\ \ | |/ |/|
| * Improve calculation of PublicBody statistics columnsMark Longair2013-08-20-18/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On PublicBody, we don't need to update info_requests_count because that's already done with :counter_cache. On the other hand, info_requests_successful_count and info_requests_not_held_count can't be updated easily with counter_cache (since they need conditions to be attached). Instead we update them in post_save and post_destroy, as suggested here: http://blog.douglasfshearer.com/post/17495285851/custom-counter-cache-with-conditions This also adds tests to ensure that the after_(save|destroy) callbacks are called and that they modify the counts correctly.
| * Add a page with experimental statistics on public bodiesMark Longair2013-08-20-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The statistics on the status of the requests to a particular public body are too slow to calculate on-the-fly, so this commit adds: * Extra columns on public_bodies to store counts of the successful, not held, and overdue request counts for each public body. * A rake task which should be run periodically to update the overdue request count column. If Javascript is not available, the summary statistics are shown as tables. If Javascript is available, graphs are drawn with Flot.
* | Mark all events for the fixed requests as needing a reindex.release/0.13Louise Crow2013-08-20-9/+16
|/
* Merge branch 'feature/further-request-event-fixes' into rails-3-developLouise Crow2013-08-15-0/+30
|\
| * Add task for cleaning up bad request histories.Louise Crow2013-08-15-0/+30
| |
* | Only check commonlib, don't try to split the response into segments (as @mhl ↵Louise Crow2013-08-08-7/+8
| | | | | | | | points out, the case where the initial character is a space is somewhat confusing), just grab the first character of the whole string and check it against expected values.
* | Call it an error, not a warning.Louise Crow2013-07-30-4/+4
| |