Trac importer: user can now choose between sqlite and sqlite3 adapter for Trac database.
Trac importer: issues and wiki modules are enabled by default for the imported project. Fixed: 404 error when trying to save a custom query under certain circumstance. git-svn-id: http://redmine.rubyforge.org/svn/trunk@894 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1454a711ca
commit
b0bb1baeaa
|
@ -2,7 +2,8 @@
|
||||||
<h2><%=l(:label_issue_plural)%></h2>
|
<h2><%=l(:label_issue_plural)%></h2>
|
||||||
<% set_html_title l(:label_issue_plural) %>
|
<% set_html_title l(:label_issue_plural) %>
|
||||||
|
|
||||||
<% form_tag({ :controller => 'queries', :action => 'new', :project_id => @project }, :id => 'query_form') do %>
|
<% form_tag({ :controller => 'queries', :action => 'new' }, :id => 'query_form') do %>
|
||||||
|
<%= hidden_field_tag('project_id', @project.id) if @project %>
|
||||||
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
<%= render :partial => 'queries/filters', :locals => {:query => @query} %>
|
||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= link_to_remote l(:button_apply),
|
<%= link_to_remote l(:button_apply),
|
||||||
|
|
|
@ -190,6 +190,9 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.migrate
|
def self.migrate
|
||||||
|
establish_connection({:adapter => trac_adapter,
|
||||||
|
:database => trac_db_path})
|
||||||
|
|
||||||
# Quick database test before clearing Redmine data
|
# Quick database test before clearing Redmine data
|
||||||
TracComponent.count
|
TracComponent.count
|
||||||
|
|
||||||
|
@ -370,7 +373,7 @@ namespace :redmine do
|
||||||
def self.limit_for(klass, attribute)
|
def self.limit_for(klass, attribute)
|
||||||
klass.columns_hash[attribute.to_s].limit
|
klass.columns_hash[attribute.to_s].limit
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.encoding(charset)
|
def self.encoding(charset)
|
||||||
@ic = Iconv.new('UTF-8', charset)
|
@ic = Iconv.new('UTF-8', charset)
|
||||||
rescue Iconv::InvalidEncoding
|
rescue Iconv::InvalidEncoding
|
||||||
|
@ -388,11 +391,17 @@ namespace :redmine do
|
||||||
puts e
|
puts e
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.trac_directory
|
def self.trac_directory
|
||||||
@trac_directory
|
@trac_directory
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.set_trac_adapter(adapter)
|
||||||
|
return false unless %w(sqlite sqlite3).include?(adapter)
|
||||||
|
@trac_adapter = adapter
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.trac_adapter; @trac_adapter end
|
||||||
def self.trac_db_path; "#{trac_directory}/db/trac.db" end
|
def self.trac_db_path; "#{trac_directory}/db/trac.db" end
|
||||||
def self.trac_attachments_directory; "#{trac_directory}/attachments" end
|
def self.trac_attachments_directory; "#{trac_directory}/attachments" end
|
||||||
|
|
||||||
|
@ -404,6 +413,8 @@ namespace :redmine do
|
||||||
:description => identifier.humanize
|
:description => identifier.humanize
|
||||||
project.identifier = identifier
|
project.identifier = identifier
|
||||||
puts "Unable to create a project with identifier '#{identifier}'!" unless project.save
|
puts "Unable to create a project with identifier '#{identifier}'!" unless project.save
|
||||||
|
# enable issues and wiki for the created project
|
||||||
|
project.enabled_module_names = ['issue_tracking', 'wiki']
|
||||||
end
|
end
|
||||||
@target_project = project.new_record? ? nil : project
|
@target_project = project.new_record? ? nil : project
|
||||||
end
|
end
|
||||||
|
@ -441,12 +452,11 @@ namespace :redmine do
|
||||||
end
|
end
|
||||||
|
|
||||||
prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory}
|
prompt('Trac directory') {|directory| TracMigrate.set_trac_directory directory}
|
||||||
|
prompt('Trac database adapter (sqlite, sqlite3)', :default => 'sqlite') {|adapter| TracMigrate.set_trac_adapter adapter}
|
||||||
prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding}
|
prompt('Trac database encoding', :default => 'UTF-8') {|encoding| TracMigrate.encoding encoding}
|
||||||
prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier}
|
prompt('Target project identifier') {|identifier| TracMigrate.target_project_identifier identifier}
|
||||||
puts
|
puts
|
||||||
|
|
||||||
TracMigrate.establish_connection({:adapter => 'sqlite',
|
|
||||||
:database => "#{TracMigrate.trac_db_path}"})
|
|
||||||
TracMigrate.migrate
|
TracMigrate.migrate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue