Skip to content

Commit

Permalink
add the missing magic header # encoding: utf-8 so all internal string…
Browse files Browse the repository at this point in the history
…s are UTF-8 in Ruby < 2.0
  • Loading branch information
Pere Urbon-Bayes committed Aug 12, 2015
1 parent 0cf1a98 commit 4a742a7
Show file tree
Hide file tree
Showing 51 changed files with 49 additions and 14 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8

$: << File.join(File.dirname(__FILE__), "lib")

Expand Down
1 change: 1 addition & 0 deletions lib/bootstrap/bundler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
module LogStash
module Bundler
extend self
Expand Down
3 changes: 2 additions & 1 deletion lib/bootstrap/environment.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
# bootstrap.rb contains the minimal code to be able to launch Bundler to eventually be able
# to retrieve the core code in the logstash-core gem which can live under different paths
# depending on the launch context (local dev, packaged, etc)
Expand Down Expand Up @@ -46,4 +47,4 @@ def logstash_gem_home
LogStash::Bundler.setup!({:without => [:build, :development]})
require ARGV.shift
LogStash::Runner.new.main(ARGV)
end
end
1 change: 1 addition & 0 deletions lib/bootstrap/rspec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require_relative "environment"
LogStash::Bundler.setup!({:without => [:build]})
require "logstash/environment"
Expand Down
1 change: 1 addition & 0 deletions lib/bootstrap/rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
module LogStash
module Rubygems
extend self
Expand Down
3 changes: 2 additions & 1 deletion lib/logstash-core.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# encoding: utf-8
module LogStash
end
end
1 change: 0 additions & 1 deletion lib/logstash/config/mixin.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

require "logstash/namespace"
require "logstash/config/registry"
require "logstash/logging"
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/environment.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "logstash/errors"
require "logstash/version"

Expand Down
3 changes: 2 additions & 1 deletion lib/logstash/java_integration.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "java"

# this is mainly for usage with JrJackson json parsing in :raw mode which genenerates
Expand Down Expand Up @@ -96,4 +97,4 @@ def |(other)
def inspect
"<#{self.class.name}:#{self.hashCode} #{self.to_a(&:inspect)}>"
end
end
end
1 change: 0 additions & 1 deletion lib/logstash/namespace.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

module LogStash
module Inputs; end
module Outputs; end
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "logstash/patches/bugfix_jruby_2558"
require "logstash/patches/cabin"
require "logstash/patches/profile_require_calls"
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches/bugfix_jruby_2558.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "logstash/environment"

if LogStash::Environment.windows? && LogStash::Environment.jruby?
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches/bundler.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
# Bundler monkey patches
module ::Bundler
# Patch bundler to write a .lock file specific to the version of ruby.
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches/cabin.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
if ENV["PROFILE_BAD_LOG_CALLS"] || ($DEBUGLIST || []).include?("log")
# Set PROFILE_BAD_LOG_CALLS=1 in your environment if you want
# to track down logger calls that cause performance problems
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches/rubygems.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
# monkey patch RubyGems to silence ffi warnings:
#
# WARN: Unresolved specs during Gem::Specification.reset:
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/patches/stronger_openssl_defaults.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "openssl"

# :nodoc:
Expand Down
1 change: 0 additions & 1 deletion lib/logstash/program.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

require "logstash/namespace"

module LogStash::Program
Expand Down
1 change: 0 additions & 1 deletion lib/logstash/runner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

Thread.abort_on_exception = true
Encoding.default_external = Encoding::UTF_8
$DEBUGLIST = (ENV["DEBUG"] || "").split(",")
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/string_interpolation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "thread_safe"
require "forwardable"

Expand Down
1 change: 0 additions & 1 deletion lib/logstash/util/accessors.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

require "logstash/namespace"
require "logstash/util"
require "thread_safe"
Expand Down
1 change: 0 additions & 1 deletion lib/logstash/util/decorators.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

require "logstash/namespace"
require "logstash/util"

Expand Down
1 change: 1 addition & 0 deletions lib/logstash/util/filetools.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "net/http"
require "uri"
require "digest/sha1"
Expand Down
3 changes: 2 additions & 1 deletion lib/logstash/util/java_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'cabin'

