url_escape 2009.06.24

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ desc "Clean compiled remnants"
2
+ task :clean do
3
+ make = RUBY_PLATFORM.match(/mswin/) ? "nmake" : "make"
4
+ Dir.chdir("ext") do
5
+ sh "#{make} distclean" rescue nil
6
+ %w{url_escape.bundle url_escape.so.manifest Makefile escape.o rl_escape.so}.each { |file| File.unlink(file) if File.file?(file) }
7
+ end
8
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
2
+ # Distributed under the terms of the MIT license.
3
+ # See the LICENSE file that accompanied this software for the full MIT License text
4
+ #
5
+ require "pathname"
6
+ task :legal do
7
+ license = Pathname("LICENSE")
8
+ license.open("w+") do |f|
9
+ f.puts PROJECT_COPYRIGHT
10
+ end unless license.file? and license.read == PROJECT_COPYRIGHT
11
+ doc = Pathname("doc/LEGAL")
12
+ doc.open("w+") do |f|
13
+ f.puts "LICENSE"
14
+ end unless doc.file?
15
+ end
16
+
17
+ desc "add copyright summary to all .rb files in the distribution"
18
+ task :copyright => [:legal] do
19
+ doc = Pathname("doc/LEGAL")
20
+ ignore = doc.readlines.
21
+ select { |line| line.strip!; Pathname(line).file? }.
22
+ map { |file| Pathname(file).expand_path }
23
+
24
+ puts "adding copyright summary to files that don't have it currently"
25
+ puts PROJECT_COPYRIGHT_SUMMARY
26
+ puts
27
+
28
+ (Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') +
29
+ Pathname.glob("Rakefile")).each do |file|
30
+ next if ignore.include? file.expand_path
31
+ lines = file.readlines.map{ |l| l.chomp }
32
+ if lines.first.match(/^# \* \w.*/)
33
+ @f = lines.shift
34
+ end
35
+ unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY
36
+ oldlines = file.readlines
37
+ oldlines.shift if @f
38
+ file.open("w+") { |f| f.puts @f if @f;f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,23 @@
1
+ require 'rake/gempackagetask'
2
+
3
+ desc "make a gemspec"
4
+ task :gemspec => [:manifest, :changelog, :authors] do
5
+ gemspec_file = "#{GEMSPEC.name}.gemspec"
6
+ File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
7
+ end
8
+
9
+ desc "package and install from gemspec"
10
+ task :install => [:gemspec] do
11
+ sh "gem build #{GEMSPEC.name}.gemspec"
12
+ sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
13
+ end
14
+
15
+ desc "uninstall the gem"
16
+ task :uninstall => [:clean] do
17
+ sh %{gem uninstall -x #{GEMSPEC.name}}
18
+ end
19
+
20
+ Rake::GemPackageTask.new(GEMSPEC) do |p|
21
+ p.need_tar = true
22
+ p.need_zip = true
23
+ end
@@ -0,0 +1,99 @@
1
+ # Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
2
+ # Distributed under the terms of the MIT license.
3
+ # See the LICENSE file which accompanies this software for the full text
4
+ #
5
+ task :gem_installer do
6
+ class GemInstaller
7
+ def initialize(options = {}, &block)
8
+ @gems = []
9
+ @options = options
10
+
11
+ run(&block)
12
+ end
13
+
14
+ def run(&block)
15
+ instance_eval(&block) if block_given?
16
+ end
17
+
18
+ def gem(name, version = nil, options = {})
19
+ if version.respond_to?(:merge!)
20
+ options = version
21
+ else
22
+ options[:version] = version
23
+ end
24
+ unless rubylib?(options[:lib] || name)
25
+ @gems << [name, options]
26
+ end
27
+ @gems
28
+ end
29
+
30
+ def rubylib?(libname)
31
+ libdirs = ENV["RUBYLIB"].to_s.split(":")
32
+ return false if libdirs.size == 0
33
+ libdirs.each { |dir|
34
+ libdir = Pathname(dir)
35
+ if libdir.directory?
36
+ begin
37
+ require libdir.join(libname)
38
+ rescue LoadError
39
+ return false
40
+ end
41
+ end
42
+ }
43
+ puts "Loaded #{libname} from RUBYLIB"
44
+ true
45
+ end
46
+
47
+ def setup_gemspec(gemspec)
48
+ gemspec.dependencies.each do |dependency|
49
+ dependency.version_requirements.as_list.each do |version|
50
+ gem(dependency.name, version)
51
+ end
52
+ end
53
+
54
+ setup
55
+ end
56
+
57
+ def setup
58
+ require 'rubygems'
59
+ require 'rubygems/dependency_installer'
60
+
61
+ @gems.each do |name, options|
62
+ setup_gem(name, options)
63
+ end
64
+ end
65
+
66
+ def setup_gem(name, options, try_install = true)
67
+ print "activating #{name} ... "
68
+ Gem.activate(name, *[options[:version]].compact)
69
+ require(options[:lib] || name)
70
+ puts "success."
71
+ rescue LoadError => error
72
+ puts error
73
+ install_gem(name, options) if try_install
74
+ setup_gem(name, options, try_install = false)
75
+ end
76
+
77
+ def install_gem(name, options)
78
+ installer = Gem::DependencyInstaller.new(options)
79
+
80
+ temp_argv(options[:extconf]) do
81
+ print "Installing #{name} ... "
82
+ installer.install(name, options[:version])
83
+ puts "done."
84
+ end
85
+ end
86
+
87
+ def temp_argv(extconf)
88
+ if extconf ||= @options[:extconf]
89
+ old_argv = ARGV.clone
90
+ ARGV.replace(extconf.split(' '))
91
+ end
92
+
93
+ yield
94
+
95
+ ensure
96
+ ARGV.replace(old_argv) if extconf
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,4 @@
1
+ desc 'update manifest'
2
+ task :manifest do
3
+ File.open('MANIFEST', 'w+'){|io| io.puts(*GEMSPEC.files) }
4
+ end
@@ -0,0 +1,52 @@
1
+ namespace :release do
2
+ task :all => [:release_github, :release_rubyforge]
3
+
4
+ desc 'Display instructions to release on github'
5
+ task :github => [:reversion, :gemspec] do
6
+ name, version = GEMSPEC.name, GEMSPEC.version
7
+
8
+ puts <<INSTRUCTIONS
9
+ First add the relevant files:
10
+
11
+ git add AUTHORS MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
12
+
13
+ Then commit them, tag the commit, and push:
14
+
15
+ git commit -m 'Version #{version}'
16
+ git tag -a -m '#{version}' '#{version}'
17
+ git push
18
+
19
+ INSTRUCTIONS
20
+
21
+ end
22
+
23
+ # TODO: Not tested
24
+ desc 'Display instructions to release on rubyforge'
25
+ task :rubyforge => [:reversion, :gemspec, :package] do
26
+ rf_project, name, version = GEMSPEC.rubyforge_project, GEMSPEC.name, GEMSPEC.version.to_s
27
+
28
+ puts <<INSTRUCTIONS
29
+ To publish to rubyforge do following:
30
+
31
+ rubyforge login
32
+ rubyforge add_release #{rf_project} #{name} #{version.dump} pkg/#{name}-#{version}.gem
33
+
34
+ After you have done these steps, see:
35
+
36
+ VERSION=#{version.dump} rake release:rubyforge_archives
37
+
38
+ INSTRUCTIONS
39
+ end
40
+
41
+ desc 'Display instructions to add archives after release:rubyforge'
42
+ task :rubyforge_archives do
43
+ rf_project, name, version = GEMSPEC.rubyforge_project, GEMSPEC.name, GEMSPEC.version.to_s
44
+ puts "Adding archives for distro packagers is:", ""
45
+
46
+ Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
47
+ puts "rubyforge add_file %s %s %p %p" % [rf_project, name, version, file]
48
+ end
49
+
50
+ puts
51
+ end
52
+ end
@@ -0,0 +1,8 @@
1
+ desc "update version.rb"
2
+ task :reversion do
3
+ File.open("lib/#{GEMSPEC.name}/version.rb", 'w+') do |file|
4
+ file.puts("module #{PROJECT_MODULE}")
5
+ file.puts(' VERSION = %p' % GEMSPEC.version.to_s)
6
+ file.puts('end')
7
+ end
8
+ end
@@ -0,0 +1,18 @@
1
+ # Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
2
+ # Distributed under the terms of the MIT license.
3
+ # See the LICENSE file which accompanies this software for the full text
4
+ #
5
+ desc 'install all possible dependencies'
6
+ task :setup => :gem_installer do
7
+ GemInstaller.new do
8
+ # core
9
+ gem "rack"
10
+
11
+ # spec
12
+ gem "bacon"
13
+
14
+ # doc
15
+
16
+ setup
17
+ end
18
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: url_escape
3
+ version: !ruby/object:Gem::Version
4
+ version: 2009.06.24
5
+ platform: ruby
6
+ authors:
7
+ - Evan Phoenix
8
+ - TJ Vanderpoel
9
+ - Michael Fellinger
10
+ - Trey Dempsey
11
+ - Jayson Vaughn
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2009-06-24 00:00:00 -05:00
17
+ default_executable:
18
+ dependencies: []
19
+
20
+ description: Fast replacement for CGI.escape and Rack::Utils.escape
21
+ email: manveru@rubyists.com
22
+ executables: []
23
+
24
+ extensions:
25
+ - ext/extconf.rb
26
+ extra_rdoc_files: []
27
+
28
+ files:
29
+ - RELEASE
30
+ - AUTHORS
31
+ - CHANGELOG
32
+ - MANIFEST
33
+ - README
34
+ - Rakefile
35
+ - ext/escape.c
36
+ - ext/extconf.rb
37
+ - spec/bench.rb
38
+ - spec/big_bench.rb
39
+ - spec/helper.rb
40
+ - spec/url_escape.rb
41
+ - tasks/authors.rake
42
+ - tasks/bacon.rake
43
+ - tasks/build.rake
44
+ - tasks/changelog.rake
45
+ - tasks/clean.rake
46
+ - tasks/copyright.rake
47
+ - tasks/gem.rake
48
+ - tasks/gem_installer.rake
49
+ - tasks/manifest.rake
50
+ - tasks/release.rake
51
+ - tasks/reversion.rake
52
+ - tasks/setup.rake
53
+ has_rdoc: true
54
+ homepage: http://github.com/bougyman/seedling
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - ext
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project: url-escape
77
+ rubygems_version: 1.3.4
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Fast url_escape library written in C
81
+ test_files: []
82
+