olelo 0.9.14 → 0.9.15

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: fa782b9e3ea47992610cfa33f1bddaacace33dd0
4
- data.tar.gz: 9120ed9f7337dabe28f14d678b1cbf67f97057d7
3
+ metadata.gz: dcf56a3f895102507ed214a48852d7719b34a87f
4
+ data.tar.gz: 91d7c9a7eb3d9cfbc958304e09ba827e62995ac8
5
5
  SHA512:
6
- metadata.gz: 881647481ee59f6ba41cc9d246517098033a1ff92ea9fb54931d9af6a373aa84f2c76ccd40df73aabde4dd274b0b11d5093b374bbd5f96231446ceb5f94824bf
7
- data.tar.gz: fb868fbed460dfdad246636d524bcdc411f7f972221b77edb6110833dba490e7e109bb120e4b0b36f0d3fa4cbdb18550a9706729278c85dca0678dfb614bc661
6
+ metadata.gz: 2b5ae3b55f623132d9f8a8f1e8469a4ae454b56af7723e3eb6afc345c7f2925d5a09989333a81ae44a6dd07cbdd2bc6784cae4143070851865d6011be1ad82d7
7
+ data.tar.gz: 4461656d97821c1a4a849bf1ccbf0f04bf252cad4fe8b03c419cadd412d720d978e47ccff7917e0fbb56e8ce0aae47bb5140efc184412da32c38ca96fd5002c4
@@ -80,7 +80,16 @@ For production purposes, I recommend that you deploy the wiki with [[http://unic
80
80
  $ unicorn path-to/config.ru
81
81
  }}}
82
82
 
83
- Unicorn is a very flexible ruby application server and Ōlelo runs very well on it. You can adapt the number of Unicorn workers depending on the load you expect. It is a good idea to observe the Unicorn workers as described in https://github.com/blog/519-unicorn-god and kill missbehaving workers if necessary.
83
+ Unicorn is a very flexible ruby application server and Ōlelo runs very well on it. You can adapt the number of Unicorn workers depending on the load you expect. It is a good idea to observe the Unicorn workers as described in https://github.com/blog/519-unicorn-god and kill missbehaving workers if necessary. You can call this snippet in a cronjob which terminates all workers gracefully that need more than 100M.
84
+
85
+ {{{
86
+ #!/bin/bash
87
+ ps -e -www -o pid,rss,command | grep '[u]nicorn worker' | while read -r -a a; do
88
+ pid=${a[0]}
89
+ mem=${a[1]}
90
+ [[ "$mem" -gt 100000 ]] && kill -s QUIT $pid
91
+ done
92
+ }}}
84
93
 
85
94
  == Configuration
86
95
 
@@ -53,7 +53,7 @@ regexp :mediawiki_nowiki, /<nowiki>.*?<\/nowiki>/m, '<notags>\0</notags>'
53
53
  #
54
54
  ################################################################################
55
55
 
56
- interwiki_map = YAML.load_file(File.join(Config['config_path'], 'interwiki.yml'))
56
+ interwiki_map = Util.yaml_load_file(File.join(Config['config_path'], 'interwiki.yml'))
57
57
 
58
58
  ################################################################################
59
59
  # Creole aspects configuration
@@ -4,7 +4,7 @@ require 'digest/md5'
4
4
  require 'digest/sha2'
5
5
  require 'open3'
6
6
  require 'set'
7
- require 'yaml'
7
+ require 'psych'
8
8
  require 'mimemagic'
9
9
  require 'socket'
10
10
  require 'multi_json'
@@ -42,7 +42,7 @@ module Olelo
42
42
  end
43
43
 
44
44
  def load!(file)
45
- update(YAML.load_file(file))
45
+ update(Util.yaml_load_file(file))
46
46
  end
47
47
 
48
48
  def each(&block)
@@ -23,7 +23,7 @@ module Olelo
23
23
 
24
24
  def init_locale
25
25
  Locale.locale = Config['locale']
26
- Locale.add(YAML.load_file(File.join(File.dirname(__FILE__), 'locale.yml')))
26
+ Locale.add(yaml_load_file(File.join(File.dirname(__FILE__), 'locale.yml')))
27
27
  end
28
28
 
29
29
  def init_templates
@@ -38,7 +38,7 @@ module Olelo
38
38
  # Load locale provided by plugin
39
39
  Plugin.after(:load) do
40
40
  virtual_fs.glob('locale.yml') do |fs, name|
41
- Locale.add(YAML.load(fs.read(name)))
41
+ Locale.add(yaml_load(fs.read(name)))
42
42
  end
43
43
  end
44
44
 
@@ -50,6 +50,25 @@ module Olelo
50
50
  raise MultiError, errors if !errors.empty?
51
51
  end
52
52
 
