tidtools 0.1.0 → 0.2.0
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/History.txt +10 -0
- data/Manifest.txt +8 -6
- data/README.rdoc +99 -10
- data/bin/tiddler2texts +14 -0
- data/bin/tidgrep +3 -4
- data/bin/twgrep +3 -4
- data/lib/tidtools.rb +1 -1
- data/lib/tidtools/platform.rb +4 -0
- data/lib/tidtools/tiddle.rb +14 -4
- data/lib/tidtools/tiddler2texts.rb +50 -0
- data/lib/tidtools/tiddler2texts_cli.rb +24 -0
- data/lib/{tidgrep → tidtools}/tidgrep.rb +3 -3
- data/lib/{tidgrep/cli.rb → tidtools/tidgrep_cli.rb} +7 -8
- data/lib/{twgrep/cli.rb → tidtools/twgrep_cli.rb} +8 -9
- data/test/test_helper.rb +0 -1
- data/test/test_tiddler2texts.rb +20 -0
- data/test/test_tiddler2texts_cli.rb +19 -0
- data/test/test_tidgrep_cli.rb +6 -10
- data/test/test_tidtools.rb +1 -6
- data/test/test_twgrep_cli.rb +7 -11
- metadata +59 -37
- data/bin/twmerge +0 -15
- data/lib/twmerge/cli.rb +0 -30
- data/test/test_twmerge_cli.rb +0 -14
data/History.txt
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
+
=== 0.2.0 2012/01/27
|
2
|
+
|
3
|
+
* tiddler2texts コマンドを追加
|
4
|
+
* TiddlyWikiをTiddlerごとのテキストファイルに分割
|
5
|
+
* Ruby1.9に対応
|
6
|
+
* ディレクトリ構造の整理
|
7
|
+
* twmergeの削除
|
8
|
+
|
1
9
|
=== 0.0.10 2010/06/21
|
2
10
|
|
3
11
|
* TIDDLYWIKI_PATHSの区切り文字を';'に変更
|
4
12
|
* 空白付きのパスを上手く処理出来ないため
|
5
13
|
* README.rdocを作成
|
6
14
|
* 基本的な使い方等を記述
|
15
|
+
* README.rdocを修正
|
16
|
+
* 先頭にURIが無いと、rake package時に怒られたため追加
|
7
17
|
|
8
18
|
=== 0.0.9 2010/06/20
|
9
19
|
|
data/Manifest.txt
CHANGED
@@ -3,22 +3,24 @@ Manifest.txt
|
|
3
3
|
PostInstall.txt
|
4
4
|
README.rdoc
|
5
5
|
Rakefile
|
6
|
+
bin/tiddler2texts
|
6
7
|
bin/tidgrep
|
7
8
|
bin/twgrep
|
8
|
-
bin/twmerge
|
9
|
-
lib/tidgrep/cli.rb
|
10
|
-
lib/tidgrep/tidgrep.rb
|
11
9
|
lib/tidtools.rb
|
12
10
|
lib/tidtools/platform.rb
|
13
11
|
lib/tidtools/tiddle.rb
|
12
|
+
lib/tidtools/tiddler2texts.rb
|
13
|
+
lib/tidtools/tiddler2texts_cli.rb
|
14
|
+
lib/tidtools/tidgrep.rb
|
15
|
+
lib/tidtools/tidgrep_cli.rb
|
14
16
|
lib/tidtools/tweet.rb
|
15
|
-
lib/
|
16
|
-
lib/twmerge/cli.rb
|
17
|
+
lib/tidtools/twgrep_cli.rb
|
17
18
|
script/console
|
18
19
|
script/destroy
|
19
20
|
script/generate
|
20
21
|
test/test_helper.rb
|
22
|
+
test/test_tiddler2texts.rb
|
23
|
+
test/test_tiddler2texts_cli.rb
|
21
24
|
test/test_tidgrep_cli.rb
|
22
25
|
test/test_tidtools.rb
|
23
26
|
test/test_twgrep_cli.rb
|
24
|
-
test/test_twmerge_cli.rb
|
data/README.rdoc
CHANGED
@@ -1,29 +1,118 @@
|
|
1
1
|
= tidtools
|
2
2
|
http://github.com/ongaeshi/tidtools
|
3
3
|
|
4
|
-
TiddlyWiki
|
4
|
+
tidtoolsは、TiddlyWikiをより使いやすくするためのコマンドラインツール群です。Wiki内の検索等、様々なツールが用意されています。RubyGem経由で簡単にインストール可能です。
|
5
5
|
|
6
6
|
== INSTALL:
|
7
|
+
通常のgemインストールと同様です。
|
7
8
|
|
8
9
|
gem install tidtools
|
9
10
|
|
10
11
|
== DESCRIPTION:
|
11
|
-
|
12
|
-
<b>twgrep</b>:: twgrep
|
13
|
-
<b>twmerge</b>:: twmerge
|
12
|
+
インストールすると以下のツールが使えるようになります。
|
14
13
|
|
15
|
-
<b>
|
16
|
-
<b>
|
14
|
+
<b>tiddler2texts</b>:: TiddlyWikiをTiddlerごとのテキストファイルに分割
|
15
|
+
<b>tidgrep</b>:: TiddlyWikiファイルをgrep検索
|
16
|
+
<b>twgrep</b>:: TiddlyWiki内のつぶやき形式のテキストを検索
|
17
|
+
|
18
|
+
一緒に、TiddlyWikiを扱うためのライブラリもインストールされます
|
19
|
+
|
20
|
+
<b>Tiddler2texts</b>:: TiddlyWikiをTiddlerごとのテキストファイルに分割
|
21
|
+
<b>Tiddle</b>:: TiddlyWiki形式のファイルから、Tiddleの配列を取得出来る
|
22
|
+
<b>Tweet</b>:: つぶやき形式のテキストを扱う
|
17
23
|
|
18
24
|
== SETUP:
|
25
|
+
よく使うTiddlyWikiファイルが決まっているのであれば、
|
26
|
+
環境変数 <em>TIDDLYWIKI_PATHS</em> を設定しておくと便利です。
|
27
|
+
|
28
|
+
.bashrcで設定するなら以下のようになります
|
29
|
+
|
30
|
+
# tidtoolsがデフォルトで検索するパス
|
31
|
+
export TIDDLYWIKI_PATHS="/Users/ongaeshi/memo.html"
|
32
|
+
|
33
|
+
';'を区切り文字として、複数のTiddlyWikiを検索対象に指定することも出来ます。
|
34
|
+
|
35
|
+
# ';'を区切り文字にすると、複数のTiddlyWikiを検索対象に指定出来ます
|
36
|
+
export TIDDLYWIKI_PATHS="/Users/ongaeshi/memo.html;/Users/ongaeshi/work.html"
|
19
37
|
|
20
38
|
== FIRST_STEP:
|
39
|
+
環境変数を指定しておけば、ファイルの場所を指定しなくても簡単に検索が出来ます。
|
40
|
+
|
41
|
+
% tidgrep tidtools # tidtoolsと書いてあるテキストを探す
|
42
|
+
SiteSubtitle:1:tidtools実験用のダミーメモ
|
43
|
+
Tweet - 4:16:ノートのWindowsマシンだとスムーズにtidtoolsのインストールが出来た。
|
44
|
+
Tweet - 4:24:tidtools、まだバグがあるよ。
|
45
|
+
Tweet - 4:50:tidtools0.0.4 - twgrepを追加
|
46
|
+
.
|
47
|
+
.
|
48
|
+
|
49
|
+
環境変数を設定していなくても、-fオプションを指定すれば検索出来ます。
|
50
|
+
|
51
|
+
% tidgrep -f /Users/ongaeshi/memo.html tidtools # -fで検索対象を指定(ここでも;区切りが使える)
|
52
|
+
SiteSubtitle:1:tidtools実験用のダミーメモ
|
53
|
+
Tweet - 4:16:ノートのWindowsマシンだとスムーズにtidtoolsのインストールが出来た。
|
54
|
+
Tweet - 4:24:tidtools、まだバグがあるよ。
|
55
|
+
Tweet - 4:50:tidtools0.0.4 - twgrepを追加
|
56
|
+
.
|
57
|
+
.
|
58
|
+
|
59
|
+
<b>twgrep</b>はtidgrepの特殊版で、<b>つぶやき形式</b>という特殊な形式で書かれたテキスト専用の検索ツールです。
|
60
|
+
|
61
|
+
つぶやき形式とは、私が勝手に作ったTiddlyWikiでつぶやきっぽいテキストを書くための整形ルールです。
|
62
|
+
<b>'----'</b>で区切りを表現し、区切りの前に<b>日時</b>を入れます。
|
63
|
+
また<b>"Tweet - New"</b>のように、Tiddleのタイトルに<b>Tweet</b>という文字列を含みます。
|
64
|
+
|
65
|
+
私は月が変わるごとに新しいTiddleを作ることにしていて、<b>"Tweet - New"</b>, <b>"Tweet - 5"</b>, <b>"Tweet - 4"</b>のようにTiddleを作っています。
|
66
|
+
|
67
|
+
# つぶやき形式の例
|
68
|
+
# このつぶやきは "Tweet - 4" というTiddleに保存されている
|
69
|
+
|
70
|
+
おやすみー、結局こんなに遅くなった
|
71
|
+
~~@@color(gray):2010/04/06 2:28@@~~
|
72
|
+
----
|
73
|
+
リリース失敗・・・、tidtools0.0.5を再リリース
|
74
|
+
~~@@color(gray):2010/04/06 1:21@@~~
|
75
|
+
----
|
76
|
+
tidtools0.0.4をリリース
|
77
|
+
~~@@color(gray):2010/04/06 22:03@@~~
|
78
|
+
----
|
79
|
+
おはよう
|
80
|
+
~~@@color(gray):2010/04/06 08:30@@~~
|
81
|
+
----
|
82
|
+
|
83
|
+
twgrepはこんな感じで使います。
|
84
|
+
|
85
|
+
% twgrep tidtools # tidtoolsという文字を含むつぶやきを検索
|
86
|
+
--- Tweet - New --------------------
|
87
|
+
リリース失敗・・・、tidtools0.0.5を再リリース
|
88
|
+
~~@@color(gray):2010/04/06 1:21@@~~
|
89
|
+
----
|
90
|
+
tidtools0.0.4をリリース
|
91
|
+
~~@@color(gray):2010/04/06 22:03@@~~
|
92
|
+
----
|
93
|
+
|
94
|
+
<b>tiddler2texts</b>はTiddlyWikiをTiddlerごとのテキストファイルに分割します。
|
95
|
+
|
96
|
+
# output_dir/に出力
|
97
|
+
$ tiddler2texts /path/to/tiddlywiki.html output_dir
|
98
|
+
|
99
|
+
以下のようなスクリプトを書けば、複数のTiddlyWikiをまとめてテキストに変換することが可能です。
|
100
|
+
|
101
|
+
require 'rubygems'
|
102
|
+
require 'tidtools/tiddler2texts'
|
103
|
+
|
104
|
+
if __FILE__ == $0
|
105
|
+
Tidtools::Tiddler2texts.output('/path/to/memo1.html', 'memo1')
|
106
|
+
Tidtools::Tiddler2texts.output('/path/to/memo2.html', 'memo2')
|
107
|
+
end
|
108
|
+
|
109
|
+
より詳しい使い方は各コマンドのヘルプを見て下さい。
|
21
110
|
|
22
111
|
== LINKS:
|
23
|
-
{github}[http://github.com/ongaeshi/tidtools]::
|
24
|
-
{Rubygems}[http://rubygems.org/gems/tidtools]:: gem
|
25
|
-
{Twitter}[http://twitter.com/tidtools]:: Twitter
|
26
|
-
{blog}[http://d.hatena.ne.jp/tuto0621/]::
|
112
|
+
{github}[http://github.com/ongaeshi/tidtools]:: ソースコード等
|
113
|
+
{Rubygems}[http://rubygems.org/gems/tidtools]:: gemの置き場所
|
114
|
+
{Twitter}[http://twitter.com/tidtools]:: このツール専用のTwitterアカウントです
|
115
|
+
{blog}[http://d.hatena.ne.jp/tuto0621/]:: 開発者のブログです、他のことも書きますがご容赦下さい
|
27
116
|
|
28
117
|
== LICENSE:
|
29
118
|
MIT License
|
data/bin/tiddler2texts
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding: utf-8 -*-
|
3
|
+
#
|
4
|
+
# Created on 2012-01-27.
|
5
|
+
# Copyright (c) 2012. All rights reserved.
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require "tidtools/tiddler2texts_cli"
|
9
|
+
|
10
|
+
# バージョン番号
|
11
|
+
Version = "0.2.0"
|
12
|
+
|
13
|
+
# コマンドの実行
|
14
|
+
Tidtools::Tiddler2textsCli.execute(STDOUT, ARGV)
|
data/bin/tidgrep
CHANGED
@@ -5,11 +5,10 @@
|
|
5
5
|
# Copyright (c) 2010. All rights reserved.
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
|
-
require
|
9
|
-
require "tidgrep/cli"
|
8
|
+
require "tidtools/tidgrep_cli"
|
10
9
|
|
11
10
|
# バージョン番号
|
12
|
-
Version = "0.
|
11
|
+
Version = "0.2.0"
|
13
12
|
|
14
13
|
# コマンドの実行
|
15
|
-
|
14
|
+
Tidtools::TidgrepCli.execute(STDOUT, ARGV)
|
data/bin/twgrep
CHANGED
@@ -5,11 +5,10 @@
|
|
5
5
|
# Copyright (c) 2010. All rights reserved.
|
6
6
|
|
7
7
|
require 'rubygems'
|
8
|
-
require
|
9
|
-
require "twgrep/cli"
|
8
|
+
require "tidtools/twgrep_cli"
|
10
9
|
|
11
10
|
# バージョン番号
|
12
|
-
Version = "0.
|
11
|
+
Version = "0.2.0"
|
13
12
|
|
14
13
|
# コマンドの実行
|
15
|
-
|
14
|
+
Tidtools::TwgrepCli.execute(STDOUT, ARGV)
|
data/lib/tidtools.rb
CHANGED
data/lib/tidtools/platform.rb
CHANGED
data/lib/tidtools/tiddle.rb
CHANGED
@@ -2,7 +2,12 @@
|
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hpricot'
|
5
|
-
require '
|
5
|
+
require File.join(File.dirname(__FILE__), '../tidtools/platform')
|
6
|
+
if Platform.ruby19?
|
7
|
+
require 'date'
|
8
|
+
else
|
9
|
+
require 'parsedate'
|
10
|
+
end
|
6
11
|
|
7
12
|
class Tiddle
|
8
13
|
attr_reader :title, :created, :modified, :tags, :changecount, :content
|
@@ -32,7 +37,7 @@ class Tiddle
|
|
32
37
|
tiddle['changecount'],
|
33
38
|
content(tiddle)))
|
34
39
|
|
35
|
-
#
|
40
|
+
# print tiddle['modified'], '=>', tiddles.last.modified, "\n"
|
36
41
|
end
|
37
42
|
end
|
38
43
|
end
|
@@ -77,10 +82,15 @@ class Tiddle
|
|
77
82
|
private_class_method :content1
|
78
83
|
|
79
84
|
# 時刻に変換
|
85
|
+
# 1.9の場合はDateTimeを、1.8.7の場合はTimeを返す
|
80
86
|
def self.convtime(str)
|
81
87
|
if (str)
|
82
|
-
|
83
|
-
|
88
|
+
if Platform.ruby19?
|
89
|
+
DateTime.parse(str)
|
90
|
+
else
|
91
|
+
ary = ParseDate::parsedate(str)
|
92
|
+
Time::local(*ary[0..4])
|
93
|
+
end
|
84
94
|
else
|
85
95
|
nil
|
86
96
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/01/27
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'tidtools/tiddle'
|
10
|
+
require 'fileutils'
|
11
|
+
require 'kconv'
|
12
|
+
|
13
|
+
module Tidtools
|
14
|
+
module Tiddler2texts
|
15
|
+
module_function
|
16
|
+
|
17
|
+
def escape(src)
|
18
|
+
r = src
|
19
|
+
r.gsub!(/\//, "/")
|
20
|
+
r.gsub!(/:/, ":")
|
21
|
+
r.gsub!(/>/, ">")
|
22
|
+
r.gsub!(/"/, "”")
|
23
|
+
r
|
24
|
+
end
|
25
|
+
|
26
|
+
def output(filename, output_dir)
|
27
|
+
filename = File.expand_path filename
|
28
|
+
|
29
|
+
FileUtils.mkdir_p output_dir
|
30
|
+
|
31
|
+
data = Tiddle.parse(filename)
|
32
|
+
|
33
|
+
data.each do |tiddler|
|
34
|
+
# OSX
|
35
|
+
filename = output_dir + '/' + escape(tiddler.title)
|
36
|
+
# win
|
37
|
+
# filename = output_dir + '/' + escape(tiddler.title.kconv(Kconv::SJIS))
|
38
|
+
|
39
|
+
next if (File.exist?(filename) and File.read(filename) == tiddler.content)
|
40
|
+
|
41
|
+
open(filename, 'w') do |f|
|
42
|
+
puts "#{filename}"
|
43
|
+
f.write tiddler.content
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/01/27
|
7
|
+
|
8
|
+
require 'tidtools/tiddler2texts'
|
9
|
+
require 'optparse'
|
10
|
+
|
11
|
+
module Tidtools
|
12
|
+
class Tiddler2textsCli
|
13
|
+
def self.execute(stdout, arguments=[])
|
14
|
+
opt = OptionParser.new("#{File.basename($0)} tiddlywiki.html output_dir")
|
15
|
+
opt.parse!(arguments)
|
16
|
+
|
17
|
+
if arguments.size == 2
|
18
|
+
Tiddler2texts.output(arguments[0], arguments[1])
|
19
|
+
else
|
20
|
+
stdout.puts opt.help
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
3
|
-
require
|
2
|
+
require 'tidtools/tiddle'
|
3
|
+
require 'tidtools/platform'
|
4
4
|
require 'kconv'
|
5
5
|
|
6
|
-
module
|
6
|
+
module Tidtools
|
7
7
|
class Tidgrep
|
8
8
|
# 圧縮表示時のパラメータ
|
9
9
|
MATCH_LINE_COMP_NUM = 5
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
2
|
+
require 'tidtools/tidgrep'
|
3
3
|
require 'optparse'
|
4
4
|
|
5
|
-
module
|
6
|
-
class
|
5
|
+
module Tidtools
|
6
|
+
class TidgrepCli
|
7
7
|
def self.execute(stdout, arguments=[])
|
8
8
|
file_names = ENV['TIDDLYWIKI_PATHS'].split(";")
|
9
9
|
file_no = 0
|
@@ -35,12 +35,11 @@ module Tidgrep
|
|
35
35
|
arguments,
|
36
36
|
kcode)
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
|
38
|
+
if obj.validOption?
|
39
|
+
obj.execute
|
40
|
+
else
|
41
|
+
stdout.puts opt.help
|
41
42
|
end
|
42
|
-
|
43
|
-
obj.execute
|
44
43
|
end
|
45
44
|
end
|
46
45
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require
|
2
|
+
require 'tidtools/tidgrep'
|
3
3
|
require 'optparse'
|
4
4
|
|
5
|
-
module
|
6
|
-
class
|
5
|
+
module Tidtools
|
6
|
+
class TwgrepCli
|
7
7
|
def self.execute(stdout, arguments=[])
|
8
8
|
file_names = ENV['TIDDLYWIKI_PATHS'].split(";")
|
9
9
|
file_no = 0
|
@@ -23,7 +23,7 @@ module Twgrep
|
|
23
23
|
opt.on('-c', '--comp', 'compression disp') {|v| is_comp = true; report = true }
|
24
24
|
opt.parse!(arguments)
|
25
25
|
|
26
|
-
obj = Tidgrep
|
26
|
+
obj = Tidgrep.new(stdout,
|
27
27
|
file_names,
|
28
28
|
file_no,
|
29
29
|
title,
|
@@ -34,12 +34,11 @@ module Twgrep
|
|
34
34
|
arguments,
|
35
35
|
kcode)
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
if obj.validOption? && arguments.size > 0
|
38
|
+
obj.execute
|
39
|
+
else
|
40
|
+
stdout.puts opt.help
|
40
41
|
end
|
41
|
-
|
42
|
-
obj.execute
|
43
42
|
end
|
44
43
|
end
|
45
44
|
end
|
data/test/test_helper.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/01/27
|
7
|
+
|
8
|
+
require 'test_helper'
|
9
|
+
require 'tidtools/tiddler2texts'
|
10
|
+
|
11
|
+
class TestTiddler2texts < Test::Unit::TestCase
|
12
|
+
include Tidtools
|
13
|
+
|
14
|
+
def test_escape
|
15
|
+
assert_equal "afile", Tiddler2texts.escape("afile")
|
16
|
+
assert_equal "/path/to/dir", Tiddler2texts.escape("/path/to/dir")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# @file
|
4
|
+
# @brief
|
5
|
+
# @author ongaeshi
|
6
|
+
# @date 2012/01/27
|
7
|
+
|
8
|
+
require 'test_helper'
|
9
|
+
require 'tidtools/tiddler2texts_cli'
|
10
|
+
|
11
|
+
class TestTiddler2textsCli < Test::Unit::TestCase
|
12
|
+
def test_noarg
|
13
|
+
io = StringIO.new
|
14
|
+
Tidtools::Tiddler2textsCli.execute(io, [])
|
15
|
+
assert_match /tiddlywiki/, io.string
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
|
data/test/test_tidgrep_cli.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require '
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tidtools/tidgrep_cli'
|
3
3
|
|
4
4
|
class TestTidgrepCli < Test::Unit::TestCase
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_print_default_output
|
12
|
-
assert_match(/To update this executable/, @stdout)
|
5
|
+
def test_noarg
|
6
|
+
io = StringIO.new
|
7
|
+
Tidtools::TidgrepCli.execute(io, [])
|
8
|
+
assert_match /tidgrep/, io.string
|
13
9
|
end
|
14
10
|
end
|
data/test/test_tidtools.rb
CHANGED
data/test/test_twgrep_cli.rb
CHANGED
@@ -1,14 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require '
|
1
|
+
require 'test_helper'
|
2
|
+
require 'tidtools/twgrep_cli'
|
3
3
|
|
4
4
|
class TestTwgrepCli < Test::Unit::TestCase
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
def test_noarg
|
6
|
+
io = StringIO.new
|
7
|
+
Tidtools::TwgrepCli.execute(io, [])
|
8
|
+
assert_match /twgrep/, io.string
|
9
9
|
end
|
10
|
-
|
11
|
-
def test_print_default_output
|
12
|
-
assert_match(/To update this executable/, @stdout)
|
13
|
-
end
|
14
|
-
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tidtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 2
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.2.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- ongaeshi
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2012-01-28 00:00:00 +09:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: hpricot
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 59
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 8
|
@@ -32,46 +35,43 @@ dependencies:
|
|
32
35
|
type: :runtime
|
33
36
|
version_requirements: *id001
|
34
37
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
38
|
+
name: hoe
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 47
|
41
46
|
segments:
|
42
47
|
- 2
|
48
|
+
- 8
|
43
49
|
- 0
|
44
|
-
|
45
|
-
version: 2.0.4
|
50
|
+
version: 2.8.0
|
46
51
|
type: :development
|
47
52
|
version_requirements: *id002
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
<b>twgrep</b>:: twgrep
|
65
|
-
<b>twmerge</b>:: twmerge
|
66
|
-
|
67
|
-
<b>Tiddle</b>:: Tiddle
|
68
|
-
<b>Tweet</b>:: Tweet
|
53
|
+
description: !binary |
|
54
|
+
44Kk44Oz44K544OI44O844Or44GZ44KL44Go5Lul5LiL44Gu44OE44O844Or
|
55
|
+
44GM5L2/44GI44KL44KI44GG44Gr44Gq44KK44G+44GZ44CCCgo8Yj50aWRk
|
56
|
+
bGVyMnRleHRzPC9iPjo6IFRpZGRseVdpa2njgpJUaWRkbGVy44GU44Go44Gu
|
57
|
+
44OG44Kt44K544OI44OV44Kh44Kk44Or44Gr5YiG5YmyCjxiPnRpZGdyZXA8
|
58
|
+
L2I+OjogVGlkZGx5V2lraeODleOCoeOCpOODq+OCkmdyZXDmpJzntKIKPGI+
|
59
|
+
dHdncmVwPC9iPjo6IFRpZGRseVdpa2nlhoXjga7jgaTjgbbjgoTjgY3lvaLl
|
60
|
+
vI/jga7jg4bjgq3jgrnjg4jjgpLmpJzntKIKCuS4gOe3kuOBq+OAgVRpZGRs
|
61
|
+
eVdpa2njgpLmibHjgYbjgZ/jgoHjga7jg6njgqTjg5bjg6njg6rjgoLjgqTj
|
62
|
+
g7Pjgrnjg4jjg7zjg6vjgZXjgozjgb7jgZkKCjxiPlRpZGRsZXIydGV4dHM8
|
63
|
+
L2I+OjogVGlkZGx5V2lraeOCklRpZGRsZXLjgZTjgajjga7jg4bjgq3jgrnj
|
64
|
+
g4jjg5XjgqHjgqTjg6vjgavliIblibIKPGI+VGlkZGxlPC9iPjo6IFRpZGRs
|
65
|
+
eVdpa2nlvaLlvI/jga7jg5XjgqHjgqTjg6vjgYvjgonjgIFUaWRkbGXjga7p
|
66
|
+
hY3liJfjgpLlj5blvpflh7rmnaXjgosKPGI+VHdlZXQ8L2I+Ojog44Gk44G2
|
67
|
+
44KE44GN5b2i5byP44Gu44OG44Kt44K544OI44KS5omx44GG
|
68
|
+
|
69
69
|
email:
|
70
70
|
- ongaeshi@example.com
|
71
71
|
executables:
|
72
|
+
- tiddler2texts
|
72
73
|
- tidgrep
|
73
74
|
- twgrep
|
74
|
-
- twmerge
|
75
75
|
extensions: []
|
76
76
|
|
77
77
|
extra_rdoc_files:
|
@@ -84,25 +84,27 @@ files:
|
|
84
84
|
- PostInstall.txt
|
85
85
|
- README.rdoc
|
86
86
|
- Rakefile
|
87
|
+
- bin/tiddler2texts
|
87
88
|
- bin/tidgrep
|
88
89
|
- bin/twgrep
|
89
|
-
- bin/twmerge
|
90
|
-
- lib/tidgrep/cli.rb
|
91
|
-
- lib/tidgrep/tidgrep.rb
|
92
90
|
- lib/tidtools.rb
|
93
91
|
- lib/tidtools/platform.rb
|
94
92
|
- lib/tidtools/tiddle.rb
|
93
|
+
- lib/tidtools/tiddler2texts.rb
|
94
|
+
- lib/tidtools/tiddler2texts_cli.rb
|
95
|
+
- lib/tidtools/tidgrep.rb
|
96
|
+
- lib/tidtools/tidgrep_cli.rb
|
95
97
|
- lib/tidtools/tweet.rb
|
96
|
-
- lib/
|
97
|
-
- lib/twmerge/cli.rb
|
98
|
+
- lib/tidtools/twgrep_cli.rb
|
98
99
|
- script/console
|
99
100
|
- script/destroy
|
100
101
|
- script/generate
|
101
102
|
- test/test_helper.rb
|
103
|
+
- test/test_tiddler2texts.rb
|
104
|
+
- test/test_tiddler2texts_cli.rb
|
102
105
|
- test/test_tidgrep_cli.rb
|
103
106
|
- test/test_tidtools.rb
|
104
107
|
- test/test_twgrep_cli.rb
|
105
|
-
- test/test_twmerge_cli.rb
|
106
108
|
has_rdoc: true
|
107
109
|
homepage: http://github.com/ongaeshi/tidtools
|
108
110
|
licenses: []
|
@@ -114,29 +116,49 @@ rdoc_options:
|
|
114
116
|
require_paths:
|
115
117
|
- lib
|
116
118
|
required_ruby_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
117
120
|
requirements:
|
118
121
|
- - ">="
|
119
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
120
124
|
segments:
|
121
125
|
- 0
|
122
126
|
version: "0"
|
123
127
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
none: false
|
124
129
|
requirements:
|
125
130
|
- - ">="
|
126
131
|
- !ruby/object:Gem::Version
|
132
|
+
hash: 3
|
127
133
|
segments:
|
128
134
|
- 0
|
129
135
|
version: "0"
|
130
136
|
requirements: []
|
131
137
|
|
132
138
|
rubyforge_project: tidtools
|
133
|
-
rubygems_version: 1.3.
|
139
|
+
rubygems_version: 1.3.7
|
134
140
|
signing_key:
|
135
141
|
specification_version: 3
|
136
|
-
summary:
|
142
|
+
summary: !binary |
|
143
|
+
44Kk44Oz44K544OI44O844Or44GZ44KL44Go5Lul5LiL44Gu44OE44O844Or
|
144
|
+
44GM5L2/44GI44KL44KI44GG44Gr44Gq44KK44G+44GZ44CCICA8Yj50aWRk
|
145
|
+
bGVyMnRleHRzPC9iPjo6IFRpZGRseVdpa2njgpJUaWRkbGVy44GU44Go44Gu
|
146
|
+
44OG44Kt44K544OI44OV44Kh44Kk44Or44Gr5YiG5YmyIDxiPnRpZGdyZXA8
|
147
|
+
L2I+OjogVGlkZGx5V2lraeODleOCoeOCpOODq+OCkmdyZXDmpJzntKIgPGI+
|
148
|
+
dHdncmVwPC9iPjo6IFRpZGRseVdpa2nlhoXjga7jgaTjgbbjgoTjgY3lvaLl
|
149
|
+
vI/jga7jg4bjgq3jgrnjg4jjgpLmpJzntKIgIOS4gOe3kuOBq+OAgVRpZGRs
|
150
|
+
eVdpa2njgpLmibHjgYbjgZ/jgoHjga7jg6njgqTjg5bjg6njg6rjgoLjgqTj
|
151
|
+
g7Pjgrnjg4jjg7zjg6vjgZXjgozjgb7jgZkgIDxiPlRpZGRsZXIydGV4dHM8
|
152
|
+
L2I+OjogVGlkZGx5V2lraeOCklRpZGRsZXLjgZTjgajjga7jg4bjgq3jgrnj
|
153
|
+
g4jjg5XjgqHjgqTjg6vjgavliIblibIgPGI+VGlkZGxlPC9iPjo6IFRpZGRs
|
154
|
+
eVdpa2nlvaLlvI/jga7jg5XjgqHjgqTjg6vjgYvjgonjgIFUaWRkbGXjga7p
|
155
|
+
hY3liJfjgpLlj5blvpflh7rmnaXjgosgPGI+VHdlZXQ8L2I+Ojog44Gk44G2
|
156
|
+
44KE44GN5b2i5byP44Gu44OG44Kt44K544OI44KS5omx44GG
|
157
|
+
|
137
158
|
test_files:
|
138
159
|
- test/test_helper.rb
|
160
|
+
- test/test_tiddler2texts.rb
|
161
|
+
- test/test_tiddler2texts_cli.rb
|
139
162
|
- test/test_tidgrep_cli.rb
|
140
163
|
- test/test_tidtools.rb
|
141
164
|
- test/test_twgrep_cli.rb
|
142
|
-
- test/test_twmerge_cli.rb
|
data/bin/twmerge
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# -*- coding: utf-8 -*-
|
3
|
-
#
|
4
|
-
# Created on 2010-5-2.
|
5
|
-
# Copyright (c) 2010. All rights reserved.
|
6
|
-
|
7
|
-
require 'rubygems'
|
8
|
-
require File.expand_path(File.dirname(__FILE__) + "/../lib/tidtools")
|
9
|
-
require "twmerge/cli"
|
10
|
-
|
11
|
-
# バージョン番号
|
12
|
-
Version = "0.0.1"
|
13
|
-
|
14
|
-
# コマンドの実行
|
15
|
-
Twmerge::CLI.execute(STDOUT, ARGV)
|
data/lib/twmerge/cli.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require File.join(File.dirname(__FILE__), '../tidtools/tiddle')
|
3
|
-
require File.join(File.dirname(__FILE__), '../tidtools/tweet')
|
4
|
-
require 'optparse'
|
5
|
-
|
6
|
-
module Twmerge
|
7
|
-
class CLI
|
8
|
-
def self.execute(stdout, arguments=[])
|
9
|
-
opt = OptionParser.new('twmerge origin_file add_file')
|
10
|
-
opt.parse!(arguments)
|
11
|
-
|
12
|
-
if (arguments.size != 2)
|
13
|
-
puts opt.help
|
14
|
-
exit
|
15
|
-
end
|
16
|
-
|
17
|
-
# テキストを取得
|
18
|
-
origin = open(arguments[0]).read
|
19
|
-
add = Tweet.decorate(open(arguments[1]).read)
|
20
|
-
|
21
|
-
# マージ
|
22
|
-
tweets = Tweet.merge(origin, add)
|
23
|
-
|
24
|
-
# 結果を表示
|
25
|
-
tweets.each do |elem|
|
26
|
-
puts elem.content, "----"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
data/test/test_twmerge_cli.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "test_helper.rb")
|
2
|
-
require 'twmerge/cli'
|
3
|
-
|
4
|
-
class TestTwmergeCli < Test::Unit::TestCase
|
5
|
-
def setup
|
6
|
-
Twmerge::CLI.execute(@stdout_io = StringIO.new, [])
|
7
|
-
@stdout_io.rewind
|
8
|
-
@stdout = @stdout_io.read
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_print_default_output
|
12
|
-
assert_match(/To update this executable/, @stdout)
|
13
|
-
end
|
14
|
-
end
|