Project

General

Profile

Feature #26561 » frozen_string_literals.patch

Pavel Rosický, 2017-07-27 22:12

View differences:

lib/plugins/acts_as_tree/Rakefile (working copy)
1
# frozen_string_literal: true
1 2
require 'rake'
2 3
require 'rake/testtask'
3 4
require 'rake/rdoctask'
lib/plugins/gravatar/Rakefile (working copy)
1
require 'spec/rake/spectask'
2
require 'rake/rdoctask'
3

  
4
desc 'Default: run all specs'
5
task :default => :spec
6

  
7
desc 'Run all application-specific specs'
8
Spec::Rake::SpecTask.new(:spec) do |t|
9
  # t.rcov = true
10
end
11

  
12
desc "Report code statistics (KLOCs, etc) from the application"
13
task :stats do
14
  RAILS_ROOT = File.dirname(__FILE__)
15
  STATS_DIRECTORIES = [
16
    %w(Libraries  lib/),
17
    %w(Specs      spec/),
18
  ].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
19
  require 'code_statistics'
20
  CodeStatistics.new(*STATS_DIRECTORIES).to_s
21
end
22

  
23
namespace :doc do
24
  desc 'Generate documentation for the assert_request plugin.'
25
  Rake::RDocTask.new(:plugin) do |rdoc|
26
    rdoc.rdoc_dir = 'rdoc'
27
    rdoc.title    = 'Gravatar Rails Plugin'
28
    rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=rw'
29
    rdoc.rdoc_files.include('README')
30
    rdoc.rdoc_files.include('lib/**/*.rb')
31
  end
32
end
1
# frozen_string_literal: true
2
require 'spec/rake/spectask'
3
require 'rake/rdoctask'
4

  
5
desc 'Default: run all specs'
6
task :default => :spec
7

  
8
desc 'Run all application-specific specs'
9
Spec::Rake::SpecTask.new(:spec) do |t|
10
  # t.rcov = true
11
end
12

  
13
desc "Report code statistics (KLOCs, etc) from the application"
14
task :stats do
15
  RAILS_ROOT = File.dirname(__FILE__)
16
  STATS_DIRECTORIES = [
17
    %w(Libraries  lib/),
18
    %w(Specs      spec/),
19
  ].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
20
  require 'code_statistics'
21
  CodeStatistics.new(*STATS_DIRECTORIES).to_s
22
end
23

  
24
namespace :doc do
25
  desc 'Generate documentation for the assert_request plugin.'
26
  Rake::RDocTask.new(:plugin) do |rdoc|
27
    rdoc.rdoc_dir = 'rdoc'
28
    rdoc.title    = 'Gravatar Rails Plugin'
29
    rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=rw'
30
    rdoc.rdoc_files.include('README')
31
    rdoc.rdoc_files.include('lib/**/*.rb')
32
  end
33
end
lib/plugins/open_id_authentication/Rakefile (working copy)
1
require 'rake'
2
require 'rake/testtask'
3
require 'rake/rdoctask'
4

  
5
desc 'Default: run unit tests.'
6
task :default => :test
7

  
8
desc 'Test the open_id_authentication plugin.'
9
Rake::TestTask.new(:test) do |t|
10
  t.libs << 'lib'
11
  t.pattern = 'test/**/*_test.rb'
12
  t.verbose = true
13
end
14

  
15
desc 'Generate documentation for the open_id_authentication plugin.'
16
Rake::RDocTask.new(:rdoc) do |rdoc|
17
  rdoc.rdoc_dir = 'rdoc'
18
  rdoc.title    = 'OpenIdAuthentication'
19
  rdoc.options << '--line-numbers' << '--inline-source'
20
  rdoc.rdoc_files.include('README')
21
  rdoc.rdoc_files.include('lib/**/*.rb')
