yield 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/bin/yield +12 -0
- data/lib/views/index.erb +17 -0
- data/lib/yield.rb +60 -0
- data/lib/yield/version.rb +3 -0
- data/yield.gemspec +28 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6779454982def8d7e9e59ddd32d340746ac0c8c0
|
4
|
+
data.tar.gz: b40db3d3a1555d852e8d61294a1ef3d0e7593861
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7b72d62f361fec83f5c67f51f8ee68bd0ac975abe52f316f27a77c4fc094c53351519a4d830e394912a9230a5b5eb5c59c3806ee6e2baaa94d5ac4391983ce92
|
7
|
+
data.tar.gz: 69d91e56b8f12615454ffacec4be62ef72a2e333069adca31b452a2807f1504e3c427176165669cdeedab27b3334840d9516e2b82d5280d06929a1596b631b3c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Casey Scarborough
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Yield
|
2
|
+
|
3
|
+
Yield is a command line utility that generates a preview of README.md and markdown files using GitHub Flavored Markdown
|
4
|
+
in your browser.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
### Dependencies
|
9
|
+
|
10
|
+
* [sinatra](http://sinatrarb.com)
|
11
|
+
* [octokit](http://octokit.github.io)
|
12
|
+
|
13
|
+
Install the gem by issuing the following command:
|
14
|
+
|
15
|
+
```bash
|
16
|
+
$ gem install yield
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
From the root of your project, or any folder containing a README.md file, run the following command:
|
22
|
+
|
23
|
+
```bash
|
24
|
+
$ yield
|
25
|
+
-> yield is now serving your markdown at localhost:4567 using Thin...
|
26
|
+
```
|
27
|
+
|
28
|
+
You may also specify a path to a markdown file you'd like to render, such as:
|
29
|
+
|
30
|
+
```bash
|
31
|
+
$ yield UPDATES.md
|
32
|
+
```
|
33
|
+
|
34
|
+
Then navigate to [localhost:4567](http://localhost:4567) in your browser to view the preview of the file.
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/yield
ADDED
data/lib/views/index.erb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<link rel="stylesheet" href="https://github.global.ssl.fastly.net/assets/github-c6ca95663cba6496fe7a5bdd98671b82cd956df3.css" />
|
4
|
+
<link rel="stylesheet" href="https://github.global.ssl.fastly.net/assets/github2-71386ba60dc4794e755db985b31f4dfc74dcd99d.css" />
|
5
|
+
<style>.page {margin:30px auto;width:920px;}</style>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div class="page">
|
9
|
+
<div id="readme" class="clearfix announce instapaper_body md">
|
10
|
+
<span class="name"><span class="octicon octicon-book"></span> <%= filename %></span>
|
11
|
+
<article class="markdown-body entry-content">
|
12
|
+
<%= content %>
|
13
|
+
</article>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</body>
|
17
|
+
</html>
|
data/lib/yield.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
require "sinatra"
|
2
|
+
require "octokit"
|
3
|
+
require_relative "yield/version"
|
4
|
+
|
5
|
+
|
6
|
+
module Yield
|
7
|
+
|
8
|
+
class Markdown < Sinatra::Base
|
9
|
+
|
10
|
+
disable :logging, :dump_errors
|
11
|
+
@@content = nil
|
12
|
+
@@filename = nil
|
13
|
+
|
14
|
+
# Override run! method from Sinatra
|
15
|
+
def self.run!(options = {})
|
16
|
+
set options
|
17
|
+
handler = detect_rack_handler
|
18
|
+
handler_name = handler.name.gsub(/.*::/, '')
|
19
|
+
server_settings = settings.respond_to?(:server_settings) ? settings.server_settings : {}
|
20
|
+
handler.run self, server_settings.merge(:Port => port, :Host => bind) do |server|
|
21
|
+
unless handler_name =~ /cgi/i
|
22
|
+
$stderr.puts "-> yield is now serving your markdown " +
|
23
|
+
"at localhost:#{port} using #{handler_name}..."
|
24
|
+
end
|
25
|
+
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
|
26
|
+
server.threaded = settings.threaded if server.respond_to? :threaded=
|
27
|
+
set :running, true
|
28
|
+
yield server if block_given?
|
29
|
+
end
|
30
|
+
rescue Errno::EADDRINUSE
|
31
|
+
$stderr.puts "-> Port #{port} is already being used!"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Override quit! method from Sinatra
|
35
|
+
def self.quit!(server, handler_name)
|
36
|
+
# Use Thin's hard #stop! if available, otherwise just #stop.
|
37
|
+
server.respond_to?(:stop!) ? server.stop! : server.stop
|
38
|
+
$stderr.puts "\n-> Stopping yield..." unless handler_name =~/cgi/i
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.render(filename = 'README.md')
|
42
|
+
original_stdout = $stdout
|
43
|
+
$stdout = fake = StringIO.new
|
44
|
+
|
45
|
+
@@filename = filename
|
46
|
+
begin
|
47
|
+
@@content = Octokit.markdown(File.read(@@filename), mode: 'gfm')
|
48
|
+
rescue Exception => e
|
49
|
+
puts "Filename '#{@@filename}' doesn't exist."
|
50
|
+
exit
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
get '/' do
|
55
|
+
erb :index, locals: { content: @@content, filename: @@filename }
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
data/yield.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'yield/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "yield"
|
8
|
+
spec.version = Yield::VERSION
|
9
|
+
spec.authors = ["Casey Scarborough"]
|
10
|
+
spec.email = ["caseyscarborough@gmail.com"]
|
11
|
+
spec.description = %q{A utility for previewing markdown files in GitHub Flavored Markdown.}
|
12
|
+
spec.summary = %q{Yield is a command line utility written in Ruby that allows a user to render
|
13
|
+
markdown files for previewing in a browser. It renders the markdown files using GitHub flavored
|
14
|
+
markdown at http://localhost:4567 using Sinatra.}
|
15
|
+
spec.homepage = ""
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
|
26
|
+
spec.add_dependency "sinatra"
|
27
|
+
spec.add_dependency "octokit"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yield
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Casey Scarborough
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sinatra
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octokit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A utility for previewing markdown files in GitHub Flavored Markdown.
|
70
|
+
email:
|
71
|
+
- caseyscarborough@gmail.com
|
72
|
+
executables:
|
73
|
+
- yield
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/yield
|
83
|
+
- lib/views/index.erb
|
84
|
+
- lib/yield.rb
|
85
|
+
- lib/yield/version.rb
|
86
|
+
- yield.gemspec
|
87
|
+
homepage: ''
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.0.5
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: Yield is a command line utility written in Ruby that allows a user to render
|
111
|
+
markdown files for previewing in a browser. It renders the markdown files using
|
112
|
+
GitHub flavored markdown at http://localhost:4567 using Sinatra.
|
113
|
+
test_files: []
|