mdpress 0.0.2 → 0.0.3
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/bin/mdpress +17 -2
- metadata +17 -3
data/bin/mdpress
CHANGED
@@ -4,6 +4,8 @@ require 'redcarpet'
|
|
4
4
|
require 'fileutils'
|
5
5
|
require 'impress_renderer'
|
6
6
|
require 'trollop'
|
7
|
+
require 'tempfile'
|
8
|
+
require 'launchy'
|
7
9
|
|
8
10
|
def log(x)
|
9
11
|
puts "\033[94m" + x + "\033[0m"
|
@@ -21,6 +23,7 @@ EOS
|
|
21
23
|
opt :automatic, "Keeps running and automatically updates the presentation to reflect changes to markdown file."
|
22
24
|
opt :stylesheet, "Specify what stylesheet to use.", :default => "default"
|
23
25
|
opt :list, "List all available stylesheets."
|
26
|
+
opt :run, "Run presentation (automatically compiles to a tmp directory and opens in a browser window)"
|
24
27
|
end
|
25
28
|
|
26
29
|
if opts[:list]
|
@@ -72,10 +75,19 @@ unless File.exist?(STYLESHEET)
|
|
72
75
|
exit
|
73
76
|
end
|
74
77
|
|
75
|
-
|
78
|
+
if opts[:run]
|
79
|
+
file = ARGV[0]
|
80
|
+
tmp = Tempfile.new("mdpress")
|
81
|
+
tmp.write(File.read(file))
|
82
|
+
tmp.flush
|
83
|
+
FILENAME = tmp.path
|
84
|
+
DIRNAME = FILENAME + "_dir"
|
85
|
+
else
|
86
|
+
FILENAME = ARGV[0]
|
87
|
+
DIRNAME = File.basename(FILENAME, File.extname(FILENAME))
|
88
|
+
end
|
76
89
|
|
77
90
|
log "making directory"
|
78
|
-
DIRNAME = File.basename(FILENAME, File.extname(FILENAME))
|
79
91
|
Dir.mkdir(DIRNAME)
|
80
92
|
|
81
93
|
render
|
@@ -98,6 +110,9 @@ end
|
|
98
110
|
if opts[:automatic]
|
99
111
|
log "waiting for updates..."
|
100
112
|
auto
|
113
|
+
elsif opts[:run]
|
114
|
+
log "opening in browser."
|
115
|
+
Launchy.open(DIRNAME + "/index.html", :application => :browser)
|
101
116
|
else
|
102
117
|
log "done."
|
103
118
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdpress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Aditya Bhargava
|
@@ -46,6 +46,20 @@ dependencies:
|
|
46
46
|
version: "0"
|
47
47
|
type: :runtime
|
48
48
|
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: launchy
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :runtime
|
62
|
+
version_requirements: *id003
|
49
63
|
description: Build impress.js presentations from markdown files.
|
50
64
|
email: bluemangroupie@gmail.com
|
51
65
|
executables:
|