22
end
1
# frozen_string_literal: true
2
require 'rake'
3
require 'rake/testtask'
4
require 'rake/rdoctask'
5

  
6
desc 'Default: run unit tests.'
7
task :default => :test
8

  
9
desc 'Test the open_id_authentication plugin.'
10
Rake::TestTask.new(:test) do |t|
11
  t.libs << 'lib'
12
  t.pattern = 'test/**/*_test.rb'
13
  t.verbose = true
14
end
15

  
16
desc 'Generate documentation for the open_id_authentication plugin.'
17
Rake::RDocTask.new(:rdoc) do |rdoc|
18
  rdoc.rdoc_dir = 'rdoc'
19
  rdoc.title    = 'OpenIdAuthentication'
20
  rdoc.options << '--line-numbers' << '--inline-source'
21
  rdoc.rdoc_files.include('README')
22
  rdoc.rdoc_files.include('lib/**/*.rb')
23
end
Rakefile (working copy)
1
#!/usr/bin/env rake
2
# Add your own tasks in files placed in lib/tasks ending in .rake,
3
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4

  
5
require File.expand_path('../config/application', __FILE__)
6

  
7
RedmineApp::Application.load_tasks
1
# frozen_string_literal: true
2
#!/usr/bin/env rake
3
# Add your own tasks in files placed in lib/tasks ending in .rake,
4
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5

  
6
require File.expand_path('../config/application', __FILE__)
7

  
8
RedmineApp::Application.load_tasks
lib/plugins/open_id_authentication/lib/tasks/open_id_authentication_tasks.rake (working copy)
1
namespace :open_id_authentication do
2
  namespace :db do
3
    desc "Creates authentication tables for use with OpenIdAuthentication"
4
    task :create => :environment do
5
      generate_migration(["open_id_authentication_tables", "add_open_id_authentication_tables"])
6
    end
7

  
8
    desc "Upgrade authentication tables from ruby-openid 1.x.x to 2.x.x"
9
    task :upgrade => :environment do
10
      generate_migration(["upgrade_open_id_authentication_tables", "upgrade_open_id_authentication_tables"])
11
    end
12

  
13
    def generate_migration(args)
14
      require 'rails_generator'
15
      require 'rails_generator/scripts/generate'
16

  
17
      if ActiveRecord::Base.connection.supports_migrations?
18
        Rails::Generator::Scripts::Generate.new.run(args)
19
      else
20
        raise "Task unavailable to this database (no migration support)"
21
      end
22
    end
23

  
24
    desc "Clear the authentication tables"
25
    task :clear => :environment do
26
      OpenIdAuthentication::DbStore.cleanup_nonces
27
      OpenIdAuthentication::DbStore.cleanup_associations
28
    end
29
  end
30
end
1
# frozen_string_literal: true
2
namespace :open_id_authentication do
3
  namespace :db do
4
    desc "Creates authentication tables for use with OpenIdAuthentication"
5
    task :create => :environment do
6
      generate_migration(["open_id_authentication_tables", "add_open_id_authentication_tables"])
7
    end
8

  
9
    desc "Upgrade authentication tables from ruby-openid 1.x.x to 2.x.x"
10
    task :upgrade => :environment do
11
      generate_migration(["upgrade_open_id_authentication_tables", "upgrade_open_id_authentication_tables"])
12
    end
13

  
14
    def generate_migration(args)
15
      require 'rails_generator'
16
      require 'rails_generator/scripts/generate'
17

  
18
      if ActiveRecord::Base.connection.supports_migrations?
19
        Rails::Generator::Scripts::Generate.new.run(args)
20
      else
21
        raise "Task unavailable to this database (no migration support)"
22
      end
23
    end
24

  
25
    desc "Clear the authentication tables"
26
    task :clear => :environment do
27
      OpenIdAuthentication::DbStore.cleanup_nonces
28
      OpenIdAuthentication::DbStore.cleanup_associations
29
    end
30
  end
31
end
lib/tasks/ci.rake (working copy)
1
# frozen_string_literal: true
1 2
desc "Run the Continuous Integration tests for Redmine"
2 3
task :ci do
3 4
  # RAILS_ENV and ENV[] can diverge so force them both to test
lib/tasks/ciphering.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
lib/tasks/deprecated.rake (working copy)
1
# frozen_string_literal: true
1 2
def deprecated_task(name, new_name)
2 3
  task name=>new_name do
3 4
    $stderr.puts "\nNote: The rake task #{name} has been deprecated, please use the replacement version #{new_name}"
lib/tasks/email.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
lib/tasks/extract_fixtures.rake (working copy)
1
# frozen_string_literal: true
1 2
desc 'Create YAML test fixtures from data in an existing database.
2 3
Defaults to development database. Set RAILS_ENV to override.'
3 4

  
lib/tasks/initializers.rake (working copy)
1
# frozen_string_literal: true
1 2
desc 'Generates a secret token for the application.'
2 3

  
3 4
file 'config/initializers/secret_token.rb' do
lib/tasks/load_default_data.rake (working copy)
1
# frozen_string_literal: true
1 2
desc 'Load Redmine default configuration data. Language is chosen interactively or by setting REDMINE_LANG environment variable.'
2 3

  
3 4
namespace :redmine do
lib/tasks/locales.rake (working copy)
1
# frozen_string_literal: true
1 2
desc 'Updates and checks locales against en.yml'
2 3
task :locales do
3 4
  %w(locales:update locales:check_interpolation).collect do |task|
lib/tasks/metrics.rake (working copy)
1
# frozen_string_literal: true
1 2
begin
2 3
  require 'metric_fu'
3 4
rescue LoadError
lib/tasks/migrate_from_mantis.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
lib/tasks/migrate_from_trac.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
lib/tasks/permissions.rake (working copy)
1
# frozen_string_literal: true
1 2
namespace :redmine do
2 3
  desc "List all permissions and the actions registered with them"
3 4
  task :permissions => :environment do
lib/tasks/redmine.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
lib/tasks/reminder.rake (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
......
36 37
    options[:project] = ENV['project'] if ENV['project']
37 38
    options[:tracker] = ENV['tracker'].to_i if ENV['tracker']
38 39
    options[:users] = (ENV['users'] || '').split(',').each(&:strip!)
39
    options[:version] = ENV['version'] if ENV['version'] 
40
    options[:version] = ENV['version'] if ENV['version']
40 41

  
41 42
    Mailer.with_synched_deliveries do
42 43
      Mailer.reminders(options)
lib/tasks/testing.rake (working copy)
1
# frozen_string_literal: true
1 2
namespace :test do
2 3
  desc 'Measures test coverage'
3 4
  task :coverage do
lib/tasks/yardoc.rake (working copy)
1
# frozen_string_literal: true
1 2
begin
2 3
  require 'yard'
3 4

  
app/controllers/account_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/activities_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/admin_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/application_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/attachments_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/auth_sources_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/auto_completes_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/boards_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/calendars_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/comments_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/context_menus_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/custom_field_enumerations_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/custom_fields_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/documents_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/email_addresses_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/enumerations_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/files_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/gantts_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/groups_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/imports_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/issue_categories_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/issue_relations_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/issue_statuses_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/issues_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/journals_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
......
70 71
    end
71 72
    # Replaces pre blocks with [...]
72 73
    text = text.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]')
73
    @content = "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
74
    @content = ''.dup
75
    @content << "#{ll(Setting.default_language, :text_user_wrote, user)}\n> "
74 76
    @content << text.gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
75 77
  rescue ActiveRecord::RecordNotFound
76 78
    render_404
app/controllers/mail_handler_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/members_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/messages_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
......
112 113
    @subject = @message.subject
113 114
    @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
114 115

  
115
    @content = "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
116
    @content = ''.dup
117
    @content << "#{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
