libc-tidy_ffi 0.0.4 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.1.0. Clean class method.
1
2
  v0.0.4. Options validation
2
3
  v0.0.3. Add method “errors” to return errors after cleanup
3
4
  v0.0.2. Do not require matchy, rr and context as development dependencies. A user does not need them.
data/Manifest CHANGED
@@ -1,7 +1,7 @@
1
1
  CHANGELOG
2
2
  LICENSE
3
3
  Manifest
4
- README
4
+ README.rdoc
5
5
  Rakefile
6
6
  lib/tidy_ffi/interface.rb
7
7
  lib/tidy_ffi/lib_tidy.rb
@@ -10,6 +10,7 @@ lib/tidy_ffi/tidy.rb
10
10
  lib/tidy_ffi/tidy_ffi_extensions.rb
11
11
  lib/tidy_ffi.rb
12
12
  test/test_helper.rb
13
+ test/test_lowlevel.rb
13
14
  test/test_options.rb
14
15
  test/test_simple.rb
15
16
  tidy_ffi.gemspec
@@ -22,8 +22,10 @@ You can use different ways to set up options. These examples are produces the sa
22
22
 
23
23
  TidyFFI::Tidy.new('test', :show_body_only => true).clean
24
24
 
25
+ TidyFFI::Tidy.clean('test', :show_body_only => 1)
26
+
25
27
  == Links
26
28
 
27
29
  * Source code: http://github.com/libc/tidy_ffi
28
30
  * Bug tracker: http://rubyforge.org/tracker/?atid=30230&group_id=7805&func=browse
29
- * Rubyforge project: http://rubyforge.org/projects/tidy-ffi/
31
+ * Rubyforge project: http://rubyforge.org/projects/tidy-ffi
data/Rakefile CHANGED
@@ -8,11 +8,16 @@ begin
8
8
  p.runtime_dependencies = ['ffi >= 0.2.0']
9
9
  # p.development_dependencies = ['rr', 'matchy', 'context']
10
10
  p.project = 'tidy-ffi'
11
+ p.rdoc_pattern = /^(lib|bin|tasks|ext)|^README\.rdoc|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
12
+ p.retain_gemspec = true
11
13
  end
14
+
15
+ # My common error
16
+ task :rdoc => :doc do; end
12
17
  rescue LoadError => boom
13
18
  puts "You are missing a dependency required for meta-operations on this gem."
14
19
  puts "#{boom.to_s.capitalize}."
15
20
 
16
21
  desc 'No effect.'
17
22
  task :default do; end
18
- end
23
+ end
@@ -64,6 +64,10 @@ class TidyFFI::OptionsContainer #:nodoc:
64
64
  @obj.new(args.first, options.to_hash!.merge(args[1] || {}))
65
65
  end
66
66
 
67
+ def clean(str, opts = {})
68
+ @obj.clean(str, options.to_hash!.merge(opts))
69
+ end
70
+
67
71
  def initialize(obj, options1, options2)
68
72
  @obj = obj
69
73
  @options = TidyFFI::OptionsContainer.new(options1)
data/lib/tidy_ffi/tidy.rb CHANGED
@@ -25,6 +25,11 @@ class TidyFFI::Tidy
25
25
  end
26
26
  end
27
27
 
28
+ # Returns cleaned string
29
+ def self.clean(str, options = {})
30
+ new(str, options).clean
31
+ end
32
+
28
33
  # Returns errors for string
29
34
  def errors
30
35
  @errors ||= begin
data/test/test_helper.rb CHANGED
@@ -9,5 +9,5 @@ require 'context'
9
9
 
10
10
  class Test::Unit::TestCase
11
11
  alias method_name name unless instance_methods.include?('method_name')
12
- include RR::Adapters::TestUnit unless instance_methods.include?('stub')
12
+ include RR::Adapters::TestUnit unless instance_methods.include?('stub') || instance_methods.include?(:stub)
13
13
  end
data/test/test_options.rb CHANGED
@@ -101,6 +101,10 @@ class TestOptions < Test::Unit::TestCase
101
101
  @t.options.show_body_only = 1
102
102
  @t.clean.should == "test\n"
103
103
  end
104
+
105
+ it "passes options to clean class method" do
106
+ T.with_options(:show_body_only => true).clean("test").should == "test\n"
107
+ end
104
108
  end
105
109
 
106
110
  context "with_options proxy class" do
data/test/test_simple.rb CHANGED
@@ -17,6 +17,9 @@ class TestSimple < Test::Unit::TestCase
17
17
  it "clean up text" do
