tdiary 4.0.1.20131102 → 4.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c92106283ff746cd9b3e761a47e88d977133daae
4
- data.tar.gz: ead05318a8f257deb9521da45639fd4ff5f85c51
3
+ metadata.gz: e3b1d5ff9c5be93ee04e88c9d5e1a1894e7e42dd
4
+ data.tar.gz: dc3abc8a1d49859c4db89e70c1f84c34d8176227
5
5
  SHA512:
6
- metadata.gz: 97153fc99872796fdfde5d18ee45a8e5559bb926c935a2e48df67c373f06608ab297b517dac886d7a5956a76bd7657dfdbba787e1264e87ecb0a8d65dcb15374
7
- data.tar.gz: 1b7ce4f5dfc798b3f7de85bc269758316f69eece15db576e23ec15273b557e0c10eef231405d4209af05be228aae2f2b84b5373b1c84697406f14c51fd2fde07
6
+ metadata.gz: a4fd13995035a6a6ac9a4a62cee6fdd567d9c0d5a4c3fbe88368d7ba082bc339dc918149164a2dc9fc0824ed1e8a63f9cc378a69b322f32ebab6832288811ab5
7
+ data.tar.gz: 5b7c08feb7f14e2cd6b002cd7a5105dcb6dde0d8b3278a11f8f22736ad6f54e39eb657b99b0467135c0b0faa1fbf7ecaebec4852aa3a48206019b3065b3c329e
data/.travis.yml CHANGED
@@ -1,3 +1,5 @@
1
+ language: ruby
2
+
1
3
  services: memcache
2
4
 
3
5
  rvm:
data/Gemfile.lock CHANGED
@@ -2,7 +2,7 @@ GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
4
  addressable (2.3.5)
5
- capybara (2.1.0)
5
+ capybara (2.2.0)
6
6
  mime-types (>= 1.16)
7
7
  nokogiri (>= 1.3.3)
8
8
  rack (>= 1.0.0)
@@ -10,7 +10,7 @@ GEM
10
10
  xpath (~> 2.0)
11
11
  childprocess (0.3.9)
12
12
  ffi (~> 1.0, >= 1.0.11)
13
- coderay (1.0.9)
13
+ coderay (1.1.0)
14
14
  coffee-script (2.2.0)
15
15
  coffee-script-source
16
16
  execjs
@@ -22,10 +22,11 @@ GEM
22
22
  term-ansicolor
23
23
  thor
24
24
  daemons (1.1.9)
25
- diff-lcs (1.2.4)
25
+ diff-lcs (1.2.5)
26
+ docile (1.1.1)
26
27
  eventmachine (1.0.3)
27
28
  execjs (2.0.2)
28
- fastimage (1.5.3)
29
+ fastimage (1.5.4)
29
30
  addressable (~> 2.3, >= 2.3.5)
30
31
  ffi (1.9.3)
31
32
  hike (1.2.3)
@@ -36,7 +37,7 @@ GEM
36
37
  rspec (>= 1.3.1)
37
38
  selenium-webdriver (>= 0.1.3)
38
39
  jasmine-core (1.3.1)
39
- launchy (2.3.0)
40
+ launchy (2.4.2)
40
41
  addressable (~> 2.3)
41
42
  libv8 (3.16.14.3)
42
43
  method_source (0.8.2)
@@ -46,8 +47,8 @@ GEM
46
47
  nokogiri (1.6.0)
47
48
  mini_portile (~> 0.5.0)
48
49
  pit (0.0.7)
49
- pry (0.9.12.2)
50
- coderay (~> 1.0.5)
50
+ pry (0.9.12.4)
51
+ coderay (~> 1.0)
51
52
  method_source (~> 0.8)
52
53
  slop (~> 3.4)
53
54
  rack (1.5.2)
@@ -65,7 +66,7 @@ GEM
65
66
  rspec-expectations (~> 2.14.0)
66
67
  rspec-mocks (~> 2.14.0)