116 118
    @content << @message.content.to_s.strip.gsub(%r{<pre>(.*?)</pre>}m, '[...]').gsub(/(\r?\n|\r\n?)/, "\n> ") + "\n\n"
117 119
  end
118 120

  
app/controllers/my_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/news_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/previews_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/principal_memberships_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/project_enumerations_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/projects_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/queries_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/reports_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/repositories_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/roles_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/search_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
......
21 22

  
22 23
  def index
23 24
    @question = params[:q] || ""
24
    @question.strip!
25
    @question = @question.strip
25 26
    @all_words = params[:all_words] ? params[:all_words].present? : true
26 27
    @titles_only = params[:titles_only] ? params[:titles_only].present? : false
27 28
    @search_attachments = params[:attachments].presence || '0'
app/controllers/settings_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/sys_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/timelog_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/trackers_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/users_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/versions_controller.rb (working copy)
1
# frozen_string_literal: trues
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/watchers_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/welcome_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/wiki_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/wikis_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/controllers/workflows_controller.rb (working copy)
1
# frozen_string_literal: true
1 2
# Redmine - project management software
2 3
# Copyright (C) 2006-2017  Jean-Philippe Lang
3 4
#
app/helpers/account_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/activities_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/admin_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
17 18
# along with this program; if not, write to the Free Software
18 19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 20

  
21
# frozen_string_literal: true
22

  
20 23
module AdminHelper
21 24
  def project_status_options_for_select(selected)
