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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03defec1ea870b38272042b25121fec8e78bc853
4
- data.tar.gz: 231dedf0f9e8d1d0fdca14d06747b11baa99b957
3
+ metadata.gz: 9c03ff854db8019836bed34d394b4164929c5658
4
+ data.tar.gz: e56ab20032a7e1a6aaa869b0e20b8a9ab3c2f454
5
5
  SHA512:
6
- metadata.gz: 4415a2dba2417ba0fee03d232ce4bc673b698ff7abc652e7db52ae8a1ca2c701502e13abd482ab5e237e6a036235bba968e29c8c3910e108ad5110517b6e728f
7
- data.tar.gz: f267de8bafdb95340c3b0b1f0cb10e5021833ccbbdd22ad47074d1f3703cae58d95dff304063f25b1d458e0248b464d101474a7b041091700c0a9f81005d5d5b
6
+ metadata.gz: e6794926269a51b059d16236781149fce0b31c7d20dde9c1a50af4b49cd6f64d8b58e4a1ab28cebca26549b94003817d91488fd3db8b9c20457bb4552b651fd7
7
+ data.tar.gz: d485279f1c32145f0c3a0be000d1cf7dd1d473aa1971a5447f3c7a05bd8106228234d8375baf55a018ebaa7cf0b1c349dc46346e779fff174d8d95b65864d86d
data/Gemfile.lock CHANGED
@@ -10,7 +10,7 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- gollum_rails (0.0.5)
13
+ gollum_rails (0.0.6)
14
14
  activemodel (~> 3.2.13)
15
15
  builder (~> 3.0.0)
16
16
  gollum-lib (~> 0.0.1)
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.5'
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
- "\t\trails g gollum_rails:install\n\n"\
69
+ "\trails g gollum_rails:install\n\n"\
68
70
  "To generate a new Page model just run:\n\n"\
69
- "\t\rails g gollum_rails:model MODEL_NAME"\
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
@@ -12,7 +12,7 @@ require 'gollum-lib'
12
12
  module GollumRails
13
13
 
14
14
  # GollumRails version string
15
- VERSION = '0.0.5'
15
+ VERSION = '0.0.6'
16
16
 
17
17
  # Simplified error
18
18
  class Error < StandardError; end
@@ -26,7 +26,7 @@ module GollumRails
26
26
 
27
27
  # Initializer
28
28
  def initialize
29
- @wiki = Wiki.class_variable_get(:@@wiki)
29
+ @wiki = Connector.wiki_class
30
30
  end
31
31
 
32
32
 
@@ -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
- @@wiki = gollum.new @git
18
+ con = ::Gollum::Wiki.new @git
28
19
  else
29
- @@wiki = gollum.new @git.path
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
@@ -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.class_variable_get(:@@wiki)
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.instance_variable_set("@page", page.new_page(name, content, format, commit)) if valid?
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
- @@gollum_page = block
234
- end
235
- if check
236
- @@gollum_page.call context.class.validator
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
@@ -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 path_valid? @repository
35
- repository = Grit::Repo.new @repository.to_s
36
- GollumRails::Adapters::Gollum::Wiki.new repository
37
- true
38
- else
39
- raise GollumInternalError, 'no repository path specified'
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.5
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\t\trails g gollum_rails:install\n\nTo
164
- generate a new Page model just run:\n\n\t\rails g gollum_rails:model MODEL_NAME**********************************************"
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