gollum_rails 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -5
- data/gollum_rails.gemspec +4 -2
- data/lib/generators/gollum_rails/language/language_generator.rb +81 -0
- data/lib/generators/gollum_rails/model/model_generator.rb +51 -0
- data/lib/generators/gollum_rails/model/templates/model_template.erb +13 -0
- data/lib/gollum_rails.rb +1 -1
- data/lib/gollum_rails/adapters/activemodel.rb +1 -2
- data/lib/gollum_rails/adapters/gollum.rb +1 -1
- data/lib/gollum_rails/page.rb +18 -21
- data/lib/gollum_rails/setup.rb +1 -1
- metadata +4 -2
- data/lib/gollum_rails/adapters/activemodel/callback.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e41af3125cdcc43422294feedf11dc6eef18661
|
4
|
+
data.tar.gz: f16d153ea9d97b819da9df159eff4670f0ab2ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae6e9c0ffdf2ca8807824065597dd936ad870781046385a7698bde4bd51b0fec5b358965e7e5c33a32e4b465447d09ff1b09eda9adad2c14f791fd111bc8a6bb
|
7
|
+
data.tar.gz: 5b2887aa33886262d52fceade5291de7d63bb3f797dea6f189688d947a8516204ae0b76af6d5e85f555287c8f5523cdc7d0f7a3d907830ccaff1d2e6e31c9e25
|
data/Gemfile.lock
CHANGED
@@ -10,7 +10,7 @@ GIT
|
|
10
10
|
PATH
|
11
11
|
remote: .
|
12
12
|
specs:
|
13
|
-
gollum_rails (0.0.
|
13
|
+
gollum_rails (0.0.8)
|
14
14
|
activemodel (~> 3.2.13)
|
15
15
|
builder (~> 3.0.0)
|
16
16
|
gollum-lib (~> 0.0.1)
|
@@ -55,7 +55,7 @@ GEM
|
|
55
55
|
rest-client
|
56
56
|
simplecov (>= 0.7)
|
57
57
|
thor
|
58
|
-
diff-lcs (1.2.
|
58
|
+
diff-lcs (1.2.2)
|
59
59
|
erubis (2.7.0)
|
60
60
|
github-markdown (0.5.3)
|
61
61
|
github-markup (0.7.5)
|
@@ -75,7 +75,7 @@ GEM
|
|
75
75
|
i18n (>= 0.4.0)
|
76
76
|
mime-types (~> 1.16)
|
77
77
|
treetop (~> 1.4.8)
|
78
|
-
mime-types (1.
|
78
|
+
mime-types (1.22)
|
79
79
|
multi_json (1.7.2)
|
80
80
|
nokogiri (1.5.9)
|
81
81
|
polyglot (0.3.3)
|
@@ -110,7 +110,7 @@ GEM
|
|
110
110
|
json (~> 1.4)
|
111
111
|
rest-client (1.6.7)
|
112
112
|
mime-types (>= 1.16)
|
113
|
-
rr (1.0.
|
113
|
+
rr (1.0.5)
|
114
114
|
rspec (2.13.0)
|
115
115
|
rspec-core (~> 2.13.0)
|
116
116
|
rspec-expectations (~> 2.13.0)
|
@@ -131,7 +131,7 @@ GEM
|
|
131
131
|
rack (~> 1.0)
|
132
132
|
tilt (~> 1.1, != 1.3.0)
|
133
133
|
stringex (1.5.1)
|
134
|
-
thor (0.18.
|
134
|
+
thor (0.18.1)
|
135
135
|
tilt (1.3.6)
|
136
136
|
treetop (1.4.12)
|
137
137
|
polyglot
|
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.8'
|
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'
|
@@ -40,10 +40,12 @@ Gem::Specification.new do |s|
|
|
40
40
|
gollum_rails.gemspec
|
41
41
|
lib/generators/gollum_rails/install/install_generator.rb
|
42
42
|
lib/generators/gollum_rails/install/templates/gollum_initializer.rb
|
43
|
+
lib/generators/gollum_rails/language/language_generator.rb
|
44
|
+
lib/generators/gollum_rails/model/model_generator.rb
|
45
|
+
lib/generators/gollum_rails/model/templates/model_template.erb
|
43
46
|
lib/gollum_rails.rb
|
44
47
|
lib/gollum_rails/adapters/activemodel.rb
|
45
48
|
lib/gollum_rails/adapters/activemodel/boolean.rb
|
46
|
-
lib/gollum_rails/adapters/activemodel/callback.rb
|
47
49
|
lib/gollum_rails/adapters/activemodel/error.rb
|
48
50
|
lib/gollum_rails/adapters/activemodel/naming.rb
|
49
51
|
lib/gollum_rails/adapters/activemodel/validation.rb
|
@@ -0,0 +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
|
+
|
@@ -0,0 +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
|
+
|
data/lib/gollum_rails.rb
CHANGED
@@ -34,13 +34,12 @@ module GollumRails
|
|
34
34
|
module ActiveModel
|
35
35
|
|
36
36
|
# connector version
|
37
|
-
VERSION="
|
37
|
+
VERSION="1.9.0"
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
42
|
require File.expand_path '../activemodel/boolean', __FILE__
|
43
|
-
require File.expand_path '../activemodel/callback', __FILE__
|
44
43
|
require File.expand_path '../activemodel/naming', __FILE__
|
45
44
|
require File.expand_path '../activemodel/error', __FILE__
|
46
45
|
require File.expand_path '../activemodel/validation', __FILE__
|
data/lib/gollum_rails/page.rb
CHANGED
@@ -152,8 +152,8 @@ module GollumRails
|
|
152
152
|
rescue ::Gollum::DuplicatePageError => e
|
153
153
|
page.instance_variable_set "@page",page.find_page(name)
|
154
154
|
end
|
155
|
+
return page.page
|
155
156
|
end
|
156
|
-
return page.page
|
157
157
|
end
|
158
158
|
|
159
159
|
# aliasing save
|
@@ -183,9 +183,6 @@ module GollumRails
|
|
183
183
|
# Returns an instance of Gollum::Page
|
184
184
|
def self.create!(hash)
|
185
185
|
action = self.create(hash)
|
186
|
-
if action.nil? or action.is_a? Adapters::ActiveModel::Boolean
|
187
|
-
raise GollumInternalError, "Page is nil"
|
188
|
-
end
|
189
186
|
action
|
190
187
|
end
|
191
188
|
|
@@ -246,7 +243,13 @@ module GollumRails
|
|
246
243
|
self.class.validate self,true
|
247
244
|
end
|
248
245
|
|
249
|
-
#
|
246
|
+
# Validation functions
|
247
|
+
#
|
248
|
+
# context - The current config
|
249
|
+
# check - check now
|
250
|
+
# block - Validations
|
251
|
+
#
|
252
|
+
# Returns true or raises an exception
|
250
253
|
def self.validate(context=nil,check=false,&block)
|
251
254
|
#if block
|
252
255
|
# @@gollum_page = block
|
@@ -256,36 +259,30 @@ module GollumRails
|
|
256
259
|
#end
|
257
260
|
end
|
258
261
|
|
259
|
-
# todo
|
260
|
-
def self.register_validations_for(*args)
|
261
|
-
end
|
262
|
-
|
263
|
-
|
264
|
-
# module templates following:
|
265
|
-
|
266
|
-
# empty
|
267
|
-
#def self.method_missing(name, *args)
|
268
|
-
#
|
269
|
-
#end
|
270
|
-
|
271
|
-
# empty
|
272
|
-
#def method_missing(name, *args)
|
273
|
-
#end
|
274
|
-
|
275
262
|
# Finds an existing page or creates it
|
276
263
|
#
|
264
|
+
# name - The name
|
265
|
+
# commit - Hash
|
266
|
+
#
|
277
267
|
# Returns self
|
278
268
|
def self.find_or_initialize_by_name(name, commit)
|
279
269
|
result_for_find = self.find(name)
|
280
270
|
self.create({:format => :markdown, :name => name, :content => ".", :commit => commit })
|
281
271
|
end
|
282
272
|
|
273
|
+
# Checks if the fileformat is supported
|
274
|
+
#
|
275
|
+
# format - String
|
276
|
+
#
|
277
|
+
# Returns true or false
|
283
278
|
def self.format_supported?(format)
|
284
279
|
supported = ['ascii', 'github-markdown','markdown', 'creole', 'org', 'pod', 'rdoc']
|
285
280
|
format.in?(supported)
|
286
281
|
end
|
287
282
|
|
283
|
+
#######
|
288
284
|
private
|
285
|
+
#######
|
289
286
|
|
290
287
|
# Get the right commit out of 2 commits
|
291
288
|
#
|
data/lib/gollum_rails/setup.rb
CHANGED
@@ -34,7 +34,7 @@ module GollumRails
|
|
34
34
|
if action
|
35
35
|
Adapters::Gollum::Connector.enabled = true
|
36
36
|
if @repository == :application
|
37
|
-
initialize_wiki Rails.config.wiki_repository
|
37
|
+
initialize_wiki Rails.application.config.wiki_repository
|
38
38
|
else
|
39
39
|
initialize_wiki @repository
|
40
40
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Kasper
|
@@ -139,10 +139,12 @@ files:
|
|
139
139
|
- gollum_rails.gemspec
|
140
140
|
- lib/generators/gollum_rails/install/install_generator.rb
|
141
141
|
- lib/generators/gollum_rails/install/templates/gollum_initializer.rb
|
142
|
+
- lib/generators/gollum_rails/language/language_generator.rb
|
143
|
+
- lib/generators/gollum_rails/model/model_generator.rb
|
144
|
+
- lib/generators/gollum_rails/model/templates/model_template.erb
|
142
145
|
- lib/gollum_rails.rb
|
143
146
|
- lib/gollum_rails/adapters/activemodel.rb
|
144
147
|
- lib/gollum_rails/adapters/activemodel/boolean.rb
|
145
|
-
- lib/gollum_rails/adapters/activemodel/callback.rb
|
146
148
|
- lib/gollum_rails/adapters/activemodel/error.rb
|
147
149
|
- lib/gollum_rails/adapters/activemodel/naming.rb
|
148
150
|
- lib/gollum_rails/adapters/activemodel/validation.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
module GollumRails
|
2
|
-
module Adapters
|
3
|
-
module ActiveModel
|
4
|
-
|
5
|
-
# Callback handling class
|
6
|
-
class Callback
|
7
|
-
extend ::ActiveModel::Callbacks
|
8
|
-
|
9
|
-
define_model_callbacks :create, :only => [:after, :before]
|
10
|
-
define_model_callbacks :update, :only => [:after, :before]
|
11
|
-
define_model_callbacks :save, :only => [:after, :before]
|
12
|
-
define_model_callbacks :delete, :only => [:after, :before]
|
13
|
-
define_model_callbacks :find, :only => [:after, :before]
|
14
|
-
|
15
|
-
before_create :before_create
|
16
|
-
before_update :before_update
|
17
|
-
before_save :before_save
|
18
|
-
before_delete :before_delete
|
19
|
-
before_find :before_find
|
20
|
-
|
21
|
-
after_create :after_create
|
22
|
-
after_update :after_update
|
23
|
-
after_save :after_save
|
24
|
-
after_delete :after_delete
|
25
|
-
after_find :after_find
|
26
|
-
|
27
|
-
# Before create action
|
28
|
-
def before_create; end
|
29
|
-
|
30
|
-
# Before update action
|
31
|
-
def before_update; end
|
32
|
-
|
33
|
-
# Before save action
|
34
|
-
def before_save; end
|
35
|
-
|
36
|
-
# Before delete action
|
37
|
-
def before_delete; end
|
38
|
-
|
39
|
-
# Before find action
|
40
|
-
def before_find; end
|
41
|
-
|
42
|
-
# After create action
|
43
|
-
def after_create; end
|
44
|
-
|
45
|
-
# After update action
|
46
|
-
def after_update; end
|
47
|
-
|
48
|
-
# After save action
|
49
|
-
def after_save; end
|
50
|
-
|
51
|
-
# After delete action
|
52
|
-
def after_delete; end
|
53
|
-
|
54
|
-
# After find action
|
55
|
-
def after_find; end
|
56
|
-
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|