22 25
    options_for_select([[l(:label_all), ''],
app/helpers/application_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
237 238
  end
238 239

  
239 240
  def toggle_link(name, id, options={})
240
    onclick = "$('##{id}').toggle(); "
241
    onclick = ''.dup
242
    onclick << "$('##{id}').toggle(); "
241 243
    onclick << (options[:focus] ? "$('##{options[:focus]}').focus(); " : "this.blur(); ")
242 244
    onclick << "$(window).scrollTop($('##{options[:focus]}').position().top); " if options[:scroll]
243 245
    onclick << "return false;"
......
281 283
  # The given collection may be a subset of the whole project tree
282 284
  # (eg. some intermediate nodes are private and can not be seen)
283 285
  def render_project_nested_lists(projects, &block)
284
    s = ''
286
    s = ''.dup
285 287
    if projects.any?
286 288
      ancestors = []
287 289
      original_project = @project
......
311 313
  end
312 314

  
313 315
  def render_page_hierarchy(pages, node=nil, options={})
314
    content = ''
316
    content = ''.dup
315 317
    if pages[node]
316 318
      content << "<ul class=\"pages-hierarchy\">\n"
317 319
      pages[node].each do |page|
......
328 330

  
329 331
  # Renders flash messages
330 332
  def render_flash_messages
331
    s = ''
333
    s = ''.dup
332 334
    flash.each do |k,v|
333 335
      s << content_tag('div', v.html_safe, :class => "flash #{k}", :id => "flash_#{k}")
334 336
    end
......
367 369

  
368 370
  def render_projects_for_jump_box(projects, selected=nil)
369 371
    jump = params[:jump].presence || current_menu_item
370
    s = ''.html_safe
372
    s = ''.dup.html_safe
371 373
    project_tree(projects) do |project, level|
372 374
      padding = level * 16
373 375
      text = content_tag('span', project.name, :style => "padding-left:#{padding}px;")
......
399 401
  end
400 402

  
401 403
  def project_tree_options_for_select(projects, options = {})
402
    s = ''.html_safe
404
    s = ''.dup.html_safe
403 405
    if blank_text = options[:include_blank]
404 406
      if blank_text == true
405 407
        blank_text = '&nbsp;'.html_safe
......
428 430
  end
429 431

  
430 432
  def principals_check_box_tags(name, principals)
431
    s = ''
433
    s = ''.dup
432 434
    principals.each do |principal|
433 435
      s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
434 436
    end
......
437 439

  
438 440
  # Returns a string for users/groups option tags
439 441
  def principals_options_for_select(collection, selected=nil)
440
    s = ''
442
    s = ''.dup
441 443
    if collection.include?(User.current)
442 444
      s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
443 445
    end
444
    groups = ''
446
    groups = ''.dup
445 447
    collection.sort.each do |element|
446 448
      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected
447 449
      (element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
......
624 626
    else
625 627
      raise ArgumentError, 'invalid arguments to textilizable'
626 628
    end
627
    return '' if text.blank?
629
    return ''.dup if text.blank?
628 630
    project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
629 631
    @only_path = only_path = options.delete(:only_path) == false ? false : true
630 632

  
......
660 662
  def parse_non_pre_blocks(text, obj, macros)
661 663
    s = StringScanner.new(text)
662 664
    tags = []
663
    parsed = ''
665
    parsed = ''.dup
664 666
    while !s.eos?
665 667
      s.scan(/(.*?)(<(\/)?(pre|code)(.*?)>|\z)/im)
666 668
      text, full_tag, closing, tag = s[1], s[2], s[3], s[4]
......
1124 1126
      if headings.empty?
1125 1127
        ''
1126 1128
      else
1127
        div_class = 'toc'
1129
        div_class = 'toc'.dup
1128 1130
        div_class << ' right' if right_align
1129 1131
        div_class << ' left' if left_align
1130
        out = "<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
1132
        out = ''.dup
1133
        out << "<ul class=\"#{div_class}\"><li><strong>#{l :label_table_of_contents}</strong></li><li>"
1131 1134
        root = headings.map(&:first).min
1132 1135
        current = root
1133 1136
        started = false
......
1188 1191

  
1189 1192
  # Renders a list of error messages
1190 1193
  def render_error_messages(errors)
1191
    html = ""
1194
    html = "".dup
1192 1195
    if errors.present?
1193 1196
      html << "<div id='errorExplanation'><ul>\n"
1194 1197
      errors.each do |error|
......
1303 1306

  
1304 1307
  def include_calendar_headers_tags
1305 1308
    unless @calendar_headers_tags_included
1306
      tags = ''.html_safe
1309
      tags = ''.dup.html_safe
1307 1310
      @calendar_headers_tags_included = true
1308 1311
      content_for :header_tags do
1309 1312
        start_of_week = Setting.start_of_week
app/helpers/attachments_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/auth_sources_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/boards_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/calendars_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/context_menus_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
20 21
module ContextMenusHelper
21 22
  def context_menu_link(name, url, options={})
22 23
    options[:class] ||= ''
24
    options[:class] = options[:class].dup if options[:class].frozen?
23 25
    if options.delete(:selected)
24 26
      options[:class] << ' icon-checked disabled'
25 27
      options[:disabled] = true
app/helpers/custom_fields_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
55 56
    items = []
56 57
    items << [l(:label_custom_field_plural), custom_fields_path]
57 58
    items << [l(custom_field.type_name), custom_fields_path(:tab => custom_field.class.name)] if custom_field
58
    items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name) 
59
    items << (custom_field.nil? || custom_field.new_record? ? l(:label_custom_field_new) : custom_field.name)
59 60

  
60 61
    title(*items)
61 62
  end
......
68 69
  end
69 70

  
70 71
  def custom_field_tag_name(prefix, custom_field)
71
    name = "#{prefix}[custom_field_values][#{custom_field.id}]"
72
    name = ''.dup
73
    name << "#{prefix}[custom_field_values][#{custom_field.id}]"
72 74
    name << "[]" if custom_field.multiple?
73 75
    name
74 76
  end
......
92 94
    css = title ? "field-description" : nil
93 95
    content_tag 'span', custom_field.name, :title => title, :class => css
94 96
  end
95
  
97

  
96 98
  # Return custom field label tag
97 99
  def custom_field_label_tag(name, custom_value, options={})
98 100
    required = options[:required] || custom_value.custom_field.is_required?
app/helpers/documents_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/email_addresses_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/enumerations_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/gantt_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/groups_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/imports_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/issue_categories_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/issue_relations_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/issue_statuses_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/issues_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
74 75
  end
75 76

  
76 77
  def render_issue_subject_with_tree(issue)
77
    s = ''
78
    s = ''.dup
78 79
    ancestors = issue.root? ? [] : issue.ancestors.visible.to_a
79 80
    ancestors.each do |ancestor|
80 81
      s << '<div>' + content_tag('p', link_to_issue(ancestor, :project => (issue.project_id != ancestor.project_id)))
......
90 91
  end
91 92

  
92 93
  def render_descendants_tree(issue)
93
    s = '<table class="list issues odd-even">'
94
    s = '<table class="list issues odd-even">'.dup
94 95
    issue_list(issue.descendants.visible.preload(:status, :priority, :tracker, :assigned_to).sort_by(&:lft)) do |child, level|
95
      css = "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
96
      css = ''.dup
97
      css << "issue issue-#{child.id} hascontextmenu #{child.css_classes}"
96 98
      css << " idnt idnt-#{level}" if level > 0
97 99
      s << content_tag('tr',
98 100
             content_tag('td', check_box_tag("ids[]", child.id, false, :id => nil), :class => 'checkbox') +
......
110 112
  def render_issue_relations(issue, relations)
111 113
    manage_relations = User.current.allowed_to?(:manage_issue_relations, issue.project)
112 114

  
113
    s = ''.html_safe
115
    s = ''.dup.html_safe
114 116
    relations.each do |relation|
115 117
      other_issue = relation.other_issue(issue)
116 118
      css = "issue hascontextmenu #{other_issue.css_classes}"
......
143 145
      if issue.total_estimated_hours == issue.estimated_hours
144 146
        l_hours_short(issue.estimated_hours)
145 147
      else
146
        s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
148
        s = ''.dup
149
        s << l_hours_short(issue.estimated_hours) if issue.estimated_hours.present?
147 150
        s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
148 151
        s.html_safe
149 152
      end
......
256 259
    values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
257 260
    return if values.empty?
258 261

  
259
    s = ''.html_safe
262
    s = ''.dup.html_safe
260 263
    values.each_with_index do |value, i|
261 264
      attr_value = show_value(value)
262 265
      next if attr_value.blank?
app/helpers/journals_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
49 50
        links << link_to(l(:button_delete),
50 51
                         journal_path(journal, :journal => {:notes => ""}),
51 52
                         :remote => true,
52
                         :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, 
53
                         :method => 'put', :data => {:confirm => l(:text_are_you_sure)},
53 54
                         :title => l(:button_delete),
54 55
                         :class => 'icon-only icon-del'
55 56
                        )
app/helpers/mail_handler_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/members_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/messages_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/my_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
20 21
module MyHelper
21 22
  # Renders the blocks
22 23
  def render_blocks(blocks, user, options={})
23
    s = ''.html_safe
24
    s = ''.dup.html_safe
24 25

  
25 26
    if blocks.present?
26 27
      blocks.each do |block|
app/helpers/news_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/principal_memberships_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/projects_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
43 44
      selected = (parent_id.blank? ? nil : Project.find(parent_id))
44 45
    end
45 46

  
46
    options = ''
47
    options = ''.dup
47 48
    options << "<option value=''>&nbsp;</option>" if project.allowed_parents.include?(nil)
48 49
    options << project_tree_options_for_select(project.allowed_parents.compact, :selected => selected)
49 50
    content_tag('select', options.html_safe, :name => 'project[parent_id]', :id => 'project_parent_id')
50 51
  end
51 52

  
52 53
  def render_project_action_links
53
    links = "".html_safe
54
    links = ''.dup.html_safe
54 55
    if User.current.allowed_to?(:add_project, nil, :global => true)
55 56
      links << link_to(l(:label_project_new), new_project_path, :class => 'icon icon-add')
56 57
    end
......
105 106
    selection = boards.select {|b| b.parent == parent}
106 107
    return '' if selection.empty?
107 108

  
108
    s = ''.html_safe
109
    s = ''.dup.html_safe
109 110
    selection.each do |board|
110 111
      node = capture(board, level, &block)
111 112
      node << render_boards_tree(boards, board, level+1, &block)
app/helpers/queries_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
59 60
  end
60 61

  
61 62
  def query_filters_hidden_tags(query)
62
    tags = ''.html_safe
63
    tags = ''.dup.html_safe
63 64
    query.filters.each do |field, options|
64 65
      tags << hidden_field_tag("f[]", field, :id => nil)
65 66
      tags << hidden_field_tag("op[#{field}]", options[:operator], :id => nil)
......
71 72
  end
72 73

  
73 74
  def query_columns_hidden_tags(query)
74
    tags = ''.html_safe
75
    tags = ''.dup.html_safe
75 76
    query.columns.each do |column|
76 77
      tags << hidden_field_tag("c[]", column.name, :id => nil)
77 78
    end
......
88 89
  end
89 90

  
90 91
  def available_block_columns_tags(query)
91
    tags = ''.html_safe
92
    tags = ''.dup.html_safe
92 93
    query.available_block_columns.each do |column|
93 94
      tags << content_tag('label', check_box_tag('c[]', column.name.to_s, query.has_column?(column), :id => nil) + " #{column.caption}", :class => 'inline')
94 95
    end
......
97 98

  
98 99
  def available_totalable_columns_tags(query, options={})
99 100
    tag_name = (options[:name] || 't') + '[]'
100
    tags = ''.html_safe
101
    tags = ''.dup.html_safe
101 102
    query.available_totalable_columns.each do |column|
102 103
      tags << content_tag('label', check_box_tag(tag_name, column.name.to_s, query.totalable_columns.include?(column), :id => nil) + " #{column.caption}", :class => 'inline')
103 104
    end
......
289 290
    session_key = klass.name.underscore.to_sym
290 291

  
291 292
    if params[:query_id].present?
292
      cond = "project_id IS NULL"
293
      cond = 'project_id IS NULL'.dup
293 294
      cond << " OR project_id = #{@project.id}" if @project
294 295
      @query = klass.where(cond).find(params[:query_id])
295 296
      raise ::Unauthorized unless @query.visible?
......
369 370

  
370 371
    tags
371 372
  end
372
 
373

  
373 374
  def query_hidden_sort_tag(query)
374 375
    hidden_field_tag("sort", query.sort_criteria.to_param, :id => nil)
375 376
  end
......
388 389
    content_tag('h3', title) + "\n" +
389 390
      content_tag('ul',
390 391
        queries.collect {|query|
391
            css = 'query'
392
            css = 'query'.dup
392 393
            css << ' selected' if query == @query
393 394
            content_tag('li', link_to(query.name, url_params.merge(:query_id => query), :class => css))
394 395
          }.join("\n").html_safe,
......
400 401
  def render_sidebar_queries(klass, project)
401 402
    queries = sidebar_queries(klass, project)
402 403

  
403
    out = ''.html_safe
404
    out = ''.dup.html_safe
404 405
    out << query_links(l(:label_my_queries), queries.select(&:is_private?))
405 406
    out << query_links(l(:label_query_plural), queries.reject(&:is_private?))
406 407
    out
app/helpers/reports_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
app/helpers/repositories_helper.rb (working copy)
1 1
# encoding: utf-8
2
# frozen_string_literal: true
2 3
#
3 4
# Redmine - project management software
4 5
# Copyright (C) 2006-2017  Jean-Philippe Lang
......
78 79

  
79 80
  def render_changes_tree(tree)
80 81
    return '' if tree.nil?
... This diff was truncated because it exceeds the maximum size that can be displayed.
(1-1/2)