module LogStash::Util::JavaVersion
Expand Down Expand Up @@ -61,4 +62,4 @@ def self.bad_java_version?(version_string)
false
end
end
end
end
1 change: 1 addition & 0 deletions lib/logstash/util/plugin_version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'logstash/errors'
require 'rubygems/version'
require 'forwardable'
Expand Down
1 change: 0 additions & 1 deletion lib/logstash/util/prctl.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# encoding: utf-8

module LibC
require "ffi"
extend FFI::Library
Expand Down
1 change: 1 addition & 0 deletions lib/logstash/util/reporter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
class InflightEventsReporter
def self.logger=(logger)
@logger = logger
Expand Down
3 changes: 2 additions & 1 deletion lib/logstash/util/retryable.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
module LogStash
module Retryable
# execute retryable code block
Expand Down Expand Up @@ -36,4 +37,4 @@ def retryable(options = {}, &block)
end
end
end
end
end
1 change: 1 addition & 0 deletions lib/logstash/util/unicode_trimmer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
module LogStash::Util::UnicodeTrimmer
# The largest possible unicode chars are 4 bytes
# http://stackoverflow.com/questions/9533258/what-is-the-maximum-number-of-bytes-for-a-utf-8-encoded-character
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/command.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
class LogStash::PluginManager::Command < Clamp::Command
def gemfile
@gemfile ||= LogStash::Gemfile.new(File.new(LogStash::Environment::GEMFILE_PATH, 'r+')).load
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/gemfile.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
module LogStash
class GemfileError < StandardError; end

Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/install.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "pluginmanager/command"
require "jar-dependencies"
require "jar_install_post_install_hook"
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'rubygems/spec_fetcher'
require "pluginmanager/command"

Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/main.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
$LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", "..")))

require "bootstrap/environment"
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/uninstall.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "pluginmanager/command"

class LogStash::PluginManager::Uninstall < LogStash::PluginManager::Command
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/update.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "pluginmanager/command"
require "jar-dependencies"
require "jar_install_post_install_hook"
Expand Down
1 change: 1 addition & 0 deletions lib/pluginmanager/util.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "rubygems/package"

module LogStash::PluginManager
Expand Down
1 change: 0 additions & 1 deletion rakelib/bootstrap.rake
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

task "bootstrap" => [ "vendor:all", "compile:all" ]
1 change: 1 addition & 0 deletions spec/core/conditionals_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'spec_helper'

module ConditionalFanciness
Expand Down
1 change: 1 addition & 0 deletions spec/core/config_mixin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/config/mixin"

Expand Down
1 change: 1 addition & 0 deletions spec/core/environment_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/environment"

Expand Down
1 change: 1 addition & 0 deletions spec/core/pipeline_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"

class DummyInput < LogStash::Inputs::Base
Expand Down
1 change: 1 addition & 0 deletions spec/core/plugin_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/plugin"

Expand Down
1 change: 1 addition & 0 deletions spec/core/runner_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/runner"
require "stud/task"
Expand Down
1 change: 1 addition & 0 deletions spec/core/timestamp_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/timestamp"

Expand Down
1 change: 1 addition & 0 deletions spec/coverage_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
# Useful module to help loading all logstash content when
# running coverage analysis
module CoverageHelper
Expand Down
1 change: 1 addition & 0 deletions spec/license_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'spec_helper'
require 'rakelib/default_plugins'

Expand Down
1 change: 1 addition & 0 deletions spec/logstash/agent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'spec_helper'

describe LogStash::Agent do
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require_relative 'coverage_helper'
# In order to archive an expected coverage analysis we need to eager load
# all logstash code base, otherwise it will not get a good analysis.
Expand Down
3 changes: 2 additions & 1 deletion spec/util/java_version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'spec_helper'
require 'logstash/util/java_version'

Expand Down Expand Up @@ -71,4 +72,4 @@
include_examples("version parsing", "an update+build", "1.4.0_03-beta", 1, 4, 0, 3, "beta")
end

end
end
1 change: 1 addition & 0 deletions spec/util/plugin_version_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require "spec_helper"
require "logstash/util/plugin_version"

Expand Down
1 change: 1 addition & 0 deletions spec/util_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# encoding: utf-8
require 'spec_helper'

require "logstash/util"
Expand Down

0 comments on commit 4a742a7

Please sign in to comment.