67
68
  rspec-core (2.14.7)
68
- rspec-expectations (2.14.3)
69
+ rspec-expectations (2.14.4)
69
70
  diff-lcs (>= 1.1.3, < 2.0)
70
71
  rspec-mocks (2.14.4)
71
72
  rubyzip (1.0.0)
@@ -75,12 +76,13 @@ GEM
75
76
  rubyzip (~> 1.0.0)
76
77
  websocket (~> 1.0.4)
77
78
  sequel (4.4.0)
78
- simplecov (0.7.1)
79
- multi_json (~> 1.0)
80
- simplecov-html (~> 0.7.1)
81
- simplecov-html (0.7.1)
82
- slop (3.4.6)
83
- sprockets (2.10.0)
79
+ simplecov (0.8.2)
80
+ docile (~> 1.1.0)
81
+ multi_json
82
+ simplecov-html (~> 0.8.0)
83
+ simplecov-html (0.8.0)
84
+ slop (3.4.7)
85
+ sprockets (2.10.1)
84
86
  hike (~> 1.2)
85
87
  multi_json (~> 1.0)
86
88
  rack (~> 1.0)
@@ -100,7 +102,7 @@ GEM
100
102
  rack (>= 1.0.0)
101
103
  thor (0.18.1)
102
104
  tilt (1.4.1)
103
- tins (0.12.0)
105
+ tins (0.13.1)
104
106
  websocket (1.0.7)
105
107
  xpath (2.0.0)
106
108
  nokogiri (~> 1.3)
data/config.ru CHANGED
@@ -1,4 +1,5 @@
1
1
  $:.unshift( File::dirname( __FILE__ ).untaint )
2
+ require 'tdiary'
2
3
  require 'tdiary/environment'
3
4
  require 'tdiary/application'
4
5
 
@@ -39,27 +39,22 @@ htpasswd -cd .htpasswd username
39
39
 
40
40
  ### ライブラリを有効にする
41
41
 
42
- まず、利用する外部サービスに対応したライブラリを有効にします。Twitter認証では `omniauth-twitter` ライブラリを使用します。Gemfileにて以下の行が有効になっていることを確認してください。無ければ追加してください。
42
+ まず、利用する外部サービスに対応したライブラリを有効にします。Twitter認証では `omniauth-twitter` ライブラリを使用します。Gemfile.localにて以下の行が有効になっていることを確認してください。無ければ追加してください。
43
43
 
44
44
  ```
45
45
  gem 'omniauth'
46
46
  gem 'omniauth-twitter'
47
47
  ```
48
48
 
49
- 次に設定ファイル `config.ru` を編集します。 `use OmniAuth::Builder` ブロック内の `provier :twitter` で始まる行を有効にします。
49
+ 次に設定ファイル `config.ru` を編集します。 ```run TDiary::Applicationn.new( base_dir )``` の前に以下の行を追加します。無ければ追加してください。
50
50
 
51
51
  ```
52
- # OmniAuth settings
53
- use Rack::Session::Pool, :expire_after => 2592000
54
- use OmniAuth::Builder do
55
- configure {|conf| conf.path_prefix = "#{base_dir}/auth" }
56
- provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
57
- end
52
+ require 'tdiary/application/extension/omniauth'
58
53
  ```
59
54
 
60
55
  ### 鍵とパスワードの取得と環境変数への設定
61
56
 
