gollum_rails 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/HISTORY.md +8 -0
- data/gollum_rails.gemspec +1 -1
- data/lib/gollum_rails.rb +1 -1
- data/lib/gollum_rails/finders.rb +38 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7722875d793d56642ad1a05a5ebc360e297ca6b2
|
4
|
+
data.tar.gz: 0fb1d9f345e5b93afab6ae91e4687710cd7725cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18f5e87b8172f330b77a418301f4805feea518ba72141c28a8ceeca98ee799d28e68ef69aed968ba17234b8ed88ed0f4407f628b981534d49f0bd3608cf4bb97
|
7
|
+
data.tar.gz: 8822651c8f55cbb3b49caeb9e2f2194989e46f738448bd3c118c4031ef0ffeb2a58fe9c326f1354faddc6071bf63f9e6f2c16f9505143682a89b7ca68fd928d1
|
data/Gemfile.lock
CHANGED
data/HISTORY.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# 1.5.3 19th February 2014
|
2
|
+
* Documentation improvements
|
3
|
+
* Refactored find `find` method call to accept page resets and exact matches
|
4
|
+
* Bugfixing
|
5
|
+
|
6
|
+
# 1.5.2 18th February 2014
|
7
|
+
* Bugfixing
|
8
|
+
|
1
9
|
# 1.5.1 28th January 2014
|
2
10
|
* Updated `update_attributes` to work with hashes
|
3
11
|
* Bugfixing
|
data/gollum_rails.gemspec
CHANGED
data/lib/gollum_rails.rb
CHANGED
data/lib/gollum_rails/finders.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module GollumRails
|
2
2
|
module Finders
|
3
3
|
extend ActiveSupport::Concern
|
4
|
+
|
4
5
|
module ClassMethods
|
5
6
|
# Finds an existing page or creates it
|
6
7
|
#
|
@@ -9,9 +10,9 @@ module GollumRails
|
|
9
10
|
#
|
10
11
|
# Returns self
|
11
12
|
def find_or_initialize_by_name(name, commit={})
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
result = find(name)
|
14
|
+
if result
|
15
|
+
result
|
15
16
|
else
|
16
17
|
new(:format => :markdown, :name => name, :content => ".", :commit => commit)
|
17
18
|
end
|
@@ -21,14 +22,26 @@ module GollumRails
|
|
21
22
|
#
|
22
23
|
# name - the name of the page
|
23
24
|
# version - optional - The pages version
|
25
|
+
# reset_folder - optional - resets the folder to / before performing the search
|
26
|
+
# exact - optional - perform an exact match
|
24
27
|
#
|
25
28
|
# Return an instance of Gollum::Page
|
26
|
-
def find(name, version=nil)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
def find(name, version=nil, reset_folder=false, exact=true)
|
30
|
+
name = name[:name] if name.kind_of?(Hash) && name.has_key?(:name)
|
31
|
+
Setup.wiki_options.merge(:page_file_dir => nil) if reset_folder
|
32
|
+
wiki.clear_cache
|
33
|
+
path = File.split(name)
|
34
|
+
if path.first == '/' || path.first == '.'
|
35
|
+
folder = nil
|
36
|
+
else
|
37
|
+
folder = path.first
|
38
|
+
end
|
39
|
+
page = wiki.paged(path.last, folder, exact, version)
|
40
|
+
if page
|
41
|
+
new(gollum_page: page)
|
42
|
+
else
|
43
|
+
nil
|
44
|
+
end
|
32
45
|
end
|
33
46
|
|
34
47
|
# == Searches the wiki for files CONTENT!
|
@@ -41,26 +54,38 @@ module GollumRails
|
|
41
54
|
end
|
42
55
|
|
43
56
|
# Gets all pages in the wiki
|
57
|
+
#
|
58
|
+
# Returns an Array with GollumRails::Page s
|
44
59
|
def all(options={})
|
45
60
|
set_folder(options)
|
46
61
|
pages = wiki.pages
|
47
|
-
|
62
|
+
pages.map do |page|
|
48
63
|
self.new(gollum_page: page)
|
49
64
|
end
|
50
65
|
end
|
51
66
|
|
67
|
+
# Gets the last item from `all` method call
|
68
|
+
#
|
69
|
+
# options - optional - some options e.g. :folder
|
70
|
+
#
|
71
|
+
# Returns a single GollumRails::Page
|
52
72
|
def first(options={})
|
53
73
|
all(options).first
|
54
74
|
end
|
55
75
|
|
76
|
+
# Gets the first item from `all` method call
|
77
|
+
#
|
78
|
+
# options - optional - some options e.g. :folder
|
79
|
+
#
|
80
|
+
# Returns a single GollumRails::Page
|
56
81
|
def last(options={})
|
57
82
|
all(options).last
|
58
83
|
end
|
59
84
|
|
85
|
+
# Aliasing this for ActiveRecord behavior
|
60
86
|
alias_method :find_all, :all
|
61
87
|
|
62
|
-
#
|
63
|
-
#
|
88
|
+
# Catch-all method
|
64
89
|
def method_missing(name, *args)
|
65
90
|
if name =~ /^find_by_(name)$/
|
66
91
|
self.find(args.first)
|
@@ -71,4 +96,4 @@ module GollumRails
|
|
71
96
|
|
72
97
|
end
|
73
98
|
end
|
74
|
-
end
|
99
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Kasper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|