gollum-lib 1.0.5 → 1.0.6

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.

checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: aff116f5c69c8fedeab7e72a0f7b8ff44a7484d2
4
- data.tar.gz: ea440b481f5546eb88076f3064e8f79d07dfb4de
5
- SHA512:
6
- metadata.gz: f5d6542ce0ffa92f03b428ba0cd63fab44599444c48c8c3dca237c3a86583e99b92cfc12ba9854c85e4a3d45c0081eddda60c22cb7dafa55378fcfaa100e3c82
7
- data.tar.gz: 01887c48f26662fa6a5a35b045f68ab61e7f4afb3891404ed36c24e1f01e498c126095c26b7cfdfde7f1e66706a1848fd0ee1f9b81faf05592f5905947b22cf0
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTQzN2UwNTQyMWZjMWIyYTAwMWIxYzQ3NDVkOGJkZGI0MWFjYmEwOA==
5
+ data.tar.gz: !binary |-
6
+ MDYzOThmMzJhNGZhNmIxZDRjODNkYWVlNjI2OWYzZmFjYmU3N2U1Mw==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZjA1NDUyODg1ODc1ZTg2NmNhNDliMmUwY2E0ZDg2ODUwZDI1OWViNjYwZGJh
10
+ MDIyZGIxOGMwNDdhODdkODRhM2I1MGY0MDlkODJiYjMyMzZkNmNjYWRkODE1
11
+ ZDQ3ODdlMzM4N2YwY2FlYWJjYzhhYTE0ZmI2ZjZiNWVmZmIzZTE=
12
+ data.tar.gz: !binary |-
13
+ MTVhYmU0MzJlNzkzMjE4YjQ3ZGE0ZGMzODQ1Zjg1YjlmY2M0MzBmMTM5NzQ5
14
+ ZTRhZjU0Njk0ZGZhMTI1NGU1OGZhNDVhMDRmZjYzZDk0ODBhOGZkYzdiY2E3
15
+ MDdlZTY5OGM4ZDNjNTE0ODRmOTY5MjdiYWEyMzk3ZTFhY2NmN2M=
data/README.md CHANGED
@@ -202,6 +202,16 @@ To delete a page and commit the change:
202
202
  wiki.delete_page(page, commit)
