gollum_rails 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/gollum_rails.gemspec +5 -3
- data/lib/generators/gollum_rails/install/install_generator.rb +22 -0
- data/lib/generators/gollum_rails/install/templates/gollum_initializer.rb +22 -0
- data/lib/gollum_rails.rb +1 -1
- data/lib/gollum_rails/adapters/gollum/page.rb +1 -1
- data/lib/gollum_rails/adapters/gollum/wiki.rb +7 -11
- data/lib/gollum_rails/page.rb +9 -10
- data/lib/gollum_rails/setup.rb +19 -7
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c03ff854db8019836bed34d394b4164929c5658
|
4
|
+
data.tar.gz: e56ab20032a7e1a6aaa869b0e20b8a9ab3c2f454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6794926269a51b059d16236781149fce0b31c7d20dde9c1a50af4b49cd6f64d8b58e4a1ab28cebca26549b94003817d91488fd3db8b9c20457bb4552b651fd7
|
7
|
+
data.tar.gz: d485279f1c32145f0c3a0be000d1cf7dd1d473aa1971a5447f3c7a05bd8106228234d8375baf55a018ebaa7cf0b1c349dc46346e779fff174d8d95b65864d86d
|
data/Gemfile.lock
CHANGED
data/gollum_rails.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |s|
|
|
4
4
|
s.name = 'gollum_rails'
|
5
5
|
s.rubyforge_project = s.name
|
6
6
|
|
7
|
-
s.version = '0.0.
|
7
|
+
s.version = '0.0.6'
|
8
8
|
|
9
9
|
s.summary = 'Combines the benefits from Gollum and Rails'
|
10
10
|
s.description= 'Use all the benefits from Rails and combine them with the awesome Gollum wiki'
|
@@ -38,6 +38,8 @@ Gem::Specification.new do |s|
|
|
38
38
|
Rakefile
|
39
39
|
examples/rails/initializer.rb
|
40
40
|
gollum_rails.gemspec
|
41
|
+
lib/generators/gollum_rails/install/install_generator.rb
|
42
|
+
lib/generators/gollum_rails/install/templates/gollum_initializer.rb
|
41
43
|
lib/gollum_rails.rb
|
42
44
|
lib/gollum_rails/adapters/activemodel.rb
|
43
45
|
lib/gollum_rails/adapters/activemodel/boolean.rb
|
@@ -64,9 +66,9 @@ Gem::Specification.new do |s|
|
|
64
66
|
s.post_install_message = "Important: \n\n" \
|
65
67
|
"**********************************************\n\n" \
|
66
68
|
"To use the 'autoinitializer' just run the following command:\n\n"\
|
67
|
-
"\
|
69
|
+
"\trails g gollum_rails:install\n\n"\
|
68
70
|
"To generate a new Page model just run:\n\n"\
|
69
|
-
"\
|
71
|
+
"\trails g gollum_rails:model MODEL_NAME\n"\
|
70
72
|
"**********************************************"
|
71
73
|
end
|
72
74
|
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module GollumRails
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
desc "This generator will install gollum_rails"
|
8
|
+
|
9
|
+
def install_application
|
10
|
+
if File.exist? 'config/initializers/gollum.rb'
|
11
|
+
puts <<-EOM
|
12
|
+
Warning! 'config/initializers/gollum.rb' exists
|
13
|
+
It should be removed, as it may contain data of a previous installation
|
14
|
+
EOM
|
15
|
+
else
|
16
|
+
copy_file "gollum_initializer.rb", "config/initializers/gollum.rb"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Initializer for the GollumRails gem.
|
2
|
+
GollumRails::Setup.build do |config|
|
3
|
+
|
4
|
+
# Set the path to the GIT-Repository.
|
5
|
+
#
|
6
|
+
# Possible values are:
|
7
|
+
#
|
8
|
+
# => an absolute path: '/home/railsapp/db/wiki.git'
|
9
|
+
# => a relative path: Path.join(RAILS_ROOT, 'db', 'wiki.git')
|
10
|
+
# => a symbol (only application) it uses the currently active rails environment configuration for the path
|
11
|
+
#
|
12
|
+
config.repository = :application
|
13
|
+
|
14
|
+
# Tells GollumRails to startup.
|
15
|
+
#
|
16
|
+
# By default this value is disabled, because no path is set
|
17
|
+
#
|
18
|
+
# Possible values are:
|
19
|
+
#
|
20
|
+
# true or false
|
21
|
+
config.startup = false
|
22
|
+
end
|
data/lib/gollum_rails.rb
CHANGED
@@ -6,28 +6,20 @@ module GollumRails
|
|
6
6
|
# TODO: doc
|
7
7
|
class Wiki
|
8
8
|
|
9
|
-
Connector.wiki_class = self
|
10
|
-
|
11
9
|
# Gets / Sets the git path or object
|
12
10
|
attr_accessor :git
|
13
11
|
|
14
|
-
# Static callers
|
15
|
-
class << self
|
16
|
-
# Gets / Sets the wiki instance
|
17
|
-
attr_accessor :wiki
|
18
|
-
end
|
19
|
-
|
20
12
|
# Initializes the class
|
21
13
|
#
|
22
14
|
# location - String or Grit::Repo
|
23
15
|
def initialize(location)
|
24
|
-
gollum = ::Gollum::Wiki
|
25
16
|
@git = location
|
26
17
|
if location.is_a? ::String
|
27
|
-
|
18
|
+
con = ::Gollum::Wiki.new @git
|
28
19
|
else
|
29
|
-
|
20
|
+
con= ::Gollum::Wiki.new @git.path
|
30
21
|
end
|
22
|
+
Connector.wiki_class = con
|
31
23
|
end
|
32
24
|
|
33
25
|
# Static call from within any other class
|
@@ -37,6 +29,10 @@ module GollumRails
|
|
37
29
|
Wiki.new(location)
|
38
30
|
end
|
39
31
|
|
32
|
+
def self.method_missing(name, *args)
|
33
|
+
Connector.wiki_class.send(name, *args)
|
34
|
+
end
|
35
|
+
|
40
36
|
end
|
41
37
|
end
|
42
38
|
end
|
data/lib/gollum_rails/page.rb
CHANGED
@@ -65,7 +65,7 @@ module GollumRails
|
|
65
65
|
|
66
66
|
# Gets the wiki instance
|
67
67
|
def wiki
|
68
|
-
@wiki || Adapters::Gollum::Connector.wiki_class
|
68
|
+
@wiki || Adapters::Gollum::Connector.wiki_class
|
69
69
|
end
|
70
70
|
|
71
71
|
# Gets the pages' name
|
@@ -133,12 +133,11 @@ module GollumRails
|
|
133
133
|
# Returns an instance of Gollum::Page or false
|
134
134
|
def save
|
135
135
|
begin
|
136
|
-
page.
|
137
|
-
return page.page||false
|
136
|
+
page.new_page(name,content,format,commit)
|
138
137
|
rescue ::Gollum::DuplicatePageError => e
|
139
138
|
page.instance_variable_set "@page",page.find_page(name)
|
140
|
-
return page.page
|
141
139
|
end
|
140
|
+
return page.page
|
142
141
|
end
|
143
142
|
|
144
143
|
# aliasing save
|
@@ -229,12 +228,12 @@ module GollumRails
|
|
229
228
|
|
230
229
|
# todo
|
231
230
|
def self.validate(context=nil,check=false,&block)
|
232
|
-
if block
|
233
|
-
|
234
|
-
end
|
235
|
-
if check
|
236
|
-
|
237
|
-
end
|
231
|
+
#if block
|
232
|
+
# @@gollum_page = block
|
233
|
+
#end
|
234
|
+
#if check
|
235
|
+
# @@gollum_page.call context.class.validator
|
236
|
+
#end
|
238
237
|
end
|
239
238
|
|
240
239
|
# todo
|
data/lib/gollum_rails/setup.rb
CHANGED
@@ -30,14 +30,15 @@ module GollumRails
|
|
30
30
|
# Startup action for building wiki components
|
31
31
|
#
|
32
32
|
# Returns true or throws an exception if the path is invalid
|
33
|
-
def startup
|
34
|
-
if
|
35
|
-
repository
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
33
|
+
def startup=(action)
|
34
|
+
if action
|
35
|
+
if @repository == :application
|
36
|
+
initialize_wiki Rails.config.wiki_repository
|
37
|
+
else
|
38
|
+
initialize_wiki @repository
|
39
|
+
end
|
40
40
|
end
|
41
|
+
|
41
42
|
end
|
42
43
|
|
43
44
|
# defines block builder for Rails initializer.
|
@@ -63,6 +64,17 @@ module GollumRails
|
|
63
64
|
return !(path.nil? || path.empty? || ! path.is_a?(String))
|
64
65
|
end
|
65
66
|
|
67
|
+
def initialize_wiki(path)
|
68
|
+
if path_valid? path
|
69
|
+
repository = Grit::Repo.new path.to_s
|
70
|
+
GollumRails::Adapters::Gollum::Wiki.new repository
|
71
|
+
true
|
72
|
+
else
|
73
|
+
raise GollumInternalError, 'no repository path specified'
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
66
78
|
end
|
67
79
|
end
|
68
80
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gollum_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Kasper
|
@@ -137,6 +137,8 @@ files:
|
|
137
137
|
- Rakefile
|
138
138
|
- examples/rails/initializer.rb
|
139
139
|
- gollum_rails.gemspec
|
140
|
+
- lib/generators/gollum_rails/install/install_generator.rb
|
141
|
+
- lib/generators/gollum_rails/install/templates/gollum_initializer.rb
|
140
142
|
- lib/gollum_rails.rb
|
141
143
|
- lib/gollum_rails/adapters/activemodel.rb
|
142
144
|
- lib/gollum_rails/adapters/activemodel/boolean.rb
|
@@ -160,8 +162,8 @@ licenses:
|
|
160
162
|
- AGPL
|
161
163
|
metadata: {}
|
162
164
|
post_install_message: "Important: \n\n**********************************************\n\nTo
|
163
|
-
use the 'autoinitializer' just run the following command:\n\n\
|
164
|
-
generate a new Page model just run:\n\n\
|
165
|
+
use the 'autoinitializer' just run the following command:\n\n\trails g gollum_rails:install\n\nTo
|
166
|
+
generate a new Page model just run:\n\n\trails g gollum_rails:model MODEL_NAME\n**********************************************"
|
165
167
|
rdoc_options: []
|
166
168
|
require_paths:
|
167
169
|
- lib
|