gollum-lib 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gollum-lib might be problematic. Click here for more details.

data/gollum-lib.gemspec CHANGED
@@ -2,11 +2,11 @@ Gem::Specification.new do |s|
2
2
  s.specification_version = 2 if s.respond_to? :specification_version=
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
  s.rubygems_version = '0.0.1'
5
- s.required_ruby_version = ">= 1.8.7"
5
+ s.required_ruby_version = ">= 1.9"
6
6
 
7
7
  s.name = 'gollum-lib'
8
- s.version = '1.0.3'
9
- s.date = '2013-06-18'
8
+ s.version = '1.0.4'
9
+ s.date = '2013-07-20'
10
10
  s.rubyforge_project = 'gollum-lib'
11
11
  s.license = 'MIT'
12
12
 
@@ -25,10 +25,10 @@ Gem::Specification.new do |s|
25
25
  s.add_dependency('grit', '~> 2.5.0')
26
26
  s.add_dependency('github-markup', ['>= 0.7.5', '< 1.0.0'])
27
27
  s.add_dependency('github-markdown', '~> 0.5.3')
28
- s.add_dependency('pygments.rb', '~> 0.5.0')
29
- s.add_dependency('sanitize', ['~> 2.0.3', '< 2.0.4']) # sanitize 2.0.4 depends on nokogiri ~> 1.6.0
30
- s.add_dependency('nokogiri', ['~> 1.5.9', '< 1.6.0']) # nokogiri 1.6.0 drops support for Ruby 1.8
31
- s.add_dependency('stringex', '~> 1.5.1')
28
+ s.add_dependency('pygments.rb', '~> 0.5.2')
29
+ s.add_dependency('sanitize', '~> 2.0.6')
30
+ s.add_dependency('nokogiri', '~> 1.6.0')
31
+ s.add_dependency('stringex', '~> 2.0.5')
32
32
 
33
33
  s.add_development_dependency('RedCloth', '~> 4.2.9')
34
34
  s.add_development_dependency('mocha', '~> 0.13.2')
data/lib/gollum-lib.rb CHANGED
@@ -30,7 +30,7 @@ $KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
30
30
 
31
31
  module Gollum
32
32
  module Lib
33
- VERSION = '1.0.3'
33
+ VERSION = '1.0.4'
34
34
  end
35
35
 
36
36
  def self.assets_path
@@ -133,7 +133,7 @@ module Gollum
133
133
  # Returns nothing.
134
134
  def update_working_dir(dir, name, format)
135
135
  unless @wiki.repo.bare
136
- if @wiki.page_file_dir
136
+ if @wiki.page_file_dir && dir !~ /^#{@wiki.page_file_dir}/
137
137
  dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(@wiki.page_file_dir, dir)
138
138
  end
139
139
 
@@ -1,4 +1,6 @@
1
1
  # ~*~ encoding: utf-8 ~*~
2
+ require 'pathname'
3
+
2
4
  module Gollum
3
5
  class File
4
6
  Wiki.file_class = self
@@ -650,9 +650,10 @@ module Gollum
650
650
  #
651
651
  #########################################################################
652
652
 
653
- # Extract metadata for data and build metadata table. Metadata
654
- # is content found between markers, and must
655
- # be a valid YAML mapping.
653
+ # Extract metadata for data and build metadata table. Metadata consists of
654
+ # key/value pairs in "key:value" format found between markers. Each
655
+ # key/value pair must be on its own line. Internal whitespace in keys and
656
+ # values is preserved, but external whitespace is ignored.
656
657
  #
657
658
  # Because ri and ruby 1.8.7 are awesome, the markers can't
658
659
  # be included in this documentation without triggering
@@ -661,8 +662,18 @@ module Gollum
661
662
  #
662
663
  # Returns the String of formatted data with metadata removed.
663
664
  def extract_metadata(data)
664
- @metadata = {}
665
- data
665
+ @metadata ||= {}
666
+ # The markers are `<!-- ---` and `-->`
667
+ data.gsub(/\<\!--+\s+---(.*?)--+\>/m) do
668
+ # Split untrusted input on newlines, then remove bits that look like
669
+ # HTML elements before parsing each line.
670
+ $1.split("\n").each do |line|
671
+ line.gsub!(/<[^>]*>/, '')
672
+ k, v = line.split(':', 2)
673
+ @metadata[k.strip] = (v ? v.strip : '') if k
674
+ end
675
+ ''
676
+ end
666
677
  end
667
678
 
668
679
  # Hook for getting the formatted value of extracted tag data.
