-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8be2888
commit ca7b64b
Showing
3 changed files
with
161 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,41 +1,67 @@ | |||
require 'rubygems' | require 'rubygems' | ||
require 'hoe' | require 'hoe' | ||
|
|
||
class Hoe | rubyforge_name = "oniguruma" | ||
# Dirty hack to eliminate Hoe from gem dependencies |
|
||
def extra_deps | begin | ||
@extra_deps.delete_if{ |x| x.first == 'hoe' } |
|
||
class Hoe | |||
# Dirty hack to eliminate Hoe from gem dependencies | |||
def extra_deps | |||
@extra_deps.delete_if{ |x| x.first == 'hoe' } | |||
end | |||
|
|||
# Dirty hack to package only the required files per platform | |||
def spec= s | |||
if ENV['PLATFORM'] =~ /win32/ | |||
s.files = s.files.reject! {|f| f =~ /extconf\.rb/} | |||
else | |||
s.files = s.files.reject! {|f| f =~ /win\//} | |||
end | |||
@spec = s | |||
end | |||
end | end | ||
|
|
||
# Dirty hack to package only the required files per platform | version = /^== *(\d+\.\d+\.\d+)/.match( File.read( 'History.txt' ) )[1] | ||
def spec= s |
|
||
h = Hoe.new('oniguruma', version) do |p| | |||
p.rubyforge_name = 'oniguruma' | |||
p.author = ['Dizan Vasquez', 'Nikolai Lugovoi'] | |||
p.email = 'dichodaemon@gmail.com' | |||
p.summary = 'Bindings for the oniguruma regular expression library' | |||
p.description = p.paragraphs_of('README.txt', 1 ).join('\n\n') | |||
p.url = 'http://oniguruma.rubyforge.org' | |||
if ENV['PLATFORM'] =~ /win32/ | if ENV['PLATFORM'] =~ /win32/ | ||
s.files = s.files.reject! {|f| f =~ /extconf\.rb/} | p.lib_files = ["win/oregexp.so"] | ||
p.spec_extras[:require_paths] = ["win", "lib", "ext" ] | |||
p.spec_extras[:platform] = Gem::Platform::WIN32 | |||
else | else | ||
s.files = s.files.reject! {|f| f =~ /win\//} | p.spec_extras[:extensions] = ["ext/extconf.rb"] | ||
end | end | ||
@spec = s | p.rdoc_pattern = /^(lib|bin|ext)|txt$/ | ||
p.changes = p.paragraphs_of('History.txt', 0).join("\n\n") | |||
p.clean_globs = ["manual/*"] | |||
end | end | ||
end | |||
|
|
||
version = /^== *(\d+\.\d+\.\d+)/.match( File.read( 'History.txt' ) )[1] | desc 'Create MaMa documentation' | ||
task :mama => :clean do | |||
system "mm -c -t refresh -o manual mm/manual.mm" | |||
end | |||
|
|||
desc 'Publish MaMa documentation to RubyForge' | |||
task :mama_publish => [:clean, :mama] do | |||
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml"))) | |||
host = "#{config["username"]}@rubyforge.org" | |||
remote_dir = "/var/www/gforge-projects/#{h.rubyforge_name}" | |||
local_dir = 'manual' | |||
system "rsync -av #{local_dir}/ #{host}:#{remote_dir}" | |||
end | |||
|
|
||
Hoe.new('oniguruma', version) do |p| | rescue LoadError => e | ||
p.rubyforge_name = 'oniguruma' | desc 'Run the test suite.' | ||
p.author = ['Dizan Vasquez', 'Nikolai Lugovoi'] | task :test do | ||
p.email = 'dichodaemon@gmail.com' | system "ruby -Ibin:lib:test test_#{rubyforge_name}.rb" | ||
p.summary = 'Bindings for the oniguruma regular expression library' | end | ||
p.description = p.paragraphs_of('README.txt', 1 ).join('\n\n') | |||
p.url = 'http://oniguruma.rubyforge.org' | |||
if ENV['PLATFORM'] =~ /win32/ | |||
p.lib_files = ["win/oregexp.so"] | |||
p.spec_extras[:require_paths] = ["win", "lib", "ext" ] | |||
p.spec_extras[:platform] = Gem::Platform::WIN32 | |||
else | |||
p.spec_extras[:extensions] = ["ext/extconf.rb"] | |||
end | |||
p.rdoc_pattern = /^(lib|bin|ext)|txt$/ | |||
p.changes = p.paragraphs_of('History.txt', 0).join("\n\n") | |||
end | end | ||
|
|
||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,101 @@ | |||
~Oniguruma for Ruby~ | |||
~~Ruby bindings for oniguruma~~ | |||
|
|||
#Main# | index | |||
|
|||
= About = | |||
|
|||
This library provides bindings to [Oniguruma http://www.geocities.jp/kosako3/oniguruma/], | |||
a regular expression library which is standard with Ruby 1.9. It allows users | |||
of Ruby 1.8 to access the extended functionality without the need to recompile | |||
or to upgrade Ruby. | |||
|
|||
This site provides an overview of the library, the api documentation is | |||
[here http://oniguruma.rubyforge.org/oniguruma]. | |||
|
|||
= Requirements = | |||
|
|||
* [Oniguruma http://www.geocities.jp/kosako3/oniguruma/] regular expression library (/>= 4.x.x/) | |||
|
|||
= Installation = | |||
|
|||
If you have [rubygems http://docs.rubygems.org/] installation is straightforward by typing | |||
(as root if needed): | |||
|
|||
--------hl shell-unix-generic,,false------ | |||
gem install -r oniguruma | |||
------------------------------------------ | |||
|
|||
If you prefer to get the sources, the last stable version may be | |||
downloaded [here http://rubyforge.org/frs/?group_id=3289]. | |||
|
|||
= Status = | |||
|
|||
The library interface is mature. Existing bugs are being fixed as they are | |||
found. | |||
|
|||
#Use# | |||
|
|||
= Details = | |||
|
|||
Oniguruma provides the same functionality (and almost the same interface) than | |||
standard regexp in Ruby. The main missing feature is the slash syntax to | |||
declare regular expressions `/regexp/`. On the other hand, oniguruma provides | |||
additional functionality: | |||
|
|||
* Extensive multibyte support. | |||
-----------hl ruby,,false----- | |||
reg = ORegexp.new( 'р(уби.*)', 'i', 'utf8' ) | |||
matches = reg.match("Text: Ехал Грека Через Реку") | |||
puts matches[0] #=> "Ехал" | |||
------------------------------ | |||
|
|||
* Named groups. | |||
-----------hl ruby,,false----- | |||
reg = ORegex.new( '(?<before>.*)(a)(?<after>.*)' ) | |||
match = reg.match( 'terraforming' ) | |||
puts match[0] #=> 'terraforming' | |||
puts match[:before] #=> 'terr' | |||
puts match[:after] #=> 'forming' | |||
------------------------------ | |||
|
|||
* Named backreferences. | |||
-----------hl ruby,,false----- | |||
re = ORegexp.new('(?<pre>\w+?)\d+(?<after>\w+)') | |||
puts re.sub('abc123def', ' \<after>123\<pre> ') #=> " def123abc " | |||
------------------------------ | |||
|
|||
* Positive and negative Lookbehind. | |||
-----------hl ruby,,false----- | |||
re = ORegexp.new('(?>!g)ong') | |||
m1 = re.match("song") | |||
puts m1[0] #=> ong | |||
m2 = re.match("gong") #=> nil | |||
------------------------------ | |||
|
|||
* Support for different regexp syntaxes (Python, Perl, etc.). | |||
-----------hl ruby,,false----- | |||
re = ORegexp.new( 'section{ (?P<name> [^}]* ) }', :syntax => SYNTAX_PYTHON ) | |||
re.sub('section{First}', 'subsection{\1}') #=> "subsection{First}" | |||
------------------------------ | |||
|
|||
# Links # | |||
|
|||
|
|||
= Rubyforge project page = | |||
|
|||
* [Textpow http://rubyforge.org/projects/oniguruma]. | |||
|
|||
= Documentation = | |||
|
|||
* [Api Documentation http://oniguruma.rubyforge.org/oniguruma]. | |||
|
|||
= Requirements = | |||
|
|||
* [Oniguruma http://www.geocities.jp/kosako3/oniguruma/]. | |||
|
|||
= Projects using Textpow = | |||
|
|||
* [Textpow http://textpow.rubyforge.org/]. | |||
* [Ultraviolet Syntax Highlighting Engine http://ultraviolet.rubyforge.org/]. | |||
* [Macaronic markup engine http://mama.rubyforge.org/]. |