tdiary 3.2.2.20130604 → 3.2.2.20130614
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/Gemfile.lock +8 -6
- data/config.ru +5 -62
- data/plugin/00default.rb +4 -4
- data/spec/acceptance_helper.rb +8 -3
- data/spec/core/rack/static_spec.rb +22 -0
- data/tdiary.gemspec +2 -0
- data/tdiary/application.rb +55 -24
- data/tdiary/application/configuration.rb +36 -0
- data/tdiary/application/extensions/omniauth.rb +23 -0
- data/tdiary/cli.rb +6 -1
- data/tdiary/core_ext.rb +7 -2
- data/tdiary/dispatcher.rb +26 -0
- data/tdiary/io/base.rb +6 -3
- data/tdiary/rack.rb +26 -0
- data/tdiary/rack/static.rb +29 -0
- data/tdiary/style/wiki_style.rb +7 -2
- data/tdiary/version.rb +1 -1
- data/tdiary/view.rb +1 -1
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eca5541a6d02354e337c5d41dc2bd36fb8ea5fe0
|
4
|
+
data.tar.gz: d5b7f5622d0edaae1391032d2f16e599e93a8133
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46f8edaf87b103a50c2f4ef339cdc2dc3e202f8486dfb361d58af145019f0e3fe41ad4717fca13d1fa4e021b39235d57ae284761ea2c5735230ac2032062af32
|
7
|
+
data.tar.gz: aed17e747b8f90391fd534bb86feb12532b8b25c51a6652f2951b7bb9aef9b98c4e94188e508232356bcdacc3acfcf8a24073604cbdc17a09d12951a9d7fe972
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
tdiary (3.2.2.
|
4
|
+
tdiary (3.2.2.20130614)
|
5
5
|
bundler (~> 1.3)
|
6
6
|
hikidoc (>= 0.0.6)
|
7
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 (~> 2.10)
|
11
12
|
thor (~> 0.18)
|
12
13
|
|
13
14
|
GEM
|
@@ -42,9 +43,9 @@ GEM
|
|
42
43
|
multi_json (~> 1.0)
|
43
44
|
faraday (0.8.7)
|
44
45
|
multipart-post (~> 1.1)
|
45
|
-
ffi (1.
|
46
|
+
ffi (1.9.0)
|
46
47
|
hashie (2.0.5)
|
47
|
-
hike (1.2.
|
48
|
+
hike (1.2.3)
|
48
49
|
hikidoc (0.0.6)
|
49
50
|
httpauth (0.2.0)
|
50
51
|
imagesize (0.1.1)
|
@@ -60,9 +61,11 @@ GEM
|
|
60
61
|
addressable (~> 2.3)
|
61
62
|
method_source (0.8.1)
|
62
63
|
mime-types (1.23)
|
63
|
-
|
64
|
+
mini_portile (0.5.0)
|
65
|
+
multi_json (1.7.6)
|
64
66
|
multipart-post (1.2.0)
|
65
|
-
nokogiri (1.
|
67
|
+
nokogiri (1.6.0)
|
68
|
+
mini_portile (~> 0.5.0)
|
66
69
|
oauth (0.4.7)
|
67
70
|
oauth2 (0.8.1)
|
68
71
|
faraday (~> 0.8)
|
@@ -177,7 +180,6 @@ DEPENDENCIES
|
|
177
180
|
selenium-webdriver
|
178
181
|
sequel
|
179
182
|
simplecov
|
180
|
-
sprockets
|
181
183
|
sqlite3
|
182
184
|
tapp
|
183
185
|
tdiary!
|
data/config.ru
CHANGED
@@ -1,64 +1,7 @@
|
|
1
1
|
$:.unshift( File::dirname( __FILE__ ).untaint )
|
2
|
+
require 'tdiary/environment'
|
3
|
+
require 'tdiary/application'
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'tdiary/rack/auth/basic'
|
7
|
-
require 'omniauth'
|
8
|
-
require 'tdiary/rack/auth/omniauth'
|
9
|
-
|
10
|
-
use Rack::Reloader unless ENV['RACK_ENV'] == 'production'
|
11
|
-
|
12
|
-
base_dir = ''
|
13
|
-
|
14
|
-
# OmniAuth settings
|
15
|
-
use Rack::Session::Pool, :expire_after => 2592000
|
16
|
-
use OmniAuth::Builder do
|
17
|
-
configure {|conf| conf.path_prefix = "#{base_dir}/auth" }
|
18
|
-
# provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
19
|
-
# provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
|
20
|
-
end
|
21
|
-
map "#{base_dir}/auth" do
|
22
|
-
run TDiary::Rack::Auth::OmniAuth::CallbackHandler.new
|
23
|
-
end
|
24
|
-
|
25
|
-
map "#{base_dir}/update.rb" do
|
26
|
-
# Basic Auth
|
27
|
-
use TDiary::Rack::Auth::Basic, '.htpasswd'
|
28
|
-
|
29
|
-
# OAuth
|
30
|
-
# use TDiary::Rack::Auth::OmniAuth, :twitter do |auth|
|
31
|
-
# auth.info.nickname == 'your_twitter_screen_name'
|
32
|
-
# end
|
33
|
-
|
34
|
-
run TDiary::Application.new(:update)
|
35
|
-
end
|
36
|
-
|
37
|
-
map "#{base_dir}/assets" do
|
38
|
-
environment = Sprockets::Environment.new
|
39
|
-
%w(js theme).each {|path| environment.append_path File.join(TDiary.root, path) }
|
40
|
-
|
41
|
-
# FIXME: dirty hack, it should create TDiary::Server::Config.assets_path
|
42
|
-
TDiary::Contrib::Assets.setup(environment) if defined?(TDiary::Contrib)
|
43
|
-
|
44
|
-
# if you need to auto compilation for CoffeeScript
|
45
|
-
# require 'tdiary/rack/assets/precompile'
|
46
|
-
# use TDiary::Rack::Assets::Precompile, environment
|
47
|
-
|
48
|
-
run environment
|
49
|
-
end
|
50
|
-
|
51
|
-
map "#{base_dir}/" do
|
52
|
-
use TDiary::Rack::HtmlAnchor
|
53
|
-
run Rack::Cascade.new([
|
54
|
-
Rack::File.new("./public/"),
|
55
|
-
TDiary::Rack::ValidRequestPath.new(TDiary::Application.new(:index))
|
56
|
-
])
|
57
|
-
end
|
58
|
-
|
59
|
-
# Local Variables:
|
60
|
-
# mode: ruby
|
61
|
-
# indent-tabs-mode: t
|
62
|
-
# tab-width: 3
|
63
|
-
# ruby-indent-level: 3
|
64
|
-
# End:
|
5
|
+
use ::Rack::Reloader unless ENV['RACK_ENV'] == 'production'
|
6
|
+
base_dir = '/'
|
7
|
+
run TDiary::Application.new( base_dir )
|
data/plugin/00default.rb
CHANGED
@@ -851,13 +851,13 @@ def saveconf_theme
|
|
851
851
|
@conf.css = @cgi.params['css'][0]
|
852
852
|
end
|
853
853
|
|
854
|
-
|
855
|
-
Dir::glob(
|
854
|
+
theme_paths = [::TDiary::PATH, TDiary.server_root].map {|d| "#{d}/theme/*" }
|
855
|
+
@conf_theme_list = Dir::glob( theme_paths ).sort.map {|dir|
|
856
856
|
theme = dir.sub( %r[.*/theme/], '')
|
857
857
|
next unless FileTest::file?( "#{dir}/#{theme}.css".untaint )
|
858
858
|
name = theme.split( /_/ ).collect{|s| s.capitalize}.join( ' ' )
|
859
|
-
|
860
|
-
|
859
|
+
[theme,name]
|
860
|
+
}.compact.uniq
|
861
861
|
end
|
862
862
|
|
863
863
|
# comments
|
data/spec/acceptance_helper.rb
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'sprockets'
|
2
3
|
|
3
4
|
Dir["#{File.dirname(__FILE__)}/acceptance/support/**/*.rb"].each {|f| require f}
|
4
5
|
|
6
|
+
require 'tdiary/application'
|
5
7
|
Capybara.app = Rack::Builder.new do
|
6
8
|
map '/' do
|
7
|
-
run TDiary::
|
9
|
+
run TDiary::Dispatcher.index
|
8
10
|
end
|
9
11
|
|
10
12
|
map '/index.rb' do
|
11
|
-
run TDiary::
|
13
|
+
run TDiary::Dispatcher.index
|
12
14
|
end
|
13
15
|
|
14
16
|
map '/update.rb' do
|
15
|
-
run TDiary::
|
17
|
+
run TDiary::Dispatcher.update
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
21
|
+
# FIXME: TDiary::Application has auth middleware in update.rb, so it cannot be tested.
|
22
|
+
# Capybara.app = TDiary::Application.new
|
23
|
+
|
19
24
|
Capybara.save_and_open_page_path = File.dirname(__FILE__) + '/../tmp/capybara'
|
20
25
|
|
21
26
|
RSpec.configure do |config|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'rack/test'
|
3
|
+
require 'tdiary/rack/static'
|
4
|
+
|
5
|
+
describe TDiary::Rack::Static do
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
describe "reserve static files" do
|
9
|
+
let(:app) { TDiary::Rack::Static.new(
|
10
|
+
lambda{|env| [500, {}, ['Internal Server Error']]}, 'doc')}
|
11
|
+
|
12
|
+
it 'should return the file in static directory' do
|
13
|
+
get '/README.md'
|
14
|
+
last_response.should be_ok
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should run the app if file is not exist' do
|
18
|
+
get '/index.rb'
|
19
|
+
last_response.status.should be 500
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/tdiary.gemspec
CHANGED
@@ -26,6 +26,8 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'rdtool', '>= 0.6.0'
|
27
27
|
spec.add_dependency 'imagesize', '>= 0.1.0'
|
28
28
|
|
29
|
+
spec.add_dependency 'sprockets', '~> 2.10'
|
30
|
+
|
29
31
|
spec.add_dependency 'thor', '~> 0.18'
|
30
32
|
spec.add_dependency "bundler", "~> 1.3"
|
31
33
|
end
|
data/tdiary/application.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
require 'rack/builder'
|
3
|
+
require 'tdiary/application/configuration'
|
4
|
+
require 'tdiary/rack'
|
5
|
+
require 'sprockets'
|
2
6
|
|
3
7
|
# FIXME too dirty hack :-<
|
4
8
|
class CGI
|
@@ -12,40 +16,67 @@ end
|
|
12
16
|
|
13
17
|
module TDiary
|
14
18
|
class Application
|
15
|
-
|
16
|
-
|
19
|
+
class << self
|
20
|
+
def configure(&block)
|
21
|
+
instance_eval &block
|
22
|
+
end
|
23
|
+
|
24
|
+
def config
|
25
|
+
@config ||= Configuration.new
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize( base_dir = '/' )
|
30
|
+
@app = ::Rack::Builder.app {
|
31
|
+
map base_dir do
|
32
|
+
Application.config.builder_procs.each do |builder_proc|
|
33
|
+
instance_eval &builder_proc
|
34
|
+
end
|
35
|
+
end
|
36
|
+
}
|
17
37
|
end
|
18
38
|
|
19
39
|
def call( env )
|
20
|
-
|
21
|
-
dispatch_request( req )
|
40
|
+
@app.call( env )
|
22
41
|
end
|
42
|
+
end
|
23
43
|
|
24
|
-
|
44
|
+
Application.configure do
|
45
|
+
config.assets_paths.concat %w(js theme).map {|path|
|
46
|
+
[TDiary.root, TDiary.server_root].map {|base_dir|
|
47
|
+
File.join(base_dir, path)
|
48
|
+
}
|
49
|
+
}.flatten.uniq
|
25
50
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
51
|
+
config.builder do
|
52
|
+
map Application.config.path[:index] do
|
53
|
+
use TDiary::Rack::HtmlAnchor
|
54
|
+
use TDiary::Rack::Static, "public"
|
55
|
+
use TDiary::Rack::ValidRequestPath
|
56
|
+
run TDiary::Dispatcher.index
|
57
|
+
end
|
34
58
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
59
|
+
map Application.config.path[:update] do
|
60
|
+
instance_eval &Application.config.authenticate_proc
|
61
|
+
run TDiary::Dispatcher.update
|
62
|
+
end
|
39
63
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
64
|
+
map Application.config.path[:assets] do
|
65
|
+
environment = Sprockets::Environment.new
|
66
|
+
Application.config.assets_paths.each do |path|
|
67
|
+
environment.append_path path
|
68
|
+
end
|
69
|
+
|
70
|
+
if Application.config.assets_precompile
|
71
|
+
require 'tdiary/rack/assets/precompile'
|
72
|
+
use TDiary::Rack::Assets::Precompile, environment
|
73
|
+
end
|
74
|
+
|
75
|
+
run environment
|
46
76
|
end
|
47
|
-
$stdin = stdin_spy
|
48
77
|
end
|
78
|
+
|
79
|
+
config.authenticate TDiary::Rack::Auth::Basic, '.htpasswd'
|
49
80
|
end
|
50
81
|
end
|
51
82
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module TDiary
|
2
|
+
class Application
|
3
|
+
class Configuration
|
4
|
+
attr_accessor :assets_paths, :assets_precompile, :plugin_paths, :path, :builder_procs, :authenticate_proc
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@assets_paths = []
|
8
|
+
# if you need to auto compilation for CoffeeScript
|
9
|
+
@assets_precompile = false;
|
10
|
+
@plugin_paths = []
|
11
|
+
@path = {
|
12
|
+
index: '/',
|
13
|
+
update: '/update.rb',
|
14
|
+
assets: '/assets'
|
15
|
+
}
|
16
|
+
@builder_procs = []
|
17
|
+
@authenticate_proc = proc { }
|
18
|
+
end
|
19
|
+
|
20
|
+
def builder(&block)
|
21
|
+
@builder_procs << block
|
22
|
+
end
|
23
|
+
|
24
|
+
def authenticate(middleware, *params, &block)
|
25
|
+
@authenticate_proc = proc { use middleware, *params, &block }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Local Variables:
|
32
|
+
# mode: ruby
|
33
|
+
# indent-tabs-mode: t
|
34
|
+
# tab-width: 3
|
35
|
+
# ruby-indent-level: 3
|
36
|
+
# End:
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'tdiary/application'
|
3
|
+
require 'tdiary/rack/auth/omniauth'
|
4
|
+
|
5
|
+
TDiary::Application.configure do
|
6
|
+
config.builder do
|
7
|
+
use ::Rack::Session::Pool, :expire_after => 2592000
|
8
|
+
use OmniAuth::Builder do
|
9
|
+
configure {|conf| conf.path_prefix = "/auth" }
|
10
|
+
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
11
|
+
provider :github, ENV['GITHUB_KEY'], ENV['GITHUB_SECRET']
|
12
|
+
end
|
13
|
+
|
14
|
+
map('/auth') do
|
15
|
+
run TDiary::Rack::Auth::OmniAuth::CallbackHandler.new
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
config.authenticate TDiary::Rack::Auth::OmniAuth, :twitter do |auth|
|
20
|
+
# TODO: an user can setting
|
21
|
+
auth.info.nickname == 'your_twitter_screen_name'
|
22
|
+
end
|
23
|
+
end
|
data/tdiary/cli.rb
CHANGED
@@ -81,6 +81,8 @@ module TDiary
|
|
81
81
|
method_option "port", :aliases => "p", :type => :numeric, :default => 19292, :banner =>
|
82
82
|
"use PORT"
|
83
83
|
def server
|
84
|
+
require 'tdiary'
|
85
|
+
|
84
86
|
if options[:cgi]
|
85
87
|
opts = {
|
86
88
|
:daemon => ENV['DAEMON'],
|
@@ -92,7 +94,6 @@ module TDiary
|
|
92
94
|
TDiary::Server.run( opts )
|
93
95
|
elsif
|
94
96
|
# --rack option
|
95
|
-
require 'rack'
|
96
97
|
# Rack::Server reads ARGV as :config, so delete it
|
97
98
|
ARGV.shift
|
98
99
|
opts = {
|
@@ -142,6 +143,10 @@ module TDiary
|
|
142
143
|
empty_directory(target)
|
143
144
|
empty_directory(File.join(target, 'public'))
|
144
145
|
empty_directory(File.join(target, 'misc/plugin'))
|
146
|
+
empty_directory(File.join(target, 'tdiary/filter'))
|
147
|
+
empty_directory(File.join(target, 'tdiary/style'))
|
148
|
+
empty_directory(File.join(target, 'js'))
|
149
|
+
empty_directory(File.join(target, 'theme'))
|
145
150
|
%w(
|
146
151
|
README.md
|
147
152
|
Gemfile
|
data/tdiary/core_ext.rb
CHANGED
@@ -102,8 +102,13 @@ module Safe
|
|
102
102
|
result = nil
|
103
103
|
if $SAFE < level then
|
104
104
|
Proc.new {
|
105
|
-
|
106
|
-
|
105
|
+
begin
|
106
|
+
$SAFE = level
|
107
|
+
rescue ArgumentError => e
|
108
|
+
# $SAFE=4 was removed from Ruby 2.1.0.
|
109
|
+
ensure
|
110
|
+
result = yield
|
111
|
+
end
|
107
112
|
}.call
|
108
113
|
else
|
109
114
|
result = yield
|
data/tdiary/dispatcher.rb
CHANGED
@@ -16,6 +16,11 @@ module TDiary
|
|
16
16
|
@target = TARGET[target]
|
17
17
|
end
|
18
18
|
|
19
|
+
def call( env )
|
20
|
+
req = adopt_rack_request_to_plain_old_tdiary_style( env )
|
21
|
+
dispatch_cgi( req )
|
22
|
+
end
|
23
|
+
|
19
24
|
# FIXME rename method name to more suitable one.
|
20
25
|
def dispatch_cgi( request, cgi = CGI.new )
|
21
26
|
result = @target.run( request, cgi )
|
@@ -66,6 +71,27 @@ module TDiary
|
|
66
71
|
end
|
67
72
|
private :new
|
68
73
|
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def adopt_rack_request_to_plain_old_tdiary_style( env )
|
78
|
+
req = TDiary::Request.new( env )
|
79
|
+
req.params # fill params to tdiary_request
|
80
|
+
$RACK_ENV = req.env
|
81
|
+
env["rack.input"].rewind
|
82
|
+
fake_stdin_as_params
|
83
|
+
req
|
84
|
+
end
|
85
|
+
|
86
|
+
def fake_stdin_as_params
|
87
|
+
stdin_spy = StringIO.new( "" )
|
88
|
+
# FIXME dirty hack
|
89
|
+
if $RACK_ENV && $RACK_ENV['rack.input']
|
90
|
+
stdin_spy.print( $RACK_ENV['rack.input'].read )
|
91
|
+
stdin_spy.rewind
|
92
|
+
end
|
93
|
+
$stdin = stdin_spy
|
94
|
+
end
|
69
95
|
end
|
70
96
|
end
|
71
97
|
|
data/tdiary/io/base.rb
CHANGED
@@ -37,9 +37,12 @@ module TDiary
|
|
37
37
|
|
38
38
|
def load_styles
|
39
39
|
@styles = {}
|
40
|
-
paths = @tdiary.conf.options['style.path'] ||
|
41
|
-
|
42
|
-
|
40
|
+
paths = @tdiary.conf.options['style.path'] ||
|
41
|
+
[TDiary::PATH, TDiary.server_root].map {|base|
|
42
|
+
["#{base}/tdiary/style", "#{base}/tdiary"]
|
43
|
+
}
|
44
|
+
[paths].flatten.uniq.each do |path|
|
45
|
+
path = path.sub(/\/+$/, '').untaint
|
43
46
|
Dir.glob("#{path}/*_style.rb") do |style_file|
|
44
47
|
require style_file.untaint
|
45
48
|
style = File.basename(style_file).sub(/_style\.rb$/, '')
|
data/tdiary/rack.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
module TDiary
|
4
|
+
module Rack
|
5
|
+
autoload :HtmlAnchor, 'tdiary/rack/html_anchor'
|
6
|
+
autoload :ValidRequestPath, 'tdiary/rack/valid_request_path'
|
7
|
+
autoload :Static, 'tdiary/rack/static'
|
8
|
+
|
9
|
+
module Assets
|
10
|
+
autoload :Precompile, 'tdiary/rack/assets/precompile'
|
11
|
+
end
|
12
|
+
|
13
|
+
module Auth
|
14
|
+
autoload :Basic, 'tdiary/rack/auth/basic'
|
15
|
+
autoload :OmniAuth, 'tdiary/rack/auth/omniauth'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Local Variables:
|
21
|
+
# mode: ruby
|
22
|
+
# indent-tabs-mode: t
|
23
|
+
# tab-width: 3
|
24
|
+
# ruby-indent-level: 3
|
25
|
+
# End:
|
26
|
+
# vim: ts=3
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'rack/file'
|
3
|
+
|
4
|
+
module TDiary
|
5
|
+
module Rack
|
6
|
+
class Static
|
7
|
+
def initialize( app, base_dir )
|
8
|
+
@app = app
|
9
|
+
@file = ::Rack::File.new( base_dir )
|
10
|
+
end
|
11
|
+
|
12
|
+
def call( env )
|
13
|
+
result = @file.call( env )
|
14
|
+
if result[0].to_i == 404
|
15
|
+
@app.call( env )
|
16
|
+
else
|
17
|
+
result
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Local Variables:
|
25
|
+
# mode: ruby
|
26
|
+
# indent-tabs-mode: t
|
27
|
+
# tab-width: 3
|
28
|
+
# ruby-indent-level: 3
|
29
|
+
# End:
|
data/tdiary/style/wiki_style.rb
CHANGED
@@ -72,8 +72,13 @@ module TDiary
|
|
72
72
|
|
73
73
|
def valid_plugin_syntax?(code)
|
74
74
|
lambda {
|
75
|
-
|
76
|
-
|
75
|
+
begin
|
76
|
+
$SAFE = 4
|
77
|
+
rescue ArgumentError
|
78
|
+
# $SAFE=4 was removed from Ruby 2.1.0.
|
79
|
+
ensure
|
80
|
+
eval( "BEGIN {return true}\n#{code}", nil, "(plugin)", 0 )
|
81
|
+
end
|
77
82
|
}.call
|
78
83
|
rescue SyntaxError
|
79
84
|
lambda { eval('') }.call
|
data/tdiary/version.rb
CHANGED
data/tdiary/view.rb
CHANGED
@@ -83,7 +83,7 @@ module TDiary
|
|
83
83
|
return if @filters
|
84
84
|
|
85
85
|
@filters = []
|
86
|
-
filter_path = @conf.filter_path || "#{PATH}/tdiary/filter"
|
86
|
+
filter_path = @conf.filter_path || "{#{PATH},#{TDiary.server_root}}/tdiary/filter"
|
87
87
|
Dir::glob( "#{filter_path}/*.rb" ).sort.each do |file|
|
88
88
|
require file.untaint
|
89
89
|
@filters << TDiary::Filter::const_get( "#{File::basename( file, '.rb' ).capitalize}Filter" )::new( @cgi, @conf )
|
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: 3.2.2.
|
4
|
+
version: 3.2.2.20130614
|
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-06-
|
13
|
+
date: 2013-06-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -82,6 +82,20 @@ dependencies:
|
|
82
82
|
- - '>='
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: 0.1.0
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: sprockets
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ~>
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '2.10'
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.10'
|
85
99
|
- !ruby/object:Gem::Dependency
|
86
100
|
name: thor
|
87
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -391,6 +405,7 @@ files:
|
|
391
405
|
- spec/core/plugin_spec.rb
|
392
406
|
- spec/core/rack/assets/precompile_spec.rb
|
393
407
|
- spec/core/rack/html_anchor_spec.rb
|
408
|
+
- spec/core/rack/static_spec.rb
|
394
409
|
- spec/core/rack/valid_request_path_spec.rb
|
395
410
|
- spec/core/style/emptdiary_style_spec.rb
|
396
411
|
- spec/core/style/etdiary_style_spec.rb
|
@@ -422,6 +437,8 @@ files:
|
|
422
437
|
- tdiary.rb
|
423
438
|
- tdiary/admin.rb
|
424
439
|
- tdiary/application.rb
|
440
|
+
- tdiary/application/configuration.rb
|
441
|
+
- tdiary/application/extensions/omniauth.rb
|
425
442
|
- tdiary/author_only_base.rb
|
426
443
|
- tdiary/base.rb
|
427
444
|
- tdiary/cli.rb
|
@@ -447,10 +464,12 @@ files:
|
|
447
464
|
- tdiary/lang/en.rb
|
448
465
|
- tdiary/lang/ja.rb
|
449
466
|
- tdiary/plugin.rb
|
467
|
+
- tdiary/rack.rb
|
450
468
|
- tdiary/rack/assets/precompile.rb
|
451
469
|
- tdiary/rack/auth/basic.rb
|
452
470
|
- tdiary/rack/auth/omniauth.rb
|
453
471
|
- tdiary/rack/html_anchor.rb
|
472
|
+
- tdiary/rack/static.rb
|
454
473
|
- tdiary/rack/valid_request_path.rb
|
455
474
|
- tdiary/referer_manager.rb
|
456
475
|
- tdiary/request.rb
|
@@ -544,6 +563,7 @@ test_files:
|
|
544
563
|
- spec/core/plugin_spec.rb
|
545
564
|
- spec/core/rack/assets/precompile_spec.rb
|
546
565
|
- spec/core/rack/html_anchor_spec.rb
|
566
|
+
- spec/core/rack/static_spec.rb
|
547
567
|
- spec/core/rack/valid_request_path_spec.rb
|
548
568
|
- spec/core/style/emptdiary_style_spec.rb
|
549
569
|
- spec/core/style/etdiary_style_spec.rb
|