summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
committererdgeist <erdgeist@erdgeist.org>2026-06-27 22:52:50 +0200
commit9a19a0494ef51cdac9a78e24d517ca48ba44c453 (patch)
tree8eaae12d8047a40e29d3ea7ff3116b5c869e04bd /lib
parent85a01e35274b8d4d4165a7b26bd7986e211246bb (diff)
parent1853082fcd8c067390c246f9daa01a9b47387497 (diff)
Migration from Rails 2.3.5 to Rails 8.1 successful.
Merging dev branch.
Diffstat (limited to 'lib')
-rw-r--r--lib/authenticated_system.rb2
-rw-r--r--lib/authors_importer.rb2
-rw-r--r--lib/awesome_patch.rb16
-rw-r--r--lib/chaos_importer.rb4
-rw-r--r--lib/tasks/development_init.rake8
-rw-r--r--lib/tasks/test_db.rake19
-rw-r--r--lib/update_importer.rb4
7 files changed, 29 insertions, 26 deletions
diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb
index 838b734..217f79e 100644
--- a/lib/authenticated_system.rb
+++ b/lib/authenticated_system.rb
@@ -74,7 +74,7 @@ module AuthenticatedSystem
74 # 74 #
75 # We can return to this location by calling #redirect_back_or_default. 75 # We can return to this location by calling #redirect_back_or_default.
76 def store_location 76 def store_location
77 session[:return_to] = request.request_uri 77 session[:return_to] = request.fullpath
78 end 78 end
79 79
80 # Redirect to the URI stored by the most recent store_location call or 80 # Redirect to the URI stored by the most recent store_location call or
diff --git a/lib/authors_importer.rb b/lib/authors_importer.rb
index 8532a95..e0b16bd 100644
--- a/lib/authors_importer.rb
+++ b/lib/authors_importer.rb
@@ -4,7 +4,7 @@ require 'digest/sha1'
4class AuthorsImporter 4class AuthorsImporter
5 5
6 def initialize path 6 def initialize path
7 @parsed_file = CSV::Reader.parse(File.open(path, "r")) if File.exists? path 7 @parsed_file = CSV::Reader.parse(File.open(path, "r")) if File.exist? path
8 end 8 end
9 9
10 def import_authors 10 def import_authors
diff --git a/lib/awesome_patch.rb b/lib/awesome_patch.rb
deleted file mode 100644
index d9f738c..0000000
--- a/lib/awesome_patch.rb
+++ /dev/null
@@ -1,16 +0,0 @@
1module CollectiveIdea
2 module Acts #:nodoc:
3 module NestedSet
4 module InstanceMethods
5 alias_method :move_to_original, :move_to
6
7 def move_to target, position
8 move_to_original target, position
9 if self.class == Node
10 self.update_unique_name
11 end
12 end
13 end
14 end
15 end
16end \ No newline at end of file
diff --git a/lib/chaos_importer.rb b/lib/chaos_importer.rb
index db2a96b..41dca30 100644
--- a/lib/chaos_importer.rb
+++ b/lib/chaos_importer.rb
@@ -148,7 +148,7 @@ class ChaosImporter
148 :body => extract_body(html) 148 :body => extract_body(html)
149 } 149 }
150 150
151 draft.update_attributes options 151 draft.update options
152 draft 152 draft
153 end 153 end
154 154
@@ -215,7 +215,7 @@ class ChaosImporter
215 unless tmp_event = node.event 215 unless tmp_event = node.event
216 tmp_event = Event.create! event_options.merge({:node_id => node.id}) 216 tmp_event = Event.create! event_options.merge({:node_id => node.id})
217 else 217 else
218 tmp_event.update_attributes event_options 218 tmp_event.update event_options
219 end 219 end
220 end 220 end
221 221
diff --git a/lib/tasks/development_init.rake b/lib/tasks/development_init.rake
index 2ac9a83..94f323c 100644
--- a/lib/tasks/development_init.rake
+++ b/lib/tasks/development_init.rake
@@ -25,19 +25,19 @@ namespace :cccms do
25 25
26 desc "Import the authors" 26 desc "Import the authors"
27 task :import_authors => :environment do |t| 27 task :import_authors => :environment do |t|
28 importer = AuthorsImporter.new("#{RAILS_ROOT}/db/authors.csv") 28 importer = AuthorsImporter.new(Rails.root.join('db', 'authors.csv').to_s)
29 importer.import_authors 29 importer.import_authors
30 end 30 end
31 31
32 desc "Update authors on pages" 32 desc "Update authors on pages"
33 task :update_authors_on_pages => :environment do |t| 33 task :update_authors_on_pages => :environment do |t|
34 i = ChaosImporter.new("#{RAILS_ROOT}/db/updates") 34 i = ChaosImporter.new(Rails.root.join('db', 'updates').to_s)
35 i.update_authors_on_pages 35 i.update_authors_on_pages
36 end 36 end
37 37
38 desc "Import the old XML Files" 38 desc "Import the old XML Files"
39 task :import_updates => :environment do |t| 39 task :import_updates => :environment do |t|
40 i = ChaosImporter.new("#{RAILS_ROOT}/db/updates") 40 i = ChaosImporter.new(Rails.root.join('db', 'updates').to_s)
41 i.import_updates 41 i.import_updates
42 end 42 end
43 43
@@ -134,4 +134,4 @@ namespace :cccms do
134 orphans.each { |page| page.destroy } 134 orphans.each { |page| page.destroy }
135 end 135 end
136 136
137end \ No newline at end of file 137end
diff --git a/lib/tasks/test_db.rake b/lib/tasks/test_db.rake
new file mode 100644
index 0000000..0a7a17d
--- /dev/null
+++ b/lib/tasks/test_db.rake
@@ -0,0 +1,19 @@
1namespace :db do
2 namespace :test do
3 task :load_schema do
4 ActiveRecord::Base.establish_connection(:test)
5 ActiveRecord::Schema.verbose = false
6 load "#{Rails.root}/db/schema.rb"
7 end
8
9 task :prepare => :environment do
10 begin
11 ActiveRecord::Base.establish_connection(:test)
12 ActiveRecord::Base.connection
13 rescue
14 system("psql -U postgres postgres -c \"CREATE DATABASE psql_test OWNER psql ENCODING 'UTF8';\"")
15 end
16 Rake::Task['db:test:load_schema'].invoke
17 end
18 end
19end
diff --git a/lib/update_importer.rb b/lib/update_importer.rb
index 103ac5a..2978c43 100644
--- a/lib/update_importer.rb
+++ b/lib/update_importer.rb
@@ -82,7 +82,7 @@ class UpdateImporter
82 I18n.locale = lang 82 I18n.locale = lang
83 83
84 unless node.head 84 unless node.head
85 page.update_attributes( 85 page.update(
86 :title => xhtml.elements['title'].get_text.to_s, 86 :title => xhtml.elements['title'].get_text.to_s,
87 :abstract => xhtml.elements['abstract'].get_text.to_s, 87 :abstract => xhtml.elements['abstract'].get_text.to_s,
88 :body => body 88 :body => body
@@ -176,7 +176,7 @@ class UpdateImporter
176 unless tmp_event = node.event 176 unless tmp_event = node.event
177 tmp_event = Event.create! event_options.merge({:node_id => node.id}) 177 tmp_event = Event.create! event_options.merge({:node_id => node.id})
178 else 178 else
179 tmp_event.update_attributes event_options 179 tmp_event.update event_options
180 end 180 end
181 end 181 end
182 end 182 end