gollum_rails 0.0.8 → 1.0.0

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: 0e41af3125cdcc43422294feedf11dc6eef18661
4
- data.tar.gz: f16d153ea9d97b819da9df159eff4670f0ab2ed8
3
+ metadata.gz: 09f7ee2859734417d3752763d1c3c1b3c162a8df
4
+ data.tar.gz: b69cae667fa9c8ec7c81215133ca1062e741e76a
5
5
  SHA512:
6
- metadata.gz: ae6e9c0ffdf2ca8807824065597dd936ad870781046385a7698bde4bd51b0fec5b358965e7e5c33a32e4b465447d09ff1b09eda9adad2c14f791fd111bc8a6bb
7
- data.tar.gz: 5b2887aa33886262d52fceade5291de7d63bb3f797dea6f189688d947a8516204ae0b76af6d5e85f555287c8f5523cdc7d0f7a3d907830ccaff1d2e6e31c9e25
6
+ metadata.gz: 3be4a36dd812402751dad7cdbdf2fe63fe4be10c11f3963ab8c20d470651184a2283c181439141cc101cf4428f89d4696dce2e452e1edb4e85a91b160fda3a78
7
+ data.tar.gz: 68a520d6a40e235ed6fff4a37cd9a4b3bc78282c61bbc1b137b5d5b05538f05a40fde1af8460e63e1d378879515190121e9d575c25c8f9927f2490b9205dc932
data/Gemfile.lock CHANGED
@@ -10,11 +10,9 @@ GIT
10
10
  PATH
11
11
  remote: .
12
12
  specs:
13
- gollum_rails (0.0.8)
13
+ gollum_rails (1.0.0)
14
14
  activemodel (~> 3.2.13)
15
- builder (~> 3.0.0)
16
- gollum-lib (~> 0.0.1)
17
- rack (~> 1.4.5)
15
+ gollum-lib (~> 1.0.0)
18
16
 
19
17
  GEM
20
18
  remote: https://rubygems.org/
@@ -49,7 +47,7 @@ GEM
49
47
  arel (3.0.2)
50
48
  builder (3.0.4)
51
49
  colorize (0.5.8)
52
- coveralls (0.6.3)
50
+ coveralls (0.6.4)
53
51
  colorize
54
52
  multi_json (~> 1.3)
55
53
  rest-client
@@ -59,11 +57,11 @@ GEM
59
57
  erubis (2.7.0)
60
58
  github-markdown (0.5.3)
61
59
  github-markup (0.7.5)
62
- gollum-lib (0.0.1)
60
+ gollum-lib (1.0.0)
63
61
  github-markdown (~> 0.5.3)
64
62
  github-markup (>= 0.7.5, < 1.0.0)
65
63
  grit (~> 2.5.0)
66
- nokogiri (~> 1.5.6)
64
+ nokogiri (~> 1.5.9)
67
65
  pygments.rb (~> 0.4.2)
68
66
  sanitize (~> 2.0.3)
69
67
  stringex (~> 1.5.1)
data/HISTORY.md CHANGED
@@ -1,5 +1,19 @@
1
- # 0.0.6 4th April 2013
2
- * Validators
1
+ # 1.0.0 3th April 2013
2
+ * added validators
3
+ * removed unused gems
4
+ * updated documentation
5
+ * removed unused middleware
6
+ * improved code coverage
7
+
8
+ # 0.0.8 1th April 2013
9
+ * updated documentation
10
+ * removed unused code
11
+
12
+ # 0.0.7 1th April 2013
13
+ * improved installation instructions
14
+ * improved performance
15
+
16
+ # 0.0.6 1th April 2013
3
17
  * missing generators added
4
18
 
5
19
  # 0.0.5 31th March 2013
data/gollum_rails.gemspec CHANGED
@@ -4,17 +4,17 @@ 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.8'
7
+ s.version = '1.0.0'
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'
11
11
  #File.read(File.join(File.dirname(__FILE__), 'README.md'))
12
12
 
13
13
  s.add_dependency 'activemodel', '~> 3.2.13'
14
- s.add_dependency 'gollum-lib', '~> 0.0.1'
14
+ s.add_dependency 'gollum-lib', '~> 1.0.0'
15
15
  #s.add_dependency 'grit', '~> 2.5.0'
16
- s.add_dependency 'builder', '~> 3.0.0'
17
- s.add_dependency 'rack', '~> 1.4.5'
16
+ #s.add_dependency 'builder', '~> 3.0.0'
17
+ #s.add_dependency 'rack', '~> 1.4.5'
18
18
 
19
19
  s.add_development_dependency 'rspec', '~> 2.13.0'
20
20
  s.add_development_dependency 'rails', '~> 3.2.13'
