Skip to content
This repository has been archived by the owner on May 16, 2021. It is now read-only.

Commit

Permalink
escape unicode in gemspec, fixes #35
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Dec 12, 2012
1 parent 62e99e6 commit eed241e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Rakefile
@@ -1,3 +1,4 @@
# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)

begin
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/rack/protection/version.rb
Expand Up @@ -4,7 +4,7 @@ def self.version
VERSION
end

SIGNATURE = [1, 3, 1]
SIGNATURE = [1, 3, 2]
VERSION = SIGNATURE.join('.')

VERSION.extend Comparable
Expand Down
4 changes: 2 additions & 2 deletions rack-protection.gemspec
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit eed241e

Please sign in to comment.