markyboot 0.0.1
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/.gitignore +26 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/markyboot +5 -0
- data/features/generating_html.feature +10 -0
- data/features/support/aruba.rb +1 -0
- data/lib/markyboot/cli.rb +26 -0
- data/lib/markyboot/version.rb +3 -0
- data/lib/markyboot.rb +57 -0
- data/markyboot.gemspec +25 -0
- data/spec/example.md +1 -0
- metadata +128 -0
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
18
|
+
vendor/ruby
|
19
|
+
|
20
|
+
bin/cucumber
|
21
|
+
bin/htmldiff
|
22
|
+
bin/ldiff
|
23
|
+
bin/rake2thor
|
24
|
+
bin/redcarpet
|
25
|
+
bin/thor
|
26
|
+
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Chris Moore
|
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,29 @@
|
|
1
|
+
# Markyboot
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'markyboot'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install markyboot
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/markyboot
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Generate an HTML document
|
2
|
+
|
3
|
+
Scenario: When no file is provided
|
4
|
+
When I run "markyboot preview"
|
5
|
+
Then the output should contain "No file"
|
6
|
+
|
7
|
+
Scenario: When a Markdown file is provided
|
8
|
+
When I run "markyboot preview ../../spec/example.md"
|
9
|
+
Then the output should contain "opened in browser"
|
10
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba/cucumber'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'markyboot'
|
3
|
+
|
4
|
+
module Markyboot
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
desc "preview FILE", "Convert a Markdown document and open it in the default browser."
|
8
|
+
def preview(file = nil)
|
9
|
+
raise "No file specified" if file.nil?
|
10
|
+
|
11
|
+
content = File.read(file)
|
12
|
+
html = Markyboot::Document.new(content).render
|
13
|
+
|
14
|
+
begin
|
15
|
+
preview = File.new('/tmp/preview.html', 'w')
|
16
|
+
preview.write html
|
17
|
+
system %Q{open #{preview.path}}
|
18
|
+
puts "#{preview.path} opened in browser."
|
19
|
+
ensure
|
20
|
+
preview.close
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/markyboot.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'redcarpet'
|
2
|
+
require "markyboot/version"
|
3
|
+
|
4
|
+
module Markyboot
|
5
|
+
|
6
|
+
class HTMLwithAlbino < Redcarpet::Render::HTML
|
7
|
+
end
|
8
|
+
|
9
|
+
class Document
|
10
|
+
attr_accessor :html
|
11
|
+
|
12
|
+
def initialize(contents)
|
13
|
+
marker = Redcarpet::Markdown.new(HTMLwithAlbino, :fenced_code_blocks => true)
|
14
|
+
@html = marker.render(contents)
|
15
|
+
end
|
16
|
+
|
17
|
+
def layout
|
18
|
+
layout = <<-HTML.gsub(/^ {6}/, '')
|
19
|
+
<!DOCTYPE html>
|
20
|
+
<html lang="en">
|
21
|
+
<head>
|
22
|
+
<title>Preview</title>
|
23
|
+
<meta charset="utf-8">
|
24
|
+
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" />
|
25
|
+
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.1/styles/zenburn.min.css" />
|
26
|
+
<style type="text/css">
|
27
|
+
body {
|
28
|
+
background-color: #eee;
|
29
|
+
}
|
30
|
+
.container {
|
31
|
+
background-color: #fff;
|
32
|
+
width: 650px;
|
33
|
+
margin: 2em auto;
|
34
|
+
padding: 2em;
|
35
|
+
}
|
36
|
+
pre code.ruby {
|
37
|
+
line-height: 1.45em;
|
38
|
+
}
|
39
|
+
</style>
|
40
|
+
</head>
|
41
|
+
<body>
|
42
|
+
<div class="container">
|
43
|
+
REPLACE_ME
|
44
|
+
</div>
|
45
|
+
<script src="http://yandex.st/highlightjs/6.1/highlight.min.js"></script>
|
46
|
+
<script>hljs.initHighlightingOnLoad();</script>
|
47
|
+
</body>
|
48
|
+
</html>
|
49
|
+
HTML
|
50
|
+
layout
|
51
|
+
end
|
52
|
+
|
53
|
+
def render
|
54
|
+
layout.gsub(/REPLACE_ME/, @html)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/markyboot.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'markyboot/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "markyboot"
|
8
|
+
gem.version = Markyboot::VERSION
|
9
|
+
gem.authors = ["Chris Moore"]
|
10
|
+
gem.email = ["cdmwebs@gmail.com"]
|
11
|
+
gem.description = %q{A quick gem to open a Markdown document in the default browser with some style applied.}
|
12
|
+
gem.summary = %q{Got some Markdown with code blocks you want to preview? Well, this is the gem for you!}
|
13
|
+
gem.homepage = "https://github.com/cdmwebs/markyboot"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'thor'
|
21
|
+
gem.add_dependency 'redcarpet'
|
22
|
+
|
23
|
+
gem.add_development_dependency "cucumber"
|
24
|
+
gem.add_development_dependency "aruba"
|
25
|
+
end
|
data/spec/example.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Hello world!
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: markyboot
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Moore
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-11-03 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: redcarpet
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: cucumber
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: aruba
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: A quick gem to open a Markdown document in the default browser with some
|
79
|
+
style applied.
|
80
|
+
email:
|
81
|
+
- cdmwebs@gmail.com
|
82
|
+
executables:
|
83
|
+
- markyboot
|
84
|
+
extensions: []
|
85
|
+
extra_rdoc_files: []
|
86
|
+
files:
|
87
|
+
- .gitignore
|
88
|
+
- Gemfile
|
89
|
+
- LICENSE.txt
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- bin/markyboot
|
93
|
+
- features/generating_html.feature
|
94
|
+
- features/support/aruba.rb
|
95
|
+
- lib/markyboot.rb
|
96
|
+
- lib/markyboot/cli.rb
|
97
|
+
- lib/markyboot/version.rb
|
98
|
+
- markyboot.gemspec
|
99
|
+
- spec/example.md
|
100
|
+
homepage: https://github.com/cdmwebs/markyboot
|
101
|
+
licenses: []
|
102
|
+
post_install_message:
|
103
|
+
rdoc_options: []
|
104
|
+
require_paths:
|
105
|
+
- lib
|
106
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ! '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 1.8.23
|
121
|
+
signing_key:
|
122
|
+
specification_version: 3
|
123
|
+
summary: Got some Markdown with code blocks you want to preview? Well, this is the
|
124
|
+
gem for you!
|
125
|
+
test_files:
|
126
|
+
- features/generating_html.feature
|
127
|
+
- features/support/aruba.rb
|
128
|
+
- spec/example.md
|