pat / dm-sanitizer

DataMapper plugin for automated/configurable user input sanitization.

dm-sanitizer / Rakefile
100644 81 lines (72 sloc) 2.553 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
require 'pathname'
require 'rubygems'
require 'rake'
require "rake/clean"
require "rake/gempackagetask"
 
ROOT = Pathname(__FILE__).dirname.expand_path
JRUBY = RUBY_PLATFORM =~ /java/
WINDOWS = Gem.win_platform?
SUDO = (WINDOWS || JRUBY) ? '' : ('sudo' unless ENV['SUDOLESS'])
 
require ROOT + 'lib/dm-sanitizer/version'
 
AUTHOR = 'Sergei Zimakov'
EMAIL = 'zimakov@gmail.com'
GEM_NAME = 'dm-sanitizer'
GEM_VERSION = DataMapper::Sanitizer::VERSION
GEM_DEPENDENCIES = [['dm-core', '>= 0.9.4'], ['sanitize', '>= 1.0.0']]
GEM_CLEAN = %w[ log pkg coverage ]
GEM_EXTRAS = { :has_rdoc => true, :extra_rdoc_files => %w[ README.txt LICENSE History.txt ] }
 
PROJECT_NAME = 'dm-sanitizer'
PROJECT_URL = "http://github.com/pat/#{GEM_NAME}/tree/master/"
PROJECT_DESCRIPTION = PROJECT_SUMMARY = 'DataMapper plugin for automated/configurable user input sanitization.'
 
[ ROOT ].each do |dir|
  Pathname.glob(dir.join('tasks/**/*.rb').to_s).each { |f| require f }
end
#
# spec = Gem::Specification.new do |s|
# s.name = GEM_NAME
# s.version = GEM_VERSION
# s.platform = Gem::Platform::RUBY
# s.author = AUTHOR
# s.email = EMAIL
# s.homepage = PROJECT_URL
# s.summary = PROJECT_SUMMARY
# s.description = PROJECT_DESCRIPTION
# s.require_path = 'lib'
# s.files = %w[ LICENSE README.txt Rakefile History.txt TODO ] + Dir['lib/**/*'] + Dir['spec/**/*']
# s.rubyforge_project = GEM_NAME
#
# # rdoc
# s.has_rdoc = false
# s.extra_rdoc_files = %w[ LICENSE README.txt History.txt ]
#
# # Dependencies
# GEM_DEPENDENCIES.each {|dep| s.add_dependency( dep[0], dep[1] )}
# end
#
# Rake::GemPackageTask.new(spec) do |package|
# package.gem_spec = spec
# end
#
# Specs
 
begin
  gem 'rspec', '~>1.2'
  require 'spec'
  require 'spec/rake/spectask'
 
  task :default => [ :spec ]
 
  desc 'Run specifications'
  Spec::Rake::SpecTask.new(:spec) do |t|
    t.spec_opts << '--options' << 'spec/spec.opts' if File.exists?('spec/spec.opts')
    t.spec_files = Pathname.glob((ROOT + 'spec/**/*_spec.rb').to_s).map { |f| f.to_s }
 
    begin
      gem 'rcov', '~>0.8'
      t.rcov = JRUBY ? false : (ENV.has_key?('NO_RCOV') ? ENV['NO_RCOV'] != 'true' : true)
      t.rcov_opts << '--exclude' << 'spec'
      t.rcov_opts << '--text-summary'
      t.rcov_opts << '--sort' << 'coverage' << '--sort-reverse'
    rescue LoadError
      # rcov not installed
    end
  end
rescue LoadError
  # rspec not installed
end