markview 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -1
- data/bin/markview +3 -1
- data/lib/markview.rb +4 -4
- data/lib/static/style.css +3 -3
- data/test/render_test.rb +24 -0
- metadata +29 -7
data/README.md
CHANGED
@@ -21,7 +21,12 @@ the README. Markview is smart enough to find the README if you choose not to
|
|
21
21
|
specify the file.
|
22
22
|
|
23
23
|
$ markview README.md
|
24
|
-
|
24
|
+
|
25
|
+
Preview
|
26
|
+
-------
|
27
|
+
|
28
|
+
![Markview Preview](http://img.skitch.com/20100225-gt6h7nqqt281hhx4d1qstu7cqm.png)
|
29
|
+
|
25
30
|
Author
|
26
31
|
------
|
27
32
|
|
data/bin/markview
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
|
2
3
|
begin
|
3
4
|
require 'vegas'
|
4
5
|
rescue LoadError
|
@@ -7,4 +8,5 @@ rescue LoadError
|
|
7
8
|
end
|
8
9
|
require File.expand_path(File.dirname(__FILE__) + "/../lib/markview")
|
9
10
|
|
10
|
-
|
11
|
+
use Rack::ShowExceptions
|
12
|
+
Vegas::Runner.new(Markview::Application, 'markview', :foreground => true )
|
data/lib/markview.rb
CHANGED
@@ -8,8 +8,8 @@ module Markview
|
|
8
8
|
|
9
9
|
set :views, File.expand_path(File.dirname(__FILE__)) + '/views'
|
10
10
|
set :public, File.expand_path(File.dirname(__FILE__)) + '/static'
|
11
|
-
|
12
|
-
def markdown_me
|
11
|
+
|
12
|
+
def self.markdown_me
|
13
13
|
ARGV[0] ||= Dir.glob("*.{md,markdown}")[0]; mdown=""
|
14
14
|
begin
|
15
15
|
File.open("#{ARGV[0]}", "r") { |f|
|
@@ -25,8 +25,8 @@ module Markview
|
|
25
25
|
end
|
26
26
|
|
27
27
|
get '/' do
|
28
|
-
@markdown = markdown_me
|
28
|
+
@markdown = Markview::Application.markdown_me
|
29
29
|
erb :base
|
30
30
|
end
|
31
|
-
end
|
31
|
+
end
|
32
32
|
end
|
data/lib/static/style.css
CHANGED
@@ -21,9 +21,9 @@ body,input,textarea { font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial
|
|
21
21
|
a { color:#2e80d3; text-decoration:none; }
|
22
22
|
a:hover { text-decoration:underline; }
|
23
23
|
|
24
|
-
div#content {
|
24
|
+
div#content {margin:2% auto; position:relative; width:60%; }
|
25
25
|
div#content > div { float:left; }
|
26
|
-
div#content div#markdown-output { border:
|
26
|
+
div#content div#markdown-output { border: 1px solid #E9E9E9; background:#F8F8F8; padding:5%; overflow-y:auto; }
|
27
27
|
|
28
28
|
.markdown * { line-height:1.4em; }
|
29
29
|
.markdown em { background-color:#fffeca; padding:0 0.08em;}
|
@@ -63,4 +63,4 @@ div#content div#markdown-output { border:0px solid #999; background:#fff; paddin
|
|
63
63
|
.markdown pre.console{background-color:#000;color:white;font-size:90%;line-height:1.5em;margin:0 0 1em;padding:0.5em}
|
64
64
|
.markdown pre.console code{background-color:#000;border:medium none;color:#fff;font-size:100%;padding:0}
|
65
65
|
.markdown pre.console span{color:#888}
|
66
|
-
.markdown pre.console span.command{color:yellow};
|
66
|
+
.markdown pre.console span.command{color:yellow};
|
data/test/render_test.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'contest'
|
2
|
+
require 'vegas'
|
3
|
+
require 'markview'
|
4
|
+
|
5
|
+
class RenderTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
test "renders given file" do
|
8
|
+
ARGV[0] = 'README.md'
|
9
|
+
assert_equal RDiscount.new(File.read(ARGV[0])).to_html, Markview::Application.markdown_me
|
10
|
+
end
|
11
|
+
|
12
|
+
test "renders discovered file" do
|
13
|
+
ARGV[0] = Dir.glob("*.{md,markdown}")[0]
|
14
|
+
assert_equal RDiscount.new(File.read(ARGV[0])).to_html, Markview::Application.markdown_me
|
15
|
+
end
|
16
|
+
|
17
|
+
test "Vegas runs application" do
|
18
|
+
pid = fork { Vegas::Runner.new(Markview::Application, 'markview', :foreground => true, :skip_launch => true, :debug => true) }
|
19
|
+
sleep(1)
|
20
|
+
Process.detach(pid)
|
21
|
+
Process.kill( 'HUP', pid)
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markview
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Sands
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-02-
|
12
|
+
date: 2010-02-26 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.1.
|
23
|
+
version: 0.1.4
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sinatra
|
@@ -42,7 +42,27 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: 1.5.8
|
44
44
|
version:
|
45
|
-
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: contest
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.2
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: turn
|
57
|
+
type: :development
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.7.0
|
64
|
+
version:
|
65
|
+
description: A markdown viewer that renders on the fly.
|
46
66
|
email: marksands07@gmail.com
|
47
67
|
executables:
|
48
68
|
- markview
|
@@ -51,10 +71,12 @@ extensions: []
|
|
51
71
|
extra_rdoc_files: []
|
52
72
|
|
53
73
|
files:
|
54
|
-
-
|
74
|
+
- bin/markview
|
55
75
|
- lib/markview.rb
|
56
76
|
- lib/static/style.css
|
57
77
|
- lib/views/base.erb
|
78
|
+
- README.md
|
79
|
+
- test/render_test.rb
|
58
80
|
has_rdoc: true
|
59
81
|
homepage: http://github.com/marksands/markview
|
60
82
|
licenses: []
|
@@ -83,5 +105,5 @@ rubygems_version: 1.3.5
|
|
83
105
|
signing_key:
|
84
106
|
specification_version: 3
|
85
107
|
summary: A markdown viewer that renders on the fly.
|
86
|
-
test_files:
|
87
|
-
|
108
|
+
test_files:
|
109
|
+
- test/render_test.rb
|