nwiki 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7af17cd8e23856566b6b26ecb8707f4190f23853
4
- data.tar.gz: e4faa98e3da4433c4e1ecef3f93722d338b6c775
3
+ metadata.gz: eecc56e810f75f0f06584f265493da16b84e3432
4
+ data.tar.gz: aed494a9edc8a9d8692acd2397cac1d343792887
5
5
  SHA512:
6
- metadata.gz: 3eef6e94029f5484876c9f4f629fad48d48d0f608d343c33424990ed1f403cb7a6f03842de8efa6b8fde3aa714a28d55f3090b6da5fde17e36eab4861f4c6221
7
- data.tar.gz: c744f19d0f7bc10b2bc35733c25dcee8ccbe7fff4b3fffd3c9c56c137926db59b05465cb8d61d8229cf965715ddd1636da626cc029d9781fda1f637be2662437
6
+ metadata.gz: d64aae30e4cf967ed2ad8364c54034668fb6a71497858777a1ff739ebe05b6058ce17fbb45b3b455783057e8f4e2db1a005e102c3a9545a0b078fc5912ce2740
7
+ data.tar.gz: 9dd7b40c8226ac1b86cc3d3c948d69bdf06dc4ca773939c73c1e9fc5b58bbffd4617bbd01a65297144be5c02f67057fd1dc0b122d71b7088d491fb640d84e7d7
data/CHANGELOG.org CHANGED
@@ -1,4 +1,8 @@
1
1
  * CHANGELOG
2
+ ** 0.1.8
3
+ - [feature] add git hook for writing commit message easily
4
+ - [feature] (elisp) sync org-filename with title
5
+ - [feature] (elisp) add and commit file to repository
2
6
  ** 0.1.7
3
7
  - [feature] works on Ruby2.1
4
8
  ** 0.1.6
@@ -0,0 +1,52 @@
1
+ ;; from "How do I rename an open file in Emacs?"
2
+ ;; http://stackoverflow.com/questions/384284/how-do-i-rename-an-open-file-in-emacs
3
+ (defun rename-file-and-buffer (new-name)
4
+ "Renames both current buffer and file it's visiting to NEW-NAME."
5
+ (interactive "sNew name: ")
6
+ (let ((name (buffer-name))
7
+ (filename (buffer-file-name)))
8
+ (if (not filename)
9
+ (message "Buffer '%s' is not visiting a file!" name)
10
+ (if (get-buffer new-name)
11
+ (message "A buffer named '%s' already exists!" new-name)
12
+ (progn
13
+ (rename-file name new-name 1)
14
+ (rename-buffer new-name)
15
+ (set-visited-file-name new-name)
16
+ (set-buffer-modified-p nil))))))
17
+
18
+ (defun nwiki-get-buffer-text ()
19
+ (buffer-substring-no-properties (point-min) (point-max)))
20
+
21
+ (defun nwiki-extract-title (text)
22
+ (let ((first-line (first (split-string text "\n"))))
23
+ (replace-regexp-in-string "^\*+ +" "" first-line)))
24
+
25
+ (defun nwiki-sync-buffername-with-title ()
26
+ "sync buffername with title"
27
+ (interactive)
28
+ (let ((file-name-from-title (concat
29
+ (nwiki-extract-title(nwiki-get-buffer-text))
30
+ ".org"))
31
+ (buffer-file-name-without-directory (file-name-nondirectory buffer-file-name)))
32
+ (unless (equal file-name-from-title buffer-file-name-without-directory)
33
+ (rename-file-and-buffer file-name-from-title))))
34
+
35
+ (defun nwiki-add-this-buffer ()
36
+ "add this buffer to repository"
37
+ (shell-command (format "git add %s" buffer-file-name)))
38
+
39
+ (defun nwiki-commit-this-buffer ()
40
+ "commit this buffer to repository"
41
+ (shell-command "git commit --no-edit"))
42
+
43
+ (defun nwiki-add-and-commit-this-buffer ()
44
+ "add and commit this buffer to repository"
45
+ (nwiki-add-this-buffer)
46
+ (nwiki-commit-this-buffer))
47
+
48
+ (defun nwiki-sync-and-commit ()
49
+ "sync and commit this-buffer"
50
+ (interactive)
51
+ (nwiki-sync-buffername-with-title)
52
+ (nwiki-add-and-commit-this-buffer))
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ exit unless ARGV[1].nil?
3
+
4
+ message = `git diff --cached --name-status -r`.
5
+ force_encoding('UTF-8').
6
+ split("\n").map{|e| e.split }.
7
+ select{|e| e[1] =~ /\.org$/ }.
8
+ map{|e| File.basename(e[1]).sub(/\.org$/, '') }.
9
+ join(',')
10
+
11
+ File.write(ARGV[0], message + "\n" + File.read(ARGV[0]))
data/lib/nwiki/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nwiki
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nwiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - niku
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-09 00:00:00.000000000 Z
11
+ date: 2014-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -141,6 +141,8 @@ files:
141
141
  - README.md
142
142
  - Rakefile
143
143
  - config.ru
144
+ - ext/elisp/nwiki-mode.el
145
+ - ext/git-hooks/prepare-commit-msg
144
146
  - lib/nwiki.rb
145
147
  - lib/nwiki/core.rb
146
148
  - lib/nwiki/core/directory.rb