escape unicode in gemspec, fixes #35

This commit is contained in:
Konstantin Haase 2012-12-12 10:22:30 +01:00
parent 3cc65d7b13
commit cc76630d82
3 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,4 @@
# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
begin
@ -15,12 +16,14 @@ 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(',')
@ -28,7 +31,12 @@ task 'rack-protection.gemspec' do
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 File

@ -4,7 +4,7 @@ module Rack
VERSION
end
SIGNATURE = [1, 3, 1]
SIGNATURE = [1, 3, 2]
VERSION = SIGNATURE.join('.')
VERSION.extend Comparable

View File

@ -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