viewmd 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3444da61b127641f4673be0fdc72ad9f57b63914
4
+ data.tar.gz: 3087b5294d9b83cf39e158eb08122b7d8ed19a40
5
+ SHA512:
6
+ metadata.gz: 23d7a657f5bf47924a98a34351b3d63d39d71035ab08e09992672e47f8cce14ff4a1e4e0c372b1f9495870e79a0f7b726e6fe6392d45a45982fb54dff4b95dd9
7
+ data.tar.gz: 50444cc0fcfad27692da5477171bb3d1bd600d90694cb2db305c6ec14fc9ce5a17208d622e43ff109759e66ffb152002844067a48b7c3139f3374cfabab0e7ad
data/.gitignore ADDED
@@ -0,0 +1,25 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .env
7
+ .rspec
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.bundle
21
+ *.so
22
+ *.o
23
+ *.a
24
+ mkmf.log
25
+ **/.DS_Store
data/CONTRIBUTORS.md ADDED
@@ -0,0 +1 @@
1
+ * Andrey Pronin <moonfly.msk@gmail.com> aka moonfly (https://github.com/moonfly)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in viewmd.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2014 [CONTRIBUTORS.md](https://github.com/moonfly/viewmd/master/CONTRIBUTORS.md)
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,56 @@
1
+ # Viewmd
2
+
3
+ Viewmd is a command line tool for viewing your Markdown files (e.g. README.md) in your local browser. Uses GitHub Markup parser, so the result should look very close to what you'd see on Github if you put the file there.
4
+
5
+ I guess, we all hate committing files with bugs. In case of Markdown files, like README.md, it's possible to make some little mistake while editing the file (e.g. forget the trailing triple-backticks) and end up with an incorrectly formatted file checked in to your repository. Seeing it only on GitHub already, for example, and having to do another little fix & commit just to fix this little formatting mistake seens like an untidy process to me. Thus I created this really simple command-line tool to see how the file would look like *before* committing.
6
+
7
+ It's really simple and doesn't try to catch all errors (e.g. trying to open a non-existent file).
8
+
9
+ Please note that I tested it on MacOS only. If you use other OS in your development environment, it may not work. It actually uses [Launchy](https://github.com/copiousfreetime/launchy) for opening files, so it will all depend on Launchy's support for your OS.
10
+
11
+ ## Installation
12
+
13
+ If you prefer managing your tools through your application's Gemfile, add this line there:
14
+
15
+ ```ruby
16
+ gem 'viewmd', group: :development, require: false
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or, better yet, as with all generic dev-tools, install the gem yourself environment-wide as:
24
+
25
+ $ gem install viewmd
26
+
27
+ ## Usage
28
+
29
+ $ viewmd <filename>
30
+
31
+ ## Versioning
32
+
33
+ Semantic versioning (http://semver.org/spec/v2.0.0.html) is used.
34
+
35
+ For a version number MAJOR.MINOR.PATCH, unless MAJOR is 0:
36
+
37
+ 1. MAJOR version is incremented when incompatible API changes are made,
38
+ 2. MINOR version is incremented when functionality is added in a backwards-compatible manner,
39
+ 3. PATCH version is incremented when backwards-compatible bug fixes are made.
40
+
41
+ Major version "zero" (0.y.z) is for initial development. Anything may change at any time.
42
+ The public API should not be considered stable.
43
+
44
+ ## Dependencies
45
+
46
+ * [github-markup](https://github.com/github/markup)
47
+ * [redcarpet](https://github.com/vmg/redcarpet)
48
+ * [launchy](https://github.com/copiousfreetime/launchy)
49
+
50
+ ## Contributing
51
+
52
+ 1. Fork it ( https://github.com/moonfly/viewmd/fork )
53
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
54
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
55
+ 4. Push to the branch (`git push origin my-new-feature`)
56
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
data/bin/viewmd ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'viewmd'
3
+
4
+ if ARGV.count == 1 && File.exists?(ARGV.first)
5
+ Viewmd::view(ARGV.first)
6
+ else
7
+ puts "Viewmd (ver #{Viewmd::VERSION}): view Markdown (GitHub Markup) file in a browser"
8
+ puts " Usage: viewmd <md-file>"
9
+ end
data/lib/viewmd.rb ADDED
@@ -0,0 +1,17 @@
1
+ require 'viewmd/version'
2
+ require 'github/markup'
3
+ require 'launchy'
4
+ require 'tempfile'
5
+
6
+ module Viewmd
7
+ def self.view(name)
8
+ Tempfile.create(['viewmd','.htm'],Dir.tmpdir,File::CREAT|File::TRUNC|File::RDWR, 0600) do |f|
9
+ f << GitHub::Markup.render(name, File.read(name))
10
+ f.flush
11
+ Launchy.open(f.path)
12
+ # joining the launchy thread doesn't help to wait for browser to close before deleting the file
13
+ # so, let's just wait a little
14
+ sleep 2
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Viewmd
2
+ VERSION = "0.1.0"
3
+ end
data/viewmd.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'viewmd/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "viewmd"
8
+ spec.version = Viewmd::VERSION
9
+ spec.authors = ['moonfly (Andrey Pronin)']
10
+ spec.email = ['moonfly.msk@gmail.com']
11
+ spec.summary = %q{Command line tool for viewing Markdown files (GitHub Markup) in a browser}
12
+ spec.description = %q{Command line tool for viewing Markdown files (GitHub Markup) in a browser}
13
+ spec.homepage = 'https://github.com/moonfly/viewmd'
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
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.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.rdoc_options = ['--charset=UTF-8']
26
+ spec.extra_rdoc_files = %w[README.md CONTRIBUTORS.md LICENSE.md]
27
+
28
+ spec.add_dependency 'github-markup', '>= 1.3'
29
+ spec.add_dependency 'launchy', '>= 2.4'
30
+ spec.add_dependency 'redcarpet', '>= 3.1'
31
+
32
+ spec.add_development_dependency "bundler", ">= 1.6"
33
+ spec.add_development_dependency "rake"
34
+ spec.add_development_dependency 'rspec', '~> 3.0'
35
+ spec.add_development_dependency 'coveralls'
36
+ end
metadata ADDED
@@ -0,0 +1,157 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: viewmd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - moonfly (Andrey Pronin)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: github-markup
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :runtime
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: launchy
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2.4'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2.4'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Command line tool for viewing Markdown files (GitHub Markup) in a browser
112
+ email:
113
+ - moonfly.msk@gmail.com
114
+ executables:
115
+ - viewmd
116
+ extensions: []
117
+ extra_rdoc_files:
118
+ - README.md
119
+ - CONTRIBUTORS.md
120
+ - LICENSE.md
121
+ files:
122
+ - ".gitignore"
123
+ - CONTRIBUTORS.md
124
+ - Gemfile
125
+ - LICENSE.md
126
+ - README.md
127
+ - Rakefile
128
+ - bin/viewmd
129
+ - lib/viewmd.rb
130
+ - lib/viewmd/version.rb
131
+ - viewmd.gemspec
132
+ homepage: https://github.com/moonfly/viewmd
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options:
138
+ - "--charset=UTF-8"
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.2.2
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: Command line tool for viewing Markdown files (GitHub Markup) in a browser
157
+ test_files: []