Sha256: c24e9fba5b7de39b09c176ff0e218cd51093c312652a0dff102f9584c40729af

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)

begin
  require 'bundler'
  Bundler::GemHelper.install_tasks
rescue LoadError => e
  $stderr.puts e
end

desc "run specs"
task(:spec) { ruby '-S rspec spec' }

desc "generate gemspec"
task 'rack-protection.gemspec' do
  require 'rack/protection/version'
  content = File.binread 'rack-protection.gemspec'

  # fetch data
  fields = {
    :authors => `git shortlog -sn`.force_encoding('utf-8').scan(/[^\d\s].*/),
    :email   => ["mail@zzak.io", "konstantin.haase@gmail.com"],
    :files   => %w(License README.md Rakefile Gemfile rack-protection.gemspec) + Dir['lib/**/*']
  }

  # 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

task :gemspec => 'rack-protection.gemspec'
task :default => :spec
task :test    => :spec

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/rack-protection-2.0.0.rc2/Rakefile
rack-protection-2.0.0.rc2 Rakefile
rack-protection-2.0.0.rc1 Rakefile
rack-protection-2.0.0.beta2 Rakefile
rack-protection-2.0.0.beta1 Rakefile