53
+ def yaml_load_file(file)
54
+ File.open(file, 'r:bom|utf-8') {|f| yaml_load(f.read) }
55
+ end
56
+
57
+ if Psych.respond_to? :safe_load
58
+ def yaml_load(content)
59
+ Psych.safe_load(content)
60
+ end
61
+ else
62
+ puts 'WARNING: Psych doesn\'t support safe_load. Potentially unsafe YAML files might be loaded.'
63
+ def yaml_load(content)
64
+ Psych.load(content)
65
+ end
66
+ end
67
+
68
+ def yaml_dump(object)
69
+ Psych.dump(object)
70
+ end
71
+
53
72
  # Like CGI.escape but escapes space not as +
54
73
  def escape(s)
55
74
  s = s.to_s
@@ -1,3 +1,3 @@
1
1
  module Olelo
2
- VERSION = '0.9.14'
2
+ VERSION = '0.9.15'
3
3
  end
@@ -12,29 +12,31 @@ Gem::Specification.new do |s|
12
12
  s.description = 'Olelo is a git-based wiki which supports many markup languages, tags, embedded TeX and much more. It can be extended through plugins.'
13
13
  s.homepage = 'http://gitwiki.org/'
14
14
  s.rubyforge_project = s.name
15
+ s.license = 'MIT'
15
16
 
16
17
  s.files = `git ls-files | grep -P -v '^tools/'`.split("\n")
17
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
19
  s.require_paths = %w(lib)
19
20
 
20
- s.required_ruby_version = '>= 1.9.2'
21
+ s.required_ruby_version = '>= 1.9.3'
21
22
 
22
- s.add_runtime_dependency('RedCloth', ['~> 4.2.9'])
23
- s.add_runtime_dependency('creole', ['~> 0.5.0'])
24
- s.add_runtime_dependency('evaluator', ['~> 0.1.6'])
25
- s.add_runtime_dependency('mimemagic', ['~> 0.2.0'])
26
- s.add_runtime_dependency('multi_json', ['~> 1.7.3'])
27
- s.add_runtime_dependency('nokogiri', ['~> 1.6.0'])
28
- s.add_runtime_dependency('rack', ['~> 1.5.0'])
29
- s.add_runtime_dependency('redcarpet', ['~> 3.0.0'])
30
- s.add_runtime_dependency('rugged', ['~> 0.19.0'])
31
- s.add_runtime_dependency('slim', ['~> 2.0.0'])
32
- s.add_runtime_dependency('moneta', ['~> 0.7.0'])
33
- s.add_runtime_dependency('rouge', ['~> 0.3.6'])
34
- s.add_runtime_dependency('rack-protection', ['~> 1.5.0'])
23
+ s.add_runtime_dependency('RedCloth', '~> 4.2.9')
24
+ s.add_runtime_dependency('creole', '~> 0.5.0')
25
+ s.add_runtime_dependency('evaluator', '~> 0.1.6')
26
+ s.add_runtime_dependency('mimemagic', '~> 0.2.0')
27
+ s.add_runtime_dependency('multi_json', '~> 1.7.3')
28
+ s.add_runtime_dependency('nokogiri', '~> 1.6.0')
29
+ s.add_runtime_dependency('rack', '~> 1.5.0')
30
+ s.add_runtime_dependency('redcarpet', '~> 3.0.0')
31
+ s.add_runtime_dependency('rugged', '~> 0.19.0')
32
+ s.add_runtime_dependency('slim', '~> 2.0.0')
33
+ s.add_runtime_dependency('psych', '~> 2.0.0')
34
+ s.add_runtime_dependency('moneta', '~> 0.7.0')
35
+ s.add_runtime_dependency('rouge', '~> 0.3.6')
36
+ s.add_runtime_dependency('rack-protection', '~> 1.5.0')
35
37
 
36
- s.add_development_dependency('bacon', ['~> 1.1.0'])
37
- s.add_development_dependency('rack-test', ['~> 0.6.2'])
38
- s.add_development_dependency('rake', ['>= 0.8.7'])
39
- s.add_development_dependency('sass', ['~> 3.2.3'])
38
+ s.add_development_dependency('bacon', '~> 1.1.0')
39
+ s.add_development_dependency('rack-test', '~> 0.6.2')
40
+ s.add_development_dependency('rake', '>= 0.8.7')
41
+ s.add_development_dependency('sass', '~> 3.2.3')
40
42
  end
@@ -4,11 +4,11 @@ dependencies 'utils/rouge'
4
4
 
5
5
  Aspect.create(:highlight, priority: 2, layout: true, cacheable: true) do
6
6
  def accepts?(page)
7
- !page.content.empty? && ::Rouge::Lexer.guess_by_filename(page.name)
7
+ !page.content.empty? && ::Rouge::Lexer.guesses(:mimetype => page.mime.to_s).size == 1
8
8
  end
9
9
 
10
10
  def call(context, page)
11
- ::Rouge.highlight(page.content, ::Rouge::Lexer.guess_by_filename(page.name), 'html')
11
+ ::Rouge.highlight(page.content, ::Rouge::Lexer.guess_by_mimetype(page.mime.to_s), 'html')
12
12
  end
