diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-30 16:46:16 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-05-30 16:46:16 +0300 |
commit | 1a595c3f0fb4a80aeb3efdaeb27d084f8029fd57 (patch) | |
tree | 5273c58118dd64c0700a88154eb0c0c7bec59397 /lib/gitlab_ci/encode.rb | |
parent | d76520a3d091be232ce8a05fcaf605e2f268f821 (diff) | |
download | gitlab-ci-1a595c3f0fb4a80aeb3efdaeb27d084f8029fd57.tar.gz |
Remove runner functionality. Added api for builds
Diffstat (limited to 'lib/gitlab_ci/encode.rb')
-rw-r--r-- | lib/gitlab_ci/encode.rb | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/lib/gitlab_ci/encode.rb b/lib/gitlab_ci/encode.rb deleted file mode 100644 index 41b8a66..0000000 --- a/lib/gitlab_ci/encode.rb +++ /dev/null @@ -1,33 +0,0 @@ -require 'charlock_holmes/string' - -module GitlabCi - module Encode - extend self - - def encode!(message) - return nil unless message.respond_to? :force_encoding - - # if message is utf-8 encoding, just return it - message.force_encoding("UTF-8") - return message if message.valid_encoding? - - # return message if message type is binary - detect = CharlockHolmes::EncodingDetector.detect(message) - return message if detect[:type] == :binary - - # if message is not utf-8 encoding, convert it - if detect[:encoding] - message.force_encoding(detect[:encoding]) - message.encode!("UTF-8", detect[:encoding], undef: :replace, replace: "", invalid: :replace) - end - - # ensure message encoding is utf8 - message.valid_encoding? ? message : raise - - # Prevent app from crash cause of encoding errors - rescue - encoding = detect ? detect[:encoding] : "unknown" - "--broken encoding: #{encoding}" - end - end -end |