gollum 2.1.2 → 2.1.3

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

Potentially problematic release.


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

data/README.md CHANGED
@@ -520,8 +520,10 @@ your changes merged back into core is as follows:
520
520
  1. Send a pull request to the github/gollum project.
521
521
 
522
522
  ## RELEASING
523
-
523
+ Update VERSION in lib/gollum.rb
524
524
  $ rake gemspec
525
+ $ git tag vX.Y.Z
526
+ $ git push origin vX.Y.Z
525
527
  $ gem build gollum.gemspec
526
528
  $ gem push gollum-X.Y.Z.gem
527
529
 
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = ">= 1.8.7"
6
6
 
7
7
  s.name = 'gollum'
8
- s.version = '2.1.2'
9
- s.date = '2012-08-06'
8
+ s.version = '2.1.3'
9
+ s.date = '2012-08-13'
10
10
  s.rubyforge_project = 'gollum'
11
11
 
12
12
  s.summary = "A simple, Git-powered wiki."
@@ -22,7 +22,7 @@ require File.expand_path('../gollum/tex', __FILE__)
22
22
  require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
23
23
 
24
24
  module Gollum
25
- VERSION = '2.1.2'
25
+ VERSION = '2.1.3'
26
26
 
27
27
  def self.assets_path
28
28
  ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
@@ -82,12 +82,12 @@ module Precious
82
82
  end
83
83
 
84
84
  before do
85
- @base_url = url('/', false)
85
+ @base_url = url('/', false).chomp('/')
86
86
  settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path
87
87
  end
88
88
 
89
89
  get '/' do
90
- show_page_or_file('Home')
90
+ redirect File.join(settings.wiki_options[:base_path].to_s, 'Home')
91
91
  end
92
92
 
93
93
  # path is set to name if path is nil.
@@ -277,7 +277,7 @@
277
277
  }
278
278
 
279
279
  // attempt to load the definition for this language
280
- var script_uri = '.' + baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
280
+ var script_uri = baseUrl + '/javascript/editor/langs/' + markup_name + '.js';
281
281
  $.ajax({
282
282
  url: script_uri,
283
283
  dataType: 'script',
@@ -4,7 +4,7 @@ $(document).ready(function() {
4
4
  var ok = confirm($(this).data('confirm'));
5
5
  if ( ok ) {
6
6
  var loc = window.location;
7
- loc = baseUrl + 'delete' + loc.pathname
7
+ loc = baseUrl + '/delete' + loc.pathname
8
8
  window.location = loc;
9
9
  }
10
10
  // Don't navigate on cancel.
@@ -138,7 +138,7 @@ $(document).ready(function() {
138
138
  var msg = 'Renamed ' + oldName + ' to ' + newName;
139
139
  jQuery.ajax( {
140
140
  type: 'POST',
141
- url: baseUrl + 'edit/' + oldName,
141
+ url: baseUrl + '/edit/' + oldName,
142
142
  data: { path: path, rename: newName, page: oldName, message: msg },
143
143
  success: function() {
144
144
  window.location = baseUrl + encodeURIComponent(newName);
@@ -6,11 +6,11 @@
6
6
  <li class="minibutton">
7
7
  {{>searchbar}}
8
8
  </li>
9
- <li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
9
+ <li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
10
10
  class="action-view-page">View Page</a></li>
11
- <li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
11
+ <li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
12
12
  class="action-edit-page">Edit Page</a></li>
13
- <li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
13
+ <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
14
14
  class="action-page-history">Page History</a></li>
15
15
  </ul>
16
16
  </div>
@@ -23,10 +23,10 @@
23
23
 
24
24
  {{#show_revert}}
25
25
  <ul class="actions">
26
- <li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
26
+ <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
27
27
  class="action-page-history">Back to Page History</a></li>
28
28
  <li class="minibutton">
29
- <form name="gollum-revert" action="{{base_url}}revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
29
+ <form name="gollum-revert" action="{{base_url}}/revert/{{escaped_url_path}}/{{before}}/{{after}}" method="post" id="gollum-revert-form">
30
30
  <a href="#" class="gollum-revert-button">Revert Changes</a>
31
31
  </form>
32
32
  </li>
@@ -49,7 +49,7 @@
49
49
  </div>
50
50
  <div id="footer">
51
51
  <ul class="actions">
52
- <li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
52
+ <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
53
53
  class="action-page-history">Back to Page History</a></li>
54
54
  {{#show_revert}}
55
55
  <li class="minibutton">
@@ -2,9 +2,9 @@
2
2
  <div id="head">
3
3
  <h1>Editing <strong>{{title}}</strong></h1>
4
4
  <ul class="actions">
5
- <li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
5
+ <li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
6
6
  class="action-view-page">View Page</a></li>
7
- <li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
7
+ <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
8
8
  class="action-page-history">Page History</a></li>
9
9
  </ul>
10
10
  </div>
@@ -1,9 +1,9 @@
1
1
  <div id="gollum-editor" data-escaped-name="{{escaped_name}}" class="{{#is_create_page}}create{{/is_create_page}}{{#is_edit_page}}edit{{/is_edit_page}}">
2
2
  {{#is_create_page}}
3
- <form name="gollum-editor" action="{{base_url}}create" method="post">
3
+ <form name="gollum-editor" action="{{base_url}}/create" method="post">
4
4
  {{/is_create_page}}
5
5
  {{#is_edit_page}}
6
- <form name="gollum-editor" action="{{base_url}}edit/{{escaped_name}}" method="post">
6
+ <form name="gollum-editor" action="{{base_url}}/edit/{{escaped_name}}" method="post">
7
7
  {{/is_edit_page}}
8
8
  <fieldset id="gollum-editor-fields">
9
9
  {{#is_create_page}}
@@ -126,7 +126,7 @@
126
126
 
127
127
  <span class="jaws"><br></span>
128
128
  <input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
129
- <a href="{{base_url}}preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
129
+ <a href="{{base_url}}/preview" id="gollum-editor-preview" class="minibutton" title="Preview this Page">Preview</a>
130
130
  </fieldset>
131
131
  </form>
132
132
  </div>
@@ -2,9 +2,9 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="Content-type" content="text/html;charset=utf-8">
5
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
6
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
7
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/_styles.css" media="all">
5
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/gollum.css" media="all">
6
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
7
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/_styles.css" media="all">
8
8
  <title>{{title}}</title>
9
9
  </head>
10
10
  <body>
@@ -12,7 +12,7 @@
12
12
  <div id="home_button">
13
13
  <ul class="actions">
14
14
  <li class="minibutton">
15
- <a href="{{base_url}}" class="action-edit-page">Home</a>
15
+ <a href="{{base_url}}/" class="action-edit-page">Home</a>
16
16
  </li>
17
17
  </ul>
18
18
  </div>
@@ -5,9 +5,9 @@
5
5
  <li class="minibutton">
6
6
  {{>searchbar}}
7
7
  </li>
8
- <li class="minibutton"><a href="{{base_url}}{{escaped_url_path}}"
8
+ <li class="minibutton"><a href="{{base_url}}/{{escaped_url_path}}"
9
9
  class="action-view-page">View Page</a></li>
10
- <li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
10
+ <li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
11
11
  class="action-edit-page">Edit Page</a></li>
12
12
  </ul>
13
13
  </div>
@@ -19,7 +19,7 @@
19
19
  </ul>
20
20
 
21
21
  <form name="compare-versions" id="version-form" method="post"
22
- action="{{base_url}}compare/{{escaped_url_path}}">
22
+ action="{{base_url}}/compare/{{escaped_url_path}}">
23
23
  <fieldset>
24
24
  <table>
25
25
  <tbody>
@@ -39,7 +39,7 @@
39
39
  <td class="commit-name">
40
40
  <span class="time-elapsed">{{date}}:</span>&nbsp;
41
41
  {{message}}
42
- [<a href="{{base_url}}{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
42
+ [<a href="{{base_url}}/{{escaped_url_path}}/{{id}}" title="View commit">{{id7}}</a>]
43
43
  </td>
44
44
  </tr>
45
45
  {{/versions}}
@@ -2,22 +2,22 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta http-equiv="Content-type" content="text/html;charset=utf-8">
5
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/gollum.css" media="all">
6
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/editor.css" media="all">
7
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/dialog.css" media="all">
8
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/template.css" media="all">
5
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/gollum.css" media="all">
6
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/editor.css" media="all">
7
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/dialog.css" media="all">
8
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/template.css" media="all">
9
9
 
10
10
  <!--[if IE 7]>
11
- <link rel="stylesheet" type="text/css" href="{{base_url}}css/ie7.css" media="all">
11
+ <link rel="stylesheet" type="text/css" href="{{base_url}}/css/ie7.css" media="all">
12
12
  <![endif]-->
13
13
 
14
14
  <script>var baseUrl = '{{base_url}}'</script>
15
- <script type="text/javascript" src="{{base_url}}javascript/jquery-1.7.2.min.js"></script>
16
- <script type="text/javascript" src="{{base_url}}javascript/mousetrap.min.js"></script>
17
- <script type="text/javascript" src="{{base_url}}javascript/gollum.js"></script>
18
- <script type="text/javascript" src="{{base_url}}javascript/gollum.dialog.js"></script>
19
- <script type="text/javascript" src="{{base_url}}javascript/gollum.placeholder.js"></script>
20
- <script type="text/javascript" src="{{base_url}}javascript/editor/gollum.editor.js"></script>
15
+ <script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
16
+ <script type="text/javascript" src="{{base_url}}/javascript/mousetrap.min.js"></script>
17
+ <script type="text/javascript" src="{{base_url}}/javascript/gollum.js"></script>
18
+ <script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
19
+ <script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
20
+ <script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
21
21
  {{#mathjax}}<script>(function(d,j){
22
22
  j = d.createElement('script');
23
23
  j.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
@@ -5,21 +5,21 @@
5
5
  <li class="minibutton">
6
6
  {{>searchbar}}
7
7
  </li>
8
- <li class="minibutton"><a href="{{base_url}}"
8
+ <li class="minibutton"><a href="{{base_url}}/"
9
9
  class="action-edit-page">Home</a></li>
10
- <li class="minibutton"><a href="{{base_url}}pages"
10
+ <li class="minibutton"><a href="{{base_url}}/pages"
11
11
  class="action-all-pages">All</a></li>
12
- <li class="minibutton"><a href="{{base_url}}fileview"
12
+ <li class="minibutton"><a href="{{base_url}}/fileview"
13
13
  class="action-all-pages">Files</a></li>
14
14
  <li class="minibutton" class="jaws">
15
15
  <a href="#" id="minibutton-new-page">New</a></li>
16
16
  <li class="minibutton" class="jaws">
17
17
  <a href="#" id="minibutton-rename-page">Rename</a></li>
18
18
  {{#editable}}
19
- <li class="minibutton"><a href="{{base_url}}edit/{{escaped_url_path}}"
19
+ <li class="minibutton"><a href="{{base_url}}/edit/{{escaped_url_path}}"
20
20
  class="action-edit-page">Edit</a></li>
21
21
  {{/editable}}
22
- <li class="minibutton"><a href="{{base_url}}history/{{escaped_url_path}}"
22
+ <li class="minibutton"><a href="{{base_url}}/history/{{escaped_url_path}}"
23
23
  class="action-page-history">History</a></li>
24
24
  </ul>
25
25
  </div>
@@ -62,7 +62,7 @@
62
62
  <div id="footer">
63
63
  <p id="last-edit">Last edited by <b>{{author}}</b>, {{date}}</p>
64
64
  <p>
65
- <a id="delete-link" href="{{base_url}}{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
65
+ <a id="delete-link" href="{{base_url}}/{{escaped_url_path}}" data-confirm="Are you sure you want to delete this page?"><span>Delete this Page</span></a>
66
66
  </p>
67
67
  </div>
68
68
  </div>
@@ -5,7 +5,7 @@
5
5
  <li class="minibutton">
6
6
  {{>searchbar}}
7
7
  </li>
8
- <li class="minibutton"><a href="{{base_url}}"
8
+ <li class="minibutton"><a href="{{base_url}}/"
9
9
  class="action-edit-page">Home</a></li>
10
10
  <li class="minibutton" class="jaws">
11
11
  <a href="#" id="minibutton-new-page">New</a>
@@ -5,7 +5,7 @@
5
5
  <li class="minibutton">
6
6
  {{>searchbar}}
7
7
  </li>
8
- <li class="minibutton"><a href="{{base_url}}"
8
+ <li class="minibutton"><a href="{{base_url}}/"
9
9
  class="action-edit-page">Home</a></li>
10
10
  </ul>
11
11
  </div>
@@ -15,7 +15,7 @@
15
15
  <ul>
16
16
  {{#results}}
17
17
  <li>
18
- <a href="{{base_url}}{{name}}">{{name}}</a>
18
+ <a href="{{base_url}}/{{name}}">{{name}}</a>
19
19
  <span class="count">({{count}} matches)</span>
20
20
  </li>
21
21
  {{/results}}
@@ -1,5 +1,5 @@
1
1
  <div id="searchbar">
2
- <form action="{{base_url}}search" method="get" id="search-form">
2
+ <form action="{{base_url}}/search" method="get" id="search-form">
3
3
  <div id="searchbar-fauxtext">
4
4
  <input type="text" name="q" id="search-query" value="Search&hellip;" autocomplete="off">
5
5
  <a href="#" id="search-submit" title="Search this wiki">
@@ -3,6 +3,9 @@ require 'cgi'
3
3
  require 'pygments'
4
4
  require 'base64'
5
5
 
6
+ # initialize Pygments
7
+ Pygments.start
8
+
6
9
  module Gollum
7
10
 
8
11
  class Markup
@@ -142,13 +142,14 @@ context "Frontend" do
142
142
  assert last_response.ok?
143
143
  end
144
144
 
145
- test "page create and edit with dash" do
145
+ test "page create and edit with dash & page rev" do
146
146
  page = 'c-d-e'
147
147
  path = 'a/b/' # path must end with /
148
148
 
149
149
  post '/create', :content => 'create_msg', :page => page,
150
150
  :path => path, :format => 'markdown', :message => ''
151
- assert_equal 'create_msg', @wiki.paged(page, path).raw_data
151
+ page_c = @wiki.paged(page, path)
152
+ assert_equal 'create_msg', page_c.raw_data
152
153
 
153
154
  # must clear or create_msg will be returned
154
155
  @wiki.clear_cache
@@ -156,7 +157,19 @@ context "Frontend" do
156
157
  # post '/edit' fails. post '/edit/' works.
157
158
  post '/edit/', :content => 'edit_msg',
158
159
  :page => page, :path => path, :message => ''
159
- assert_equal 'edit_msg', @wiki.paged(page, path).raw_data
160
+ page_e = @wiki.paged(page, path)
161
+ assert_equal 'edit_msg', page_e.raw_data
162
+
163
+ @wiki.clear_cache
164
+
165
+ # test `get %r{/(.+?)/([0-9a-f]{40})} do` in app.rb
166
+ get '/' + page_c.escaped_url_path + '/' + page_c.version.to_s
167
+ assert last_response.ok?
168
+ assert_match /create_msg/, last_response.body
169
+
170
+ get '/' + page_e.escaped_url_path + '/' + page_e.version.to_s
171
+ assert last_response.ok?
172
+ assert_match /edit_msg/, last_response.body
160
173
  end
161
174
 
162
175
  test "guards against creation of existing page" do
@@ -236,6 +249,20 @@ context "Frontend" do
236
249
  assert_equal page1.version.sha, page2.version.sha
237
250
  end
238
251
 
252
+ test "redirects from 'base_path' or 'base_path/' to 'base_path/Home'" do
253
+ Precious::App.set(:wiki_options, {})
254
+ get "/"
255
+ assert_match "http://example.org/Home", last_response.headers['Location']
256
+
257
+ Precious::App.set(:wiki_options, { :base_path => '/wiki' })
258
+ get "/"
259
+ assert_match "http://example.org/wiki/Home", last_response.headers['Location']
260
+
261
+ Precious::App.set(:wiki_options, { :base_path => '/wiki/' })
262
+ get "/"
263
+ assert_match "http://example.org/wiki/Home", last_response.headers['Location']
264
+ end
265
+
239
266
  def app
240
267
  Precious::App
241
268
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
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: 2012-08-06 00:00:00.000000000 Z
13
+ date: 2012-08-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grit