13
13
  end
14
14
 
@@ -9,7 +9,7 @@ Filter.create :link_classifier do |context, content|
9
9
  if href.starts_with?('http://') || href.starts_with?('https://')
10
10
  classes << 'external'
11
11
  elsif !href.empty? && !href.starts_with?('#')
12
- path, query = href.split('?')
12
+ path, query = href.split(/[?#]/, 2)
13
13
  if path.starts_with? Config['base_path']
14
14
  path = path[Config['base_path'].length..-1]
15
15
  elsif !path.starts_with? '/'
@@ -0,0 +1,7 @@
1
+ description 'Pandoc filter'
2
+ require 'pandoc-ruby'
3
+
4
+ Filter.create :pandoc do |context, content|
5
+ PandocRuby.convert(content, from: options[:from], to: options[:to])
6
+ end
7
+
@@ -92,7 +92,7 @@ class GitrbRepository < Repository
92
92
  def get_attributes(path, version)
93
93
  check_path(path)
94
94
  object = get_object(path + ATTRIBUTE_EXT, version)
95
- object && object.type == :blob ? YAML.load(object.data) : {}
95
+ object && object.type == :blob ? yaml_load(object.data) : {}
96
96
  end
97
97
 
98
98
  # @override
@@ -115,7 +115,7 @@ class GitrbRepository < Repository
115
115
  # @override
116
116
  def set_attributes(path, attributes)
117
117
  check_path(path)
118
- attributes = attributes.blank? ? nil : YAML.dump(attributes).sub(/\A\-\-\-\s*\n/s, '')
118
+ attributes = attributes.blank? ? nil : yaml_dump(attributes).sub(/\A\-\-\-\s*\n/s, '')
119
119
  expand_tree(path)
120
120
  if attributes
121
121
  @git.root[path + ATTRIBUTE_EXT] = Gitrb::Blob.new(data: attributes)
@@ -203,7 +203,7 @@ class RuggedRepository < Repository
203
203
 
204
204
  def set_attributes(path, attributes)
205
205
  check_path(path)
206
- attributes = attributes.blank? ? nil : YAML.dump(attributes).sub(/\A\-\-\-\s*\n/s, '')
206
+ attributes = attributes.blank? ? nil : yaml_dump(attributes).sub(/\A\-\-\-\s*\n/s, '')
207
207
  expand_tree(path)
208
208
  if attributes
209
209
  work_tree[path + ATTRIBUTE_EXT] = Blob.new(@git, attributes)
@@ -337,7 +337,7 @@ class RuggedRepository < Repository
337
337
  raise 'Not a commit' unless Rugged::Commit === commit
338
338
  path += ATTRIBUTE_EXT
339
339
  object = object_by_path(commit, path)
340
- object ? YAML.load(object.content) : {}
340
+ object ? yaml_load(object.content) : {}
341
341
  end
342
342
 
343
343
  def diff(path, from, to)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: olelo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.14
4
+ version: 0.9.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Mendler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-15 00:00:00.000000000 Z
11
+ date: 2013-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: RedCloth
@@ -150,6 +150,20 @@ dependencies:
150
150
  - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: 2.0.0
153
+ - !ruby/object:Gem::Dependency
154
+ name: psych
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ~>
158
+ - !ruby/object:Gem::Version
159
+ version: 2.0.0
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ~>
165
+ - !ruby/object:Gem::Version
166
+ version: 2.0.0
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: moneta
155
169
  requirement: !ruby/object:Gem::Requirement
@@ -352,6 +366,7 @@ files:
352
366
  - plugins/filters/markdown_nowiki.rb
353
367
  - plugins/filters/numbering.xsl
354
368
  - plugins/filters/orgmode.rb
369
+ - plugins/filters/pandoc.rb
355
370
  - plugins/filters/remind/main.rb
356
371
  - plugins/filters/remind/rem2html
357
372
  - plugins/filters/rubypants.rb
@@ -539,7 +554,8 @@ files:
539
554
  - test/templates_test.rb
540
555
  - test/util_test.rb
541
556
  homepage: http://gitwiki.org/
542
- licenses: []
557
+ licenses:
558
+ - MIT
543
559
  metadata: {}
544
560
  post_install_message:
545
561
  rdoc_options: []
@@ -549,7 +565,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
549
565
  requirements:
550
566
  - - '>='
551
567
  - !ruby/object:Gem::Version
552
- version: 1.9.2
568
+ version: 1.9.3
553
569
  required_rubygems_version: !ruby/object:Gem::Requirement
554
570
  requirements:
555
571
  - - '>='
@@ -557,7 +573,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
557
573
  version: '0'
558
574
  requirements: []
559
575
  rubyforge_project: olelo
560
- rubygems_version: 2.0.3
576
+ rubygems_version: 2.0.0
561
577
  signing_key:
562
578
  specification_version: 4
563
579
  summary: Olelo is a git-based wiki.