@@ -36,7 +36,6 @@ Gem::Specification.new do |s|
36
36
  LICENSE
37
37
  README.md
38
38
  Rakefile
39
- examples/rails/initializer.rb
40
39
  gollum_rails.gemspec
41
40
  lib/generators/gollum_rails/install/install_generator.rb
42
41
  lib/generators/gollum_rails/install/templates/gollum_initializer.rb
@@ -48,7 +47,6 @@ Gem::Specification.new do |s|
48
47
  lib/gollum_rails/adapters/activemodel/boolean.rb
49
48
  lib/gollum_rails/adapters/activemodel/error.rb
50
49
  lib/gollum_rails/adapters/activemodel/naming.rb
51
- lib/gollum_rails/adapters/activemodel/validation.rb
52
50
  lib/gollum_rails/adapters/gollum.rb
53
51
  lib/gollum_rails/adapters/gollum/.gitkeep
54
52
  lib/gollum_rails/adapters/gollum/committer.rb
@@ -65,12 +63,16 @@ Gem::Specification.new do |s|
65
63
 
66
64
 
67
65
  s.require_paths = %w[lib]
68
- s.post_install_message = "Important: \n\n" \
69
- "**********************************************\n\n" \
70
- "To use the 'autoinitializer' just run the following command:\n\n"\
71
- "\trails g gollum_rails:install\n\n"\
72
- "To generate a new Page model just run:\n\n"\
73
- "\trails g gollum_rails:model MODEL_NAME\n"\
74
- "**********************************************"
66
+ s.post_install_message = <<-END
67
+ Important: \n
68
+ **********************************************
69
+ To use the installer just run the following command:
70
+ \trails g gollum_rails:install\n
71
+ To generate a new Page model just run:
72
+ \trails g gollum_rails:model MODEL_NAME\n
73
+ To install an additional parsing language run:
74
+ rails g gollum_rails:language LANGUAGE
75
+ **********************************************"
76
+ END
75
77
  end
76
78
 
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.8'
15
+ VERSION = '1.0.0'
16
16
 
17
17
  # Simplified error
18
18
  class Error < StandardError; end
@@ -34,7 +34,7 @@ module GollumRails
34
34
  module ActiveModel
35
35
 
36
36
  # connector version
37
- VERSION="1.9.0"
37
+ VERSION="1.10.0"
38
38
  end
39
39
  end
40
40
  end
@@ -42,4 +42,6 @@ end
42
42
  require File.expand_path '../activemodel/boolean', __FILE__
43
43
  require File.expand_path '../activemodel/naming', __FILE__
44
44
  require File.expand_path '../activemodel/error', __FILE__
45
- require File.expand_path '../activemodel/validation', __FILE__
45
+
46
+ # removed in 0.0.8
47
+ #require File.expand_path '../activemodel/validation', __FILE__
@@ -14,6 +14,7 @@ module GollumRails
14
14
  #
15
15
  class Page
16
16
  extend ::ActiveModel::Callbacks
17
+ include ::ActiveModel::Validations
17
18
  include ::ActiveModel::Conversion
18
19
  extend ::ActiveModel::Naming
19
20
 
@@ -44,8 +45,7 @@ module GollumRails
44
45
  # commit must be given to perform any page action!
45
46
  def initialize(attrs = {})
46
47
  if Adapters::Gollum::Connector.enabled
47
- attrs.each{|k,v| self.instance_variable_set("@#{k}", v)}
48
- attrs.each{|k,v| self.class.validator.instance_variable_set("@#{k}", v)}
48
+ attrs.each{|k,v| self.public_send("#{k}=",v)} if attrs
49
49
  else
50
50
  raise GollumInternalError, 'gollum_rails is not enabled!'
51
51
  end
@@ -58,11 +58,11 @@ module GollumRails
58
58
  # Sets the wiki instance
59
59
  attr_writer :wiki
60
60
 
61
- # Sets the pages name
62
- attr_writer :name
61
+ # Gets / Sets the pages name
62
+ attr_accessor :name
63
63
 
64
- # Sets the contents content
65
- attr_writer :content
64
+ # Gets / Sets the contents content
65
+ attr_accessor :content
66
66
 
67
67
  # Sets the commit Hash
68
68
  attr_writer :commit
@@ -82,16 +82,6 @@ module GollumRails
82
82
  @wiki || Adapters::Gollum::Connector.wiki_class
83
83
  end
84
84
 
85
- # Gets the pages' name
86
- def name
87
- @name || @gollum_page.name
88
- end
89
-
90
- # Gets the raw content of the current page
91
- def content
92
- @content || @gollum_page.raw_content
93
- end
94
-
95
85
  # Need to implement the Committer connector (forgot it completely)
