tdiary 3.2.2.20130617 → 3.2.2.20130720
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.
- checksums.yaml +4 -4
- data/.travis.yml +5 -5
- data/Gemfile +20 -11
- data/Gemfile.lock +24 -18
- data/doc/INSTALL-cgi.md +82 -0
- data/doc/INSTALL-rack.md +97 -0
- data/doc/INSTALL.md +12 -56
- data/index.rb +3 -5
- data/misc/plugin/image.rb +11 -14
- data/misc/style/gfm/gfm_style.rb +4 -0
- data/misc/style/rd/rd_style.rb +2 -2
- data/plugin/00default.rb +3 -3
- data/spec/acceptance_helper.rb +0 -1
- data/spec/core/compatible_spec.rb +34 -36
- data/spec/core/rack/assets/precompile_spec.rb +40 -41
- data/spec/core/style/gfm_style_spec.rb +26 -0
- data/spec/core/style/rd_style_spec.rb +22 -0
- data/{vendor/jasmine-jquery-1.4.2 → spec/javascripts/helpers}/jasmine-jquery.js +134 -23
- data/{vendor/jquery-1.8 → spec/javascripts}/jquery.js +1092 -847
- data/spec/javascripts/support/jasmine.yml +6 -66
- data/tdiary/application.rb +0 -1
- data/tdiary/core_ext.rb +2 -0
- data/tdiary/dispatcher.rb +10 -16
- data/tdiary/request.rb +210 -58
- data/tdiary/response.rb +1 -18
- data/tdiary/tasks/release.rake +28 -46
- data/tdiary/version.rb +1 -1
- data/tdiary.gemspec +2 -3
- data/update.rb +3 -5
- data/vendor/.gitkeep +0 -0
- metadata +27 -24
- data/Gemfile.cgi +0 -5
- data/Gemfile.cgi.lock +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331ad10aa781304284bf30bcffd7ac906d10008e
|
4
|
+
data.tar.gz: 145e4dce8f97b01b8956b766c90750e58e518cd3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bb6644b7d7c0d49ad63deeee553e71382ff5d672e5e4a101b59e5c0acf8d6a6aed60ee4fcff745d792fa43104fed0adcb017e9fa1593a6ff593567ae3366099
|
7
|
+
data.tar.gz: dee79535c57ab09450c3ef61179d6a1cd109be72ec990ee123cce53a237f127c27d390bcf866612321df67f3792e5358c68d2ba991dac560d2642665c77ac8e6
|
data/.travis.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
services: memcache
|
2
2
|
|
3
|
-
bundler_args: --without development
|
4
|
-
|
5
3
|
rvm:
|
6
4
|
- 1.9.3
|
7
5
|
- 2.0.0
|
8
6
|
|
7
|
+
before_install:
|
8
|
+
- "export DISPLAY=:99.0"
|
9
|
+
- "sh -e /etc/init.d/xvfb start"
|
10
|
+
|
9
11
|
before_script:
|
10
|
-
- export DISPLAY=:99.0
|
11
|
-
- sh -e /etc/init.d/xvfb start
|
12
12
|
- DAEMON=1 bundle exec rake server
|
13
13
|
|
14
|
-
script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec:
|
14
|
+
script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec spec:acceptance:rdb jasmine:ci test ; fi
|
15
15
|
|
16
16
|
env:
|
17
17
|
- TEST_MODE=rack
|
data/Gemfile
CHANGED
@@ -16,25 +16,34 @@ end
|
|
16
16
|
# use edge tDiary contrib
|
17
17
|
# gem 'tdiary-contrib', :git => 'git@github.com:tdiary/tdiary-contrib.git'
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
gem '
|
22
|
-
|
23
|
-
gem 'redis-namespace'
|
19
|
+
group :coffee do
|
20
|
+
gem 'coffee-script'
|
21
|
+
gem 'therubyracer'
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
gem '
|
24
|
+
group :memcached do
|
25
|
+
gem 'dalli'
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
group :redis do
|
29
|
+
gem 'redis'
|
30
|
+
gem 'redis-namespace'
|
31
|
+
end
|
30
32
|
|
33
|
+
group :gfm do
|
31
34
|
gem 'redcarpet'
|
32
35
|
gem 'pygments.rb'
|
33
36
|
gem 'twitter-text', :require => false
|
34
37
|
end
|
35
38
|
|
36
|
-
|
37
|
-
|
39
|
+
group :server do
|
40
|
+
platforms :mri do
|
41
|
+
gem 'thin'
|
42
|
+
end
|
43
|
+
|
44
|
+
platforms :jruby do
|
45
|
+
gem 'trinidad'
|
46
|
+
end
|
38
47
|
end
|
39
48
|
|
40
49
|
group :development do
|
data/Gemfile.lock
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tdiary (3.2.2.
|
4
|
+
tdiary (3.2.2.20130720)
|
5
5
|
bundler (~> 1.3)
|
6
|
+
fastimage
|
6
7
|
hikidoc (>= 0.0.6)
|
7
|
-
imagesize (>= 0.1.0)
|
8
8
|
rack (>= 1.0.0)
|
9
9
|
rake (>= 10.0.0)
|
10
10
|
rdtool (>= 0.6.0)
|
11
|
-
sprockets (
|
11
|
+
sprockets (>= 2.10)
|
12
12
|
thor (~> 0.18)
|
13
13
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
addressable (2.3.
|
17
|
+
addressable (2.3.5)
|
18
18
|
capybara (2.1.0)
|
19
19
|
mime-types (>= 1.16)
|
20
20
|
nokogiri (>= 1.3.3)
|
@@ -27,7 +27,7 @@ GEM
|
|
27
27
|
coffee-script (2.2.0)
|
28
28
|
coffee-script-source
|
29
29
|
execjs
|
30
|
-
coffee-script-source (1.6.
|
30
|
+
coffee-script-source (1.6.3)
|
31
31
|
colorize (0.5.8)
|
32
32
|
coveralls (0.6.7)
|
33
33
|
colorize
|
@@ -41,10 +41,10 @@ GEM
|
|
41
41
|
eventmachine (1.0.3)
|
42
42
|
execjs (1.4.0)
|
43
43
|
multi_json (~> 1.0)
|
44
|
+
fastimage (1.5.0)
|
44
45
|
ffi (1.9.0)
|
45
46
|
hike (1.2.3)
|
46
47
|
hikidoc (0.0.6)
|
47
|
-
imagesize (0.1.1)
|
48
48
|
jasmine (1.3.2)
|
49
49
|
jasmine-core (~> 1.3.1)
|
50
50
|
rack (~> 1.0)
|
@@ -53,9 +53,10 @@ GEM
|
|
53
53
|
jasmine-core (1.3.1)
|
54
54
|
launchy (2.3.0)
|
55
55
|
addressable (~> 2.3)
|
56
|
+
libv8 (3.11.8.17)
|
56
57
|
method_source (0.8.1)
|
57
58
|
mime-types (1.23)
|
58
|
-
mini_portile (0.5.
|
59
|
+
mini_portile (0.5.1)
|
59
60
|
multi_json (1.7.7)
|
60
61
|
nokogiri (1.6.0)
|
61
62
|
mini_portile (~> 0.5.0)
|
@@ -65,7 +66,7 @@ GEM
|
|
65
66
|
coderay (~> 1.0.5)
|
66
67
|
method_source (~> 0.8)
|
67
68
|
slop (~> 3.4)
|
68
|
-
pygments.rb (0.5.
|
69
|
+
pygments.rb (0.5.2)
|
69
70
|
posix-spawn (~> 0.3.6)
|
70
71
|
yajl-ruby (~> 1.1.0)
|
71
72
|
rack (1.5.2)
|
@@ -74,29 +75,30 @@ GEM
|
|
74
75
|
racksh (1.0.0)
|
75
76
|
rack (>= 1.0)
|
76
77
|
rack-test (>= 0.5)
|
77
|
-
rake (10.0
|
78
|
+
rake (10.1.0)
|
78
79
|
rdtool (0.6.38)
|
79
|
-
redcarpet (
|
80
|
+
redcarpet (3.0.0)
|
80
81
|
redis (3.0.4)
|
81
82
|
redis-namespace (1.3.0)
|
82
83
|
redis (~> 3.0.0)
|
84
|
+
ref (1.0.5)
|
83
85
|
rest-client (1.6.7)
|
84
86
|
mime-types (>= 1.16)
|
85
|
-
rspec (2.
|
86
|
-
rspec-core (~> 2.
|
87
|
-
rspec-expectations (~> 2.
|
88
|
-
rspec-mocks (~> 2.
|
89
|
-
rspec-core (2.
|
90
|
-
rspec-expectations (2.
|
87
|
+
rspec (2.14.1)
|
88
|
+
rspec-core (~> 2.14.0)
|
89
|
+
rspec-expectations (~> 2.14.0)
|
90
|
+
rspec-mocks (~> 2.14.0)
|
91
|
+
rspec-core (2.14.3)
|
92
|
+
rspec-expectations (2.14.0)
|
91
93
|
diff-lcs (>= 1.1.3, < 2.0)
|
92
|
-
rspec-mocks (2.
|
94
|
+
rspec-mocks (2.14.1)
|
93
95
|
rubyzip (0.9.9)
|
94
96
|
selenium-webdriver (2.33.0)
|
95
97
|
childprocess (>= 0.2.5)
|
96
98
|
multi_json (~> 1.0)
|
97
99
|
rubyzip
|
98
100
|
websocket (~> 1.0.4)
|
99
|
-
sequel (
|
101
|
+
sequel (4.0.0)
|
100
102
|
simplecov (0.7.1)
|
101
103
|
multi_json (~> 1.0)
|
102
104
|
simplecov-html (~> 0.7.1)
|
@@ -111,6 +113,9 @@ GEM
|
|
111
113
|
tapp (1.4.0)
|
112
114
|
thor
|
113
115
|
test-unit (2.5.5)
|
116
|
+
therubyracer (0.11.4)
|
117
|
+
libv8 (~> 3.11.8.12)
|
118
|
+
ref
|
114
119
|
thin (1.5.1)
|
115
120
|
daemons (>= 1.0.9)
|
116
121
|
eventmachine (>= 0.12.6)
|
@@ -152,6 +157,7 @@ DEPENDENCIES
|
|
152
157
|
tapp
|
153
158
|
tdiary!
|
154
159
|
test-unit
|
160
|
+
therubyracer
|
155
161
|
thin
|
156
162
|
trinidad
|
157
163
|
twitter-text
|
data/doc/INSTALL-cgi.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
tDiaryのインストール (CGI環境)
|
2
|
+
==============================
|
3
|
+
|
4
|
+
一般的なCGIの実行を許可しているISPやレンタルサーバ上で利用する場合を想定し、以下のような環境を例に説明します。
|
5
|
+
|
6
|
+
- WWWサーバ: Apache 1.3.x
|
7
|
+
- ユーザ名: foo
|
8
|
+
- 日記のURL: http://www.hoge.example.org/~foo/diary/
|
9
|
+
- 上記URLのパス: /home/foo/public\_html/diary
|
10
|
+
|
11
|
+
## tDiaryの取得
|
12
|
+
|
13
|
+
tDiaryのダウンロードサイトから、配布アーカイブを取得します。
|
14
|
+
|
15
|
+
- [tDiary.org - ダウンロード](http://www.tdiary.org/20021112.html)
|
16
|
+
|
17
|
+
### 【補足】 tDiaryをGitHubから取得する場合
|
18
|
+
|
19
|
+
開発版を使いたい、更新を楽にしたいという理由でtDiaryをGitHubから取得して利用する場合は、外部ライブラリ (hikidocなど) を手動でインストールする必要があります。以降の手順に沿って、ライブラリをインストールしてください。
|
20
|
+
|
21
|
+
配布アーカイブから取得する場合は、外部ライブラリは同梱されているため、この手順は不要です。
|
22
|
+
|
23
|
+
まず、外部ライブラリの取得に必要となるBundlerインストールします。
|
24
|
+
|
25
|
+
```
|
26
|
+
% gem install bundler
|
27
|
+
```
|
28
|
+
|
29
|
+
次に、gitコマンドでtDiaryのソースコードを取得した後に、 `bundle install` コマンドを実行して外部ライブラリをインストールします。
|
30
|
+
|
31
|
+
```
|
32
|
+
% git clone git://github.com/tdiary/tdiary-core.git
|
33
|
+
% mv tdiary-core tdiary
|
34
|
+
% cd tdiary
|
35
|
+
% bundle install
|
36
|
+
```
|
37
|
+
|
38
|
+
## CGIスクリプトの設定
|
39
|
+
|
40
|
+
配布アーカイブを展開し、中身をすべて/home/foo/public\_html/diaryにコピーします。以下の2つのファイルがCGIスクリプト本体なので、WWWサーバの権限で実行可能なようにパーミッションを設定してください。
|
41
|
+
|
42
|
+
- index.rb
|
43
|
+
- update.rb
|
44
|
+
|
45
|
+
また、/usr/bin/envを使った起動ができない環境では、各ファイルの先頭を、rubyのパスに書き換える必要があるでしょう。ISPのホームディレクトリにこっそりRubyを入れたような場合を除き、通常はあまり気にしなくても良いはずです。
|
46
|
+
|
47
|
+
## .htaccessの作成
|
48
|
+
|
49
|
+
続いて、CGIの実行環境を整えます。dot.htaccessを.htaccessにリネームして、環境に合わせて書き換えます。添付のサンプルは以下のようになっています。
|
50
|
+
|
51
|
+
```
|
52
|
+
Options +ExecCGI
|
53
|
+
AddHandler cgi-script .rb
|
54
|
+
DirectoryIndex index.rb
|
55
|
+
|
56
|
+
<Files "*.rhtml">
|
57
|
+
deny from all
|
58
|
+
</Files>
|
59
|
+
|
60
|
+
<Files "tdiary.*">
|
61
|
+
deny from all
|
62
|
+
</Files>
|
63
|
+
|
64
|
+
<Files update.rb>
|
65
|
+
AuthName tDiary
|
66
|
+
AuthType Basic
|
67
|
+
AuthUserFile /home/foo/.htpasswd
|
68
|
+
Require user foo
|
69
|
+
</Files>
|
70
|
+
```
|
71
|
+
|
72
|
+
ここでは、
|
73
|
+
|
74
|
+
- CGIの実行を可能にし、
|
75
|
+
- サフィックス「.rb」のファイルをCGIと認識させ、
|
76
|
+
- index.rbをデフォルトのファイルに設定し、
|
77
|
+
- *.rhtmlとtdiary.*のファイルの参照を禁止して、
|
78
|
+
- update.rbへのアクセスにはユーザ認証が必要
|
79
|
+
|
80
|
+
という設定になっています。とりあえず書き換えが必要なのは、AuthUserFileとRequire userでしょう。意味はWebででも調べて下さい。AuthUseFileは、あらかじめhtpasswdコマンドで作成しておく必要があります(これもWebで調べればわかります)。
|
81
|
+
|
82
|
+
また、利用するWWWサーバの設定が、CGIの実行ファイルのサフィックスを固定(例:.cgi)にしている場合があります。この場合、AddHandlerやDirectoryIndexも変更する必要があるでしょう。これに応じて、index.rbやupdate.rbのファイル名も変更する必要があります。
|
data/doc/INSTALL-rack.md
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
tDiaryのインストール (Rack環境)
|
2
|
+
============================
|
3
|
+
|
4
|
+
## 概要
|
5
|
+
|
6
|
+
tDiary-4.0 以降のバージョンは gem に対応しているので、簡単に tDiary を設置出来ます。
|
7
|
+
|
8
|
+
## tDiary の取得
|
9
|
+
|
10
|
+
gem コマンドで tDiary をインストールします。
|
11
|
+
|
12
|
+
```
|
13
|
+
% gem install tdiary
|
14
|
+
```
|
15
|
+
|
16
|
+
インストールすると、 tdiary コマンドが使えるようになります。ちゃんとインストールできているか、確認してみましょう。以下のようにバージョン番号が表示されればインストール成功です(表示される番号はバージョンにより異なります)。
|
17
|
+
|
18
|
+
```
|
19
|
+
% tdiary version
|
20
|
+
4.0.0
|
21
|
+
```
|
22
|
+
|
23
|
+
rbenv を使っている場合は忘れずに rehash を実行しておきましょう。
|
24
|
+
|
25
|
+
```
|
26
|
+
% rbenv rehash
|
27
|
+
```
|
28
|
+
|
29
|
+
## tDiary の設置
|
30
|
+
|
31
|
+
newコマンドを実行してtdiaryを設置します。インストール先のディレクトリ名を指定します。以下の例では diary ディレクトリにインストールします。
|
32
|
+
|
33
|
+
```
|
34
|
+
% tdiary new diary
|
35
|
+
create diary
|
36
|
+
create diary/public
|
37
|
+
(中略)
|
38
|
+
create diary/tdiary.conf
|
39
|
+
run bundle install --without test development from "./diary"
|
40
|
+
Resolving dependencies...
|
41
|
+
Using rake (10.1.0)
|
42
|
+
Using bundler (1.3.5)
|
43
|
+
(中略)
|
44
|
+
Using twitter-text (1.6.1)
|
45
|
+
Your bundle is complete!
|
46
|
+
Gems in the groups test and development were not installed.
|
47
|
+
Use `bundle show [gemname]` to see where a bundled gem is installed.
|
48
|
+
run bundle exec tdiary htpasswd from "./diary"
|
49
|
+
Input your username/password
|
50
|
+
```
|
51
|
+
|
52
|
+
インストール途中で「Input your username/password」と表示され、
|
53
|
+
更新画面のユーザ認証のために、IDとパスワードを入力します。
|
54
|
+
|
55
|
+
```
|
56
|
+
Username: machu
|
57
|
+
New password:
|
58
|
+
Re-type new password:
|
59
|
+
install finished
|
60
|
+
run `tdiary server` in diary directory to start server
|
61
|
+
```
|
62
|
+
|
63
|
+
## tDiary の起動と終了
|
64
|
+
|
65
|
+
インストール先のディレクトリに移動して、serverコマンドを実行するとtDiaryサーバが起動します。
|
66
|
+
|
67
|
+
```
|
68
|
+
% cd diary
|
69
|
+
% bundle exec tdiary server
|
70
|
+
>> Thin web server (v1.5.1 codename Straight Razor)
|
71
|
+
>> Maximum connections set to 1024
|
72
|
+
>> Listening on 0.0.0.0:19292, CTRL+C to stop
|
73
|
+
```
|
74
|
+
|
75
|
+
Webブラウザで http://localhost:19292/ にアクセスすると、tDiaryの画面が表示されます。
|
76
|
+
|
77
|
+
CTRL+CコマンドでtDiaryサーバを終了します。
|
78
|
+
|
79
|
+
```
|
80
|
+
>> Stopping ...
|
81
|
+
```
|
82
|
+
|
83
|
+
## tDiary の更新
|
84
|
+
|
85
|
+
tDiaryのアップデートもgemコマンドを使います。
|
86
|
+
|
87
|
+
```
|
88
|
+
$ gem update tdiary
|
89
|
+
```
|
90
|
+
|
91
|
+
tDiaryの設置ディレクトリに展開されたファイルは、 tdiary updateコマンドを使って更新できます。
|
92
|
+
|
93
|
+
```
|
94
|
+
$ cd [tDiaryの設置ディレクトリ]
|
95
|
+
$ tdiary update
|
96
|
+
$ bundle install
|
97
|
+
```
|
data/doc/INSTALL.md
CHANGED
@@ -1,65 +1,21 @@
|
|
1
1
|
インストールマニュアル
|
2
|
-
|
2
|
+
======================
|
3
3
|
|
4
|
-
tDiary
|
5
|
-
|
4
|
+
tDiaryの設置
|
5
|
+
------------
|
6
6
|
|
7
|
-
|
7
|
+
tDiaryは様々な環境で動作します。それぞれの環境にあわせた設置手順を参照してください。
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
- 上記URLのパス: /home/foo/public\_html/diary
|
9
|
+
- 独自サーバ、VPSサーバなどのRack環境 … [INSTALL-rack.html](INSTALL-rack.html)
|
10
|
+
- Heroku、SqaleなどのPaaS環境 … [INSTALL-paas.html](INSTALL-paas.html)
|
11
|
+
- レンタルサーバなどのCGI環境 … [INSTALL-cgi.html](INSTALL-cgi.html)
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
配布アーカイブを展開し、中身をすべて/home/foo/public\_html/diaryにコピーします。以下の2つのファイルがCGIスクリプト本体なので、WWWサーバの権限で実行可能なようにパーミッションを設定してください。
|
17
|
-
|
18
|
-
- index.rb
|
19
|
-
- update.rb
|
20
|
-
|
21
|
-
また、/usr/bin/envを使った起動ができない環境では、各ファイルの先頭を、rubyのパスに書き換える必要があるでしょう。ISPのホームディレクトリにこっそりRubyを入れたような場合を除き、通常はあまり気にしなくても良いはずです。
|
22
|
-
|
23
|
-
### .htaccessの作成
|
24
|
-
|
25
|
-
続いて、CGIの実行環境を整えます。dot.htaccessを.htaccessにリネームして、環境に合わせて書き換えます。添付のサンプルは以下のようになっています。
|
26
|
-
|
27
|
-
```
|
28
|
-
Options +ExecCGI
|
29
|
-
AddHandler cgi-script .rb
|
30
|
-
DirectoryIndex index.rb
|
31
|
-
|
32
|
-
<Files "*.rhtml">
|
33
|
-
deny from all
|
34
|
-
</Files>
|
35
|
-
|
36
|
-
<Files "tdiary.*">
|
37
|
-
deny from all
|
38
|
-
</Files>
|
39
|
-
|
40
|
-
<Files update.rb>
|
41
|
-
AuthName tDiary
|
42
|
-
AuthType Basic
|
43
|
-
AuthUserFile /home/foo/.htpasswd
|
44
|
-
Require user foo
|
45
|
-
</Files>
|
46
|
-
```
|
47
|
-
|
48
|
-
ここでは、
|
49
|
-
|
50
|
-
- CGIの実行を可能にし、
|
51
|
-
- サフィックス「.rb」のファイルをCGIと認識させ、
|
52
|
-
- index.rbをデフォルトのファイルに設定し、
|
53
|
-
- *.rhtmlとtdiary.*のファイルの参照を禁止して、
|
54
|
-
- update.rbへのアクセスにはユーザ認証が必要
|
55
|
-
|
56
|
-
という設定になっています。とりあえず書き換えが必要なのは、AuthUserFileとRequire userでしょう。意味はWebででも調べて下さい。AuthUseFileは、あらかじめhtpasswdコマンドで作成しておく必要があります(これもWebで調べればわかります)。
|
57
|
-
|
58
|
-
また、利用するWWWサーバの設定が、CGIの実行ファイルのサフィックスを固定(例:.cgi)にしている場合があります。この場合、AddHandlerやDirectoryIndexも変更する必要があるでしょう。これに応じて、index.rbやupdate.rbのファイル名も変更する必要があります。
|
13
|
+
tDiaryの設定
|
14
|
+
------------
|
59
15
|
|
60
16
|
### tdiary.confの作成
|
61
17
|
|
62
|
-
|
18
|
+
tDiaryの設定ファイルであるtdiary.confを作ります。
|
63
19
|
|
64
20
|
初めてtDiaryをインストールする人には、付属のtdiary.conf.beginnerを使うのがオススメです。最初に使えるようにしておくと良いプラグインがあらかじめONになっていたり、spamフィルタにある程度の設定がされているなど、インストールしてすぐに使いやすい状態になっています。
|
65
21
|
|
@@ -111,7 +67,7 @@ load\_cgi\_confはその位置でCGIによる設定を読み込む指令です
|
|
111
67
|
なお、両者の指定位置は独立しているので、両者の位置を組み合わせることで様々な設定を行うことが可能です。また、@secureを指定しない場合のデフォルト値はtrueです。
|
112
68
|
|
113
69
|
tDiaryの実行
|
114
|
-
|
70
|
+
------------
|
115
71
|
|
116
72
|
### 日記の更新
|
117
73
|
|
@@ -150,7 +106,7 @@ tDiaryにはプラグインと呼ばれる機能があります。プラグイ
|
|
150
106
|
日記をつけ続けるだけです(これが一番難しい:-)。Have fun!!
|
151
107
|
|
152
108
|
著作権、サポートなど
|
153
|
-
|
109
|
+
--------------------
|
154
110
|
|
155
111
|
tDiary本体は、原作者であるただただし(t@tdtds.jp)が、GPL2の元で配布、改変を許可するフリーソフトウェアです。
|
156
112
|
|
data/index.rb
CHANGED
@@ -8,8 +8,6 @@
|
|
8
8
|
#
|
9
9
|
BEGIN { $stdout.binmode }
|
10
10
|
|
11
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile.cgi', __FILE__)
|
12
|
-
|
13
11
|
begin
|
14
12
|
if FileTest::symlink?( __FILE__ ) then
|
15
13
|
org_path = File::dirname( File::readlink( __FILE__ ) ).untaint
|
@@ -29,12 +27,12 @@ begin
|
|
29
27
|
@cgi = CGI::new(:accept_charset => 'shift_jis')
|
30
28
|
@cgi.params = cgi.params
|
31
29
|
end
|
30
|
+
|
32
31
|
request = TDiary::Request.new( ENV, @cgi )
|
33
32
|
status, headers, body = TDiary::Dispatcher.index.dispatch_cgi( request, @cgi )
|
34
|
-
headers['type'] = headers.delete('Content-Type')
|
35
|
-
TDiary::Dispatcher.send_headers( status, headers )
|
36
|
-
TDiary::Dispatcher.send_body( body )
|
37
33
|
|
34
|
+
TDiary::Dispatcher.send_headers( status, headers )
|
35
|
+
::Rack::Handler::CGI.send_body(body)
|
38
36
|
rescue Exception
|
39
37
|
if @cgi then
|
40
38
|
print @cgi.header( 'status' => CGI::HTTP_STATUS['SERVER_ERROR'], 'type' => 'text/html' )
|
data/misc/plugin/image.rb
CHANGED
@@ -86,13 +86,11 @@ def image( id, alt = 'image', thumbnail = nil, size = nil, place = 'photo' )
|
|
86
86
|
size = %Q| width="#{size.to_i}"|
|
87
87
|
end
|
88
88
|
elsif @image_maxwidth and not @conf.secure then
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
size = ""
|
95
|
-
end
|
89
|
+
t, w, h = image_info( "#{@image_dir}/#{image}".untaint )
|
90
|
+
if w > @image_maxwidth then
|
91
|
+
size = %Q[ width="#{h @image_maxwidth}"]
|
92
|
+
else
|
93
|
+
size = ""
|
96
94
|
end
|
97
95
|
end
|
98
96
|
if thumbnail then
|
@@ -138,9 +136,9 @@ end
|
|
138
136
|
#
|
139
137
|
|
140
138
|
def image_info( f )
|
141
|
-
require '
|
142
|
-
info =
|
143
|
-
[info.
|
139
|
+
require 'fastimage'
|
140
|
+
info = FastImage.new( f )
|
141
|
+
[info.type.to_s.sub( /jpeg/, 'jpg' ), info.size].flatten
|
144
142
|
end
|
145
143
|
|
146
144
|
def image_ext
|
@@ -182,10 +180,9 @@ if /^formplugin$/ =~ @mode then
|
|
182
180
|
images = image_list( date )
|
183
181
|
if @cgi.params['plugin_image_addimage'][0]
|
184
182
|
@cgi.params['plugin_image_file'].each do |file|
|
185
|
-
|
186
|
-
extension, = image_info( file )
|
183
|
+
extension, = image_info( file.path )
|
187
184
|
file.rewind
|
188
|
-
|
185
|
+
|
189
186
|
if extension =~ /\A(#{image_ext})\z/i
|
190
187
|
begin
|
191
188
|
size = file.size
|
@@ -237,7 +234,7 @@ add_form_proc do |date|
|
|
237
234
|
if @conf.secure then
|
238
235
|
img_type, img_w, img_h = 'jpg', nil, nil
|
239
236
|
else
|
240
|
-
img_type, img_w, img_h =
|
237
|
+
img_type, img_w, img_h = image_info(File.join(@image_dir,img).untaint)
|
241
238
|
end
|
242
239
|
r << %Q[<td><img id="image-index-#{id}" class="image-img form" src="#{h @image_url}/#{h img}" alt="#{id}" width="#{h( (img_w && img_w > 160) ? 160 : (img_w ? img_w : 160) )}"></td>]
|
243
240
|
if @conf.secure then
|
data/misc/style/gfm/gfm_style.rb
CHANGED
@@ -103,6 +103,10 @@ module TDiary
|
|
103
103
|
if r =~ /<a href="<a href="/
|
104
104
|
r.gsub!(/<a href="<a href=".*?" rel="nofollow">(.*?)<\/a>">(.*?)<\/a>/){ "<a href=\"#{$1}\" rel=\"nofollow\">#{$2}</a>" }
|
105
105
|
end
|
106
|
+
# ignore auto imagelink
|
107
|
+
if r =~ /<img src="<a href="/
|
108
|
+
r.gsub!(/<img src="<a href=".*?" rel="nofollow">(.*?)<\/a>"(?: alt="(.*?)")?>/){ "<img src=\"#{$1}\" alt=\"#{$2}\">" }
|
109
|
+
end
|
106
110
|
|
107
111
|
# emoji
|
108
112
|
r = r.emojify
|
data/misc/style/rd/rd_style.rb
CHANGED
@@ -99,8 +99,8 @@ module RD
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def apply_to_Footnote(element, content)
|
102
|
-
|
103
|
-
%Q|<%=fn
|
102
|
+
escaped_content = content.join.gsub( /%>/, "%%>" )
|
103
|
+
%Q|<%=fn apply_plugin( #{escaped_content.dump} ) %>|
|
104
104
|
end
|
105
105
|
|
106
106
|
def apply_to_RefToElement(element, content)
|
data/plugin/00default.rb
CHANGED
@@ -353,7 +353,7 @@ def description_tag
|
|
353
353
|
end
|
354
354
|
|
355
355
|
def jquery_tag
|
356
|
-
%Q[<script src="
|
356
|
+
%Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js" type="text/javascript"></script>]
|
357
357
|
end
|
358
358
|
|
359
359
|
enable_js( '00default.js' )
|
@@ -368,7 +368,7 @@ def script_tag_query_string
|
|
368
368
|
end
|
369
369
|
|
370
370
|
def js_url
|
371
|
-
|
371
|
+
@cgi.is_a?(RackCGI) ? 'assets' : 'js'
|
372
372
|
end
|
373
373
|
|
374
374
|
def script_tag
|
@@ -390,7 +390,7 @@ def script_tag
|
|
390
390
|
end
|
391
391
|
|
392
392
|
def theme_url
|
393
|
-
|
393
|
+
@cgi.is_a?(RackCGI) ? 'assets' : 'theme'
|
394
394
|
end
|
395
395
|
|
396
396
|
def css_tag
|