gollum_rails 0.0.2.1 → 0.0.2.2
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.
- data/README.md +38 -1
- data/gollum_rails.gemspec +1 -1
- data/lib/gollum/rails/page.rb +19 -2
- metadata +1 -1
data/README.md
CHANGED
@@ -63,8 +63,18 @@ some examples:
|
|
63
63
|
|
64
64
|
Accessible variables / methods are:
|
65
65
|
|
66
|
-
`Gollum::Rails::Page`
|
66
|
+
For: `Gollum::Rails::Page`
|
67
67
|
|
68
|
+
Every action returns a `String`, containing the commit id of the current action
|
69
|
+
|
70
|
+
First: For each action you write on a wiki page, a commit must be given. So lets do this. The commit MUST be a `Hash`
|
71
|
+
|
72
|
+
commit_data = {
|
73
|
+
:message => "test action on page",
|
74
|
+
:name => 'Florian Kasper',
|
75
|
+
:email => 'nirnanaaa@khnetworks.com'
|
76
|
+
}
|
77
|
+
|
68
78
|
**Create a new Page:**
|
69
79
|
|
70
80
|
Example for existing model `Page`
|
@@ -78,7 +88,34 @@ Example for existing model `Page`
|
|
78
88
|
|
79
89
|
Thats it. Very easy. You can use also `page.save!` method.
|
80
90
|
|
91
|
+
|
92
|
+
**Update an existing page**
|
81
93
|
|
94
|
+
page = Page.new
|
95
|
+
page.find('Example page')
|
96
|
+
page.update('some very long content', commit_data)
|
97
|
+
|
98
|
+
# you can also change the name
|
99
|
+
|
100
|
+
page.update('some very long content', commit_data, 'new-name')
|
101
|
+
|
102
|
+
# and the format (page will be recreated)
|
103
|
+
|
104
|
+
page.update('some very long content', commit_data, nil, :wiki)
|
105
|
+
|
106
|
+
|
107
|
+
**Delete a page**
|
108
|
+
|
109
|
+
page = Page.new
|
110
|
+
page.find('Example page')
|
111
|
+
page.delete
|
112
|
+
|
113
|
+
# or
|
114
|
+
|
115
|
+
page.delete!
|
116
|
+
|
117
|
+
# for getting errors instead of `NIL`
|
118
|
+
|
82
119
|
## TODO
|
83
120
|
* List all pages
|
84
121
|
* Search pages
|
data/gollum_rails.gemspec
CHANGED
data/lib/gollum/rails/page.rb
CHANGED
@@ -35,6 +35,10 @@ module Gollum
|
|
35
35
|
# a boolean variable that holds the status of save() and update()
|
36
36
|
attr_reader :persisted
|
37
37
|
|
38
|
+
#########
|
39
|
+
# READERs
|
40
|
+
#########
|
41
|
+
|
38
42
|
# holds the error messages
|
39
43
|
attr_reader :error
|
40
44
|
|
@@ -110,10 +114,11 @@ module Gollum
|
|
110
114
|
|
111
115
|
#rewrite for save() method with raising exceptions as well
|
112
116
|
def save!
|
117
|
+
saves = save
|
113
118
|
if @error
|
114
119
|
raise RuntimeError, @error
|
115
120
|
else
|
116
|
-
return
|
121
|
+
return saves
|
117
122
|
end
|
118
123
|
|
119
124
|
end
|
@@ -155,6 +160,18 @@ module Gollum
|
|
155
160
|
end
|
156
161
|
return @wiki.wiki.delete_page(@page, commit)
|
157
162
|
end
|
163
|
+
|
164
|
+
# alias for delete with exceptions
|
165
|
+
|
166
|
+
def delete!(commit)
|
167
|
+
deletes = delete(commit)
|
168
|
+
if @error
|
169
|
+
raise RuntimeError, @error
|
170
|
+
else
|
171
|
+
return deletes
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
158
175
|
# if a page is loaded wraps Gollum::Page.raw_data
|
159
176
|
def raw_data
|
160
177
|
if @page
|
@@ -213,7 +230,7 @@ module Gollum
|
|
213
230
|
return false
|
214
231
|
end
|
215
232
|
|
216
|
-
super
|
233
|
+
#super #doesn't work atm
|
217
234
|
|
218
235
|
return true
|
219
236
|
end
|