markview 0.2.3 → 0.2.4

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/README.md CHANGED
@@ -1,33 +1,25 @@
1
- Markview
2
- ========
1
+ # Markview
3
2
 
4
- Markview allows you to view nearly any and all markup formatted files in a slick way. Markview is
5
- inspired by the python library [restview](http://mg.pov.lt/restview/). As of v0.2.0, I've decided
6
- to extend markview to render virtually any and all markup formatted README's or what-have-you using
7
- the [github-markup](http://github.com/defunkt/github-markup) library.
3
+ Markview allows you to view nearly any and all markup formatted files in a slick way. Markview is inspired by the python library [restview](http://mg.pov.lt/restview/). As of v0.2.0, I've decided to extend markview to render virtually any and all markup formatted README's or what-have-you using the [github-markup](http://www.github.com/defunkt/github-markup) library.
8
4
 
9
- Install
10
- -------
5
+ ## Install
11
6
 
12
7
  New releases of Markview are published to [gemcutter](http://gemcutter.org/gems/markview)
13
8
 
14
9
  $ [sudo] gem install markview
15
10
 
16
- Usage
17
- -----
11
+ ## Usage
18
12
 
19
13
  Markview is very simple to use. Run the gem from the command line and specify
20
- a README or other markup file. Markview defaults to finding a README if you choose not to
14
+ a README or other markdown file. Markview defaults to finding a README if you choose not to
21
15
  specify the file.
22
16
 
23
17
  $ markview README.md
24
18
 
25
- Preview
26
- -------
19
+ ## Preview
27
20
 
28
21
  ![Markview Preview](http://img.skitch.com/20100225-gt6h7nqqt281hhx4d1qstu7cqm.png)
29
22
 
30
- Author
31
- ------
23
+ ## Author
32
24
 
33
25
  [Mark Sands](http://github.com/marksands) :: marksands07@gmail.com
data/lib/markview.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  $:.unshift File.expand_path(File.dirname(__FILE__) + '/lib')
2
-
3
2
  require 'sinatra'
4
3
  require 'github/markup'
5
4
 
@@ -12,7 +11,7 @@ module Markview
12
11
  set :static, true
13
12
 
14
13
  # Renders the html using GitHub::Markup
15
- def self.markdown_me
14
+ def self.markview_me
16
15
  ARGV[0] ||= Dir.glob("README*")[0]
17
16
  begin
18
17
  GitHub::Markup.render(ARGV[0], File.read(ARGV[0]))
@@ -22,8 +21,8 @@ module Markview
22
21
  end
23
22
 
24
23
  get '/' do
25
- @markdown = Application.markdown_me
26
- @title = ARGF.filename.gsub(/(.+\/)?/, '') # /path/to/README.txt => README.txt
24
+ @markdown = Markview::Application.markview_me
25
+ @title = ARGV[0].gsub(/(.+\/)?/, '') # /path/to/README.txt => README.txt
27
26
  erb :base
28
27
  end
29
28
  end
@@ -14,34 +14,35 @@ blockquote,q { quotes:"" ""; }
14
14
 
15
15
  .clear:after { clear:both; content:""; display:block; height:0; zoom:1; }
16
16
 
17
- body { background:#fff; font-size:15px; }
17
+ body { background:#fff; font-size:13px; }
18
18
  body * { line-height:1.4em; }
19
- body,input,textarea { font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; color:#333; }
20
-
21
- a { color:#2e80d3; text-decoration:none; }
22
- a:hover { text-decoration:underline; }
19
+ body,input,textarea { font-family: helvetica, arial, freesans, clean, sans-serif; color:#333; }
23
20
 
24
21
  p#file {font-size:150%;}
25
22
 
26
23
  div#content {margin:2% auto; position:relative; width:920px; }
27
24
  div#content > div { float:left; }
28
- div#content div#markview-output { border: 1px solid #E9E9E9; background:#F8F8F8; padding:5%; overflow-y:auto; }
25
+ div#content div#markview-output { border: 1px solid #E9E9E9; background:#F8F8F8; padding:10px; overflow-y:auto; min-width:900px;}
29
26
 
30
27
  .markview * {line-height:1.4em;}
31
- .markview a {text-decoration:none;}
28
+ .markview a {color:#2e80d3; text-decoration:none;}
29
+ .markview a:hover { text-decoration:underline;}
32
30
  .markview em {font-style:italic; padding:0 0.08em;}
33
31
  .markview i{font-style:italic}
34
32
  .markview strong,.markview b{font-weight:bold}
35
33
  .markview abbr{border-bottom:1px dashed;cursor:help}
36
34
  .markview small{font-size:0.8em}
37
35
 
38
- .markview h1,.markview h2,.markview h3,.markview h4,.markview h5,.markview h6{margin-bottom:0.5em}
39
- .markview h1{font-size:170%;font-weight:bold}
40
- .markview h2{font-size:150%;font-weight:bold}
41
- .markview h3{color:#555;font-size:110%;font-weight:bold}
42
- .markview h4{color:#777;font-weight:bold}
43
- .markview h5{color:#777}
44
- .markview h6{color:#777;font-size:90%}
36
+ .markview h1,.markview h2,.markview h3,.markview h4,.markview h5,.markview h6{margin-bottom:0.5em; color:black;}
37
+ .markview h1{font-size:170% !important; padding-top:0.5em!important;margin-top:1.5em!important;
38
+ line-height:1.4em; font-weight:bold; border-top: 4px solid #AAA !important; }
39
+ .markview h1:first-child { margin-top:0!important;padding-top:0.25em!important;border-top:none!important;}
40
+ .markview h2{ border-top: 4px solid #ddd; padding-top: 12px; margin-top:30px; margin-bottom:0.75em;}
41
+ .markview h2{font-size:150% !important; font-weight:bold}
42
+ .markview h3{color:black;line-height:1.3em; font-size:1.17em; font-weight:bold; margin-top:1em !important;}
43
+ .markview h4{color:black;line-height:1.4em; font-weight:bold}
44
+ .markview h5{color:black}
45
+ .markview h6{color:black;font-size:90%}
45
46
 
46
47
  .markview p{line-height:1.5em;margin:0 0 1em}
47
48
 
@@ -59,11 +60,15 @@ div#content div#markview-output { border: 1px solid #E9E9E9; background:#F8F8F8;
59
60
  .markview table th{background:#eee;border-bottom:1px solid #bbb;padding:0.2em 1em}
60
61
  .markview table td{border-bottom:1px solid #ddd;padding:0.2em 1em}
61
62
 
62
- .markview pre{background-color:#f8f8ff;border:1px solid #dedede;color:#444;font-size:90%;line-height:1.5em;margin:0 0 1em;overflow:auto;padding:0.5em}
63
- .markview pre code{background-color:#f8f8ff;border:medium none;font-size:100%;padding:0}
64
- .markview code{font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono';background-color:#f8f8ff;border:1px solid #dedede;color:#444;font-size:90%;padding:0 0.2em}
63
+ .markview pre{font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
64
+ background-color:#f8f8ff !important;border:1px solid #dedede !important;color:#444 !important; font-size:90% !important;
65
+ line-height:1.5em !important; padding: 0.5em !important; margin:1em 0 !important; overflow:auto !important;}
66
+ .markview pre code{background-color:#f8f8ff !important;border:none !important;font-size:100% !important;padding:0 !important}
67
+ .markview code{font-family: Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace;
68
+ background-color:ghostWhite !important;border:1px solid #dedede !important;color:#444 !important; font-size:90%!important;
69
+ padding:0 0.2em !important}
65
70
 
66
71
  .markview pre.console{background-color:#000;color:white;font-size:90%;line-height:1.5em;margin:0 0 1em;padding:0.5em}
67
72
  .markview pre.console code{background-color:#000;border:medium none;color:#fff;font-size:100%;padding:0}
68
73
  .markview pre.console span{color:#888}
69
- .markview pre.console span.command{color:yellow};
74
+ .markview pre.console span.command{color:yellow};
data/test/render_test.rb CHANGED
@@ -1,31 +1,28 @@
1
- require 'contest'
2
- require 'vegas'
3
- require 'markview'
1
+ require 'test/test_helper'
4
2
 
5
- class RenderTest < Test::Unit::TestCase
3
+ class RenderTest
6
4
 
7
5
  test "renders given file" do
8
- ARGV[0] = 'README.md'
9
- assert_equal GitHub::Markup.render(ARGV[0], File.read(ARGV[0])), Markview::Application.markdown_me
6
+ assert_equal GitHub::Markup.render(@argv, File.read(@argv)),
7
+ Markview::Application.markview_me
10
8
  end
11
-
9
+
12
10
  test "renders discovered file" do
13
- ARGV[0] = Dir.glob("README*")[0]
14
- assert_equal GitHub::Markup.render(ARGV[0], File.read(ARGV[0])), Markview::Application.markdown_me
11
+ discover_file
12
+ assert_equal GitHub::Markup.render(@argv, File.read(@argv)),
13
+ Markview::Application.markview_me
15
14
  end
16
-
15
+
17
16
  test "no markdown file given or found raises error" do
18
- ARGV[0] = "bad_file_name"
17
+ bad_file
19
18
  assert_raises LoadError do
20
- Markview::Application.markdown_me
19
+ Markview::Application.markview_me
21
20
  end
22
21
  end
23
22
 
24
- test "Vegas runs application" do
25
- pid = fork { Vegas::Runner.new(Markview::Application, 'markview', :foreground => true, :skip_launch => true, :debug => true) }
26
- sleep(1)
27
- Process.detach(pid)
28
- Process.kill( 'HUP', pid)
23
+ test "on GET to root" do
24
+ get "/"
25
+ should_respond_with_success
29
26
  end
30
-
27
+
31
28
  end
@@ -0,0 +1,28 @@
1
+ $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__)) + '/../lib'
2
+ require File.dirname(File.expand_path(__FILE__)) + '/../lib/markview.rb'
3
+ require 'contest'
4
+ require 'rack/test'
5
+
6
+ class RenderTest < Test::Unit::TestCase
7
+ include Rack::Test::Methods
8
+
9
+ def app
10
+ Markview::Application.new
11
+ end
12
+
13
+ def should_respond_with_success
14
+ assert last_response.ok?
15
+ end
16
+
17
+ def setup
18
+ @argv = ARGV[0] = 'README.md'
19
+ end
20
+
21
+ def discover_file
22
+ @argv = ARGV[0] = Dir.glob("README*")[0]
23
+ end
24
+
25
+ def bad_file
26
+ @argv = ARGV[0] = "bad_file_name"
27
+ end
28
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 3
9
- version: 0.2.3
8
+ - 4
9
+ version: 0.2.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Sands
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-27 00:00:00 -05:00
17
+ date: 2010-03-31 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -101,6 +101,20 @@ dependencies:
101
101
  version: 0.7.0
102
102
  type: :development
103
103
  version_requirements: *id006
104
+ - !ruby/object:Gem::Dependency
105
+ name: rack-test
106
+ prerelease: false
107
+ requirement: &id007 !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ segments:
112
+ - 0
113
+ - 5
114
+ - 3
115
+ version: 0.5.3
116
+ type: :development
117
+ version_requirements: *id007
104
118
  description: Conveniently launches practically any markup formatted files in a browser, rendering on the fly.
105
119
  email: marksands07@gmail.com
106
120
  executables:
@@ -115,6 +129,7 @@ files:
115
129
  - lib/markview/public/style.css
116
130
  - lib/markview/views/base.erb
117
131
  - README.md
132
+ - test/test_helper.rb
118
133
  - test/render_test.rb
119
134
  has_rdoc: true
120
135
  homepage: http://github.com/marksands/markview
@@ -147,4 +162,5 @@ signing_key:
147
162
  specification_version: 3
148
163
  summary: A markup viewer that renders on the fly.
149
164
  test_files:
165
+ - test/test_helper.rb
150
166
  - test/render_test.rb