@@ -182,6 +182,7 @@ module Gollum
182
182
  # :bar_side - Where the sidebar should be displayed, may be:
183
183
  # - :left
184
184
  # - :right
185
+ # :allow_uploads - Set to true to allow file uploads.
185
186
  #
186
187
  # Returns a fresh Gollum::Repo.
187
188
  def initialize(path, options = {})
@@ -221,6 +222,7 @@ module Gollum
221
222
  @bar_side = options.fetch :sidebar, :right
222
223
  @user_icons = ['gravatar', 'identicon'].include?( options[:user_icons] ) ?
223
224
  options[:user_icons] : 'none'
225
+ @allow_uploads = options.fetch :allow_uploads, false
224
226
  end
225
227
 
226
228
  # Public: check whether the wiki's git repo exists on the filesystem.
@@ -682,6 +684,9 @@ module Gollum
682
684
  # Start with collapsed file view. Default: false
683
685
  attr_reader :collapse_tree
684
686
 
687
+ # Toggles file upload functionality.
688
+ attr_reader :allow_uploads
689
+
685
690
  # Normalize the data.
686
691
  #
687
692
  # data - The String data to be normalized.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-lib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-18 00:00:00.000000000 Z
13
+ date: 2013-07-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grit
@@ -73,7 +73,7 @@ dependencies:
73
73
  requirements:
74
74
  - - ~>
75
75
  - !ruby/object:Gem::Version
76
- version: 0.5.0
76
+ version: 0.5.2
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
@@ -81,7 +81,7 @@ dependencies:
81
81
  requirements:
82
82
  - - ~>
83
83
  - !ruby/object:Gem::Version
84
- version: 0.5.0
84
+ version: 0.5.2
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: sanitize
87
87
  requirement: !ruby/object:Gem::Requirement
@@ -89,10 +89,7 @@ dependencies:
89
89
  requirements:
90
90
  - - ~>
91
91
  - !ruby/object:Gem::Version
92
- version: 2.0.3
93
- - - <
94
- - !ruby/object:Gem::Version
95
- version: 2.0.4
92
+ version: 2.0.6
96
93
  type: :runtime
97
94
  prerelease: false
98
95
  version_requirements: !ruby/object:Gem::Requirement
@@ -100,19 +97,13 @@ dependencies:
100
97
  requirements:
101
98
  - - ~>
102
99
  - !ruby/object:Gem::Version
103
- version: 2.0.3
104
- - - <
105
- - !ruby/object:Gem::Version
106
- version: 2.0.4
100
+ version: 2.0.6
107
101
  - !ruby/object:Gem::Dependency
108
102
  name: nokogiri
109
103
  requirement: !ruby/object:Gem::Requirement
110
104
  none: false
111
105
  requirements:
112
106
  - - ~>
113
- - !ruby/object:Gem::Version
114
- version: 1.5.9
115
- - - <
116
107
  - !ruby/object:Gem::Version
117
108
  version: 1.6.0
118
109
  type: :runtime
@@ -121,9 +112,6 @@ dependencies:
121
112
  none: false
122
113
  requirements:
123
114
  - - ~>
124
- - !ruby/object:Gem::Version
125
- version: 1.5.9
126
- - - <
127
115
  - !ruby/object:Gem::Version
128
116
  version: 1.6.0
129
117
  - !ruby/object:Gem::Dependency
@@ -133,7 +121,7 @@ dependencies:
133
121
  requirements:
134
122
  - - ~>
135
123
  - !ruby/object:Gem::Version
136
- version: 1.5.1
124
+ version: 2.0.5
137
125
  type: :runtime
138
126
  prerelease: false
139
127
  version_requirements: !ruby/object:Gem::Requirement
@@ -141,7 +129,7 @@ dependencies:
141
129
  requirements:
142
130
  - - ~>
143
131
  - !ruby/object:Gem::Version
144
- version: 1.5.1
132
+ version: 2.0.5
145
133
  - !ruby/object:Gem::Dependency
146
134
  name: RedCloth
147
135
  requirement: !ruby/object:Gem::Requirement
@@ -428,7 +416,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
428
416
  requirements:
429
417
  - - ! '>='
430
418
  - !ruby/object:Gem::Version
431
- version: 1.8.7
419
+ version: '1.9'
432
420
  required_rubygems_version: !ruby/object:Gem::Requirement
433
421
  none: false
434
422
  requirements:
@@ -442,4 +430,3 @@ signing_key:
442
430
  specification_version: 2
443
431
  summary: A simple, Git-powered wiki.
444
432
  test_files: []
445
- has_rdoc: