Browse files

escape unicode in gemspec, fixes #35

  • Loading branch information...
1 parent 62e99e6 commit eed241e7a324dd6e5b761648b3df57c06d122403 @rkh rkh committed Dec 12, 2012
Showing with 11 additions and 3 deletions.
  1. +8 −0 Rakefile
  2. +1 −1 lib/rack/protection/version.rb
  3. +2 −2 rack-protection.gemspec
View
8 Rakefile
@@ -1,3 +1,4 @@
+# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
begin
@@ -15,20 +16,27 @@ task 'rack-protection.gemspec' do
require 'rack/protection/version'
content = File.read 'rack-protection.gemspec'
+ # fetch data
fields = {
:authors => `git shortlog -sn`.scan(/[^\d\s].*/),
:email => `git shortlog -sne`.scan(/[^<]+@[^>]+/),
:files => `git ls-files`.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ }
}
+ # insert data
fields.each do |field, values|
updated = " s.#{field} = ["
updated << values.map { |v| "\n %p" % v }.join(',')
updated << "\n ]"
content.sub!(/ s\.#{field} = \[\n( .*\n)* \]/, updated)
end
+ # set version
content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Rack::Protection::VERSION}\""
+
+ # escape unicode
+ content.gsub!(/./) { |c| c.bytesize > 1 ? "\\u{#{c.codepoints.first.to_s(16)}}" : c }
+
File.open('rack-protection.gemspec', 'w') { |f| f << content }
end
View
2 lib/rack/protection/version.rb
@@ -4,7 +4,7 @@ def self.version
VERSION
end
- SIGNATURE = [1, 3, 1]
+ SIGNATURE = [1, 3, 2]
VERSION = SIGNATURE.join('.')
VERSION.extend Comparable
View
4 rack-protection.gemspec
@@ -2,7 +2,7 @@
Gem::Specification.new do |s|
# general infos
s.name = "rack-protection"
- s.version = "1.3.1"
+ s.version = "1.3.2"
s.description = "You should use protection!"
s.homepage = "http://github.com/rkh/rack-protection"
s.summary = s.description
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
"Steve Agalloco",
"Akzhan Abdulin",
"TOBY",
- "Bjørge Næss"
+ "Bj\u{f8}rge N\u{e6}ss"
]
# generated from git shortlog -sne

0 comments on commit eed241e

Please sign in to comment.