gollum_rails 1.4.0.rc2 → 1.4.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -6
- data/Gemfile.lock +7 -10
- data/HISTORY.md +91 -91
- data/LICENSE +661 -661
- data/README.md +74 -74
- data/Rakefile +170 -170
- data/gollum_rails.gemspec +6 -4
- data/lib/core_ext/string.rb +3 -7
- data/lib/generators/gollum_rails/install/install_generator.rb +27 -27
- data/lib/generators/gollum_rails/install/templates/gollum_initializer.rb +22 -22
- data/lib/generators/gollum_rails/language/language_generator.rb +81 -81
- data/lib/generators/gollum_rails/model/model_generator.rb +51 -51
- data/lib/generators/gollum_rails/model/templates/model_template.erb +13 -13
- data/lib/gollum_rails.rb +26 -6
- data/lib/gollum_rails/adapters/activemodel.rb +36 -36
- data/lib/gollum_rails/adapters/activemodel/boolean.rb +15 -15
- data/lib/gollum_rails/adapters/activemodel/error.rb +27 -27
- data/lib/gollum_rails/adapters/activemodel/naming.rb +42 -42
- data/lib/gollum_rails/adapters/gollum.rb +54 -54
- data/lib/gollum_rails/adapters/gollum/.gitkeep +0 -0
- data/lib/gollum_rails/adapters/gollum/error.rb +19 -19
- data/lib/gollum_rails/adapters/gollum/page.rb +177 -177
- data/lib/gollum_rails/adapters/gollum/wiki.rb +42 -42
- data/lib/gollum_rails/page.rb +266 -266
- data/lib/gollum_rails/setup.rb +81 -81
- data/lib/grit/git-ruby/internal/pack.rb +397 -397
- data/spec/gollum_rails/adapters/activemodel/error_spec.rb +11 -11
- data/spec/gollum_rails/adapters/activemodel/naming_spec.rb +27 -27
- data/spec/gollum_rails/adapters/activemodel/validation_unused.rb +102 -102
- data/spec/gollum_rails/adapters/gollum/committer_spec.rb +0 -0
- data/spec/gollum_rails/adapters/gollum/connector_spec.rb +15 -15
- data/spec/gollum_rails/adapters/gollum/error_spec.rb +7 -7
- data/spec/gollum_rails/adapters/gollum/page_spec.rb +89 -89
- data/spec/gollum_rails/adapters/gollum/wiki_spec.rb +27 -27
- data/spec/gollum_rails/error_spec.rb +10 -0
- data/spec/gollum_rails/page_spec.rb +207 -207
- data/spec/gollum_rails/respository_spec.rb +0 -0
- data/spec/gollum_rails/setup_spec.rb +44 -44
- data/spec/gollum_rails/wiki_spec.rb +0 -0
- data/spec/gollum_rails_spec.rb +9 -0
- data/spec/spec.opts +3 -3
- data/spec/spec_helper.rb +43 -43
- metadata +4 -5
- data/lib/gollum_rails/modules/hash.rb +0 -33
- data/lib/gollum_rails/modules/loader.rb +0 -5
- data/spec/gollum_rails/modules/hash_spec.rb +0 -31
data/lib/gollum_rails.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
# ~*~ encoding: utf-8 ~*~
|
2
|
+
|
3
|
+
# stdlib
|
1
4
|
require 'rubygems'
|
5
|
+
|
6
|
+
# external
|
2
7
|
require 'gollum-lib'
|
8
|
+
|
9
|
+
# patches
|
3
10
|
require 'grit/git-ruby/internal/pack'
|
4
11
|
require 'core_ext/string'
|
5
12
|
|
@@ -16,21 +23,34 @@ module GollumRails
|
|
16
23
|
autoload :Setup, 'gollum_rails/setup'
|
17
24
|
|
18
25
|
# GollumRails version string
|
19
|
-
VERSION = '1.4.0.
|
26
|
+
VERSION = '1.4.0.rc3'
|
20
27
|
|
21
28
|
# Simplified error
|
22
29
|
class Error < StandardError; end
|
23
30
|
|
24
|
-
#
|
25
|
-
#
|
31
|
+
# All Gollum internal exceptions will be redirected to this
|
26
32
|
class GollumInternalError < Error
|
27
33
|
|
34
|
+
attr_accessor :name
|
35
|
+
attr_accessor :message
|
36
|
+
attr_accessor :target
|
37
|
+
|
38
|
+
# modifies content for throwing an exception
|
39
|
+
def initialize(name, target = nil, message = nil)
|
40
|
+
@name = name
|
41
|
+
@target = target
|
42
|
+
@message = message
|
43
|
+
|
44
|
+
super(message || "An Error occured: #{name} on #{target}")
|
45
|
+
end
|
46
|
+
|
47
|
+
# Fancy inspects
|
48
|
+
def inspect
|
49
|
+
"#<GollumRails::GollumInternalError:#{object_id} {name: #{name.inspect}, message: #{message.inspect}, target: #{target.inspect}}>"
|
50
|
+
end
|
28
51
|
end
|
29
52
|
end
|
30
53
|
|
31
54
|
|
32
55
|
require File.expand_path '../gollum_rails/adapters/activemodel', __FILE__
|
33
56
|
require File.expand_path '../gollum_rails/adapters/gollum', __FILE__
|
34
|
-
# load extensions
|
35
|
-
# TODO: Remove this shit. It is unnecessary
|
36
|
-
require File.expand_path '../gollum_rails/modules/loader', __FILE__
|
@@ -1,36 +1,36 @@
|
|
1
|
-
require 'active_model'
|
2
|
-
module GollumRails
|
3
|
-
|
4
|
-
# Adapter class. To be documented
|
5
|
-
module Adapters
|
6
|
-
# ActiveModel improvements and own connectors
|
7
|
-
#
|
8
|
-
# including:
|
9
|
-
# * validation
|
10
|
-
# * callbacks
|
11
|
-
# * naming
|
12
|
-
# * error handling
|
13
|
-
#
|
14
|
-
# The following files are involved:
|
15
|
-
# * boolean.rb -> Boolean features for validation
|
16
|
-
# * naming.rb -> Conversion and Naming
|
17
|
-
# * error.rb -> Active Model error handling
|
18
|
-
#
|
19
|
-
# Released under the AGPL License. For further information see the LICENSE file distributed
|
20
|
-
# with this package.
|
21
|
-
#
|
22
|
-
# TODO:
|
23
|
-
# * a lot of testing
|
24
|
-
#
|
25
|
-
#
|
26
|
-
module ActiveModel
|
27
|
-
|
28
|
-
# connector version
|
29
|
-
VERSION="1.21.0"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
require File.expand_path '../activemodel/boolean', __FILE__
|
35
|
-
require File.expand_path '../activemodel/naming', __FILE__
|
36
|
-
require File.expand_path '../activemodel/error', __FILE__
|
1
|
+
require 'active_model'
|
2
|
+
module GollumRails
|
3
|
+
|
4
|
+
# Adapter class. To be documented
|
5
|
+
module Adapters
|
6
|
+
# ActiveModel improvements and own connectors
|
7
|
+
#
|
8
|
+
# including:
|
9
|
+
# * validation
|
10
|
+
# * callbacks
|
11
|
+
# * naming
|
12
|
+
# * error handling
|
13
|
+
#
|
14
|
+
# The following files are involved:
|
15
|
+
# * boolean.rb -> Boolean features for validation
|
16
|
+
# * naming.rb -> Conversion and Naming
|
17
|
+
# * error.rb -> Active Model error handling
|
18
|
+
#
|
19
|
+
# Released under the AGPL License. For further information see the LICENSE file distributed
|
20
|
+
# with this package.
|
21
|
+
#
|
22
|
+
# TODO:
|
23
|
+
# * a lot of testing
|
24
|
+
#
|
25
|
+
#
|
26
|
+
module ActiveModel
|
27
|
+
|
28
|
+
# connector version
|
29
|
+
VERSION="1.21.0"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
require File.expand_path '../activemodel/boolean', __FILE__
|
35
|
+
require File.expand_path '../activemodel/naming', __FILE__
|
36
|
+
require File.expand_path '../activemodel/error', __FILE__
|
@@ -1,15 +1,15 @@
|
|
1
|
-
module GollumRails
|
2
|
-
module Adapters
|
3
|
-
module ActiveModel
|
4
|
-
|
5
|
-
# Own implemented Boolean method for validating
|
6
|
-
module Boolean; end
|
7
|
-
|
8
|
-
# inherit
|
9
|
-
class ::TrueClass; include Boolean; end
|
10
|
-
|
11
|
-
# inherit
|
12
|
-
class ::FalseClass; include Boolean; end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
1
|
+
module GollumRails
|
2
|
+
module Adapters
|
3
|
+
module ActiveModel
|
4
|
+
|
5
|
+
# Own implemented Boolean method for validating
|
6
|
+
module Boolean; end
|
7
|
+
|
8
|
+
# inherit
|
9
|
+
class ::TrueClass; include Boolean; end
|
10
|
+
|
11
|
+
# inherit
|
12
|
+
class ::FalseClass; include Boolean; end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
module GollumRails
|
2
|
-
module Adapters
|
3
|
-
module ActiveModel
|
4
|
-
|
5
|
-
# Error handling class, with several exception types and debug / info messages
|
6
|
-
class Error < ::GollumRails::GollumInternalError
|
7
|
-
extend ::ActiveModel::Naming
|
8
|
-
|
9
|
-
######
|
10
|
-
public
|
11
|
-
######
|
12
|
-
|
13
|
-
# Gets/Sets the Error
|
14
|
-
attr_reader :errors
|
15
|
-
|
16
|
-
# Initializes a new Exception
|
17
|
-
#
|
18
|
-
def initialize(name, message = nil, priority = :crit)
|
19
|
-
super("Error thrown: #{name},\n\n #{(message)}")
|
20
|
-
end
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
1
|
+
module GollumRails
|
2
|
+
module Adapters
|
3
|
+
module ActiveModel
|
4
|
+
|
5
|
+
# Error handling class, with several exception types and debug / info messages
|
6
|
+
class Error < ::GollumRails::GollumInternalError
|
7
|
+
extend ::ActiveModel::Naming
|
8
|
+
|
9
|
+
######
|
10
|
+
public
|
11
|
+
######
|
12
|
+
|
13
|
+
# Gets/Sets the Error
|
14
|
+
attr_reader :errors
|
15
|
+
|
16
|
+
# Initializes a new Exception
|
17
|
+
#
|
18
|
+
def initialize(name, message = nil, priority = :crit)
|
19
|
+
super("Error thrown: #{name},\n\n #{(message)}")
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
|
2
|
-
module GollumRails
|
3
|
-
module Adapters
|
4
|
-
module ActiveModel
|
5
|
-
|
6
|
-
# Naming class for all Classes, extending the AdtiveModel::Naming module
|
7
|
-
#
|
8
|
-
# provides base functionality like filenames, classnames, variable-, instancenames
|
9
|
-
module Naming
|
10
|
-
|
11
|
-
# Outputs the currents class name
|
12
|
-
#
|
13
|
-
# Returns a String
|
14
|
-
def class_name
|
15
|
-
self.class.name
|
16
|
-
end
|
17
|
-
|
18
|
-
# Gets the pluralized filename for an object
|
19
|
-
#
|
20
|
-
# Returns a String
|
21
|
-
def plural_filename_for_class(name)
|
22
|
-
return ::ActiveModel::Naming.plural name if name.model_name
|
23
|
-
return nil
|
24
|
-
end
|
25
|
-
|
26
|
-
# Gets the singularized filename for an object
|
27
|
-
#
|
28
|
-
# Returns a String
|
29
|
-
def singular_filename_for_class(name)
|
30
|
-
return ::ActiveModel::Naming.singular name if name.model_name
|
31
|
-
return nil
|
32
|
-
end
|
33
|
-
|
34
|
-
# dummy namespace class
|
35
|
-
class NameSpace
|
36
|
-
extend ::ActiveModel::Naming
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
|
2
|
+
module GollumRails
|
3
|
+
module Adapters
|
4
|
+
module ActiveModel
|
5
|
+
|
6
|
+
# Naming class for all Classes, extending the AdtiveModel::Naming module
|
7
|
+
#
|
8
|
+
# provides base functionality like filenames, classnames, variable-, instancenames
|
9
|
+
module Naming
|
10
|
+
|
11
|
+
# Outputs the currents class name
|
12
|
+
#
|
13
|
+
# Returns a String
|
14
|
+
def class_name
|
15
|
+
self.class.name
|
16
|
+
end
|
17
|
+
|
18
|
+
# Gets the pluralized filename for an object
|
19
|
+
#
|
20
|
+
# Returns a String
|
21
|
+
def plural_filename_for_class(name)
|
22
|
+
return ::ActiveModel::Naming.plural name if name.model_name
|
23
|
+
return nil
|
24
|
+
end
|
25
|
+
|
26
|
+
# Gets the singularized filename for an object
|
27
|
+
#
|
28
|
+
# Returns a String
|
29
|
+
def singular_filename_for_class(name)
|
30
|
+
return ::ActiveModel::Naming.singular name if name.model_name
|
31
|
+
return nil
|
32
|
+
end
|
33
|
+
|
34
|
+
# dummy namespace class
|
35
|
+
class NameSpace
|
36
|
+
extend ::ActiveModel::Naming
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,54 +1,54 @@
|
|
1
|
-
# ~*~ encoding: utf-8 ~*~
|
2
|
-
module GollumRails
|
3
|
-
module Adapters
|
4
|
-
# Gollum Wiki connector classes
|
5
|
-
#
|
6
|
-
#
|
7
|
-
module Gollum
|
8
|
-
autoload :Wiki, 'gollum_rails/adapters/gollum/wiki'
|
9
|
-
autoload :Page, 'gollum_rails/adapters/gollum/page'
|
10
|
-
autoload :Error, 'gollum_rails/adapters/gollum/error'
|
11
|
-
|
12
|
-
# connector version
|
13
|
-
VERSION="2.0.0"
|
14
|
-
|
15
|
-
# Gollum connector class, keeping defaults!
|
16
|
-
#
|
17
|
-
class Connector
|
18
|
-
class << self
|
19
|
-
# Sets the page class used by all instances
|
20
|
-
attr_writer :page_class
|
21
|
-
|
22
|
-
# Sets the wiki class used by all instances
|
23
|
-
attr_writer :wiki_class
|
24
|
-
|
25
|
-
# Sets the applications status
|
26
|
-
attr_writer :enabled
|
27
|
-
|
28
|
-
# Gets the enabled status
|
29
|
-
#
|
30
|
-
# Returns a boolean value
|
31
|
-
def enabled
|
32
|
-
@enabled || false
|
33
|
-
end
|
34
|
-
# Gets the Globally used Page class or use a new one if not defined
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# Returns the internal page class or a fresh ::Gollum::Page
|
38
|
-
def page_class
|
39
|
-
@page_class || Page
|
40
|
-
end
|
41
|
-
|
42
|
-
# Gets the Globally used Page class or use a new one if not defined
|
43
|
-
#
|
44
|
-
#
|
45
|
-
# Returns the internal page class or a fresh ::Gollum::Page
|
46
|
-
def wiki_class
|
47
|
-
@wiki_class || Wiki
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
1
|
+
# ~*~ encoding: utf-8 ~*~
|
2
|
+
module GollumRails
|
3
|
+
module Adapters
|
4
|
+
# Gollum Wiki connector classes
|
5
|
+
#
|
6
|
+
#
|
7
|
+
module Gollum
|
8
|
+
autoload :Wiki, 'gollum_rails/adapters/gollum/wiki'
|
9
|
+
autoload :Page, 'gollum_rails/adapters/gollum/page'
|
10
|
+
autoload :Error, 'gollum_rails/adapters/gollum/error'
|
11
|
+
|
12
|
+
# connector version
|
13
|
+
VERSION="2.0.0"
|
14
|
+
|
15
|
+
# Gollum connector class, keeping defaults!
|
16
|
+
#
|
17
|
+
class Connector
|
18
|
+
class << self
|
19
|
+
# Sets the page class used by all instances
|
20
|
+
attr_writer :page_class
|
21
|
+
|
22
|
+
# Sets the wiki class used by all instances
|
23
|
+
attr_writer :wiki_class
|
24
|
+
|
25
|
+
# Sets the applications status
|
26
|
+
attr_writer :enabled
|
27
|
+
|
28
|
+
# Gets the enabled status
|
29
|
+
#
|
30
|
+
# Returns a boolean value
|
31
|
+
def enabled
|
32
|
+
@enabled || false
|
33
|
+
end
|
34
|
+
# Gets the Globally used Page class or use a new one if not defined
|
35
|
+
#
|
36
|
+
#
|
37
|
+
# Returns the internal page class or a fresh ::Gollum::Page
|
38
|
+
def page_class
|
39
|
+
@page_class || Page
|
40
|
+
end
|
41
|
+
|
42
|
+
# Gets the Globally used Page class or use a new one if not defined
|
43
|
+
#
|
44
|
+
#
|
45
|
+
# Returns the internal page class or a fresh ::Gollum::Page
|
46
|
+
def wiki_class
|
47
|
+
@wiki_class || Wiki
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
File without changes
|
@@ -1,19 +1,19 @@
|
|
1
|
-
module GollumRails
|
2
|
-
module Adapters
|
3
|
-
module Gollum
|
4
|
-
|
5
|
-
# Gollum adapter Error handling class
|
6
|
-
#
|
7
|
-
# provides better errors
|
8
|
-
class Error < ::StandardError
|
9
|
-
|
10
|
-
# does the formatting of the Error message
|
11
|
-
#
|
12
|
-
#
|
13
|
-
def initialize(error_message, urgence)
|
14
|
-
super "#{urgence.upcase} :: #{error_message}"
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
1
|
+
module GollumRails
|
2
|
+
module Adapters
|
3
|
+
module Gollum
|
4
|
+
|
5
|
+
# Gollum adapter Error handling class
|
6
|
+
#
|
7
|
+
# provides better errors
|
8
|
+
class Error < ::StandardError
|
9
|
+
|
10
|
+
# does the formatting of the Error message
|
11
|
+
#
|
12
|
+
#
|
13
|
+
def initialize(error_message, urgence)
|
14
|
+
super "#{urgence.upcase} :: #{error_message}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|