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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3cb15a291ccf22c9e26d5007c81a8a0d7872217d
4
- data.tar.gz: e1967f9cf308aaf0dffa1ccd5cd04e4ca3ee63a2
3
+ metadata.gz: c92106283ff746cd9b3e761a47e88d977133daae
4
+ data.tar.gz: ead05318a8f257deb9521da45639fd4ff5f85c51
5
5
  SHA512:
6
- metadata.gz: 3eebdfd11165028ff3b35fd9731b5f6b5e3c5712c2b96dc8b91666d5f59a3dee08bd0d2134988ec1a8bed70e062f99849293f76e5b77608a598f58cd6584b8d7
7
- data.tar.gz: c78628a2c55c3f0a0c9cb87cc46072aa7439fb8be24cc5bdc35757923fd87e3e65ca6cb81764488582f5149004cfed4b623a17838240a42d143af520c44a9eac
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 spec:acceptance:rdb jasmine:ci test ; fi
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
@@ -10,15 +10,6 @@ group :coffee do
10
10
  gem 'therubyracer'
11
11
  end
12
12
 
13
- group :memcached do
14
- gem 'dalli'
15
- end
16
-
17
- group :redis do
18
- gem 'redis'
19
- gem 'redis-namespace'
20
- end
21
-
22
13
  group :server do
23
14
  platforms :mri do
24
15
  gem 'thin'
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.1)
29
- fastimage (1.5.2)
30
- ffi (1.9.0)
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 (1.25)
44
- mini_portile (0.5.1)
45
- multi_json (1.8.0)
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.5)
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.3)
74
- rubyzip (0.9.9)
75
- selenium-webdriver (2.35.1)
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 (< 1.0.0)
75
+ rubyzip (~> 1.0.0)
79
76
  websocket (~> 1.0.4)
80
- sequel (4.2.0)
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.5.1)
97
+ thin (1.6.1)
101
98
  daemons (>= 1.0.9)
102
- eventmachine (>= 0.12.6)
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.11.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/defaultio'
95
- DefaultIO::new( self ).transaction( date ) do |diaries|
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::DefaultIO) && @conf.io_class == ::TDiary::DefaultIO
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::DefaultIO'
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
@@ -3,7 +3,7 @@
3
3
  # 90migrate.rb: tDiary plugin for migration 2.2 to 2.3.
4
4
  #
5
5
 
6
- if !@conf.tdiary_version && @conf.io_class.to_s == 'TDiary::DefaultIO'
6
+ if !@conf.tdiary_version && @conf.io_class.to_s == 'TDiary::IO::Default'
7
7
  def convert_pstore( file )
8
8
  require "pstore"
9
9
 
@@ -2,7 +2,7 @@
2
2
  require 'acceptance_helper'
3
3
 
4
4
  feature 'リンク元設定の利用' do
5
- scenario 'リンク元の非表示設定', :exclude_rdb do
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 'リンク元記録の除外設定が動いている', :exclude_rdb do
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, :exclude_rdb do
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
@@ -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
- when 'rdb'
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|
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8; -*-
2
2
 
3
3
  module TDiary
4
- module CacheIO
4
+ module Cache
5
5
  def restore_cache( prefix )
6
6
  restore_data("#{cache_path}/#{cache_file( prefix )}") if cache_enable?( prefix )
7
7
  end
@@ -102,9 +102,9 @@ module TDiary
102
102
  end
103
103
 
104
104
  unless @io_class
105
- require 'tdiary/io/cache/file'
105
+ require 'tdiary/cache/file'
106
106
  require 'tdiary/io/default'
107
- @io_class = DefaultIO
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
- class BaseIO
11
- def initialize( tdiary )
12
- @tdiary = tdiary
13
- @data_path = @tdiary.conf.data_path if @tdiary.conf.data_path
14
- load_styles
15
- end
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
- def transaction(date)
22
- raise StandardError, 'not implemented'
23
- end
18
+ def calendar
19
+ raise StandardError, 'not implemented'
20
+ end
24
21
 
25
- def diary_factory(date, title, body, style_name = 'tDiary')
26
- style(style_name.downcase).new(date, title, body)
27
- end
22
+ def transaction(date)
23
+ raise StandardError, 'not implemented'
24
+ end
28
25
 
29
- def cache_dir
30
- raise StandardError, 'not implemented'
31
- end
26
+ def diary_factory(date, title, body, style_name = 'tDiary')
27
+ style(style_name.downcase).new(date, title, body)
28
+ end
32
29
 
33
- def cache_path
34
- @_cache_path ||= cache_dir.untaint
35
- FileUtils.mkdir_p(@_cache_path)
36
- @_cache_path
37
- end
30
+ def cache_dir
31
+ raise StandardError, 'not implemented'
32
+ end
38
33
 
39
- def load_styles
40
- @styles = {}
41
- paths = @tdiary.conf.options['style.path'] ||
42
- [TDiary::PATH, TDiary.server_root].map {|base| "#{base}/tdiary/style" }
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
- (["tdiary", "wiki"] + [@tdiary.conf.style].map(&:downcase)).flatten.uniq.each do |style|
48
- klass = TDiary::Style.const_get("#{style.capitalize}Diary")
49
- klass.send(:include, TDiary::Style::BaseDiary)
50
- klass.send(:include, TDiary::Style::CategorizableDiary)
51
- if TDiary::Style.const_defined? ("#{style.capitalize}Section")
52
- TDiary::Style.const_get("#{style.capitalize}Section").send(:include, TDiary::Style::BaseSection)
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
- def style(s)
59
- unless @styles
60
- raise BadStyleError, "styles are not loaded"
61
- end
62
- r = @styles[s.downcase]
63
- unless r
64
- raise BadStyleError, "bad style: #{s}"
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