github-markdown-server 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/Makefile +8 -0
- data/README.md +0 -12
- data/contrib/github-markdown-server.el +20 -16
- data/github-markdown-server.gemspec +3 -1
- data/lib/github-markdown-server/version.rb +1 -1
- metadata +31 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46d8212844c1e26c454a1dbc177e856314d4faea
|
4
|
+
data.tar.gz: ac77d98c994fc316b248d501ecce112c7e50d4f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8467a29d2a597c14aaa255f84f58bada09f62f903b2abe8968abe3aca9b7c377f891813cda89a51e3eb2801bf837bb284e94555e668e9146f0919e321ce69edd
|
7
|
+
data.tar.gz: f2b06d12b46c7fcb17221df5aac8e770ae748252cfb98aad512cbb3888a0879f54f462f79f099bc72c9358bd5e025b90e05addb6a9c810bc663b33246582de0f
|
data/.travis.yml
CHANGED
data/Makefile
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
release: contrib/github-markdown-server.el
|
2
|
+
gem build github-markdown-server.gemspec
|
3
|
+
export VERSION=$(shell ./bin/github-markdown-server --version | cut -d ' ' -f 3); \
|
4
|
+
gem install github-markdown-server-$$VERSION.gem; \
|
5
|
+
gem push github-markdown-server-$$VERSION.gem
|
6
|
+
|
7
|
+
contrib/github-markdown-server.el: ~/Library/emacs/lisp/github-markdown-server.el
|
8
|
+
\cp -fv $< $@
|
data/README.md
CHANGED
@@ -35,15 +35,3 @@ There is a [contrib](contrib/) directory with an emacs lisp file which will star
|
|
35
35
|
## Contributing
|
36
36
|
|
37
37
|
Please feel free to send me pull requests! This is my first Ruby project and it always feels like my first time when I write Emacs Lisp.
|
38
|
-
|
39
|
-
## Building
|
40
|
-
|
41
|
-
I keep forgetting how to do this...
|
42
|
-
|
43
|
-
```bash
|
44
|
-
VERSION=$(./bin/github-markdown-server --version | cut -d ' ' -f 3)
|
45
|
-
\cp -fv ~/Library/emacs/lisp/github-markdown-server.el ~/mysrc/github-markdown-server/contrib/github-markdown-server.el
|
46
|
-
gem build github-markdown-server.gemspec
|
47
|
-
gem install github-markdown-server-$VERSION.gem
|
48
|
-
gem push github-markdown-server-$VERSION.gem
|
49
|
-
```
|
@@ -13,6 +13,8 @@
|
|
13
13
|
|
14
14
|
(require 'cl-lib)
|
15
15
|
|
16
|
+
(autoload 'rvm-use-default "rvm" nil t)
|
17
|
+
|
16
18
|
(defvar github-markdown-servers '() "The servers we have running.")
|
17
19
|
(defvar github-markdown-server-port 7494 "The next available server port.")
|
18
20
|
|
@@ -30,6 +32,8 @@
|
|
30
32
|
|
31
33
|
(defun github-markdown-server-start (directory port file-name)
|
32
34
|
"Start a github-markdown-server for DIRECTORY on PORT and open FILE-NAME."
|
35
|
+
(rvm-use-default)
|
36
|
+
(setenv "LANG" "en_US.UTF-8")
|
33
37
|
(let ((cmd (concat
|
34
38
|
"github-markdown-server"
|
35
39
|
" --directory=" (shell-quote-argument directory)
|
@@ -66,7 +70,7 @@ START-COMMAND the command to start a server."
|
|
66
70
|
(concat "lsof -n -i4TCP:" (number-to-string (cdr server)) " | grep LISTEN")))
|
67
71
|
(> (length server-running) 0)))
|
68
72
|
(progn
|
69
|
-
(message "reusing server")
|
73
|
+
(message (concat "reusing server" (prin1-to-string (funcall path-name-fixer file-name (substring file-name (length (car server)))))))
|
70
74
|
(call-process-shell-command
|
71
75
|
(concat "open "
|
72
76
|
(shell-quote-argument
|
@@ -96,19 +100,20 @@ START-COMMAND the command to start a server."
|
|
96
100
|
(with-temp-buffer
|
97
101
|
(insert-file-contents file-name)
|
98
102
|
(goto-char (point-min))
|
99
|
-
(
|
100
|
-
(
|
101
|
-
(
|
102
|
-
|
103
|
-
(
|
104
|
-
(
|
105
|
-
|
106
|
-
(
|
103
|
+
(let ((start (search-forward-regexp "^---" 6 't)))
|
104
|
+
(if (and start (= start 4))
|
105
|
+
(progn
|
106
|
+
(goto-char (+ (point-min) 3))
|
107
|
+
(if (search-forward-regexp "^---" (point-max) 't)
|
108
|
+
(let ((bound (point)))
|
109
|
+
(goto-char (point-min))
|
110
|
+
(if (search-forward-regexp "^permalink: \\(.*\\)$" bound 't)
|
111
|
+
(setq path-name (match-string 1))))))))))
|
107
112
|
path-name)
|
108
113
|
|
109
114
|
(defun jekyll-fix-path-name (file-name path-name)
|
110
115
|
"Work out the pathname that FILE-NAME will be served at (PATH-NAME is our best guess right now)."
|
111
|
-
(setq path-name (
|
116
|
+
(setq path-name (file-name-sans-extension path-name))
|
112
117
|
(jekyll-get-permalink-from-file file-name
|
113
118
|
(cond
|
114
119
|
((string-match "^/_posts/\\([0-9][0-9][0-9][0-9]\\)-\\([0-9][0-9]\\)-[0-9][0-9]-\\(.*\\)" path-name)
|
@@ -118,7 +123,6 @@ START-COMMAND the command to start a server."
|
|
118
123
|
|
119
124
|
(defun jekyll-server-start (directory port file-name)
|
120
125
|
"Start a Jekyll server for DIRECTORY on PORT and open FILE-NAME."
|
121
|
-
(require 'rvm)
|
122
126
|
(rvm-use-default)
|
123
127
|
(let* (
|
124
128
|
(url (concat "http://localhost:" (number-to-string port)
|
@@ -170,12 +174,12 @@ Prefix arg \[universal-argument] to not run local server and open on github or v
|
|
170
174
|
"$p = `git -C $d rev-parse --show-prefix`; "
|
171
175
|
"chomp($o, $p); "
|
172
176
|
"if ($o) { print \"$o/blob/master/$p$b\"; } else { print \"file://$f\" }' "
|
173
|
-
(shell-quote-argument (buffer-file-name)) ")
|
177
|
+
(shell-quote-argument (buffer-file-name)) ")"
|
174
178
|
(if (region-active-p)
|
175
|
-
(concat
|
176
|
-
(number-to-string (line-number-at-pos (region-beginning))) "-"
|
177
|
-
(number-to-string (line-number-at-pos (region-end))))
|
178
|
-
(number-to-string (line-number-at-pos)))
|
179
|
+
(concat "#L"
|
180
|
+
(number-to-string (line-number-at-pos (region-beginning))) "-L"
|
181
|
+
(number-to-string (line-number-at-pos (- (region-end) 1) )))
|
182
|
+
(if (> (line-number-at-pos) 1) (concat "#L" (number-to-string (line-number-at-pos))) ""))
|
179
183
|
"\"")
|
180
184
|
nil 0))))
|
181
185
|
|
@@ -12,7 +12,9 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.description = %q{Runs a webserver to preview Github markdown with live.js updating.}
|
13
13
|
s.license = 'MIT'
|
14
14
|
|
15
|
-
s.add_dependency 'github-markdown-preview', '~>
|
15
|
+
s.add_dependency 'github-markdown-preview', '~> 4.0'
|
16
|
+
s.add_dependency 'github-linguist', '~> 3.3'
|
17
|
+
s.add_dependency 'rugged', '~> 0.23'
|
16
18
|
|
17
19
|
s.add_development_dependency 'minitest', '~> 5.4'
|
18
20
|
s.add_development_dependency 'bundler', '~> 1.7'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markdown-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex K (wtwf.com)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github-markdown-preview
|
@@ -16,20 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: github-linguist
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
21
32
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
33
|
+
version: '3.3'
|
23
34
|
type: :runtime
|
24
35
|
prerelease: false
|
25
36
|
version_requirements: !ruby/object:Gem::Requirement
|
26
37
|
requirements:
|
27
38
|
- - "~>"
|
28
39
|
- !ruby/object:Gem::Version
|
29
|
-
version: '3.
|
30
|
-
|
40
|
+
version: '3.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rugged
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.23'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
31
53
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
54
|
+
version: '0.23'
|
33
55
|
- !ruby/object:Gem::Dependency
|
34
56
|
name: minitest
|
35
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +105,7 @@ files:
|
|
83
105
|
- ".travis.yml"
|
84
106
|
- Gemfile
|
85
107
|
- LICENSE
|
108
|
+
- Makefile
|
86
109
|
- README.md
|
87
110
|
- Rakefile
|
88
111
|
- bin/github-markdown-server
|