Commit d16f9272 authored by Mario Manno's avatar Mario Manno

pentabarf import updated

* more documentation on importing from pentabarf
* improved event rating import speed
* carefully import long links
* fix user role import
* redirect deleted users
* respect conference timezone on event import
* sorted Gemfile
parent 99f6b506
......@@ -4,34 +4,34 @@ ruby "1.9.3"
gem 'rails', '3.2.11'
gem 'sqlite3'
gem 'pg'
gem 'mysql2'
gem 'pg'
gem 'sqlite3'
gem 'acts_as_commentable'
gem 'acts_as_indexed'
gem 'barista'
gem 'bcrypt-ruby'
gem 'cancan'
gem 'haml'
gem 'acts_as_commentable'
gem 'will_paginate'
gem 'paperclip', '< 3.0'
gem 'gravatar-ultimate'
gem 'cocoon'
gem 'formtastic', '~> 2.1.0'
gem 'formtastic-bootstrap', :git => "git://github.com/katastrophie/formtastic-bootstrap.git"
gem 'gravatar-ultimate'
gem 'haml'
gem 'jquery-rails', '~> 1.0.19'
gem 'acts_as_indexed'
gem 'cocoon'
gem 'paper_trail', '2.3.3'
gem 'json'
gem 'localized_language_select', '0.2.0', :git => "git://github.com/oneiros/localized_language_select.git"
gem 'nokogiri'
gem 'paperclip', '< 3.0'
gem 'paper_trail', '2.3.3'
gem 'prawn'
gem 'prawn_rails'
gem 'ransack'
gem 'transitions', :require => ["transitions", "active_record/transitions"]
gem 'json'
gem 'barista'
gem 'ri_cal'
gem 'nokogiri'
gem 'settingslogic'
gem 'transitions', :require => ["transitions", "active_record/transitions"]
gem 'twitter-bootstrap-rails', :git => "git://github.com/seyhunak/twitter-bootstrap-rails.git", :ref => "5e62b21c8f258010af7f5bc858b89a24f16936a9"
gem 'formtastic-bootstrap', :git => "git://github.com/katastrophie/formtastic-bootstrap.git"
gem 'prawn'
gem 'prawn_rails'
gem 'will_paginate'
group :development, :test do
gem 'bullet'
......@@ -40,19 +40,19 @@ group :development, :test do
end
group :test do
gem 'minitest'
gem 'factory_girl_rails', '~> 1.2.0'
gem 'minitest'
gem 'turn', :require => false
end
group :development do
gem 'hpricot'
gem 'yaml_db'
gem 'shotgun'
gem 'yaml_db'
end
group :assets do
gem 'sass-rails', " ~> 3.2.0"
gem 'coffee-rails', " ~> 3.2.0"
gem 'sass-rails', " ~> 3.2.0"
gem 'uglifier'
end
......@@ -5,13 +5,15 @@ These notes may help to import data from a pentabarf postgresql database.
Using postgresql as a database for frab is still somewhat untested. The pentabarf
import is however likely to fail, as pentabarf uses text fields instead of char(255)
Imagemagick needs to be installed as we will convert pjpeg and tiff to png.
## postgresql installation
install postgresql
Install postgresql
## postgresql setup
* Make it listen on localhost
* make it listen on localhost
* create a psql user and grant some access on relations
* add a pentabarf entry for the postgresql database to your rails db environment
......@@ -27,13 +29,22 @@ Make a copy of your postgresql database, as we need to do some changes
Grant all permissions on the database copy to the import user account:
psql cccv
select 'grant all on '||schemaname||'.'||tablename||' to bar;' from pg_tables
psql NEWNAME
-- generate the grant statements
select 'grant all on '||schemaname||'.'||tablename||' to frab;' from pg_tables
order by schemaname, tablename;
-- copy&paste the generated statements into psql
-- in case you re-created the NEWNAME copy, re-grant permissions to the user
REVOKE ALL ON SCHEMA public FROM frab;
GRANT ALL ON SCHEMA public TO frab;
REVOKE ALL ON SCHEMA auth FROM frab;
GRANT ALL ON SCHEMA auth TO frab;
## data migration
I had to delete some images, too.
Conference acronyms need to be within /^[a-zA-Z0-9_-]*$/
Whitespaces are removed automatically, but you need to replace unicode characters manually.
-- conference acronyms appear in URLs, they may not contain whitespace in frab:
UPDATE conference SET acronym = replace(acronym, ' ', '');
......@@ -41,7 +52,6 @@ I had to delete some images, too.
## import
Delete any old mappings from previous imports. Maybe delete the old filess, too.
rm tmp/*mappings.yml
......@@ -49,4 +59,19 @@ Delete any old mappings from previous imports. Maybe delete the old filess, too.
RAILS_ENV=production rake db:reset
RAILS_ENV=production rake pentabarf:import:all
## testing
You can check on the barf data like this:
RAILS_ENV="development" rails console
@p = PentabarfImportHelper.new
@barf = @p.instance_variable_get('@barf')
@barf.select_all("SELECT * FROM conference")
## privileges
You maybe want to drop all users to the coordinator role, to start fresh.
User.all.select { |u| u.role == "admin" or u.role == "orga" }.each { |u| puts "dropping ${u.email}"; u.role = "coordinator"; u.save }
......@@ -49,7 +49,13 @@ class ApplicationController < ActionController::Base
end
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
user = nil
# maybe the user got deleted, so lets wrap this in a rescue block
begin
user = User.find(session[:user_id]) if session[:user_id]
rescue
end
@current_user ||= user
end
def authenticate_user!
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment