Commit 9f74370be9ee1a6d416e5c4380b65ac29580691d
1 parent
9205fad7
Exists in
master
and in
23 other branches
Noosfero classes are not always loaded automatically
Showing
1 changed file
with
6 additions
and
0 deletions
Show diff stats
lib/tasks/doc.rake
| ... | ... | @@ -41,6 +41,8 @@ namespace :noosfero do |
| 41 | 41 | toc_sections.each do |toc| |
| 42 | 42 | section_topics = Dir.glob(File.dirname(toc) + '/*.textile').map {|item| item.sub('.textile', '.en.xhtml') }.reject {|item| ['index.en.xhtml', 'toc.en.xhtml' ].include?(File.basename(item))} |
| 43 | 43 | file toc => section_topics do |t| |
| 44 | + require 'app/models/doc_item' | |
| 45 | + require 'app/models/doc_topic' | |
| 44 | 46 | begin |
| 45 | 47 | File.open(toc, 'w') do |output_file| |
| 46 | 48 | section = File.basename(File.dirname(toc)) |
| ... | ... | @@ -65,6 +67,8 @@ namespace :noosfero do |
| 65 | 67 | |
| 66 | 68 | top_level_toc = 'doc/noosfero/toc.en.xhtml' |
| 67 | 69 | file top_level_toc => index_sections do |
| 70 | + require 'app/models/doc_item' | |
| 71 | + require 'app/models/doc_topic' | |
| 68 | 72 | begin |
| 69 | 73 | File.open(top_level_toc, 'w') do |output_file| |
| 70 | 74 | output_file.puts "<!-- THIS FILE IS AUTOGENERATED. DO NOT EDIT -->" |
| ... | ... | @@ -88,6 +92,7 @@ namespace :noosfero do |
| 88 | 92 | |
| 89 | 93 | po4a_conf = 'tmp/po4a.conf' |
| 90 | 94 | file po4a_conf => english_xhtml do |
| 95 | + require 'noosfero' | |
| 91 | 96 | begin |
| 92 | 97 | File.open(po4a_conf, 'w') do |file| |
| 93 | 98 | file.puts "[po4a_langs] #{(Noosfero.locales.keys - ['en']).join(' ')}" |
| ... | ... | @@ -133,6 +138,7 @@ namespace :noosfero do |
| 133 | 138 | desc "Translates Noosfero online documentation (does not touch PO files)" |
| 134 | 139 | task :translate => [:link_plugins_textiles, :do_translation] |
| 135 | 140 | task :do_translation => english_xhtml do |
| 141 | + require 'noosfero' | |
| 136 | 142 | languages = Noosfero.locales.keys - ['en'] |
| 137 | 143 | languages.each do |lang| |
| 138 | 144 | po = "po/#{lang}/noosfero-doc.po" | ... | ... |