18
18
  T.new("test").clean.should =~ %r{<body>\s+test\s+</body>}
19
19
  T.new("test").clean.should =~ %r{<meta name="generator" content=.+?Tidy.+?>}m
20
+
21
+ T.clean("test").should =~ %r{<body>\s+test\s+</body>}
22
+ T.clean("test").should =~ %r{<meta name="generator" content=.+?Tidy.+?>}m
20
23
  end
21
24
  end
22
25
 
@@ -28,6 +31,7 @@ class TestSimple < Test::Unit::TestCase
28
31
  end
29
32
  end
30
33
 
34
+
31
35
  # Commented out, because of broken upstream matchy gem :(
32
36
  # context "options validation" do
33
37
  # it "raises error on invalid option name" do
data/tidy_ffi.gemspec CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{tidy_ffi}
5
- s.version = "0.0.4"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Eugene Pimenov"]
9
- s.date = %q{2009-03-14}
9
+ s.date = %q{2009-03-16}
10
10
  s.description = %q{Tidy library interface via FFI}
11
11
  s.email = %q{}
12
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "lib/tidy_ffi/interface.rb", "lib/tidy_ffi/lib_tidy.rb", "lib/tidy_ffi/options_container.rb", "lib/tidy_ffi/tidy.rb", "lib/tidy_ffi/tidy_ffi_extensions.rb", "lib/tidy_ffi.rb"]
13
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "lib/tidy_ffi/interface.rb", "lib/tidy_ffi/lib_tidy.rb", "lib/tidy_ffi/options_container.rb", "lib/tidy_ffi/tidy.rb", "lib/tidy_ffi/tidy_ffi_extensions.rb", "lib/tidy_ffi.rb", "test/test_helper.rb", "test/test_options.rb", "test/test_simple.rb", "tidy_ffi.gemspec", "test/test_lowlevel.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/tidy_ffi/interface.rb", "lib/tidy_ffi/lib_tidy.rb", "lib/tidy_ffi/options_container.rb", "lib/tidy_ffi/tidy.rb", "lib/tidy_ffi/tidy_ffi_extensions.rb", "lib/tidy_ffi.rb"]
13
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "lib/tidy_ffi/interface.rb", "lib/tidy_ffi/lib_tidy.rb", "lib/tidy_ffi/options_container.rb", "lib/tidy_ffi/tidy.rb", "lib/tidy_ffi/tidy_ffi_extensions.rb", "lib/tidy_ffi.rb", "test/test_helper.rb", "test/test_lowlevel.rb", "test/test_options.rb", "test/test_simple.rb", "tidy_ffi.gemspec"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{http://github.com/libc/tidy_ffi}
16
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tidy_ffi", "--main", "README"]
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Tidy_ffi", "--main", "README.rdoc"]
17
17
  s.require_paths = ["lib"]
18
18
  s.rubyforge_project = %q{tidy-ffi}
19
19
  s.rubygems_version = %q{1.3.1}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libc-tidy_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Pimenov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-14 00:00:00 -07:00
12
+ date: 2009-03-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,7 @@ extensions: []
34
34
  extra_rdoc_files:
35
35
  - CHANGELOG
36
36
  - LICENSE
37
- - README
37
+ - README.rdoc
38
38
  - lib/tidy_ffi/interface.rb
39
39
  - lib/tidy_ffi/lib_tidy.rb
40
40
  - lib/tidy_ffi/options_container.rb
@@ -45,7 +45,7 @@ files:
45
45
  - CHANGELOG
46
46
  - LICENSE
47
47
  - Manifest
48
- - README
48
+ - README.rdoc
49
49
  - Rakefile
50
50
  - lib/tidy_ffi/interface.rb
51
51
  - lib/tidy_ffi/lib_tidy.rb
@@ -54,10 +54,10 @@ files:
54
54
  - lib/tidy_ffi/tidy_ffi_extensions.rb
55
55
  - lib/tidy_ffi.rb
56
56
  - test/test_helper.rb
57
+ - test/test_lowlevel.rb
57
58
  - test/test_options.rb
58
59
  - test/test_simple.rb
59
60
  - tidy_ffi.gemspec
60
- - test/test_lowlevel.rb
61
61
  has_rdoc: true
62
62
  homepage: http://github.com/libc/tidy_ffi
63
63
  post_install_message:
@@ -67,7 +67,7 @@ rdoc_options:
67
67
  - --title
68
68
  - Tidy_ffi
69
69
  - --main
70
- - README
70
+ - README.rdoc
71
71
  require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement