gollum_rails 1.4.0.rc1 → 1.4.0.rc2
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 +2 -1
- data/HISTORY.md +91 -91
- data/LICENSE +661 -661
- data/README.md +74 -74
- data/Rakefile +170 -170
- data/gollum_rails.gemspec +1 -1
- data/lib/core_ext/string.rb +7 -10
- 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 +1 -1
- 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/modules/hash.rb +33 -33
- data/lib/gollum_rails/modules/loader.rb +5 -5
- 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/modules/hash_spec.rb +31 -31
- 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/spec.opts +3 -3
- data/spec/spec_helper.rb +43 -43
- metadata +2 -2
data/gollum_rails.gemspec
CHANGED
data/lib/core_ext/string.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
class String
|
2
|
-
if ((defined? RUBY_VERSION) && (['1.9', '2.0'].include? RUBY_VERSION[0..2]))
|
3
|
-
def getord(offset); self[offset].ord; end
|
4
|
-
else
|
5
|
-
alias :getord :[]
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
1
|
+
class String
|
2
|
+
if ((defined? RUBY_VERSION) && (['1.9', '2.0', '2.1'].include? RUBY_VERSION[0..2]))
|
3
|
+
def getord(offset); self[offset].ord; end
|
4
|
+
else
|
5
|
+
alias :getord :[]
|
6
|
+
end
|
7
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module GollumRails
|
4
|
-
|
5
|
-
# Generators for GollumRails
|
6
|
-
module Generators
|
7
|
-
|
8
|
-
# Installation generator
|
9
|
-
class InstallGenerator < ::Rails::Generators::Base
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
desc "This generator will install gollum_rails"
|
12
|
-
|
13
|
-
# Installs the necessary files
|
14
|
-
def install_application
|
15
|
-
if File.exist? 'config/initializers/gollum.rb'
|
16
|
-
puts <<-EOM
|
17
|
-
Warning! 'config/initializers/gollum.rb' exists
|
18
|
-
It should be removed, as it may contain data of a previous installation
|
19
|
-
EOM
|
20
|
-
else
|
21
|
-
copy_file "gollum_initializer.rb", "config/initializers/gollum.rb"
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module GollumRails
|
4
|
+
|
5
|
+
# Generators for GollumRails
|
6
|
+
module Generators
|
7
|
+
|
8
|
+
# Installation generator
|
9
|
+
class InstallGenerator < ::Rails::Generators::Base
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
desc "This generator will install gollum_rails"
|
12
|
+
|
13
|
+
# Installs the necessary files
|
14
|
+
def install_application
|
15
|
+
if File.exist? 'config/initializers/gollum.rb'
|
16
|
+
puts <<-EOM
|
17
|
+
Warning! 'config/initializers/gollum.rb' exists
|
18
|
+
It should be removed, as it may contain data of a previous installation
|
19
|
+
EOM
|
20
|
+
else
|
21
|
+
copy_file "gollum_initializer.rb", "config/initializers/gollum.rb"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -1,22 +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
|
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
|
@@ -1,81 +1,81 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module GollumRails
|
4
|
-
|
5
|
-
# Generators for GollumRails
|
6
|
-
module Generators
|
7
|
-
|
8
|
-
# Generates additional language files
|
9
|
-
class LanguageGenerator < ::Rails::Generators::Base
|
10
|
-
desc "This generator will install gollum_rails"
|
11
|
-
|
12
|
-
argument :language, :type => :string
|
13
|
-
|
14
|
-
# installs languages
|
15
|
-
def install_languages
|
16
|
-
case language
|
17
|
-
when "ascii"
|
18
|
-
puts <<-EOT
|
19
|
-
\n Installation instructures for ASCIIDoc:\n
|
20
|
-
\n\n Ubuntu/Debian Linux:
|
21
|
-
\n (sudo) apt-get install asciidoc
|
22
|
-
\n\n Mac with homebrew:
|
23
|
-
\n brew install asciidoc
|
24
|
-
\n
|
25
|
-
EOT
|
26
|
-
when "markdown"
|
27
|
-
run "gem install redcarped"
|
28
|
-
puts <<-EOT
|
29
|
-
\n Parser for type "markdown" was installed
|
30
|
-
\n
|
31
|
-
EOT
|
32
|
-
when "better-markdown"
|
33
|
-
run "gem install github-markdown"
|
34
|
-
puts <<-EOT
|
35
|
-
\n Parser for type "github-markdown" was installed
|
36
|
-
\n
|
37
|
-
EOT
|
38
|
-
when "textile"
|
39
|
-
run "gem install RedCloth"
|
40
|
-
puts <<-EOT
|
41
|
-
\n Parser for type "textile" was installed
|
42
|
-
\n
|
43
|
-
EOT
|
44
|
-
when "wiki"
|
45
|
-
run "gem install wikicloth"
|
46
|
-
puts <<-EOT
|
47
|
-
\n Parser for type "wiki" was installed
|
48
|
-
\n
|
49
|
-
EOT
|
50
|
-
when "org"
|
51
|
-
run "gem install org-ruby"
|
52
|
-
puts <<-EOT
|
53
|
-
\n Parser for type "org-ruby" was installed
|
54
|
-
\n
|
55
|
-
EOT
|
56
|
-
when "creole"
|
57
|
-
run "gem install creole"
|
58
|
-
puts <<-EOT
|
59
|
-
\n Parser for type "creole" was installed
|
60
|
-
\n
|
61
|
-
EOT
|
62
|
-
when "pod"
|
63
|
-
puts <<-EOT
|
64
|
-
\nPOT must be installed through CPAN (perl)
|
65
|
-
\nSee http://search.cpan.org/dist/perl/pod/perlpod.pod for further information
|
66
|
-
\n
|
67
|
-
EOT
|
68
|
-
when "rst"
|
69
|
-
puts <<-EOT
|
70
|
-
\nInstall through 'easy_install'
|
71
|
-
\nSee http://docutils.sourceforge.net/rst.html for further information
|
72
|
-
EOT
|
73
|
-
else
|
74
|
-
puts "UNKNOWN LANGUAGE"
|
75
|
-
exit 1
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module GollumRails
|
4
|
+
|
5
|
+
# Generators for GollumRails
|
6
|
+
module Generators
|
7
|
+
|
8
|
+
# Generates additional language files
|
9
|
+
class LanguageGenerator < ::Rails::Generators::Base
|
10
|
+
desc "This generator will install gollum_rails"
|
11
|
+
|
12
|
+
argument :language, :type => :string
|
13
|
+
|
14
|
+
# installs languages
|
15
|
+
def install_languages
|
16
|
+
case language
|
17
|
+
when "ascii"
|
18
|
+
puts <<-EOT
|
19
|
+
\n Installation instructures for ASCIIDoc:\n
|
20
|
+
\n\n Ubuntu/Debian Linux:
|
21
|
+
\n (sudo) apt-get install asciidoc
|
22
|
+
\n\n Mac with homebrew:
|
23
|
+
\n brew install asciidoc
|
24
|
+
\n
|
25
|
+
EOT
|
26
|
+
when "markdown"
|
27
|
+
run "gem install redcarped"
|
28
|
+
puts <<-EOT
|
29
|
+
\n Parser for type "markdown" was installed
|
30
|
+
\n
|
31
|
+
EOT
|
32
|
+
when "better-markdown"
|
33
|
+
run "gem install github-markdown"
|
34
|
+
puts <<-EOT
|
35
|
+
\n Parser for type "github-markdown" was installed
|
36
|
+
\n
|
37
|
+
EOT
|
38
|
+
when "textile"
|
39
|
+
run "gem install RedCloth"
|
40
|
+
puts <<-EOT
|
41
|
+
\n Parser for type "textile" was installed
|
42
|
+
\n
|
43
|
+
EOT
|
44
|
+
when "wiki"
|
45
|
+
run "gem install wikicloth"
|
46
|
+
puts <<-EOT
|
47
|
+
\n Parser for type "wiki" was installed
|
48
|
+
\n
|
49
|
+
EOT
|
50
|
+
when "org"
|
51
|
+
run "gem install org-ruby"
|
52
|
+
puts <<-EOT
|
53
|
+
\n Parser for type "org-ruby" was installed
|
54
|
+
\n
|
55
|
+
EOT
|
56
|
+
when "creole"
|
57
|
+
run "gem install creole"
|
58
|
+
puts <<-EOT
|
59
|
+
\n Parser for type "creole" was installed
|
60
|
+
\n
|
61
|
+
EOT
|
62
|
+
when "pod"
|
63
|
+
puts <<-EOT
|
64
|
+
\nPOT must be installed through CPAN (perl)
|
65
|
+
\nSee http://search.cpan.org/dist/perl/pod/perlpod.pod for further information
|
66
|
+
\n
|
67
|
+
EOT
|
68
|
+
when "rst"
|
69
|
+
puts <<-EOT
|
70
|
+
\nInstall through 'easy_install'
|
71
|
+
\nSee http://docutils.sourceforge.net/rst.html for further information
|
72
|
+
EOT
|
73
|
+
else
|
74
|
+
puts "UNKNOWN LANGUAGE"
|
75
|
+
exit 1
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
@@ -1,51 +1,51 @@
|
|
1
|
-
require 'rails/generators'
|
2
|
-
|
3
|
-
module GollumRails
|
4
|
-
|
5
|
-
# Generators for GollumRails
|
6
|
-
module Generators
|
7
|
-
|
8
|
-
# Generates models
|
9
|
-
class ModelGenerator < ::Rails::Generators::Base
|
10
|
-
source_root File.expand_path("../templates", __FILE__)
|
11
|
-
desc "This generator will create a model"
|
12
|
-
argument :model_name, :type => :string
|
13
|
-
|
14
|
-
# generates a model
|
15
|
-
def create_model
|
16
|
-
if ::File.exist? Rails.root.join("app", "models", "#{file_name}")
|
17
|
-
raw = <<-EOM
|
18
|
-
Warning: The file already exists
|
19
|
-
EOM
|
20
|
-
red raw
|
21
|
-
else
|
22
|
-
template "model_template.erb", "app/models/#{file_name}.rb"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
private
|
27
|
-
|
28
|
-
# Gets the filename
|
29
|
-
def file_name
|
30
|
-
model_name.underscore
|
31
|
-
end
|
32
|
-
|
33
|
-
# Gets the classname
|
34
|
-
def class_name
|
35
|
-
model_name.camelize
|
36
|
-
end
|
37
|
-
|
38
|
-
# colorizes
|
39
|
-
def colorize(text, color_code)
|
40
|
-
"#{color_code}#{text}e[0m"
|
41
|
-
end
|
42
|
-
|
43
|
-
# colorizes red
|
44
|
-
def red(text); colorize(text, "e[31m"); end
|
45
|
-
|
46
|
-
# colorizes green
|
47
|
-
def green(text); colorize(text, "e[32m"); end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module GollumRails
|
4
|
+
|
5
|
+
# Generators for GollumRails
|
6
|
+
module Generators
|
7
|
+
|
8
|
+
# Generates models
|
9
|
+
class ModelGenerator < ::Rails::Generators::Base
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
desc "This generator will create a model"
|
12
|
+
argument :model_name, :type => :string
|
13
|
+
|
14
|
+
# generates a model
|
15
|
+
def create_model
|
16
|
+
if ::File.exist? Rails.root.join("app", "models", "#{file_name}")
|
17
|
+
raw = <<-EOM
|
18
|
+
Warning: The file already exists
|
19
|
+
EOM
|
20
|
+
red raw
|
21
|
+
else
|
22
|
+
template "model_template.erb", "app/models/#{file_name}.rb"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Gets the filename
|
29
|
+
def file_name
|
30
|
+
model_name.underscore
|
31
|
+
end
|
32
|
+
|
33
|
+
# Gets the classname
|
34
|
+
def class_name
|
35
|
+
model_name.camelize
|
36
|
+
end
|
37
|
+
|
38
|
+
# colorizes
|
39
|
+
def colorize(text, color_code)
|
40
|
+
"#{color_code}#{text}e[0m"
|
41
|
+
end
|
42
|
+
|
43
|
+
# colorizes red
|
44
|
+
def red(text); colorize(text, "e[31m"); end
|
45
|
+
|
46
|
+
# colorizes green
|
47
|
+
def green(text); colorize(text, "e[32m"); end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
@@ -1,13 +1,13 @@
|
|
1
|
-
# Gollum file
|
2
|
-
class <%= class_name %> < GollumRails::Page
|
3
|
-
|
4
|
-
# callbacks:
|
5
|
-
#
|
6
|
-
# after_save :after_save
|
7
|
-
#
|
8
|
-
# def after_save
|
9
|
-
#
|
10
|
-
# end
|
11
|
-
|
12
|
-
|
13
|
-
end
|
1
|
+
# Gollum file
|
2
|
+
class <%= class_name %> < GollumRails::Page
|
3
|
+
|
4
|
+
# callbacks:
|
5
|
+
#
|
6
|
+
# after_save :after_save
|
7
|
+
#
|
8
|
+
# def after_save
|
9
|
+
#
|
10
|
+
# end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
data/lib/gollum_rails.rb
CHANGED
@@ -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__
|