Revision 1298:4f746d8966dd lib/tasks
| lib/tasks/ci.rake | ||
|---|---|---|
| 8 | 8 |
Rake::Task["ci:teardown"].invoke |
| 9 | 9 |
end |
| 10 | 10 |
|
| 11 |
# Tasks can be hooked into by redefining them in a plugin |
|
| 12 | 11 |
namespace :ci do |
| 13 |
desc "Setup Redmine for a new build."
|
|
| 12 |
desc "Setup Redmine for a new build" |
|
| 14 | 13 |
task :setup do |
| 15 |
Rake::Task["ci:dump_environment"].invoke |
|
| 16 | 14 |
Rake::Task["tmp:clear"].invoke |
| 17 |
Rake::Task["db:create"].invoke |
|
| 15 |
Rake::Task["log:clear"].invoke |
|
| 16 |
Rake::Task["db:create:all"].invoke |
|
| 18 | 17 |
Rake::Task["db:migrate"].invoke |
| 19 | 18 |
Rake::Task["db:schema:dump"].invoke |
| 19 |
Rake::Task["test:scm:setup:all"].invoke |
|
| 20 | 20 |
Rake::Task["test:scm:update"].invoke |
| 21 | 21 |
end |
| 22 | 22 |
|
| 23 | 23 |
desc "Build Redmine" |
| 24 | 24 |
task :build do |
| 25 | 25 |
Rake::Task["test"].invoke |
| 26 |
#Rake::Task["test:ui"].invoke unless RUBY_VERSION < '1.9' |
|
| 26 | 27 |
end |
| 27 | 28 |
|
| 28 |
# Use this to cleanup after building or run post-build analysis. |
|
| 29 | 29 |
desc "Finish the build" |
| 30 | 30 |
task :teardown do |
| 31 | 31 |
end |
| 32 |
end |
|
| 32 | 33 |
|
| 33 |
desc "Creates and configures the databases for the CI server" |
|
| 34 |
task :database do |
|
| 35 |
path = 'config/database.yml' |
|
| 36 |
unless File.exists?(path) |
|
| 37 |
database = ENV['DATABASE_ADAPTER'] |
|
| 38 |
ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '')
|
|
| 39 |
branch = ENV['BRANCH'].gsub('.', '').gsub('-', '')
|
|
| 40 |
dev_db_name = "ci_#{branch}_#{ruby}_dev"
|
|
| 41 |
test_db_name = "ci_#{branch}_#{ruby}_test"
|
|
| 34 |
desc "Creates database.yml for the CI server" |
|
| 35 |
file 'config/database.yml' do |
|
| 36 |
require 'yaml' |
|
| 37 |
database = ENV['DATABASE_ADAPTER'] |
|
| 38 |
ruby = ENV['RUBY_VER'].gsub('.', '').gsub('-', '')
|
|
| 39 |
branch = ENV['BRANCH'].gsub('.', '').gsub('-', '')
|
|
| 40 |
dev_db_name = "ci_#{branch}_#{ruby}_dev"
|
|
| 41 |
test_db_name = "ci_#{branch}_#{ruby}_test"
|
|
| 42 | 42 |
|
| 43 |
case database |
|
| 44 |
when 'mysql' |
|
| 45 |
raise "Error creating databases" unless |
|
| 46 |
system(%|mysql -u jenkins --password=jenkins -e 'create database #{dev_db_name} character set utf8;'|) &&
|
|
| 47 |
system(%|mysql -u jenkins --password=jenkins -e 'create database #{test_db_name} character set utf8;'|)
|
|
| 48 |
dev_conf = { 'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8' }
|
|
| 49 |
test_conf = { 'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => test_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8' }
|
|
| 50 |
when 'postgresql' |
|
| 51 |
raise "Error creating databases" unless |
|
| 52 |
system(%|psql -U jenkins -d postgres -c "create database #{dev_db_name} owner jenkins encoding 'UTF8';"|) &&
|
|
| 53 |
system(%|psql -U jenkins -d postgres -c "create database #{test_db_name} owner jenkins encoding 'UTF8';"|)
|
|
| 54 |
dev_conf = { 'adapter' => 'postgresql', 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins' }
|
|
| 55 |
test_conf = { 'adapter' => 'postgresql', 'database' => test_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins' }
|
|
| 56 |
when 'sqlite3' |
|
| 57 |
dev_conf = { 'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3" }
|
|
| 58 |
test_conf = { 'adapter' => 'sqlite3', 'database' => "db/#{test_db_name}.sqlite3" }
|
|
| 59 |
else |
|
| 60 |
raise "Unknown database" |
|
| 61 |
end |
|
| 62 |
|
|
| 63 |
File.open(path, 'w') do |f| |
|
| 64 |
f.write YAML.dump({'development' => dev_conf, 'test' => test_conf})
|
|
| 65 |
end |
|
| 66 |
end |
|
| 43 |
case database |
|
| 44 |
when 'mysql' |
|
| 45 |
dev_conf = {'adapter' => (RUBY_VERSION >= '1.9' ? 'mysql2' : 'mysql'), 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins', 'encoding' => 'utf8'}
|
|
| 46 |
test_conf = dev_conf.merge('database' => test_db_name)
|
|
| 47 |
when 'postgresql' |
|
| 48 |
dev_conf = {'adapter' => 'postgresql', 'database' => dev_db_name, 'host' => 'localhost', 'username' => 'jenkins', 'password' => 'jenkins'}
|
|
| 49 |
test_conf = dev_conf.merge('database' => test_db_name)
|
|
| 50 |
when 'sqlite3' |
|
| 51 |
dev_conf = {'adapter' => 'sqlite3', 'database' => "db/#{dev_db_name}.sqlite3"}
|
|
| 52 |
test_conf = dev_conf.merge('database' => "db/#{test_db_name}.sqlite3")
|
|
| 53 |
when 'sqlserver' |
|
| 54 |
dev_conf = {'adapter' => 'sqlserver', 'database' => dev_db_name, 'host' => 'mssqlserver', 'port' => 1433, 'username' => 'jenkins', 'password' => 'jenkins'}
|
|
| 55 |
test_conf = dev_conf.merge('database' => test_db_name)
|
|
| 56 |
else |
|
| 57 |
abort "Unknown database" |
|
| 67 | 58 |
end |
| 68 | 59 |
|
| 69 |
desc "Dump the environment information to a BUILD_ENVIRONMENT ENV variable for debugging" |
|
| 70 |
task :dump_environment do |
|
| 71 |
|
|
| 72 |
ENV['BUILD_ENVIRONMENT'] = ['ruby -v', 'gem -v', 'gem list'].collect do |command| |
|
| 73 |
result = `#{command}`
|
|
| 74 |
"$ #{command}\n#{result}"
|
|
| 75 |
end.join("\n")
|
|
| 76 |
|
|
| 60 |
File.open('config/database.yml', 'w') do |f|
|
|
| 61 |
f.write YAML.dump({'development' => dev_conf, 'test' => test_conf})
|
|
| 77 | 62 |
end |
| 78 | 63 |
end |
| 79 |
|
|
| lib/tasks/ciphering.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| lib/tasks/email.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| ... | ... | |
| 29 | 29 |
create: create a user account |
| 30 | 30 |
no_permission_check=1 disable permission checking when receiving |
| 31 | 31 |
the email |
| 32 |
no_account_notice=1 disable new user account notification |
|
| 33 |
default_group=foo,bar adds created user to foo and bar groups |
|
| 32 | 34 |
|
| 33 | 35 |
Issue attributes control options: |
| 34 | 36 |
project=PROJECT identifier of the target project |
| ... | ... | |
| 58 | 60 |
options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] |
| 59 | 61 |
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] |
| 60 | 62 |
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] |
| 63 |
options[:no_account_notice] = ENV['no_account_notice'] if ENV['no_account_notice'] |
|
| 64 |
options[:default_group] = ENV['default_group'] if ENV['default_group'] |
|
| 61 | 65 |
|
| 62 | 66 |
MailHandler.receive(STDIN.read, options) |
| 63 | 67 |
end |
| ... | ... | |
| 73 | 77 |
create: create a user account |
| 74 | 78 |
no_permission_check=1 disable permission checking when receiving |
| 75 | 79 |
the email |
| 80 |
no_account_notice=1 disable new user account notification |
|
| 81 |
default_group=foo,bar adds created user to foo and bar groups |
|
| 76 | 82 |
|
| 77 | 83 |
Available IMAP options: |
| 78 | 84 |
host=HOST IMAP server host (default: 127.0.0.1) |
| ... | ... | |
| 129 | 135 |
options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] |
| 130 | 136 |
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] |
| 131 | 137 |
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] |
| 138 |
options[:no_account_notice] = ENV['no_account_notice'] if ENV['no_account_notice'] |
|
| 139 |
options[:default_group] = ENV['default_group'] if ENV['default_group'] |
|
| 132 | 140 |
|
| 133 | 141 |
Redmine::IMAP.check(imap_options, options) |
| 134 | 142 |
end |
| ... | ... | |
| 162 | 170 |
options[:allow_override] = ENV['allow_override'] if ENV['allow_override'] |
| 163 | 171 |
options[:unknown_user] = ENV['unknown_user'] if ENV['unknown_user'] |
| 164 | 172 |
options[:no_permission_check] = ENV['no_permission_check'] if ENV['no_permission_check'] |
| 173 |
options[:no_account_notice] = ENV['no_account_notice'] if ENV['no_account_notice'] |
|
| 174 |
options[:default_group] = ENV['default_group'] if ENV['default_group'] |
|
| 165 | 175 |
|
| 166 | 176 |
Redmine::POP3.check(pop_options, options) |
| 167 | 177 |
end |
| lib/tasks/locales.rake | ||
|---|---|---|
| 43 | 43 |
files = Dir.glob(File.join(dir,'*.{yaml,yml}'))
|
| 44 | 44 |
files.sort.each do |file| |
| 45 | 45 |
puts "parsing #{file}..."
|
| 46 |
file_strings = YAML.load(File.read(file)) |
|
| 46 |
file_strings = YAML.load_file(file) |
|
| 47 |
unless file_strings.is_a?(Hash) |
|
| 48 |
puts "#{file}: content is not a Hash (#{file_strings.class.name})"
|
|
| 49 |
next |
|
| 50 |
end |
|
| 51 |
unless file_strings.keys.size == 1 |
|
| 52 |
puts "#{file}: content has multiple keys (#{file_strings.keys.size})"
|
|
| 53 |
next |
|
| 54 |
end |
|
| 47 | 55 |
file_strings = file_strings[file_strings.keys.first] |
| 48 | 56 |
|
| 49 | 57 |
file_strings.each do |key, string| |
| lib/tasks/migrate_from_mantis.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| ... | ... | |
| 18 | 18 |
desc 'Mantis migration script' |
| 19 | 19 |
|
| 20 | 20 |
require 'active_record' |
| 21 |
require 'iconv' |
|
| 21 |
require 'iconv' if RUBY_VERSION < '1.9'
|
|
| 22 | 22 |
require 'pp' |
| 23 | 23 |
|
| 24 | 24 |
namespace :redmine do |
| ... | ... | |
| 30 | 30 |
assigned_status = IssueStatus.find_by_position(2) |
| 31 | 31 |
resolved_status = IssueStatus.find_by_position(3) |
| 32 | 32 |
feedback_status = IssueStatus.find_by_position(4) |
| 33 |
closed_status = IssueStatus.find :first, :conditions => { :is_closed => true }
|
|
| 33 |
closed_status = IssueStatus.where(:is_closed => true).first
|
|
| 34 | 34 |
STATUS_MAPPING = {10 => DEFAULT_STATUS, # new
|
| 35 | 35 |
20 => feedback_status, # feedback |
| 36 | 36 |
30 => DEFAULT_STATUS, # acknowledged |
| ... | ... | |
| 53 | 53 |
TRACKER_BUG = Tracker.find_by_position(1) |
| 54 | 54 |
TRACKER_FEATURE = Tracker.find_by_position(2) |
| 55 | 55 |
|
| 56 |
roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
|
|
| 56 |
roles = Role.where(:builtin => 0).order('position ASC').all
|
|
| 57 | 57 |
manager_role = roles[0] |
| 58 | 58 |
developer_role = roles[1] |
| 59 | 59 |
DEFAULT_ROLE = roles.last |
| ... | ... | |
| 241 | 241 |
User.delete_all "login <> 'admin'" |
| 242 | 242 |
users_map = {}
|
| 243 | 243 |
users_migrated = 0 |
| 244 |
MantisUser.find(:all).each do |user|
|
|
| 244 |
MantisUser.all.each do |user|
|
|
| 245 | 245 |
u = User.new :firstname => encode(user.firstname), |
| 246 | 246 |
:lastname => encode(user.lastname), |
| 247 | 247 |
:mail => user.email, |
| ... | ... | |
| 263 | 263 |
projects_map = {}
|
| 264 | 264 |
versions_map = {}
|
| 265 | 265 |
categories_map = {}
|
| 266 |
MantisProject.find(:all).each do |project|
|
|
| 266 |
MantisProject.all.each do |project|
|
|
| 267 | 267 |
p = Project.new :name => encode(project.name), |
| 268 | 268 |
:description => encode(project.description) |
| 269 | 269 |
p.identifier = project.identifier |
| ... | ... | |
| 347 | 347 |
bug.bug_files.each do |file| |
| 348 | 348 |
a = Attachment.new :created_on => file.date_added |
| 349 | 349 |
a.file = file |
| 350 |
a.author = User.find :first
|
|
| 350 |
a.author = User.first |
|
| 351 | 351 |
a.container = i |
| 352 | 352 |
a.save |
| 353 | 353 |
end |
| ... | ... | |
| 365 | 365 |
|
| 366 | 366 |
# Bug relationships |
| 367 | 367 |
print "Migrating bug relations" |
| 368 |
MantisBugRelationship.find(:all).each do |relation|
|
|
| 368 |
MantisBugRelationship.all.each do |relation|
|
|
| 369 | 369 |
next unless issues_map[relation.source_bug_id] && issues_map[relation.destination_bug_id] |
| 370 | 370 |
r = IssueRelation.new :relation_type => RELATION_TYPE_MAPPING[relation.relationship_type] |
| 371 | 371 |
r.issue_from = Issue.find_by_id(issues_map[relation.source_bug_id]) |
| ... | ... | |
| 379 | 379 |
# News |
| 380 | 380 |
print "Migrating news" |
| 381 | 381 |
News.destroy_all |
| 382 |
MantisNews.find(:all, :conditions => 'project_id > 0').each do |news|
|
|
| 382 |
MantisNews.where('project_id > 0').all.each do |news|
|
|
| 383 | 383 |
next unless projects_map[news.project_id] |
| 384 | 384 |
n = News.new :project_id => projects_map[news.project_id], |
| 385 | 385 |
:title => encode(news.headline[0..59]), |
| ... | ... | |
| 395 | 395 |
# Custom fields |
| 396 | 396 |
print "Migrating custom fields" |
| 397 | 397 |
IssueCustomField.destroy_all |
| 398 |
MantisCustomField.find(:all).each do |field|
|
|
| 398 |
MantisCustomField.all.each do |field|
|
|
| 399 | 399 |
f = IssueCustomField.new :name => field.name[0..29], |
| 400 | 400 |
:field_format => CUSTOM_FIELD_TYPE_MAPPING[field.format], |
| 401 | 401 |
:min_length => field.length_min, |
| ... | ... | |
| 407 | 407 |
print '.' |
| 408 | 408 |
STDOUT.flush |
| 409 | 409 |
# Trackers association |
| 410 |
f.trackers = Tracker.find :all
|
|
| 410 |
f.trackers = Tracker.all |
|
| 411 | 411 |
|
| 412 | 412 |
# Projects association |
| 413 | 413 |
field.projects.each do |project| |
| ... | ... | |
| 440 | 440 |
end |
| 441 | 441 |
|
| 442 | 442 |
def self.encoding(charset) |
| 443 |
@ic = Iconv.new('UTF-8', charset)
|
|
| 444 |
rescue Iconv::InvalidEncoding |
|
| 445 |
return false |
|
| 443 |
@charset = charset |
|
| 446 | 444 |
end |
| 447 | 445 |
|
| 448 | 446 |
def self.establish_connection(params) |
| ... | ... | |
| 454 | 452 |
end |
| 455 | 453 |
|
| 456 | 454 |
def self.encode(text) |
| 457 |
@ic.iconv text |
|
| 458 |
rescue |
|
| 459 |
text |
|
| 455 |
if RUBY_VERSION < '1.9' |
|
| 456 |
@ic ||= Iconv.new('UTF-8', @charset)
|
|
| 457 |
@ic.iconv text |
|
| 458 |
else |
|
| 459 |
text.to_s.force_encoding(@charset).encode('UTF-8')
|
|
| 460 |
end |
|
| 460 | 461 |
end |
| 461 | 462 |
end |
| 462 | 463 |
|
| lib/tasks/migrate_from_trac.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| ... | ... | |
| 16 | 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | 17 |
|
| 18 | 18 |
require 'active_record' |
| 19 |
require 'iconv' |
|
| 19 |
require 'iconv' if RUBY_VERSION < '1.9'
|
|
| 20 | 20 |
require 'pp' |
| 21 | 21 |
|
| 22 | 22 |
namespace :redmine do |
| ... | ... | |
| 30 | 30 |
assigned_status = IssueStatus.find_by_position(2) |
| 31 | 31 |
resolved_status = IssueStatus.find_by_position(3) |
| 32 | 32 |
feedback_status = IssueStatus.find_by_position(4) |
| 33 |
closed_status = IssueStatus.find :first, :conditions => { :is_closed => true }
|
|
| 33 |
closed_status = IssueStatus.where(:is_closed => true).first
|
|
| 34 | 34 |
STATUS_MAPPING = {'new' => DEFAULT_STATUS,
|
| 35 | 35 |
'reopened' => feedback_status, |
| 36 | 36 |
'assigned' => assigned_status, |
| ... | ... | |
| 61 | 61 |
'patch' =>TRACKER_FEATURE |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 |
roles = Role.find(:all, :conditions => {:builtin => 0}, :order => 'position ASC')
|
|
| 64 |
roles = Role.where(:builtin => 0).order('position ASC').all
|
|
| 65 | 65 |
manager_role = roles[0] |
| 66 | 66 |
developer_role = roles[1] |
| 67 | 67 |
DEFAULT_ROLE = roles.last |
| ... | ... | |
| 257 | 257 |
u.password = 'trac' |
| 258 | 258 |
u.admin = true if TracPermission.find_by_username_and_action(username, 'admin') |
| 259 | 259 |
# finally, a default user is used if the new user is not valid |
| 260 |
u = User.find(:first) unless u.save
|
|
| 260 |
u = User.first unless u.save
|
|
| 261 | 261 |
end |
| 262 | 262 |
# Make sure he is a member of the project |
| 263 | 263 |
if project_member && !u.member_of?(@target_project) |
| ... | ... | |
| 390 | 390 |
# Components |
| 391 | 391 |
print "Migrating components" |
| 392 | 392 |
issues_category_map = {}
|
| 393 |
TracComponent.find(:all).each do |component|
|
|
| 393 |
TracComponent.all.each do |component|
|
|
| 394 | 394 |
print '.' |
| 395 | 395 |
STDOUT.flush |
| 396 | 396 |
c = IssueCategory.new :project => @target_project, |
| ... | ... | |
| 404 | 404 |
# Milestones |
| 405 | 405 |
print "Migrating milestones" |
| 406 | 406 |
version_map = {}
|
| 407 |
TracMilestone.find(:all).each do |milestone|
|
|
| 407 |
TracMilestone.all.each do |milestone|
|
|
| 408 | 408 |
print '.' |
| 409 | 409 |
STDOUT.flush |
| 410 | 410 |
# First we try to find the wiki page... |
| ... | ... | |
| 443 | 443 |
:field_format => 'string') |
| 444 | 444 |
|
| 445 | 445 |
next if f.new_record? |
| 446 |
f.trackers = Tracker.find(:all)
|
|
| 446 |
f.trackers = Tracker.all
|
|
| 447 | 447 |
f.projects << @target_project |
| 448 | 448 |
custom_field_map[field.name] = f |
| 449 | 449 |
end |
| 450 | 450 |
puts |
| 451 | 451 |
|
| 452 | 452 |
# Trac 'resolution' field as a Redmine custom field |
| 453 |
r = IssueCustomField.find(:first, :conditions => { :name => "Resolution" })
|
|
| 453 |
r = IssueCustomField.where(:name => "Resolution").first
|
|
| 454 | 454 |
r = IssueCustomField.new(:name => 'Resolution', |
| 455 | 455 |
:field_format => 'list', |
| 456 | 456 |
:is_filter => true) if r.nil? |
| 457 |
r.trackers = Tracker.find(:all)
|
|
| 457 |
r.trackers = Tracker.all
|
|
| 458 | 458 |
r.projects << @target_project |
| 459 | 459 |
r.possible_values = (r.possible_values + %w(fixed invalid wontfix duplicate worksforme)).flatten.compact.uniq |
| 460 | 460 |
r.save! |
| ... | ... | |
| 549 | 549 |
# Wiki |
| 550 | 550 |
print "Migrating wiki" |
| 551 | 551 |
if wiki.save |
| 552 |
TracWikiPage.find(:all, :order => 'name, version').each do |page|
|
|
| 552 |
TracWikiPage.order('name, version').all.each do |page|
|
|
| 553 | 553 |
# Do not migrate Trac manual wiki pages |
| 554 | 554 |
next if TRAC_WIKI_PAGES.include?(page.name) |
| 555 | 555 |
wiki_edit_count += 1 |
| ... | ... | |
| 603 | 603 |
end |
| 604 | 604 |
|
| 605 | 605 |
def self.encoding(charset) |
| 606 |
@ic = Iconv.new('UTF-8', charset)
|
|
| 607 |
rescue Iconv::InvalidEncoding |
|
| 608 |
puts "Invalid encoding!" |
|
| 609 |
return false |
|
| 606 |
@charset = charset |
|
| 610 | 607 |
end |
| 611 | 608 |
|
| 612 | 609 |
def self.set_trac_directory(path) |
| ... | ... | |
| 713 | 710 |
end |
| 714 | 711 |
end |
| 715 | 712 |
|
| 716 |
private |
|
| 717 | 713 |
def self.encode(text) |
| 718 |
@ic.iconv text |
|
| 719 |
rescue |
|
| 720 |
text |
|
| 714 |
if RUBY_VERSION < '1.9' |
|
| 715 |
@ic ||= Iconv.new('UTF-8', @charset)
|
|
| 716 |
@ic.iconv text |
|
| 717 |
else |
|
| 718 |
text.to_s.force_encoding(@charset).encode('UTF-8')
|
|
| 719 |
end |
|
| 721 | 720 |
end |
| 722 | 721 |
end |
| 723 | 722 |
|
| lib/tasks/redmine.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| ... | ... | |
| 21 | 21 |
task :prune => :environment do |
| 22 | 22 |
Attachment.prune |
| 23 | 23 |
end |
| 24 |
|
|
| 25 |
desc 'Moves attachments stored at the root of the file directory (ie. created before Redmine 2.3) to their subdirectories' |
|
| 26 |
task :move_to_subdirectories => :environment do |
|
| 27 |
Attachment.move_from_root_to_target_directory |
|
| 28 |
end |
|
| 24 | 29 |
end |
| 25 | 30 |
|
| 26 | 31 |
namespace :tokens do |
| lib/tasks/reminder.rake | ||
|---|---|---|
| 1 | 1 |
# Redmine - project management software |
| 2 |
# Copyright (C) 2006-2012 Jean-Philippe Lang
|
|
| 2 |
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
|
| 3 | 3 |
# |
| 4 | 4 |
# This program is free software; you can redistribute it and/or |
| 5 | 5 |
# modify it under the terms of the GNU General Public License |
| lib/tasks/testing.rake | ||
|---|---|---|
| 100 | 100 |
t.test_files = FileList['test/integration/routing/*_test.rb'] |
| 101 | 101 |
end |
| 102 | 102 |
Rake::Task['test:rdm_routing'].comment = "Run the routing tests" |
| 103 |
|
|
| 104 |
Rake::TestTask.new(:ui => "db:test:prepare") do |t| |
|
| 105 |
t.libs << "test" |
|
| 106 |
t.verbose = true |
|
| 107 |
t.test_files = FileList['test/ui/**/*_test.rb'] |
|
| 108 |
end |
|
| 109 |
Rake::Task['test:ui'].comment = "Run the UI tests with Capybara (PhantomJS listening on port 4444 is required)" |
|
| 103 | 110 |
end |
Also available in: Unified diff