sharkfrown 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,11 +5,24 @@ require 'rack'
5
5
  require 'pygmentize'
6
6
  require 'redcarpet'
7
7
 
8
+ require 'optparse'
9
+
10
+ options = { :port => 6789, :verbose => false }
11
+ OptionParser.new do |opts|
12
+ opts.banner = "Usage: sharkfrown [options]"
13
+
14
+ opts.on('-p', '--port PORT', "Change port (default: #{options[:port]}") { |v| options[:port] = v.to_i }
15
+ opts.on('-v', '--verbose', "Verbose (show request log)") { |v| options[:verbose] = true }
16
+ end.parse!
17
+
8
18
  class Sharkfrown
9
19
  class PygmentizeHTML < Redcarpet::Render::HTML
10
20
  def block_code(code, language)
11
21
  require 'pygmentize'
12
- Pygmentize.process(code, language)
22
+ result = Pygmentize.process(code, language)
23
+ result = "<pre>#{code}</pre>" if result.empty?
24
+
25
+ result
13
26
  end
14
27
  end
15
28
 
@@ -69,8 +82,8 @@ HTML
69
82
  end
70
83
  end
71
84
 
72
- Thin::Server.start('0.0.0.0', 6789) do
73
- use Rack::CommonLogger
85
+ Thin::Server.start('0.0.0.0', options[:port]) do
86
+ use Rack::CommonLogger if options[:verbose]
74
87
  use Rack::ShowExceptions
75
88
 
76
89
  run Sharkfrown.new
@@ -1,3 +1,3 @@
1
1
  module Sharkfrown
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sharkfrown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-26 00:00:00.000000000 Z
12
+ date: 2012-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pygmentize
@@ -96,9 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  version: '0'
97
97
  requirements: []
98
98
  rubyforge_project:
99
- rubygems_version: 1.8.23
99
+ rubygems_version: 1.8.24
100
100
  signing_key:
101
101
  specification_version: 3
102
102
  summary: Stupid-simple Rack-based Markdown browser with syntax highlighting.
103
103
  test_files: []
104
- has_rdoc: