htmlbeautifier 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,19 @@
1
- = HTML Beautifier
1
+ HTML Beautifier
2
+ ===============
2
3
 
3
4
  A normaliser/beautifier for HTML that also understands embedded Ruby. Ideal for tidying up Rails templates.
4
5
 
5
- == What it does
6
+ Usage
7
+ -----
8
+
9
+ htmlbeautifier file1 [file2 ...]
10
+
11
+ or
12
+
13
+ htmlbeautifier < input > output
14
+
15
+ What it does
16
+ ------------
6
17
 
7
18
  * Normalises hard tabs to spaces
8
19
  * Removes trailing spaces
data/Rakefile CHANGED
@@ -1,93 +1,9 @@
1
- require 'rake'
2
1
  require 'rake/testtask'
3
2
 
4
- task :default => :test
5
-
6
3
  Rake::TestTask.new(:test) do |t|
7
4
  t.libs << 'lib'
8
5
  t.pattern = 'test/test_*.rb'
9
6
  t.verbose = true
10
7
  end
11
8
 
12
- desc 'Install libraries and command-line utility'
13
- task :install do |t|
14
- sh 'ruby setup.rb'
15
- end
16
-
17
- desc 'Clean up files left over after installation'
18
- task :cleanup do |t|
19
- rm_f 'InstalledFiles'
20
- rm_f '.config'
21
- end
22
-
23
-
24
- require "rubygems"
25
- require "rake/gempackagetask"
26
- require "rake/rdoctask"
27
-
28
9
  task :default => :test
29
-
30
- require "rake/testtask"
31
- Rake::TestTask.new do |t|
32
- t.libs << "test"
33
- t.test_files = FileList["test/**/*_test.rb"]
34
- t.verbose = true
35
- end
36
-
37
- # This builds the actual gem. For details of what all these options
38
- # mean, and other ones you can add, check the documentation here:
39
- #
40
- # http://rubygems.org/read/chapter/20
41
- #
42
- require "lib/htmlbeautifier/version"
43
- spec = Gem::Specification.new do |s|
44
-
45
- # Change these as appropriate
46
- s.name = "htmlbeautifier"
47
- s.version = HtmlBeautifier::VERSION::STRING
48
- s.summary = "A normaliser/beautifier for HTML that also understands embedded Ruby."
49
- s.author = "Paul Battley"
50
- s.email = "pbattley@gmail.com"
51
- s.homepage = "http://github.com/threedaymonk/htmlbeautifier"
52
-
53
- s.has_rdoc = true
54
- s.extra_rdoc_files = %w(README.txt)
55
- s.rdoc_options = %w(--main README.txt)
56
-
57
- # Add any extra files to include in the gem
58
- s.files = %w(Rakefile README.txt) + Dir.glob("{bin,test,lib}/**/*")
59
- s.executables = FileList["bin/**"].map { |f| File.basename(f) }
60
-
61
- s.require_paths = ["lib"]
62
-
63
- # If you want to depend on other gems, add them here, along with any
64
- # relevant versions
65
- # s.add_dependency("some_other_gem", "~> 0.1.0")
66
-
67
- # If your tests use any gems, include them here
68
- # s.add_development_dependency("mocha")
69
- end
70
-
71
- # This task actually builds the gem. We also regenerate a static
72
- # .gemspec file, which is useful if something (i.e. GitHub) will
73
- # be automatically building a gem for this project. If you're not
74
- # using GitHub, edit as appropriate.
75
- Rake::GemPackageTask.new(spec) do |pkg|
76
- pkg.gem_spec = spec
77
-
78
- # Generate the gemspec file for github.
79
- file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
80
- File.open(file, "w") {|f| f << spec.to_ruby }
81
- end
82
-
83
- # Generate documentation
84
- Rake::RDocTask.new do |rd|
85
- rd.main = "README.txt"
86
- rd.rdoc_files.include("README.txt", "lib/**/*.rb")
87
- rd.rdoc_dir = "rdoc"
88
- end
89
-
90
- desc 'Clear out RDoc and generated packages'
91
- task :clean => [:clobber_rdoc, :clobber_package] do
92
- rm "#{spec.name}.gemspec"
93
- end
data/bin/htmlbeautifier CHANGED
@@ -1,4 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'htmlbeautifier/beautifier'
3
- HtmlBeautifier::Beautifier.new($stdout).scan($stdin.read)
4
- $stdout << "\n"
3
+
4
+ def beautify(input, output)
5
+ HtmlBeautifier::Beautifier.new(output).scan(input)
6
+ $stdout << "\n"
7
+ end
8
+
9
+ if ARGV.any?
10
+ ARGV.each do |f|
11
+ input = File.read(f)
12
+ File.open(f, "w") do |output|
13
+ beautify input, output
14
+ end
15
+ end
16
+ else
17
+ beautify $stdin.read, $stdout
18
+ end
@@ -2,7 +2,7 @@ module HtmlBeautifier #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: htmlbeautifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Battley
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-13 00:00:00 +01:00
12
+ date: 2010-07-02 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -19,11 +19,11 @@ executables:
19
19
  - htmlbeautifier
20
20
  extensions: []
21
21
 
22
- extra_rdoc_files:
23
- - README.txt
22
+ extra_rdoc_files: []
23
+
24
24
  files:
25
25
  - Rakefile
26
- - README.txt
26
+ - README.md
27
27
  - bin/htmlbeautifier
28
28
  - test/html_beautifier_test_utilities.rb
29
29
  - test/test_helper.rb
@@ -39,9 +39,8 @@ homepage: http://github.com/threedaymonk/htmlbeautifier
39
39
  licenses: []
40
40
 
41
41
  post_install_message:
42
- rdoc_options:
43
- - --main
44
- - README.txt
42
+ rdoc_options: []
43
+
45
44
  require_paths:
46
45
  - lib
47
46
  required_ruby_version: !ruby/object:Gem::Requirement