203
203
  ```
204
204
 
205
+ Register or unregister a hook to be called after a page commit:
206
+
207
+ ```ruby
208
+ Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
209
+ # Your code here
210
+ end
211
+
212
+ Gollum::Hook.unregister(:post_commit, :hook_id)
213
+ ```
214
+
205
215
  ## WINDOWS FILENAME VALIDATION
206
216
 
207
217
  Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
data/gollum-lib.gemspec CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
5
5
  s.required_ruby_version = ">= 1.9"
6
6
 
7
7
  s.name = 'gollum-lib'
8
- s.version = '1.0.5'
9
- s.date = '2013-08-08'
8
+ s.version = '1.0.6'
9
+ s.date = '2013-08-10'
10
10
  s.rubyforge_project = 'gollum-lib'
11
11
  s.license = 'MIT'
12
12
 
@@ -66,6 +66,7 @@ Gem::Specification.new do |s|
66
66
  lib/gollum-lib/gitcode.rb
67
67
  lib/gollum-lib/grit_ext.rb
68
68
  lib/gollum-lib/helpers.rb
69
+ lib/gollum-lib/hook.rb
69
70
  lib/gollum-lib/markup.rb
70
71
  lib/gollum-lib/markups.rb
71
72
  lib/gollum-lib/page.rb
data/lib/gollum-lib.rb CHANGED
@@ -12,6 +12,7 @@ require 'sanitize'
12
12
 
13
13
  # internal
14
14
  require File.expand_path('../gollum-lib/git_access', __FILE__)
15
+ require File.expand_path('../gollum-lib/hook', __FILE__)
15
16
  require File.expand_path('../gollum-lib/committer', __FILE__)
16
17
  require File.expand_path('../gollum-lib/pagination', __FILE__)
17
18
  require File.expand_path('../gollum-lib/blob_entry', __FILE__)
@@ -30,7 +31,7 @@ $KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
30
31
 
31
32
  module Gollum
32
33
  module Lib
33
- VERSION = '1.0.5'
34
+ VERSION = '1.0.6'
34
35
  end
35
36
 
36
37
  def self.assets_path
@@ -30,6 +30,7 @@ module Gollum
30
30
  @wiki = wiki
31
31
  @options = options
32
32
  @callbacks = []
33
+ after_commit { |*args| Hook.execute(:post_commit, *args) }
33
34
  end
34
35
 
35
36
  # Public: References the Git index for this commit.
@@ -0,0 +1,35 @@
1
+ # ~*~ encoding: utf-8 ~*~
2
+ module Gollum
3
+ class Hook
4
+ @hooks = {}
5
+
6
+ class << self
7
+ def register(type, id, &block)
8
+ type_hooks = @hooks[type] ||= {}
9
+ type_hooks[id] = block
10
+ end
11
+
12
+ def unregister(type, id)
13
+ type_hooks = @hooks[type]
14
+ if type_hooks
15
+ type_hooks.delete(id)
16
+ @hooks.delete(type) if type_hooks.empty?
17
+ end
18
+ end
19
+
20
+ def get(type, id)
21
+ @hooks.fetch(type, {})[id]
22
+ end
23
+
24
+ def execute(type, *args)
25
+ type_hooks = @hooks[type]
26
+ if type_hooks
27
+ type_hooks.each_value do |block|
28
+ block.call(*args)
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ end
35
+ end
@@ -148,11 +148,18 @@ module Gollum
148
148
  path
149
149
  end
150
150
 
151
+ # Public: The display form of the url path required to reach this page within the repo.
152
+ #
153
+ # Returns the String url_path
154
+ def url_path_display
155
+ url_path.gsub("-", " ")
156
+ end
157
+
151
158
  # Public: Defines title for page.rb
152
159
  #
153
160
  # Returns the String title
154
161
  def url_path_title
155
- metadata_title || url_path.gsub("-", " ")
162
+ metadata_title || url_path_display
156
163
  end
157
164
 
158
165
  # Public: Metadata title
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.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-08 00:00:00.000000000 Z
12
+ date: 2013-08-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: grit
@@ -29,7 +29,7 @@ dependencies:
29
29
  name: github-markup
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ! '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: 0.7.5
35
35
  - - <
@@ -39,7 +39,7 @@ dependencies:
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - '>='
42
+ - - ! '>='
43
43
  - !ruby/object:Gem::Version
44
44
  version: 0.7.5
45
45
  - - <
@@ -349,6 +349,7 @@ files:
349
349
  - lib/gollum-lib/gitcode.rb
350
350
  - lib/gollum-lib/grit_ext.rb
351
351
  - lib/gollum-lib/helpers.rb
352
+ - lib/gollum-lib/hook.rb
352
353
  - lib/gollum-lib/markup.rb
353
354
  - lib/gollum-lib/markups.rb
354
355
  - lib/gollum-lib/page.rb
@@ -369,12 +370,12 @@ require_paths:
369
370
  - lib
370
371
  required_ruby_version: !ruby/object:Gem::Requirement
371
372
  requirements:
372
- - - '>='
373
+ - - ! '>='
373
374
  - !ruby/object:Gem::Version
374
375
  version: '1.9'
375
376
  required_rubygems_version: !ruby/object:Gem::Requirement
376
377
  requirements:
377
- - - '>='
378
+ - - ! '>='
378
379
  - !ruby/object:Gem::Version
379
380
  version: '0'
380
381
  requirements: []
@@ -384,4 +385,3 @@ signing_key:
384
385
  specification_version: 2
385
386
  summary: A simple, Git-powered wiki.
386
387
  test_files: []
387
- has_rdoc: