hubdown 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 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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hubdown.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 jsk
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,55 @@
1
+ # Hubdown
2
+
3
+ Hubdown is a ruby CLI for use as a replacement for `markdown`. It supports [GitHub flavored markdown](http://github.github.com/github-flavored-markdown/) syntax, and can style it's output to closely approximate that of GitHub as seen in project README.md files.
4
+
5
+ ## Installation
6
+
7
+ To install `hubdown` run:
8
+
9
+ ```bash
10
+ $ gem install hubdown
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ There are essentially 3 options when using `hubdown`.
16
+
17
+ * Printing to STDOUT
18
+ * Writing to a file
19
+ * Previewing in browser
20
+
21
+ ***
22
+ ### Printing to STDOUT
23
+
24
+ To convert github flavored markdown to html simply execute hubdown and pass it a valid markdown file:
25
+
26
+ ```bash
27
+ $ hubdown my_file.md
28
+ ```
29
+
30
+ Doing so will send converted markdown to standard output allowing you to pipe the file as you wish.
31
+ ***
32
+ ### Writing to a file
33
+
34
+ ```bash
35
+ $ hubdown my_file.md -o my_file.html
36
+ ```
37
+
38
+ When passing the `-o` flag with a file name, hubdown will write the usual output (html) to the file you pass with `-o`.
39
+ ***
40
+ ### Previewing in browser
41
+
42
+ ```bash
43
+ $ hubdown file.md -p
44
+ ```
45
+
46
+ When passing the `-p` flag hubdown will pass the output (as though it generated a file) to your default web browser for previewing.
47
+ ***
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/hubdown.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hubdown/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "hubdown"
8
+ gem.version = Hubdown::VERSION
9
+ gem.authors = ["jsk"]
10
+ gem.email = ["knomedia@gmail.com"]
11
+ gem.description = %q{CLI for GitHub Flavored markdown to html convervsion}
12
+ gem.summary = %q{CLI for GitHub Flavored markdown to html conversion}
13
+ gem.homepage = "https://github.com/knomedia/hubdown"
14
+
15
+ gem.add_dependency 'github-markdown'
16
+ gem.add_dependency 'mixlib-cli'
17
+ gem.add_dependency 'paint'
18
+
19
+ gem.files = `git ls-files`.split($/)
20
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
21
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
22
+ gem.require_paths = ["lib"]
23
+ end
@@ -0,0 +1,3 @@
1
+ module Hubdown
2
+ VERSION = "0.0.1"
3
+ end
data/lib/hubdown.rb ADDED
@@ -0,0 +1,60 @@
1
+ require 'hubdown/version'
2
+ require 'github/markdown'
3
+
4
+ module Hubdown
5
+ # Your code goes here...
6
+ end
7
+
8
+ file_name = ARGV[0]
9
+ #output_file_name = ARGV[1] ||"#{file_name.split('.')[0]}.html"
10
+ output_file_name = ARGV[1]
11
+
12
+ css_links = [];
13
+ css_links << "https://a248.e.akamai.net/assets.github.com/assets/github-8dd5c1a834790ecb6b900ff7b2d9a1377fd5aef1.css"
14
+ css_links << "https://a248.e.akamai.net/assets.github.com/assets/github2-4591451faf42b997173d752065f048736e6f9872.css"
15
+
16
+ opening = <<EOF
17
+ <!DOCTYPE html>
18
+ <html>
19
+ <head>
20
+ <title>#{output_file_name}</title>
21
+ <link href="https://a248.e.akamai.net/assets.github.com/assets/github-8dd5c1a834790ecb6b900ff7b2d9a1377fd5aef1.css" media="screen" rel="stylesheet" type="text/css" />
22
+ <link href="https://a248.e.akamai.net/assets.github.com/assets/github2-4591451faf42b997173d752065f048736e6f9872.css" media="screen" rel="stylesheet" type="text/css" />
23
+ <style>
24
+ #wrapper {
25
+ width: 920px;
26
+ margin: 20px auto;
27
+ }
28
+ </style>
29
+ </head>
30
+
31
+ <body>
32
+ <div id="wrapper">
33
+ <div id="slider">
34
+ <div class="frames">
35
+ <div class="frame">
36
+ <div id="readme" class="clearfix announce instapaper_body md">
37
+ <span class="name">#{file_name}</span>
38
+ <article class="markdown-body entry-content">
39
+ EOF
40
+
41
+ closing = <<EOF
42
+ </article>
43
+ </div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </body>
49
+ </html>
50
+ EOF
51
+
52
+ readme = GitHub::Markdown.render_gfm File.read(file_name)
53
+ file_contents = "#{opening}#{readme}#{closing}"
54
+
55
+ if (output_file_name)
56
+ File.open( output_file_name, "w") { |f| f.write file_contents }
57
+ puts "... created: #{output_file_name}"
58
+ else
59
+ puts file_contents
60
+ end
metadata ADDED
@@ -0,0 +1,101 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hubdown
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - jsk
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-24 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: github-markdown
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: mixlib-cli
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: paint
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
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
+ description: CLI for GitHub Flavored markdown to html convervsion
63
+ email:
64
+ - knomedia@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - hubdown.gemspec
75
+ - lib/hubdown.rb
76
+ - lib/hubdown/version.rb
77
+ homepage: https://github.com/knomedia/hubdown
78
+ licenses: []
79
+ post_install_message:
80
+ rdoc_options: []
81
+ require_paths:
82
+ - lib
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ! '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 1.8.24
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: CLI for GitHub Flavored markdown to html conversion
101
+ test_files: []