62
- 設定ファイル `config.ru` に書かれているTWITTER_KEYとTWITTER_SECRETは、Twitter認証を利用するための鍵 (Consumer key) とパスワード (Consumer secret) です。これらは[Twitterのサイト](https://dev.twitter.com/apps/new)から取得できます。
57
+ Twitter 認証を使うためには、Twitter認証を利用するための鍵 (Consumer key) とパスワード (Consumer secret) としてTWITTER_KEYとTWITTER_SECRETを環境変数として設定する必要があります。これらは[Twitterのサイト](https://dev.twitter.com/apps/new)から取得できます。
63
58
 
64
59
  鍵とパスワードを取得したら環境変数に設定します。
65
60
 
@@ -72,18 +67,10 @@ export TWITTER_SECRET="your_consumer_secret"
72
67
 
73
68
  ### 編集画面へのアクセスを許可するアカウントの設定
74
69
 
75
- 日記の編集画面へのアクセスを許可するアカウントを設定します。 `config.ru` 内の `use TDiary::Rack::Auth::OmniAuth` で始まるブロックをコメントアウトしてください。
70
+ 日記の編集画面へのアクセスを許可するアカウントを設定します。 環境変数TWITTER_NAMEにログインを許可したい twitter のアカウント名(スクリーンネーム)を設定して下さい。
76
71
 
77
72
  ```
78
- map "#{base_dir}/update.rb" do
79
- # use TDiary::Rack::Auth::Basic, '.htpasswd'
80
- use TDiary::Rack::Auth::OmniAuth, :twitter do |auth|
81
- auth.info.nickname == 'your_twitter_screen_name'
82
- end
83
- run TDiary::Application.new(:update)
84
- end
73
+ export TWITTER_NAME='your_twitter_screen_name'
85
74
  ```
86
75
 
87
- `your_twitter_screen_name` にあなたのTwitterアカウント名を設定します。
88
-
89
- 日記の編集画面にアクセスすると、Twitterのログイン画面が表示されるようになります。編集画面へは `your_twitter_screen_name` で指定したアカウントのみがアクセスできます。
76
+ 日記の編集画面にアクセスすると、Twitterのログイン画面が表示されるようになります。編集画面へは `your_twitter_screen_name` で指定したアカウントのみがアクセスできます。
@@ -18,18 +18,24 @@ tDiary-3.0.1.20101011 以降のバージョンでは tDiary を test するた
18
18
 
19
19
  tDiary でテストを実行するためには以下の環境を用意する必要があります。
20
20
 
21
- - Ruby 1.9.2 以降または Ruby 2.0.0 以降
22
- - RubyGems 1.3.7 以降
23
- - Bundler 1.0.0 以降
21
+ - Ruby 1.9.3 または Ruby 2.0.0
22
+ - Bundler 1.3.5 以降
24
23
 
25
24
  動かし方
26
25
  ----
27
26
 
28
27
  tDiary のルートディレクトリ(Gemfile が存在する箇所) で以下のコマンドを実行します。
29
28
 
29
+ ```
30
+ bundle install
31
+ ```
32
+
33
+ Ruby をインストールしているディレクトリへの書き込み権限がない場合は --path オプションを付けることで任意のディレクトリに依存 gem をインストールすることができます。
34
+
30
35
  ```
31
36
  bundle install --path ~/.bundle
32
37
  ```
38
+
33
39
  bundler によるインストールが完了すると、tDiary でテストを実行できるようになります。以下のコマンドを実行すると、tDiary に付属しているテストが全て実行されます。
34
40
 
35
41
  ```
@@ -41,4 +47,6 @@ bundle exec rake spec
41
47
 
42
48
  tDiary に用意されているテストは以下の3種類で構成されています。この構成は今後も変更される可能性もあるので、Rake -T コマンドを実行して Rake タスクの内容を確認するようにしてください。
43
49
 
44
- rake spec:acceptanceEnd-to-End のテストを実行しますrake spec:corecore(tDiary本体)に関わるテストを実行します。rake spec:pluginmisc/plugin 配下に存在するプラグインファイルのテストを実行します。
50
+ - spec:core: core(tDiary本体)に関わるテストを実行します。
51
+ - spec:plugin: misc/plugin 配下に存在するプラグインファイルのテストを実行します。
52
+ - spec:acceptance: 日記の作成や削除について、HTTPリクエストからデータの保存までの End-to-End のテストを実行します
@@ -4,19 +4,16 @@ gem 'rake'
4
4
 
5
5
  gem 'rack'
6
6
  gem 'sprockets'
7
+ gem 'hikidoc'
8
+ gem 'fastimage'
9
+
7
10
  gem 'omniauth'
8
11
  gem 'omniauth-twitter'
9
12
  gem 'omniauth-github'
10
13
 
11
- gem 'coffee-script'
12
-
13
- gem 'redcarpet'
14
- gem 'twitter-text', require: false
15
- gem 'pygments.rb'
16
-
17
14
  gem 'thin', require: false
18
- gem 'sequel'
15
+ gem 'tdiary-io-rdb'
19
16
  gem 'pg'
20
17
 
21
- # To use memcached for CacheIO
22
- # gem 'dalli'
18
+ # To use memcached for Cache
19
+ # gem 'tdiary-cache-memcached'
@@ -1,22 +1,20 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- coffee-script (2.2.0)
5
- coffee-script-source
6
- execjs
7
- coffee-script-source (1.6.2)
4
+ addressable (2.3.5)
8
5
  daemons (1.1.9)
9
6
  eventmachine (1.0.3)
10
- execjs (1.4.0)
11
- multi_json (~> 1.0)
12
- faraday (0.8.7)
13
- multipart-post (~> 1.1)
14
- hashie (2.0.3)
15
- hike (1.2.2)
7
+ faraday (0.8.8)
8
+ multipart-post (~> 1.2.0)
9
+ fastimage (1.5.4)
10
+ addressable (~> 2.3, >= 2.3.5)
11
+ hashie (2.0.5)
12
+ hike (1.2.3)
13
+ hikidoc (0.0.6)
16
14
  httpauth (0.2.0)
17
15
  jwt (0.1.8)
18
16
  multi_json (>= 1.5)
19
- multi_json (1.7.2)
17
+ multi_json (1.8.2)
20
18
  multipart-post (1.2.0)
21
19
  oauth (0.4.7)
22
20
  oauth2 (0.8.1)
@@ -28,7 +26,7 @@ GEM
28
26
  omniauth (1.1.4)
29
27
  hashie (>= 1.2, < 3)
30
28
  rack
31
- omniauth-github (1.1.0)
29
+ omniauth-github (1.1.1)
32
30
  omniauth (~> 1.0)
33
31
  omniauth-oauth2 (~> 1.1)
34
32
  omniauth-oauth (1.0.1)
@@ -37,49 +35,38 @@ GEM
37
35
  omniauth-oauth2 (1.1.1)
38
36
  oauth2 (~> 0.8.0)
39
37
  omniauth (~> 1.0)
40
- omniauth-twitter (0.0.16)
38
+ omniauth-twitter (1.0.1)
41
39
  multi_json (~> 1.3)
42
40
  omniauth-oauth (~> 1.0)
43
- pg (0.15.1)
44
- posix-spawn (0.3.6)
45
- pygments.rb (0.5.0)
46
- posix-spawn (~> 0.3.6)
47
- yajl-ruby (~> 1.1.0)
41
+ pg (0.17.0)
48
42
  rack (1.5.2)
49
- rake (10.0.4)
50
- redcarpet (2.2.2)
51
- sequel (3.46.0)
52
- sprockets (2.9.3)
43
+ rake (10.1.0)
44
+ sequel (4.4.0)
45
+ sprockets (2.10.1)
53
46
  hike (~> 1.2)
54
47
  multi_json (~> 1.0)
55
48
  rack (~> 1.0)
56
49
  tilt (~> 1.1, != 1.3.0)
57
- thin (1.5.1)
50
+ tdiary-io-rdb (0.0.1)
51
+ sequel
52
+ thin (1.6.1)
58
53
  daemons (>= 1.0.9)
59
- eventmachine (>= 0.12.6)
54
+ eventmachine (>= 1.0.0)
60
55
  rack (>= 1.0.0)
61
- tilt (1.3.7)
62
- twitter-text (1.6.1)
63
- unf (~> 0.0.5)
64
- unf (0.0.5)
65
- unf_ext
66
- unf_ext (0.0.6)
67
- yajl-ruby (1.1.0)
56
+ tilt (1.4.1)
68
57
 
69
58
  PLATFORMS
70
59
  ruby
71
60
 
72
61
  DEPENDENCIES
73
- coffee-script
62
+ fastimage
63
+ hikidoc
74
64
  omniauth
75
65
  omniauth-github
76
66
  omniauth-twitter
77
67
  pg
78
- pygments.rb
79
68
  rack
80
69
  rake
81
- redcarpet
82
- sequel
83
70
  sprockets
71
+ tdiary-io-rdb
84
72
  thin
85
- twitter-text
@@ -1,13 +1,9 @@
1
1
  require 'tempfile'
2
2
  @data_path = Dir.tmpdir
3
3
 
4
- @style = 'GFM'
4
+ @style = 'Wiki'
5
5
 
6
- require 'tdiary/io/cache/file'
7
- # To use memcache addon
8
- # require 'tdiary/io/cache/memcached'
9
- require 'tdiary/io/rdb'
10
- @io_class = TDiary::RdbIO
6
+ @io_class = TDiary::IO::Rdb
11
7
 
12
8
  @index = './'
13
9
  @update = 'update.rb'
@@ -4,16 +4,13 @@ gem 'rake'
4
4
 
5
5
  gem 'rack'
6
6
  gem 'sprockets'
7
+ gem 'hikidoc'
8
+ gem 'fastimage'
9
+
7
10
  gem 'omniauth'
8
11
  gem 'omniauth-twitter'
9
12
  gem 'omniauth-github'
10
13
 
11
- gem 'coffee-script'
12
-
13
- gem 'redcarpet'
14
- gem 'twitter-text', require: false
15
- gem 'pygments.rb'
16
-
17
14
  gem 'thin', require: false
18
- gem 'sequel'
15
+ gem 'tdiary-io-rdb'
19
16
  gem 'mysql2'
@@ -1,24 +1,22 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- coffee-script (2.2.0)
5
- coffee-script-source
6
- execjs
7
- coffee-script-source (1.6.2)
4
+ addressable (2.3.5)
8
5
  daemons (1.1.9)
9
6
  eventmachine (1.0.3)
10
- execjs (1.4.0)
11
- multi_json (~> 1.0)
12
- faraday (0.8.7)
13
- multipart-post (~> 1.1)
14
- hashie (2.0.3)
15
- hike (1.2.2)
7
+ faraday (0.8.8)
8
+ multipart-post (~> 1.2.0)
9
+ fastimage (1.5.4)
10
+ addressable (~> 2.3, >= 2.3.5)
11
+ hashie (2.0.5)
12
+ hike (1.2.3)
13
+ hikidoc (0.0.6)
16
14
  httpauth (0.2.0)
17
15
  jwt (0.1.8)
18
16
  multi_json (>= 1.5)
19
- multi_json (1.7.2)
17
+ multi_json (1.8.2)
20
18
  multipart-post (1.2.0)
21
- mysql2 (0.3.11)
19
+ mysql2 (0.3.14)
22
20
  oauth (0.4.7)
23
21
  oauth2 (0.8.1)
24
22
  faraday (~> 0.8)
@@ -29,7 +27,7 @@ GEM
29
27
  omniauth (1.1.4)
30
28
  hashie (>= 1.2, < 3)
31
29
  rack
32
- omniauth-github (1.1.0)
30
+ omniauth-github (1.1.1)
33
31
  omniauth (~> 1.0)
34
32
  omniauth-oauth2 (~> 1.1)
35
33
  omniauth-oauth (1.0.1)
@@ -38,48 +36,37 @@ GEM
38
36
  omniauth-oauth2 (1.1.1)
39
37
  oauth2 (~> 0.8.0)
40
38
  omniauth (~> 1.0)
41
- omniauth-twitter (0.0.16)
39
+ omniauth-twitter (1.0.1)
42
40
  multi_json (~> 1.3)
43
41
  omniauth-oauth (~> 1.0)
44
- posix-spawn (0.3.6)
45
- pygments.rb (0.5.0)
46
- posix-spawn (~> 0.3.6)
47
- yajl-ruby (~> 1.1.0)
48
42
  rack (1.5.2)
49
- rake (10.0.4)
50
- redcarpet (2.2.2)
51
- sequel (3.46.0)
52
- sprockets (2.9.3)
43
+ rake (10.1.0)
44
+ sequel (4.4.0)
45
+ sprockets (2.10.1)
53
46
  hike (~> 1.2)
54
47
  multi_json (~> 1.0)
55
48
  rack (~> 1.0)
56
49
  tilt (~> 1.1, != 1.3.0)
57
- thin (1.5.1)
50
+ tdiary-io-rdb (0.0.1)
51
+ sequel
52
+ thin (1.6.1)
58
53
  daemons (>= 1.0.9)
59
- eventmachine (>= 0.12.6)
54
+ eventmachine (>= 1.0.0)
60
55
  rack (>= 1.0.0)
61
- tilt (1.3.7)
62
- twitter-text (1.6.1)
63
- unf (~> 0.0.5)
64
- unf (0.0.5)
65
- unf_ext
66
- unf_ext (0.0.6)
67
- yajl-ruby (1.1.0)
56
+ tilt (1.4.1)
68
57
 
69
58
  PLATFORMS
70
59
  ruby
71
60
 
72
61
  DEPENDENCIES
73
- coffee-script
62
+ fastimage
63
+ hikidoc
74
64
  mysql2
75
65
  omniauth
76
66
  omniauth-github
77
67
  omniauth-twitter
78
- pygments.rb
79
68
  rack
80
69
  rake
81
- redcarpet
82
- sequel
83
70
  sprockets
71
+ tdiary-io-rdb
84
72
  thin
85
- twitter-text
@@ -0,0 +1,95 @@
1
+ require 'spec_helper'
2
+
3
+ require 'tdiary/cache/file'
4
+ require 'tdiary/io/default'
5
+
6
+ describe TDiary::IO::Default do
7
+ it 'is_a TDiary::IO::Base' do
8
+ expect { TDiary::IO::Default.is_a?(TDiary::IO::Base) }.to be_true
9
+ end
10
+
11
+ describe "#save_cgi_conf and #load_cgi_conf" do
12
+ let(:conf) do
13
+ conf = DummyConf.new
14
+ conf.data_path = TDiary.root + "/tmp/"
15
+ conf
16
+ end
17
+
18
+ it { expect(TDiary::IO::Default.load_cgi_conf(conf)).to be_nil }
19
+
20
+ context "given body" do
21
+ before do
22
+ TDiary::IO::Default.save_cgi_conf(conf, 'foo')
23
+ end
24
+
25
+ it { expect(TDiary::IO::Default.load_cgi_conf(conf)).to eq 'foo' }
26
+
27
+ context "update" do
28
+ before do
29
+ TDiary::IO::Default.save_cgi_conf(conf, 'bar')
30
+ end
31
+ it { expect(TDiary::IO::Default.load_cgi_conf(conf)).to eq 'bar' }
32
+ end
33
+ end
34
+ end
35
+
36
+ describe "#transaction" do
37
+ let(:io) { TDiary::IO::Default.new(DummyTDiary.new) }
38
+ let(:today) { Time.now.strftime( '%Y%m%d' ) }
39
+
40
+ before do
41
+ io.transaction( Time.now ) do |diaries|
42
+ @diaries = diaries
43
+ diary = io.diary_factory(today, "foo", "", "wiki")
44
+ @diaries[today] = diary.append("bar", "hsbt")
45
+ TDiary::TDiaryBase::DIRTY_DIARY
46
+ end
47
+ end
48
+
49
+ subject { File.open(TDiary.root + "/tmp/#{Time.now.year}/#{Time.now.year}#{Time.now.month}.td2").read }
50
+ it { expect(subject).to be_include "foo" }
51
+ it { expect(subject).to be_include "bar" }
52
+
53
+ it "restore diary" do
54
+ io.transaction( Time.now ) do |diaries|
55
+ @diaries = diaries
56
+ expect(@diaries[today].title).to eq "foo"
57
+ expect(@diaries[today].to_src).to be_include "bar"
58
+ TDiary::TDiaryBase::DIRTY_DIARY
59
+ end
60
+ end
61
+
62
+ context "update diary" do
63
+ before do
64
+ io.transaction( Time.now ) do |diaries|
65
+ @diaries = diaries
66
+ @diaries[today].replace(today, "buzz", "alice")
67
+ TDiary::TDiaryBase::DIRTY_DIARY
68
+ end
69
+ end
70
+
71
+ subject { File.open(TDiary.root + "/tmp/#{Time.now.year}/#{Time.now.year}#{Time.now.month}.td2").read }
72
+
73
+ it "update contents of diary" do
74
+ expect(subject).to_not be_nil
75
+ expect(subject).to_not be_include "foo"
76
+ expect(subject).to_not be_include "bar"
77
+ expect(subject).to be_include "buzz"
78
+ expect(subject).to be_include "alice"
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ before(:all) do
85
+ ["/tmp/tdiary.conf", "/tmp/#{Time.now.year}"].each do |file|
86
+ FileUtils.rm_rf TDiary.root + file
87
+ end
88
+ end
89
+
90
+ after(:all) do
91
+ ["/tmp/tdiary.conf", "/tmp/#{Time.now.year}"].each do |file|
92
+ FileUtils.rm_rf TDiary.root + file
93
+ end
94
+ end
95
+ end
@@ -5,6 +5,12 @@ require 'tdiary'
5
5
  require 'tdiary/style/tdiary'
6
6
 
7
7
  describe TDiary::Style::TdiaryDiary do
8
+ before :all do
9
+ klass = TDiary::Style::TdiaryDiary
10
+ klass.send(:include, TDiary::Style::BaseDiary)
11
+ klass.send(:include, TDiary::Style::CategorizableDiary)
12
+ end
13
+
8
14
  before do
9
15
  @diary = TDiary::Style::TdiaryDiary.new(Time::at( 1041346800 ), "TITLE", "")
10
16
  end
@@ -5,8 +5,15 @@ require 'tdiary'
5
5
  require 'tdiary/style/wiki'
6
6
 
7
7
  describe TDiary::Style::WikiDiary do
8
+ before :all do
9
+ klass = TDiary::Style::WikiDiary
10
+ klass.send(:include, TDiary::Style::BaseDiary)
11
+ klass.send(:include, TDiary::Style::CategorizableDiary)
12
+ TDiary::Style::WikiSection.send(:include, TDiary::Style::BaseSection)
13
+ end
14
+
8
15
  before do
9
- @diary = TDiary::Style::WikiDiary.new(Time.at( 1041346800 ), "TITLE", "")
16
+ @diary = TDiary::Style::WikiDiary.new(Time::at( 1041346800 ), "TITLE", "")
10
17
  end
11
18
 
12
19
  describe '#append' do
data/spec/spec_helper.rb CHANGED
@@ -23,6 +23,34 @@ RSpec.configure do |config|
23
23
  config.treat_symbols_as_metadata_keys_with_true_values = true
24
24
  end
25
25
 
26
+ class DummyTDiary
27
+ def conf
28
+ conf = DummyConf.new
29
+ conf.data_path = TDiary.root + "/tmp/"
30
+ conf
31
+ end
32
+
33
+ def ignore_parser_cache
34
+ false
35
+ end
36
+ end
37
+
38
+ class DummyConf
39
+ attr_accessor :data_path
40
+
41
+ def cache_path
42
+ TDiary.root + "/tmp/cache"
43
+ end
44
+
45
+ def options
46
+ {}
47
+ end
48
+
49
+ def style
50
+ "wiki"
51
+ end
52
+ end
53
+
26
54
  # Local Variables:
27
55
  # mode: ruby
28
56
  # indent-tabs-mode: t
@@ -18,6 +18,6 @@ TDiary::Application.configure do
18
18
 
19
19
  config.authenticate TDiary::Rack::Auth::OmniAuth, :twitter do |auth|
20
20
  # TODO: an user can setting
21
- auth.info.nickname == 'your_twitter_screen_name'
21
+ auth.info.nickname == ENV['TWITTER_NAME'] || ENV['GITHUB_NAME']
22
22
  end
23
23
  end
@@ -101,8 +101,11 @@ module TDiary
101
101
  def_vars2 << "@#{var} = #{var} unless #{var} == nil\n"
102
102
  end
103
103
 
104
- unless @io_class
104
+ unless defined?(::TDiary::Cache) && ::TDiary::Cache.method_defined?(:store_cache)
105
105
  require 'tdiary/cache/file'
106
+ end
107
+
108
+ unless @io_class
106
109
  require 'tdiary/io/default'
107
110
  @io_class = IO::Default
108
111
  end
@@ -1,5 +1,9 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
+ # name spaces reservation
4
+ module TDiary; end
5
+ module TDiary::Cache; end
6
+
3
7
  # Set up gems listed in the Gemfile.
4
8
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
9
 
data/tdiary/io/default.rb CHANGED
@@ -35,7 +35,7 @@ module TDiary
35
35
  s.split( /\r?\n\.\r?\n/ ).each do |l|
36
36
  headers, body = Default.parse_tdiary( l )
37
37
  next unless body
38
- comment = Comment::new(
38
+ comment = ::TDiary::Comment::new(
39
39
  headers['Name'],
40
40
  headers['Mail'],
41
41
  body,
data/tdiary/style.rb CHANGED
@@ -1,4 +1,8 @@
1
1
  # -*- coding: utf-8 -*-
2
+
3
+ require 'tdiary/comment_manager'
4
+ require 'tdiary/referer_manager'
5
+
2
6
  module TDiary
3
7
  module Style
4
8
  module BaseSection
data/tdiary/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TDiary
2
- VERSION = '4.0.1.20131102'
2
+ VERSION = '4.0.2'
3
3
  end
data/tdiary.rb CHANGED
@@ -49,8 +49,6 @@ module TDiary
49
49
  # Diary model class
50
50
  autoload :Style, 'tdiary/style'
51
51
  autoload :Comment, 'tdiary/comment'
52
- autoload :CommentManager, 'tdiary/comment_manager'
53
- autoload :RefererManager, 'tdiary/referer_manager'
54
52
 
55
53
  # Routing and Dispatch
56
54
  autoload :Dispatcher, 'tdiary/dispatcher'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tdiary
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1.20131102
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-02 00:00:00.000000000 Z
13
+ date: 2013-11-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
@@ -310,6 +310,7 @@ files:
310
310
  - spec/core/compatible_spec.rb
311
311
  - spec/core/configuration_spec.rb
312
312
  - spec/core/core_ext_spec.rb
313
+ - spec/core/io/default_spec.rb
313
314
  - spec/core/plugin_spec.rb
314
315
  - spec/core/rack/assets/precompile_spec.rb
315
316
  - spec/core/rack/html_anchor_spec.rb
@@ -462,6 +463,7 @@ test_files:
462
463
  - spec/core/compatible_spec.rb
463
464
  - spec/core/configuration_spec.rb
464
465
  - spec/core/core_ext_spec.rb
466
+ - spec/core/io/default_spec.rb
465
467
  - spec/core/plugin_spec.rb
466
468
  - spec/core/rack/assets/precompile_spec.rb
467
469
  - spec/core/rack/html_anchor_spec.rb