documentify 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/documentify +7 -0
  2. data/lib/documentify.rb +42 -0
  3. metadata +48 -0
data/bin/documentify ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #$LOAD_PATH << File.dirname(__FILE__) + '/../lib'
4
+
5
+ require 'documentify'
6
+
7
+ Documentify.from_cli(ARGV)
@@ -0,0 +1,42 @@
1
+ require 'optparse'
2
+
3
+ module Documentify
4
+ VERSION = '0.1.1'
5
+
6
+ def self.wrap(content)
7
+ <<END_DOC
8
+ <html>
9
+ <head></head>
10
+ <body>
11
+ #{content}
12
+ </body>
13
+ </html>
14
+ END_DOC
15
+ end
16
+
17
+ def self.from_cli(argv)
18
+ opt = OptionParser.new do |opts|
19
+ opts.banner = "Usage: documentify [options] [content.html]"
20
+ opts.on_tail '-h', '--help', 'Show this message' do
21
+ puts opts
22
+ exit
23
+ end
24
+ end
25
+
26
+ begin
27
+ opt.parse! argv
28
+ rescue OptionParser::InvalidOption => e
29
+ $stderr.puts e
30
+ $stderr.puts opt
31
+ exit
32
+ end
33
+
34
+ if argv.empty? # from stdin
35
+ input = $stdin.read
36
+ else
37
+ input = File.read(ARGV.shift)
38
+ end
39
+
40
+ print self.wrap(input)
41
+ end
42
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: documentify
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Austin Hyde
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-12 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Documentify takes input from a file or stdin and wraps it in a proper
15
+ HTML document
16
+ email: austin109@gmail.com
17
+ executables:
18
+ - documentify
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - lib/documentify.rb
23
+ - bin/documentify
24
+ homepage: http://bitbucket.org/austinhyde/documentify
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.10
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: Wraps things in an HTML document
48
+ test_files: []