96
86
  # Gets the commit Hash from current object
97
87
  def commit
@@ -100,7 +90,7 @@ module GollumRails
100
90
 
101
91
  # Gets the pages format
102
92
  def format
103
- (@format || @gollum_page.format).to_sym
93
+ @format.to_sym
104
94
  end
105
95
 
106
96
  # Gets the validator
@@ -212,6 +202,11 @@ module GollumRails
212
202
  end
213
203
  end
214
204
 
205
+ # checks if entry already has been saved
206
+ #
207
+ #
208
+ def persisted?
209
+ end
215
210
  # Previews the page - Mostly used if you want to see what you do before saving
216
211
  #
217
212
  # This is an extremely performant method!
@@ -238,27 +233,6 @@ module GollumRails
238
233
  page.find_page name
239
234
  end
240
235
 
241
- # todo
242
- def valid?
243
- self.class.validate self,true
244
- end
245
-
246
- # Validation functions
247
- #
248
- # context - The current config
249
- # check - check now
250
- # block - Validations
251
- #
252
- # Returns true or raises an exception
253
- def self.validate(context=nil,check=false,&block)
254
- #if block
255
- # @@gollum_page = block
256
- #end
257
- #if check
258
- # @@gollum_page.call context.class.validator
259
- #end
260
- end
261
-
262
236
  # Finds an existing page or creates it
263
237
  #
264
238
  # name - The name
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Kasper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-01 00:00:00.000000000 Z
11
+ date: 2013-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -30,42 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.1
33
+ version: 1.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.1
41
- - !ruby/object:Gem::Dependency
42
- name: builder
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ~>
46
- - !ruby/object:Gem::Version
47
- version: 3.0.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: 3.0.0
55
- - !ruby/object:Gem::Dependency
56
- name: rack
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- version: 1.4.5
62
- type: :runtime
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ~>
67
- - !ruby/object:Gem::Version
68
- version: 1.4.5
40
+ version: 1.0.0
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: rspec
71
43
  requirement: !ruby/object:Gem::Requirement
@@ -135,7 +107,6 @@ files:
135
107
  - LICENSE
136
108
  - README.md
137
109
  - Rakefile
138
- - examples/rails/initializer.rb
139
110
  - gollum_rails.gemspec
140
111
  - lib/generators/gollum_rails/install/install_generator.rb
141
112
  - lib/generators/gollum_rails/install/templates/gollum_initializer.rb
@@ -147,7 +118,6 @@ files:
147
118
  - lib/gollum_rails/adapters/activemodel/boolean.rb
148
119
  - lib/gollum_rails/adapters/activemodel/error.rb
149
120
  - lib/gollum_rails/adapters/activemodel/naming.rb
150
- - lib/gollum_rails/adapters/activemodel/validation.rb
151
121
  - lib/gollum_rails/adapters/gollum.rb
152
122
  - lib/gollum_rails/adapters/gollum/.gitkeep
153
123
  - lib/gollum_rails/adapters/gollum/committer.rb
@@ -163,9 +133,11 @@ homepage: http://gollum.zyg.li
163
133
  licenses:
164
134
  - AGPL
165
135
  metadata: {}
166
- post_install_message: "Important: \n\n**********************************************\n\nTo
167
- use the 'autoinitializer' just run the following command:\n\n\trails g gollum_rails:install\n\nTo
168
- generate a new Page model just run:\n\n\trails g gollum_rails:model MODEL_NAME\n**********************************************"
136
+ post_install_message: " Important: \n\n **********************************************\n
137
+ \ To use the installer just run the following command:\n \trails g gollum_rails:install\n\n
138
+ \ To generate a new Page model just run:\n \trails g gollum_rails:model MODEL_NAME\n\n
139
+ \ To install an additional parsing language run:\n rails g gollum_rails:language
140
+ LANGUAGE\n **********************************************\"\n"
169
141
  rdoc_options: []
170
142
  require_paths:
171
143
  - lib
