glam 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/glam.gemspec +1 -1
  3. data/lib/glam.rb +1 -1
  4. data/lib/glam/cli.rb +20 -3
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebfb766d24926bb7ae2327e74fe4aa4c28cba6ed
4
- data.tar.gz: 3f90158c080e4ff95ac0d365443455d2fdf377a6
3
+ metadata.gz: a4a59bb7cf94a04f6965427b87ec36bdd271dda4
4
+ data.tar.gz: 754b5ffb41d0b72f2b8bd049c32569e30dec667c
5
5
  SHA512:
6
- metadata.gz: 4e72d8918cb66f7f1d014dc027505b066ee53150e5f09b6421600baadbcec5e43aeb6cbf9881cf97ede2dcdf371bfb2ea80b8c78b49175504f000e2184a72e7a
7
- data.tar.gz: db70c41eba8cd202ba60eadb6e2a72028ab2af932f4a4dc3ef0947820fa24af1fc942645b27fc18e70fec683113d78ce564f5cf636b51dcffbc006e386eeb258
6
+ metadata.gz: 09830db411522642371cb0550b052da1b5276222649a71f11e4f6fd8804c3af876e3dec57f97f0b8bb2a3cf55f358f99e8212085b995ff501a88964671c2f5cb
7
+ data.tar.gz: 87447b14ac94022d05d583f3e961164ffa9781c17cdbdbe1e8bf86bd7663cc61b96390ea9a53da23e99f391553d7ef96d130666f4de9c8a40c21c3d12785dc6a
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "glam"
3
- spec.version = "0.0.1"
3
+ spec.version = "0.1.0"
4
4
  spec.authors = ["Paul Barry"]
5
5
  spec.email = ["mail@paulbarry.com"]
6
6
  spec.description = %q{An HTML pretty printer}
@@ -1,7 +1,7 @@
1
1
  require 'glam/glamorizer'
2
2
 
3
3
  module Glam
4
- VERSION = '0.0.1'
4
+ VERSION = '0.1.0'
5
5
  end
6
6
 
7
7
  # Pretty-print the HTML
@@ -16,23 +16,40 @@ module Glam
16
16
 
17
17
  def run
18
18
  @parser = OptionParser.new do |o|
19
- o.on "-i", "--indent [INDENT]", Integer do |indent_size|
19
+ o.on "-i", "--indent [INDENT]", "How many spaces to indent at each level", Integer do |indent_size|
20
20
  @options[:indent_size] = indent_size
21
21
  end
22
22
  end
23
23
 
24
- @parser.banner = "glam [options] file"
24
+ @parser.banner = "glam #{Glam::VERSION}\n\nUsage: glam [options] file"
25
25
 
26
26
  @parser.on_tail "-h", "--help", "Show help" do
27
27
  $stderr.puts @parser
28
28
  exit 1
29
29
  end
30
30
 
31
+ @parser.on_tail "-v", "--version", "Print the version" do
32
+ $stderr.puts Glam::VERSION
33
+ exit 2
34
+ end
35
+
31
36
  @parser.parse!
32
37
 
33
38
  glam = Glam::Glamorizer.new(@options)
34
39
 
35
- puts glam.glamorize(ARGV[0] ? File.read(ARGV[0]) : STDIN.read)
40
+ html = if ARGV[0]
41
+ file = File.expand_path(ARGV[0])
42
+ if File.exists?(file)
43
+ File.read(file)
44
+ else
45
+ $stderr.puts "#{file} does not exist"
46
+ exit 3
47
+ end
48
+ else
49
+ STDIN.read
50
+ end
51
+
52
+ puts glam.glamorize(html)
36
53
  end
37
54
  end
38
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Barry