Skip to content
Browse files

move to rake-compiler, Bundler

  • Loading branch information...
1 parent f7fae6f commit 862d0cff3a4ccc11cb6ccef282f4b4f9bcc781a4 @brianmario committed Jan 26, 2011
Showing with 45 additions and 102 deletions.
  1. +3 −1 .gitignore
  2. +3 −0 Gemfile
  3. +17 −21 Rakefile
  4. +15 −74 escape_utils.gemspec
  5. +1 −1 ext/{ → escape_utils}/escape_utils.c
  6. +1 −1 ext/{ → escape_utils}/extconf.rb
  7. +2 −4 lib/escape_utils.rb
  8. +3 −0 lib/escape_utils/version.rb
View
4 .gitignore
@@ -3,4 +3,6 @@ Makefile
*.bundle
pkg/*
doc/*
-*.rbc
+*.rbc
+tmp/
+Gemfile.lock
View
3 Gemfile
@@ -0,0 +1,3 @@
+source :rubygems
+
+gemspec
View
38 Rakefile
@@ -1,23 +1,4 @@
-# encoding: UTF-8
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "escape_utils"
- gem.summary = "Faster string escaping routines for your web apps"
- gem.email = "seniorlopez@gmail.com"
- gem.homepage = "http://github.com/brianmario/escape_utils"
- gem.authors = ["Brian Lopez"]
- gem.require_paths = ["lib", "ext"]
- gem.extra_rdoc_files = `git ls-files *.rdoc`.split("\n")
- gem.files = `git ls-files`.split("\n")
- gem.extensions = ["ext/extconf.rb"]
- gem.files.include %w(lib/jeweler/templates/.document lib/jeweler/templates/.gitignore)
- # gem.rubyforge_project = "mysql2"
- end
-rescue LoadError
- puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install jeweler -s http://gems.github.com"
-end
-
+# rspec
begin
require 'rspec'
require 'rspec/core/rake_task'
@@ -33,4 +14,19 @@ begin
task :default => :spec
rescue LoadError
puts "rspec, or one of its dependencies, is not available. Install it with: sudo gem install rspec"
-end
+end
+
+# rake-compiler
+require 'rake' unless defined? Rake
+
+gem 'rake-compiler', '>= 0.7.5'
+require "rake/extensiontask"
+
+Rake::ExtensionTask.new('escape_utils') do |ext|
+ ext.cross_compile = true
+ ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60']
+
+ ext.lib_dir = File.join 'lib', 'escape_utils'
+end
+
+Rake::Task[:spec].prerequisites << :compile
View
89 escape_utils.gemspec
@@ -1,90 +1,31 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
-# -*- encoding: utf-8 -*-
+require './lib/escape_utils/version'
Gem::Specification.new do |s|
s.name = %q{escape_utils}
- s.version = "0.1.9"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.version = EscapeUtils::VERSION
s.authors = ["Brian Lopez"]
- s.date = %q{2010-10-15}
+ s.date = Time.now.utc.strftime("%Y-%m-%d")
s.email = %q{seniorlopez@gmail.com}
s.extensions = ["ext/extconf.rb"]
s.extra_rdoc_files = [
"README.rdoc"
]
- s.files = [
- ".gitignore",
- "CHANGELOG.md",
- "MIT-LICENSE",
- "README.rdoc",
- "Rakefile",
- "VERSION",
- "benchmark/html_escape.rb",
- "benchmark/html_unescape.rb",
- "benchmark/javascript_escape.rb",
- "benchmark/javascript_unescape.rb",
- "benchmark/url_escape.rb",
- "benchmark/url_unescape.rb",
- "escape_utils.gemspec",
- "ext/escape_utils.c",
- "ext/extconf.rb",
- "lib/escape_utils.rb",
- "lib/escape_utils/html/cgi.rb",
- "lib/escape_utils/html/erb.rb",
- "lib/escape_utils/html/haml.rb",
- "lib/escape_utils/html/rack.rb",
- "lib/escape_utils/html_safety.rb",
- "lib/escape_utils/javascript/action_view.rb",
- "lib/escape_utils/url/cgi.rb",
- "lib/escape_utils/url/erb.rb",
- "lib/escape_utils/url/rack.rb",
- "lib/escape_utils/url/uri.rb",
- "spec/html/escape_spec.rb",
- "spec/html/unescape_spec.rb",
- "spec/html_safety_spec.rb",
- "spec/javascript/escape_spec.rb",
- "spec/javascript/unescape_spec.rb",
- "spec/query/escape_spec.rb",
- "spec/query/unescape_spec.rb",
- "spec/rcov.opts",
- "spec/spec.opts",
- "spec/spec_helper.rb",
- "spec/uri/escape_spec.rb",
- "spec/uri/unescape_spec.rb",
- "spec/url/escape_spec.rb",
- "spec/url/unescape_spec.rb"
- ]
+ s.files = `git ls-files`.split("\n")
s.homepage = %q{http://github.com/brianmario/escape_utils}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib", "ext"]
- s.rubygems_version = %q{1.3.7}
+ s.rubygems_version = %q{1.4.2}
s.summary = %q{Faster string escaping routines for your web apps}
- s.test_files = [
- "spec/html/escape_spec.rb",
- "spec/html/unescape_spec.rb",
- "spec/html_safety_spec.rb",
- "spec/javascript/escape_spec.rb",
- "spec/javascript/unescape_spec.rb",
- "spec/query/escape_spec.rb",
- "spec/query/unescape_spec.rb",
- "spec/spec_helper.rb",
- "spec/uri/escape_spec.rb",
- "spec/uri/unescape_spec.rb",
- "spec/url/escape_spec.rb",
- "spec/url/unescape_spec.rb"
- ]
-
- if s.respond_to? :specification_version then
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
- s.specification_version = 3
+ s.test_files = `git ls-files spec`.split("\n")
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- else
- end
- else
- end
+ # tests
+ s.add_development_dependency 'rake-compiler', ">= 0.7.5"
+ s.add_development_dependency 'rspec', ">= 2.0.0"
+ # benchmarks
+ s.add_development_dependency 'rack'
+ s.add_development_dependency 'haml'
+ s.add_development_dependency 'fast_xs'
+ s.add_development_dependency 'actionpack'
+ s.add_development_dependency 'url_escape'
end
View
2 ext/escape_utils.c → ext/escape_utils/escape_utils.c
@@ -595,7 +595,7 @@ static VALUE rb_unescape_uri(VALUE self, VALUE str) {
}
/* Ruby Extension initializer */
-void Init_escape_utils_ext() {
+void Init_escape_utils() {
mEscapeUtils = rb_define_module("EscapeUtils");
rb_define_method(mEscapeUtils, "escape_html", rb_escape_html, -1);
rb_define_module_function(mEscapeUtils, "escape_html", rb_escape_html, -1);
View
2 ext/extconf.rb → ext/escape_utils/extconf.rb
@@ -5,4 +5,4 @@
$CFLAGS << ' -Wall -funroll-loops'
$CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
-create_makefile("escape_utils_ext")
+create_makefile("escape_utils")
View
6 lib/escape_utils.rb
@@ -1,11 +1,9 @@
# encoding: utf-8
-
-require 'escape_utils_ext'
+require 'escape_utils/escape_utils'
+require 'escape_utils/version'
EscapeUtils.send(:extend, EscapeUtils)
module EscapeUtils
- VERSION = "0.1.9"
-
# turn on/off the escaping of the '/' character during HTML escaping
# Escaping '/' is recommended by the OWASP - http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet#RULE_.231_-_HTML_Escape_Before_Inserting_Untrusted_Data_into_HTML_Element_Content
# This is because quotes around HTML attributes are optional in most/all modern browsers at the time of writing (10/15/2010)
View
3 lib/escape_utils/version.rb
@@ -0,0 +1,3 @@
+module EscapeUtils
+ VERSION = "0.1.9"
+end

0 comments on commit 862d0cf

Please sign in to comment.
Something went wrong with that request. Please try again.