File without changes
@@ -1,188 +0,0 @@
1
- module GollumRails
2
- module Adapters
3
- module ActiveModel
4
-
5
- # General Validation Class including validations
6
- class Validation
7
- include ::ActiveModel::Validations
8
-
9
- #########
10
- protected
11
- #########
12
-
13
- # Sets the variable, used to validate
14
- attr_writer :variable
15
-
16
- # Sets the Filter
17
- attr_accessor :filter
18
-
19
- # Sets all instance errors to this variable
20
- attr_writer :error
21
-
22
- ######
23
- public
24
- ######
25
-
26
- # Gets the variable, used to validate
27
- attr_reader :variable
28
-
29
- # Gets the error messages
30
- attr_reader :error
31
-
32
- # Checks for errors and returns either true or false
33
- #
34
- # Examples:
35
- # @validator.valid?
36
- # # => true
37
- # or
38
- # # => false
39
- #
40
- def valid?(errors = {})
41
- super
42
- return true if self.errors.messages == Hash.new and errors == Hash.new
43
- self.error = errors
44
- return false
45
- end
46
-
47
- # Initializes the Validator
48
- # You can pass in a block with validators, which will be used to validate given attributes
49
- #
50
- # Blocks look like:
51
- #
52
- # "#{variable} : type=String : max=200"
53
- # "#{textvariable} : type=Hash"
54
- # "#{integer} : min=100 : max=200"
55
- #
56
- # They have always the following format:
57
- #
58
- # KEY=VALUE or KEY!VALUE
59
- #
60
- # key=value explains itself. It validates the variable <b>variable</b> with the given <b>key<b> validator
61
- # and checks if it matches the given <b>value</b>
62
- #
63
- # key!value is the negociation of key=value
64
- #
65
- #
66
- # The following keys are currently available:
67
- # * type
68
- # * max
69
- # * present
70
- # * min
71
- #
72
- # Following:
73
- # * contribute yourself
74
- #
75
- # Usage:
76
- # variable = "This is a simple test"
77
- # validator = GollumRails::Adapters::ActiveModel::Validation.new
78
- # validator.validate! do |a|
79
- # a.validate(variable, "type=String,max=100,present=true")
80
- # end
81
- # validator.valid?
82
- # # => true
83
- #
84
- # Params:
85
- # block - Block to use
86
- #
87
- # Returns:
88
- def validate(&block)
89
- bla = block.call(self)
90
- end
91
-
92
-
93
- # Aliasing test method
94
- alias_method :validate!, :test
95
-
96
- # Tests given variable for conditions
97
- #
98
- # Params:
99
- # variable - variable to validate
100
- # statement - validation statement, seperated by coma
101
- #
102
- #
103
- def test(variable,statement)
104
- validation = {}
105
- if statement.include? ',' and statement.include? '='
106
- statement.split(',').each{|equalized|
107
- key,value = split_equalized_string equalized
108
- validation[key.to_s.downcase.to_sym] = value if not key.nil?
109
- }
110
- elsif statement.include? '='
111
- key,value = split_equalized_string statement
112
- validation[key.to_s.downcase.to_sym] = value if not key.nil?
113
- else
114
- raise Error, 'Syntax error! '
115
- end
116
- self.instance_variable_set("@variable", variable)
117
-
118
- validation.each_with_index do |k|
119
- if k.first.to_s.match /^type$/i
120
- code = <<-END
121
- self.singleton_class.class_exec do attr_accessor :type end
122
- self.instance_variable_set("@type", "#{k[1]}")
123
- validates_with ValidateType, :fields => [:variable]
124
- END
125
- elsif k.first.to_s.match /^(present|presence|pres)$/i
126
- code = <<-END
127
- validates_presence_of :variable
128
- END
129
- elsif k.first.to_s.match /^(min|max)$/i
130
- code = <<-END
131
- validates_length_of :variable, :#{k.first.to_s}imum => #{k[1].to_i}
132
- END
133
- else
134
- puts <<-END
135
- WARNING: no validator matches! This will cause an Error in the next release
136
- END
137
- next
138
- end
139
- self.instance_eval(code) if code
140
- end
141
- errors = self.errors.messages
142
- self.errors.instance_variable_set("@messages", {})
143
- valid? errors
144
- end
145
-
146
- #######
147
- private
148
- #######
149
-
150
- # Splits given by "="
151
- #
152
- # string - String to be split
153
- #
154
- # Returns splitted string or raise an error
155
- def split_equalized_string(string)
156
- if string.match /\w+\=(\w+|\d+)/i
157
- return string.split(/\=/,2)
158
- else
159
- raise Error, <<-END
160
- Syntax error in given String #{string}. Equal sign is missing
161
- END
162
- end
163
-
164
- end
165
- end
166
-
167
-
168
- # Validation helper for type:
169
- #
170
- # <b>Type</b>
171
- class ValidateType < ::ActiveModel::Validator
172
-
173
- # Validate given Data with given validation object
174
- #
175
- # sets error or returns true
176
- def validate(record)
177
- if record.type.match(/^\w+$/i)
178
- name = eval "#{record.type.to_s}"
179
- return true if record.variable.is_a? name
180
- record.errors.add :type, "not a kind of given class #{record.type}"
181
- else
182
- record.errors.add :type ,"invalid input detected"
183
- end
184
- end
185
- end
186
- end
187
- end
188
- end