tdiary 4.0.1.20130929 → 4.0.1.20131102
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/Gemfile +0 -9
- data/Gemfile.lock +16 -22
- data/misc/convert2.rb +2 -2
- data/misc/plugin/disp_referrer.rb +1 -1
- data/plugin/05referer.rb +1 -1
- data/plugin/90migrate.rb +1 -1
- data/spec/acceptance/save_conf_referer_spec.rb +3 -3
- data/spec/acceptance_helper.rb +2 -34
- data/tdiary/{io/cache → cache}/file.rb +1 -1
- data/tdiary/configuration.rb +2 -2
- data/tdiary/io/base.rb +49 -47
- data/tdiary/io/default.rb +214 -212
- data/tdiary/io/pstore.rb +43 -41
- data/tdiary/tasks/release.rake +1 -1
- data/tdiary/tasks/rspec.rake +0 -6
- data/tdiary/version.rb +1 -1
- data/test/disp_referrer_test.rb +1 -1
- metadata +14 -19
- data/spec/fixtures/tdiary.conf.rdb +0 -227
- data/tdiary/io/cache/memcached.rb +0 -88
- data/tdiary/io/cache/redis.rb +0 -100
- data/tdiary/io/rdb.rb +0 -213
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92106283ff746cd9b3e761a47e88d977133daae
|
4
|
+
data.tar.gz: ead05318a8f257deb9521da45639fd4ff5f85c51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97153fc99872796fdfde5d18ee45a8e5559bb926c935a2e48df67c373f06608ab297b517dac886d7a5956a76bd7657dfdbba787e1264e87ecb0a8d65dcb15374
|
7
|
+
data.tar.gz: 1b7ce4f5dfc798b3f7de85bc269758316f69eece15db576e23ec15273b557e0c10eef231405d4209af05be228aae2f2b84b5373b1c84697406f14c51fd2fde07
|
data/.travis.yml
CHANGED
@@ -15,11 +15,10 @@ before_install:
|
|
15
15
|
before_script:
|
16
16
|
- DAEMON=1 bundle exec rake server
|
17
17
|
|
18
|
-
script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec
|
18
|
+
script: if [ $TEST_MODE = "gem" ] ; then bundle exec tdiary test ; else bundle exec rake spec jasmine:ci test ; fi
|
19
19
|
|
20
20
|
env:
|
21
21
|
- TEST_MODE=rack
|
22
|
-
- TEST_MODE=rdb
|
23
22
|
- TEST_MODE=webrick
|
24
23
|
- TEST_MODE=secure
|
25
24
|
- TEST_MODE=gem
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -22,12 +22,12 @@ GEM
|
|
22
22
|
term-ansicolor
|
23
23
|
thor
|
24
24
|
daemons (1.1.9)
|
25
|
-
dalli (2.6.4)
|
26
25
|
diff-lcs (1.2.4)
|
27
26
|
eventmachine (1.0.3)
|
28
|
-
execjs (2.0.
|
29
|
-
fastimage (1.5.
|
30
|
-
|
27
|
+
execjs (2.0.2)
|
28
|
+
fastimage (1.5.3)
|
29
|
+
addressable (~> 2.3, >= 2.3.5)
|
30
|
+
ffi (1.9.3)
|
31
31
|
hike (1.2.3)
|
32
32
|
hikidoc (0.0.6)
|
33
33
|
jasmine (1.3.2)
|
@@ -40,9 +40,9 @@ GEM
|
|
40
40
|
addressable (~> 2.3)
|
41
41
|
libv8 (3.16.14.3)
|
42
42
|
method_source (0.8.2)
|
43
|
-
mime-types (
|
44
|
-
mini_portile (0.5.
|
45
|
-
multi_json (1.8.
|
43
|
+
mime-types (2.0)
|
44
|
+
mini_portile (0.5.2)
|
45
|
+
multi_json (1.8.2)
|
46
46
|
nokogiri (1.6.0)
|
47
47
|
mini_portile (~> 0.5.0)
|
48
48
|
pit (0.0.7)
|
@@ -57,9 +57,6 @@ GEM
|
|
57
57
|
rack (>= 1.0)
|
58
58
|
rack-test (>= 0.5)
|
59
59
|
rake (10.1.0)
|
60
|
-
redis (3.0.4)
|
61
|
-
redis-namespace (1.3.1)
|
62
|
-
redis (~> 3.0.0)
|
63
60
|
ref (1.0.5)
|
64
61
|
rest-client (1.6.7)
|
65
62
|
mime-types (>= 1.16)
|
@@ -67,17 +64,17 @@ GEM
|
|
67
64
|
rspec-core (~> 2.14.0)
|
68
65
|
rspec-expectations (~> 2.14.0)
|
69
66
|
rspec-mocks (~> 2.14.0)
|
70
|
-
rspec-core (2.14.
|
67
|
+
rspec-core (2.14.7)
|
71
68
|
rspec-expectations (2.14.3)
|
72
69
|
diff-lcs (>= 1.1.3, < 2.0)
|
73
|
-
rspec-mocks (2.14.
|
74
|
-
rubyzip (0.
|
75
|
-
selenium-webdriver (2.
|
70
|
+
rspec-mocks (2.14.4)
|
71
|
+
rubyzip (1.0.0)
|
72
|
+
selenium-webdriver (2.37.0)
|
76
73
|
childprocess (>= 0.2.5)
|
77
74
|
multi_json (~> 1.0)
|
78
|
-
rubyzip (
|
75
|
+
rubyzip (~> 1.0.0)
|
79
76
|
websocket (~> 1.0.4)
|
80
|
-
sequel (4.
|
77
|
+
sequel (4.4.0)
|
81
78
|
simplecov (0.7.1)
|
82
79
|
multi_json (~> 1.0)
|
83
80
|
simplecov-html (~> 0.7.1)
|
@@ -97,13 +94,13 @@ GEM
|
|
97
94
|
therubyracer (0.12.0)
|
98
95
|
libv8 (~> 3.16.14.0)
|
99
96
|
ref
|
100
|
-
thin (1.
|
97
|
+
thin (1.6.1)
|
101
98
|
daemons (>= 1.0.9)
|
102
|
-
eventmachine (>= 0.
|
99
|
+
eventmachine (>= 1.0.0)
|
103
100
|
rack (>= 1.0.0)
|
104
101
|
thor (0.18.1)
|
105
102
|
tilt (1.4.1)
|
106
|
-
tins (0.
|
103
|
+
tins (0.12.0)
|
107
104
|
websocket (1.0.7)
|
108
105
|
xpath (2.0.0)
|
109
106
|
nokogiri (~> 1.3)
|
@@ -115,7 +112,6 @@ DEPENDENCIES
|
|
115
112
|
capybara
|
116
113
|
coffee-script
|
117
114
|
coveralls
|
118
|
-
dalli
|
119
115
|
fastimage
|
120
116
|
hikidoc
|
121
117
|
jasmine
|
@@ -125,8 +121,6 @@ DEPENDENCIES
|
|
125
121
|
rack
|
126
122
|
racksh
|
127
123
|
rake
|
128
|
-
redis
|
129
|
-
redis-namespace
|
130
124
|
rspec
|
131
125
|
selenium-webdriver
|
132
126
|
sequel
|
data/misc/convert2.rb
CHANGED
@@ -91,8 +91,8 @@ module TDiary
|
|
91
91
|
false
|
92
92
|
end
|
93
93
|
|
94
|
-
require 'tdiary/
|
95
|
-
|
94
|
+
require 'tdiary/io/default'
|
95
|
+
IO::Default::new( self ).transaction( date ) do |diaries|
|
96
96
|
diaries.update( @diaries )
|
97
97
|
TDiaryBase::DIRTY_DIARY | TDiaryBase::DIRTY_COMMENT | TDiaryBase::DIRTY_REFERER
|
98
98
|
end
|
@@ -564,7 +564,7 @@ class DispRef2Setup < Hash
|
|
564
564
|
options_key = "disp_referrer2.#{key}"
|
565
565
|
self[key] = @options[options_key] if @options.has_key?( options_key )
|
566
566
|
end
|
567
|
-
self['no_cache'] = true if defined?(::TDiary::
|
567
|
+
self['no_cache'] = true if defined?(::TDiary::IO::Default) && @conf.io_class == ::TDiary::IO::Default
|
568
568
|
|
569
569
|
# additions
|
570
570
|
self['labels'] = {
|
data/plugin/05referer.rb
CHANGED
@@ -15,7 +15,7 @@ add_header_proc do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def referer_save_trigger
|
18
|
-
return unless @conf.io_class.to_s == 'TDiary::
|
18
|
+
return unless @conf.io_class.to_s == 'TDiary::IO::Default'
|
19
19
|
return unless @mode =~ /^(latest|day|edit|append|replace)$/
|
20
20
|
|
21
21
|
if @date then
|
data/plugin/90migrate.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'acceptance_helper'
|
3
3
|
|
4
4
|
feature 'リンク元設定の利用' do
|
5
|
-
scenario 'リンク元の非表示設定'
|
5
|
+
scenario 'リンク元の非表示設定' do
|
6
6
|
append_default_diary
|
7
7
|
visit '/update.rb?conf=referer'
|
8
8
|
select('非表示', :from => 'show_referer')
|
@@ -16,7 +16,7 @@ feature 'リンク元設定の利用' do
|
|
16
16
|
within('div.day') { page.should have_no_css('div[class="refererlist"]') }
|
17
17
|
end
|
18
18
|
|
19
|
-
scenario 'リンク元記録の除外設定が動いている'
|
19
|
+
scenario 'リンク元記録の除外設定が動いている' do
|
20
20
|
append_default_diary
|
21
21
|
visit '/update.rb?conf=referer'
|
22
22
|
fill_in 'no_referer', :with => '^http://www\.example\.com/.*'
|
@@ -30,7 +30,7 @@ feature 'リンク元設定の利用' do
|
|
30
30
|
within('div.day div.refererlist') { page.should have_no_link('http://www.example.com') }
|
31
31
|
end
|
32
32
|
|
33
|
-
scenario 'リンク元の置換が動いている', :exclude_selenium
|
33
|
+
scenario 'リンク元の置換が動いている', :exclude_selenium do
|
34
34
|
append_default_diary
|
35
35
|
visit '/update.rb?conf=referer'
|
36
36
|
fill_in 'referer_table', :with => <<-REFERER
|
data/spec/acceptance_helper.rb
CHANGED
@@ -39,42 +39,13 @@ RSpec.configure do |config|
|
|
39
39
|
|
40
40
|
config.before(:each) do
|
41
41
|
FileUtils.mkdir_p work_data_dir
|
42
|
+
FileUtils.cp_r(fixture_conf, File.join(work_data_dir, "tdiary.conf"), :verbose => false) unless fixture_conf.empty?
|
42
43
|
end
|
43
44
|
|
44
45
|
config.after(:each) do
|
45
46
|
FileUtils.rm_rf work_data_dir
|
46
47
|
end
|
47
48
|
|
48
|
-
if ENV['TEST_MODE'] == 'rdb'
|
49
|
-
work_db = 'sqlite://tmp/tdiary_test.db'
|
50
|
-
config.before(:each) do
|
51
|
-
Sequel.connect(work_db) do |db|
|
52
|
-
db.drop_table(:conf) if db.table_exists?(:conf)
|
53
|
-
db.create_table :conf do
|
54
|
-
String :body, :text => true
|
55
|
-
end
|
56
|
-
db[:conf].insert(:body => File.read(fixture_conf))
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
config.after(:each) do
|
61
|
-
Sequel.connect(work_db) do |db|
|
62
|
-
[:diaries, :comments, :conf].each do |table|
|
63
|
-
db.drop_table(table) if db.table_exists? table
|
64
|
-
end
|
65
|
-
end
|
66
|
-
Dalli::Client.new(nil, {:namespace => 'test'}).flush
|
67
|
-
end
|
68
|
-
else
|
69
|
-
config.before(:each) do
|
70
|
-
FileUtils.cp_r(fixture_conf, File.join(work_data_dir, "tdiary.conf"), :verbose => false) unless fixture_conf.empty?
|
71
|
-
end
|
72
|
-
|
73
|
-
config.after(:each) do
|
74
|
-
FileUtils.rm_r File.join(work_data_dir, "tdiary.conf")
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
49
|
if ENV['TEST_MODE'] == 'webrick'
|
79
50
|
Capybara.default_driver = :selenium
|
80
51
|
Capybara.app_host = 'http://localhost:' + (ENV['PORT'] || '19292')
|
@@ -85,10 +56,7 @@ RSpec.configure do |config|
|
|
85
56
|
[:exclude_selenium, :exclude_no_secure]
|
86
57
|
when 'secure'
|
87
58
|
[:exclude_rack, :exclude_secure]
|
88
|
-
|
89
|
-
[:exclude_rdb, :exclude_rack, :exclude_no_secure]
|
90
|
-
else
|
91
|
-
# TEST_MODE = rack
|
59
|
+
else # rack
|
92
60
|
[:exclude_rack, :exclude_no_secure]
|
93
61
|
end
|
94
62
|
excludes.each do |exclude|
|
data/tdiary/configuration.rb
CHANGED
@@ -102,9 +102,9 @@ module TDiary
|
|
102
102
|
end
|
103
103
|
|
104
104
|
unless @io_class
|
105
|
-
require 'tdiary/
|
105
|
+
require 'tdiary/cache/file'
|
106
106
|
require 'tdiary/io/default'
|
107
|
-
@io_class =
|
107
|
+
@io_class = IO::Default
|
108
108
|
end
|
109
109
|
|
110
110
|
cgi_conf = @io_class.load_cgi_conf(self)
|
data/tdiary/io/base.rb
CHANGED
@@ -7,63 +7,65 @@ require 'fileutils'
|
|
7
7
|
require 'tdiary/style' # XXX can't auto loading TDiary::Style subclasses
|
8
8
|
|
9
9
|
module TDiary
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def calendar
|
18
|
-
raise StandardError, 'not implemented'
|
19
|
-
end
|
10
|
+
module IO
|
11
|
+
class Base
|
12
|
+
def initialize( tdiary )
|
13
|
+
@tdiary = tdiary
|
14
|
+
@data_path = @tdiary.conf.data_path if @tdiary.conf.data_path
|
15
|
+
load_styles
|
16
|
+
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def calendar
|
19
|
+
raise StandardError, 'not implemented'
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
def transaction(date)
|
23
|
+
raise StandardError, 'not implemented'
|
24
|
+
end
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def diary_factory(date, title, body, style_name = 'tDiary')
|
27
|
+
style(style_name.downcase).new(date, title, body)
|
28
|
+
end
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
@_cache_path
|
37
|
-
end
|
30
|
+
def cache_dir
|
31
|
+
raise StandardError, 'not implemented'
|
32
|
+
end
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
[paths].flatten.uniq.each do |path|
|
44
|
-
path = path.sub(/\/+$/, '').untaint
|
45
|
-
Dir.glob("#{path}/*.rb") {|style_file| require style_file.untaint }
|
34
|
+
def cache_path
|
35
|
+
@_cache_path ||= cache_dir.untaint
|
36
|
+
FileUtils.mkdir_p(@_cache_path)
|
37
|
+
@_cache_path
|
46
38
|
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
39
|
+
|
40
|
+
def load_styles
|
41
|
+
@styles = {}
|
42
|
+
paths = @tdiary.conf.options['style.path'] ||
|
43
|
+
[TDiary::PATH, TDiary.server_root].map {|base| "#{base}/tdiary/style" }
|
44
|
+
[paths].flatten.uniq.each do |path|
|
45
|
+
path = path.sub(/\/+$/, '').untaint
|
46
|
+
Dir.glob("#{path}/*.rb") {|style_file| require style_file.untaint }
|
47
|
+
end
|
48
|
+
(["tdiary", "wiki"] + [@tdiary.conf.style].map(&:downcase)).flatten.uniq.each do |style|
|
49
|
+
klass = TDiary::Style.const_get("#{style.capitalize}Diary")
|
50
|
+
klass.send(:include, TDiary::Style::BaseDiary)
|
51
|
+
klass.send(:include, TDiary::Style::CategorizableDiary)
|
52
|
+
if TDiary::Style.const_defined? ("#{style.capitalize}Section")
|
53
|
+
TDiary::Style.const_get("#{style.capitalize}Section").send(:include, TDiary::Style::BaseSection)
|
54
|
+
end
|
55
|
+
@styles[style] = klass
|
53
56
|
end
|
54
|
-
@styles[style] = klass
|
55
57
|
end
|
56
|
-
end
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
59
|
+
def style(s)
|
60
|
+
unless @styles
|
61
|
+
raise BadStyleError, "styles are not loaded"
|
62
|
+
end
|
63
|
+
r = @styles[s.downcase]
|
64
|
+
unless r
|
65
|
+
raise BadStyleError, "bad style: #{s}"
|
66
|
+
end
|
67
|
+
r
|
65
68
|
end
|
66
|
-
r
|
67
69
|
end
|
68
70
|
end
|
69
71
|
end
|