readem 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # An amazing tool renders readmes in realtime
2
+
3
+ Assuming I have all my projects in the ~/Projects directory, we can
4
+ start a web server on port 4567 which renders a list of projects which have a README.
5
+
6
+ When I want to serve up all my readmes, I enter this at the terminal:
7
+
8
+ gem install readem
9
+ readem
10
+
11
+ Then my browser will automagically open the URL http://localhost:1337/
12
+ and view a list of links to projects.
13
+
14
+ When I click one of the links, the readme for that repository is
15
+ displayed. Then it reloads the readme every 3 seconds after I stop
16
+ editing, so I can view my changes in "realtime".
17
+
18
+ ## Implementation notes
19
+
20
+ Rendering markdown: use the Makeup gem.
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+ ## Implementation notes
52
+
53
+ ### Directories with readmes
54
+ require "pathname"
55
+ readmes = Pathname.glob("/home/marius/Projects/*/README.md")
56
+ readme_dirs = readmes.map(&:dirname)
57
+ local_dirnames = readme_dirs.map(&:dirname)
58
+
59
+ ### Mark up Markdown
60
+
61
+ There's this thing called Makeup. How does it work? Use the
62
+ [README](http://gitorious.org/gitorious/makeup), stupid.
63
+
64
+ require "makeup/markup"
65
+ first_readme = readmes.first
66
+ first_readme = Makeup::Markup.new.render(first_readme.basename.to_s, first_readme.read)
67
+
68
+ - Sinatra
69
+ - List each readme
70
+ - get /project-name: render readme
71
+
72
+
73
+ ### Bootstrap boilerplate
74
+ <!DOCTYPE html>
75
+ <html>
76
+ <head>
77
+ <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
78
+ <title>Zomg</title>
79
+ </head>
80
+ <body>
81
+ <div class="container">
82
+ <h1>Amazing</h1>
83
+ <code>Oh</code>
84
+ </div>
85
+ </body>
86
+ </html>
data/bin/readem ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # mode: ruby
3
+
4
+ require "sinatra"
5
+ require "pathname"
6
+ require "makeup/markup"
7
+ require "readem/version"
8
+
9
+ set :bind, "0.0.0.0"
10
+ set :port, 1337
11
+ set :root, File.expand_path(File.dirname(__FILE__) + "/../")
12
+ set :run, true
13
+
14
+ get "/" do
15
+ readmes = Pathname.glob("/home/marius/Projects/*/README.md")
16
+ readme_dirs = readmes.map(&:dirname)
17
+ @local_dirnames = readme_dirs.map {|dir| dir.to_s.split("/").last}
18
+ erb :index
19
+ end
20
+
21
+ get "/:dir" do
22
+ readme = Pathname("/home/marius/Projects/#{params[:dir]}/README.md")
23
+ readme_data = readme.read
24
+ @markup = Makeup::Markup.new.render("README.md", readme_data)
25
+ erb :readme
26
+ end
@@ -0,0 +1,3 @@
1
+ module Readem
2
+ VERSION = "0.1.1"
3
+ end
data/readem.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'readem/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "readem"
8
+ spec.version = Readem::VERSION
9
+ spec.authors = ["Marius Mathiesen"]
10
+ spec.email = ["marius.mathiesen@gmail.com"]
11
+ spec.description = %q{Serve the READMEs in your ~/Projects in a web browser}
12
+ spec.summary = %q{Run it, and see all your READMEs.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "makeup", "~> 0.4"
22
+ spec.add_dependency "sinatra", "~> 1.4"
23
+ spec.add_dependency "redcarpet", "~> 2.3"
24
+
25
+ spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "rake"
27
+ end
data/views/index.erb ADDED
@@ -0,0 +1,9 @@
1
+ <h1>All your READMEs are now belong to us</h1>
2
+ <ul>
3
+ <% for dir in @local_dirnames do %>
4
+ <li><a href="/<%= dir %>"><%= dir %></a></li>
5
+ <% end %>
6
+ </ul>
7
+
8
+
9
+ <p>Served by readem <%= Readem::VERSION %></p>
data/views/layout.erb ADDED
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
5
+ <title>Zomg</title>
6
+ </head>
7
+ <body>
8
+ <div class="container">
9
+ <%= yield %>
10
+ </div>
11
+ </body>
12
+ </html>
data/views/readme.erb ADDED
@@ -0,0 +1 @@
1
+ <%= @markup %>
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: readem
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.1
6
+ platform: ruby
7
+ authors:
8
+ - Marius Mathiesen
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-13 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ type: :runtime
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.4'
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '0.4'
29
+ name: makeup
30
+ - !ruby/object:Gem::Dependency
31
+ type: :runtime
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '1.4'
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: '1.4'
45
+ name: sinatra
46
+ - !ruby/object:Gem::Dependency
47
+ type: :runtime
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '2.3'
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '2.3'
61
+ name: redcarpet
62
+ - !ruby/object:Gem::Dependency
63
+ type: :development
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ prerelease: false
71
+ version_requirements: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '1.3'
77
+ name: bundler
78
+ - !ruby/object:Gem::Dependency
79
+ type: :development
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ prerelease: false
87
+ version_requirements: !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ! '>='
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ name: rake
94
+ description: Serve the READMEs in your ~/Projects in a web browser
95
+ email:
96
+ - marius.mathiesen@gmail.com
97
+ executables:
98
+ - readem
99
+ extensions: []
100
+ extra_rdoc_files: []
101
+ files:
102
+ - .gitignore
103
+ - Gemfile
104
+ - README.md
105
+ - bin/readem
106
+ - lib/readem/version.rb
107
+ - readem.gemspec
108
+ - views/index.erb
109
+ - views/layout.erb
110
+ - views/readme.erb
111
+ homepage: ''
112
+ licenses:
113
+ - MIT
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ none: false
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
124
+ required_rubygems_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ requirements: []
131
+ rubyforge_project:
132
+ rubygems_version: 1.8.24
133
+ signing_key:
134
+ specification_version: 3
135
+ summary: Run it, and see all your READMEs.
136
+ test_files: []