gollum_rails 0.0.2.2 → 0.0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,151 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gollum_rails (0.0.2.4)
5
+ activemodel (~> 3.2.11)
6
+ builder (~> 3.0.0)
7
+ gollum (~> 2.4.11)
8
+ grit (~> 2.5.0)
9
+ rack (~> 1.4.0)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ actionmailer (3.2.11)
15
+ actionpack (= 3.2.11)
16
+ mail (~> 2.4.4)
17
+ actionpack (3.2.11)
18
+ activemodel (= 3.2.11)
19
+ activesupport (= 3.2.11)
20
+ builder (~> 3.0.0)
21
+ erubis (~> 2.7.0)
22
+ journey (~> 1.0.4)
23
+ rack (~> 1.4.0)
24
+ rack-cache (~> 1.2)
25
+ rack-test (~> 0.6.1)
26
+ sprockets (~> 2.2.1)
27
+ activemodel (3.2.11)
28
+ activesupport (= 3.2.11)
29
+ builder (~> 3.0.0)
30
+ activerecord (3.2.11)
31
+ activemodel (= 3.2.11)
32
+ activesupport (= 3.2.11)
33
+ arel (~> 3.0.2)
34
+ tzinfo (~> 0.3.29)
35
+ activeresource (3.2.11)
36
+ activemodel (= 3.2.11)
37
+ activesupport (= 3.2.11)
38
+ activesupport (3.2.11)
39
+ i18n (~> 0.6)
40
+ multi_json (~> 1.0)
41
+ arel (3.0.2)
42
+ bourne (1.1.2)
43
+ mocha (= 0.10.5)
44
+ builder (3.0.4)
45
+ diff-lcs (1.2.0)
46
+ erubis (2.7.0)
47
+ github-markdown (0.5.3)
48
+ github-markup (0.7.5)
49
+ gollum (2.4.11)
50
+ github-markdown (~> 0.5.3)
51
+ github-markup (>= 0.7.4, < 1.0.0)
52
+ grit (~> 2.5.0)
53
+ mustache (>= 0.99.4, < 1.0.0)
54
+ nokogiri (~> 1.5.5)
55
+ pygments.rb (~> 0.3.2)
56
+ sanitize (~> 2.0.3)
57
+ sinatra (~> 1.3.3)
58
+ stringex (~> 1.5.1)
59
+ useragent (~> 0.4.15)
60
+ grit (2.5.0)
61
+ diff-lcs (~> 1.1)
62
+ mime-types (~> 1.15)
63
+ posix-spawn (~> 0.3.6)
64
+ hike (1.2.1)
65
+ i18n (0.6.1)
66
+ journey (1.0.4)
67
+ json (1.7.6)
68
+ mail (2.4.4)
69
+ i18n (>= 0.4.0)
70
+ mime-types (~> 1.16)
71
+ treetop (~> 1.4.8)
72
+ metaclass (0.0.1)
73
+ mime-types (1.19)
74
+ mocha (0.10.5)
75
+ metaclass (~> 0.0.1)
76
+ multi_json (1.5.0)
77
+ mustache (0.99.4)
78
+ nokogiri (1.5.6)
79
+ org-ruby (0.7.2)
80
+ rubypants (>= 0.2.0)
81
+ polyglot (0.3.3)
82
+ posix-spawn (0.3.6)
83
+ pygments.rb (0.3.7)
84
+ posix-spawn (~> 0.3.6)
85
+ yajl-ruby (~> 1.1.0)
86
+ rack (1.4.4)
87
+ rack-cache (1.2)
88
+ rack (>= 0.4)
89
+ rack-protection (1.3.2)
90
+ rack
91
+ rack-ssl (1.3.2)
92
+ rack
93
+ rack-test (0.6.2)
94
+ rack (>= 1.0)
95
+ rails (3.2.11)
96
+ actionmailer (= 3.2.11)
97
+ actionpack (= 3.2.11)
98
+ activerecord (= 3.2.11)
99
+ activeresource (= 3.2.11)
100
+ activesupport (= 3.2.11)
101
+ bundler (~> 1.0)
102
+ railties (= 3.2.11)
103
+ railties (3.2.11)
104
+ actionpack (= 3.2.11)
105
+ activesupport (= 3.2.11)
106
+ rack-ssl (~> 1.3.2)
107
+ rake (>= 0.8.7)
108
+ rdoc (~> 3.4)
109
+ thor (>= 0.14.6, < 2.0)
110
+ rake (10.0.3)
111
+ rdoc (3.12)
112
+ json (~> 1.4)
113
+ rubypants (0.2.0)
114
+ sanitize (2.0.3)
115
+ nokogiri (>= 1.4.4, < 1.6)
116
+ shoulda (3.3.2)
117
+ shoulda-context (~> 1.0.1)
118
+ shoulda-matchers (~> 1.4.1)
119
+ shoulda-context (1.0.2)
120
+ shoulda-matchers (1.4.2)
121
+ activesupport (>= 3.0.0)
122
+ bourne (~> 1.1.2)
123
+ sinatra (1.3.3)
124
+ rack (~> 1.3, >= 1.3.6)
125
+ rack-protection (~> 1.2)
126
+ tilt (~> 1.3, >= 1.3.3)
127
+ sprockets (2.2.2)
128
+ hike (~> 1.2)
129
+ multi_json (~> 1.0)
130
+ rack (~> 1.0)
131
+ tilt (~> 1.1, != 1.3.0)
132
+ stringex (1.5.1)
133
+ thor (0.17.0)
134
+ tilt (1.3.3)
135
+ treetop (1.4.12)
136
+ polyglot
137
+ polyglot (>= 0.3.1)
138
+ tzinfo (0.3.35)
139
+ useragent (0.4.16)
140
+ yajl-ruby (1.1.0)
141
+
142
+ PLATFORMS
143
+ ruby
144
+
145
+ DEPENDENCIES
146
+ gollum_rails!
147
+ org-ruby (~> 0.7.2)
148
+ rack-test (~> 0.6.2)
149
+ rails (~> 3.2.11)
150
+ rake (~> 10.0.2)
151
+ shoulda (~> 3.3.2)
data/HISTORY.md CHANGED
@@ -0,0 +1,6 @@
1
+ # 0.0.2 27th January 2013
2
+
3
+ * Refactored modules prefix
4
+ * Updated Documentation
5
+ * Removed validation
6
+ * Added Rails module support
data/README.md CHANGED
@@ -34,36 +34,21 @@ Then just run the [Bundler](http://gembundler.com/)
34
34
 
35
35
  If you want you can add an initializer into e.g. `config/initializers/gollum_rails.rb`
36
36
 
37
- Gollum::Rails::Wiki.new(<location>)
37
+ GollumRails::Wiki.new(<location>)
38
38
 
39
39
  Now your gollum wiki is ready for use
40
40
 
41
41
  If you want you can add a model the same way as normal `ActiveRecord` / `ActiveModel`
42
42
 
43
- class Page < Gollum::Rails::Page
43
+ class Page < GollumRails::Page
44
44
 
45
45
  end
46
46
 
47
- ## Validating
48
-
49
- Works like `ActiveRecord` / `ActiveModel` validation
50
-
51
- some examples:
52
-
53
- # validates the presence of the Name (already embedded into to gem)
54
- validates_presence_of :name
55
-
56
- # forces the name to have a given format e.g. only 0-9 a-z and A-Z
57
- validates_format_of :name, :with => /^[a-zA-Z0-9_]+$/i
58
-
59
- # checks if the lenght of the content fit
60
- validates_length_of :content, :maximum => 500
61
-
62
47
  ## API
63
48
 
64
49
  Accessible variables / methods are:
65
50
 
66
- For: `Gollum::Rails::Page`
51
+ For: `GollumRails::Page`
67
52
 
68
53
  Every action returns a `String`, containing the commit id of the current action
69
54
 
@@ -115,7 +100,21 @@ Thats it. Very easy. You can use also `page.save!` method.
115
100
  page.delete!
116
101
 
117
102
  # for getting errors instead of `NIL`
118
-
103
+
104
+ **Set data manually**
105
+
106
+ page = Page.new
107
+
108
+ page.name = "testpage"
109
+ page.content = "content"
110
+ page.format = :markdown
111
+ page.commit = {
112
+ :message => "test action on page",
113
+ :name => 'Florian Kasper',
114
+ :email => 'nirnanaaa@khnetworks.com'
115
+ }
116
+
117
+
119
118
  ## TODO
120
119
  * List all pages
121
120
  * Search pages
data/Rakefile ADDED
@@ -0,0 +1,164 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+
5
+ #############################################################################
6
+ #
7
+ # Helper functions
8
+ #
9
+ #############################################################################
10
+
11
+ def name
12
+ @name ||= Dir['*.gemspec'].first.split('.').first
13
+ end
14
+
15
+ def version
16
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
17
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
18
+ end
19
+
20
+ # assumes x.y.z all digit version
21
+ def next_version
22
+ # x.y.z
23
+ v = version.split '.'
24
+ # bump z
25
+ v[-1] = v[-1].to_i + 1
26
+ v.join '.'
27
+ end
28
+
29
+ def bump_version
30
+ old_file = File.read("lib/#{name}.rb")
31
+ old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
32
+ new_version = next_version
33
+ # replace first match of old vesion with new version
34
+ old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
35
+
36
+ File.write("lib/#{name}.rb", old_file)
37
+
38
+ new_version
39
+ end
40
+
41
+ def date
42
+ Date.today.to_s
43
+ end
44
+
45
+ def rubyforge_project
46
+ name
47
+ end
48
+
49
+ def gemspec_file
50
+ "#{name}.gemspec"
51
+ end
52
+
53
+ def gem_file
54
+ "#{name}-#{version}.gem"
55
+ end
56
+
57
+ def replace_header(head, header_name)
58
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
59
+ end
60
+
61
+ #############################################################################
62
+ #
63
+ # Standard tasks
64
+ #
65
+ #############################################################################
66
+
67
+ task :default => :test
68
+
69
+ require 'rake/testtask'
70
+ Rake::TestTask.new(:test) do |test|
71
+ test.libs << 'lib' << 'test' << '.'
72
+ test.pattern = 'test/**/test_*.rb'
73
+ test.verbose = true
74
+ end
75
+
76
+
77
+ desc "Open an irb session preloaded with this library"
78
+ task :console do
79
+ sh "irb -rubygems -r ./lib/#{name}.rb"
80
+ end
81
+
82
+ #############################################################################
83
+ #
84
+ # Custom tasks (add your own tasks here)
85
+ #
86
+ #############################################################################
87
+
88
+ desc "Update version number and gemspec"
89
+ task :bump do
90
+ puts "Updated version to #{bump_version}"
91
+ # Execute does not invoke dependencies.
92
+ # Manually invoke gemspec then validate.
93
+ Rake::Task[:gemspec].execute
94
+ Rake::Task[:validate].execute
95
+ end
96
+
97
+ #############################################################################
98
+ #
99
+ # Packaging tasks
100
+ #
101
+ #############################################################################
102
+
103
+ desc 'Create a release build'
104
+ task :release => :build do
105
+ unless `git branch` =~ /^\* master$/
106
+ puts "You must be on the master branch to release!"
107
+ exit!
108
+ end
109
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
110
+ sh "git pull"
111
+ sh "git tag v#{version}"
112
+ sh "git push origin master"
113
+ sh "git push origin v#{version}"
114
+ sh "gem push pkg/#{name}-#{version}.gem"
115
+ end
116
+
117
+ desc 'Build gem'
118
+ task :build => :gemspec do
119
+ sh "mkdir -p pkg"
120
+ sh "gem build #{gemspec_file}"
121
+ sh "mv #{gem_file} pkg"
122
+ end
123
+
124
+ desc 'Update gemspec'
125
+ task :gemspec => :validate do
126
+ # read spec file and split out manifest section
127
+ spec = File.read(gemspec_file)
128
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
129
+ # replace name version and date
130
+ replace_header(head, :name)
131
+ replace_header(head, :version)
132
+ replace_header(head, :date)
133
+ #comment this out if your rubyforge_project has a different name
134
+ replace_header(head, :rubyforge_project)
135
+
136
+ # determine file list from git ls-files
137
+ files = `git ls-files`.
138
+ split("\n").
139
+ sort.
140
+ reject { |file| file =~ /^\./ }.
141
+ reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
142
+ map { |file| " #{file}" }.
143
+ join("\n")
144
+
145
+ # piece file back together and write
146
+ manifest = " s.files = %w[\n#{files}\n ]\n"
147
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
148
+ #File.open(gemspec_file, 'w') { |io| io.write(spec) }
149
+ puts "Updated #{gemspec_file}"
150
+ end
151
+
152
+ desc 'Validate lib files and version file'
153
+ task :validate do
154
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}"]
155
+ unless libfiles.empty?
156
+ puts "Directory `lib` should only contain a `#{name}.rb` file and `#{name}` dir."
157
+ exit!
158
+ end
159
+ unless Dir['VERSION*'].empty?
160
+ puts "A `VERSION` file at root level violates Gem best practices."
161
+ exit!
162
+ end
163
+ end
164
+
data/gollum_rails.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gollum_rails'
3
- s.version = '0.0.2.2'
3
+ s.version = '0.0.2.4'
4
4
 
5
5
  s.summary = 'Combines the benefits from Gollum with Rails'
6
6
  s.description= 'use templating, authentication and so on'
@@ -22,24 +22,27 @@ Gem::Specification.new do |s|
22
22
  s.homepage = 'https://github.com/nirnanaaa/gollum_rails'
23
23
  s.platform = Gem::Platform::RUBY
24
24
  s.required_ruby_version = '>=1.9'
25
- s.files = %w[
26
- Gemfile
27
- HISTORY.md
28
- gollum_rails.gemspec
29
- LICENSE.md
30
- README.md
31
- lib/gollum_rails.rb
32
- lib/gollum/rails/dependency_injector.rb
33
- lib/gollum/rails/page.rb
34
- lib/gollum/rails/validations.rb
35
- lib/gollum/rails/wiki.rb
36
- lib/gollum/rails/version.rb
37
- lib/gollum/rails/gollum_rails.rb
38
- lib/gollum/rails/engine.rb
39
- lib/gollum/rails/config.rb
40
- lib/gollum/rails/messages.yml
41
- lib/gollum/rails/hash.rb
42
- ]
25
+ # = MANIFEST =
26
+ s.files = %w[
27
+ Gemfile
28
+ Gemfile.lock
29
+ HISTORY.md
30
+ LICENSE.md
31
+ README.md
32
+ Rakefile
33
+ gollum_rails.gemspec
34
+ lib/gollum_rails.rb
35
+ lib/gollum_rails/config.rb
36
+ lib/gollum_rails/dependency_injector.rb
37
+ lib/gollum_rails/engine.rb
38
+ lib/gollum_rails/gollum_rails.rb
39
+ lib/gollum_rails/hash.rb
40
+ lib/gollum_rails/messages.yml
41
+ lib/gollum_rails/page.rb
42
+ lib/gollum_rails/validations.rb
43
+ lib/gollum_rails/wiki.rb
44
+ ]
45
+ # = MANIFEST =
43
46
  s.require_paths = %w[lib]
44
47
  s.has_rdoc = false
45
48
  s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
data/lib/gollum_rails.rb CHANGED
@@ -1,10 +1,13 @@
1
1
  require 'rubygems'
2
2
  require 'gollum'
3
3
 
4
+
5
+
4
6
  module Gollum
5
7
  module Rails
6
- require 'gollum/rails/engine' if defined?(Rails)
8
+ VERSION = '0.0.2.4'
9
+ require 'gollum_rails/engine' if defined?(Rails)
7
10
  end
8
11
  end
9
12
 
10
- require 'gollum/rails/gollum_rails' if defined?(Rails)
13
+ require 'gollum_rails/gollum_rails' if defined?(Rails)
@@ -1,7 +1,6 @@
1
1
  require 'yaml'
2
2
 
3
- module Gollum
4
- module Rails
3
+ module GollumRails
5
4
  class Config
6
5
  attr_reader :config
7
6
  def self.read_config
@@ -34,5 +33,4 @@ module Gollum
34
33
  end
35
34
 
36
35
  end
37
- end
38
36
  end
@@ -1,5 +1,4 @@
1
- module Gollum
2
- module Rails
1
+ module GollumRails
3
2
  ## simple DI component
4
3
  class DependencyInjector
5
4
 
@@ -26,5 +25,4 @@ module Gollum
26
25
  @storage[name]
27
26
  end
28
27
  end
29
- end
30
28
  end
@@ -1,13 +1,11 @@
1
1
  require 'rails'
2
- require 'gollum/rails/config'
2
+ require 'gollum_rails/config'
3
3
 
4
- module Gollum
5
- module Rails
4
+ module GollumRails
6
5
  class Engine < ::Rails::Engine
7
6
  #initialize "gollum_rails.load_app" do |app|
8
- ## Gollum::Rails::Config::rails = app
7
+ ## GollumRails::Config::rails = app
9
8
  # end
10
9
  end
11
10
  end
12
- end
13
11
 
@@ -0,0 +1,6 @@
1
+ require "gollum_rails/engine"
2
+ require 'gollum_rails/config'
3
+ require "gollum_rails/dependency_injector"
4
+ require "gollum_rails/wiki"
5
+ require "gollum_rails/page"
6
+ require 'gollum_rails/validations'
File without changes
File without changes
@@ -1,7 +1,6 @@
1
1
  # ~*~ encoding: utf-8 ~*~
2
- require "gollum/rails/hash"
3
- module Gollum
4
- module Rails
2
+ require "gollum_rails/hash"
3
+ module GollumRails
5
4
  class Page
6
5
  include ActiveModel::Conversion
7
6
  include ActiveModel::Validations
@@ -50,7 +49,7 @@ module Gollum
50
49
 
51
50
  # attributes needs to be a hash
52
51
  # example:
53
- # Gollum::Rails::Page.new({name: '', content: '', format: '', commit: {}})
52
+ # GollumRails::Page.new({name: '', content: '', format: '', commit: {}})
54
53
  #
55
54
  #
56
55
  # explanation:
@@ -85,7 +84,7 @@ module Gollum
85
84
  attributes.each do |name, value|
86
85
  send("#{name}=", value)
87
86
  end
88
-
87
+
89
88
  end
90
89
 
91
90
  ## checks if @wiki.wiki is an instance of Gollum::Wiki
@@ -126,9 +125,9 @@ module Gollum
126
125
  # usage:
127
126
  #
128
127
  #
129
- # wiki = Gollum::Rails::Wiki.new(PATH)
128
+ # wiki = GollumRails::Wiki.new(PATH)
130
129
  #
131
- # page = Gollum::Rails::Page.new
130
+ # page = GollumRails::Page.new
132
131
  # cnt = page.find(PAGENAME)
133
132
  #
134
133
  # commit = {
@@ -207,8 +206,6 @@ module Gollum
207
206
  end
208
207
  end
209
208
 
210
-
211
-
212
209
  #
213
210
  # Validates the Class variables
214
211
  # default:
@@ -228,13 +225,14 @@ module Gollum
228
225
  if !@format
229
226
  @error = @options.messages.format_not_set
230
227
  return false
231
- end
228
+ end
232
229
 
233
230
  #super #doesn't work atm
234
231
 
235
232
  return true
236
233
  end
237
234
 
235
+
238
236
  #gets an Instance of Gollum::Wiki fetched by find() method
239
237
  attr_reader :page
240
238
 
@@ -267,7 +265,6 @@ module Gollum
267
265
  klass = self.new
268
266
  return klass.send(name, args)
269
267
  end
270
-
271
268
  # def method_missing(name, *args)
272
269
  # meth = name.to_s.index("find_by_")
273
270
  # if meth.nil?
@@ -281,5 +278,4 @@ module Gollum
281
278
  # end
282
279
 
283
280
  end
284
- end
285
- end
281
+ end
@@ -0,0 +1,10 @@
1
+ ## Overrides
2
+
3
+ module GollumRails
4
+ class Validations
5
+ def self.is_boolean?(variable)
6
+ variable.is_a?(TrueClass) || variable.is_a?(FalseClass)
7
+ end
8
+
9
+ end
10
+ end
@@ -1,5 +1,4 @@
1
- module Gollum
2
- module Rails
1
+ module GollumRails
3
2
  class Wiki
4
3
  attr_accessor :wiki
5
4
  def initialize(path)
@@ -30,5 +29,4 @@ module Gollum
30
29
  @wiki
31
30
  end
32
31
  end
33
- end
34
- end
32
+ 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.2.2
4
+ version: 0.0.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -178,21 +178,22 @@ extensions: []
178
178
  extra_rdoc_files: []
179
179
  files:
180
180
  - Gemfile
181
+ - Gemfile.lock
181
182
  - HISTORY.md
182
- - gollum_rails.gemspec
183
183
  - LICENSE.md
184
184
  - README.md
185
+ - Rakefile
186
+ - gollum_rails.gemspec
185
187
  - lib/gollum_rails.rb
186
- - lib/gollum/rails/dependency_injector.rb
187
- - lib/gollum/rails/page.rb
188
- - lib/gollum/rails/validations.rb
189
- - lib/gollum/rails/wiki.rb
190
- - lib/gollum/rails/version.rb
191
- - lib/gollum/rails/gollum_rails.rb
192
- - lib/gollum/rails/engine.rb
193
- - lib/gollum/rails/config.rb
194
- - lib/gollum/rails/messages.yml
195
- - lib/gollum/rails/hash.rb
188
+ - lib/gollum_rails/config.rb
189
+ - lib/gollum_rails/dependency_injector.rb
190
+ - lib/gollum_rails/engine.rb
191
+ - lib/gollum_rails/gollum_rails.rb
192
+ - lib/gollum_rails/hash.rb
193
+ - lib/gollum_rails/messages.yml
194
+ - lib/gollum_rails/page.rb
195
+ - lib/gollum_rails/validations.rb
196
+ - lib/gollum_rails/wiki.rb
196
197
  homepage: https://github.com/nirnanaaa/gollum_rails
197
198
  licenses: []
198
199
  post_install_message:
@@ -211,6 +212,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
211
212
  - - ! '>='
212
213
  - !ruby/object:Gem::Version
213
214
  version: '0'
215
+ segments:
216
+ - 0
217
+ hash: 770008221
214
218
  requirements: []
215
219
  rubyforge_project:
216
220
  rubygems_version: 1.8.23
@@ -1,7 +0,0 @@
1
- require "gollum/rails/engine"
2
- require "gollum/rails/version"
3
- require 'gollum/rails/config'
4
- require "gollum/rails/dependency_injector"
5
- require "gollum/rails/wiki"
6
- require "gollum/rails/page"
7
- require 'gollum/rails/validations'
@@ -1,10 +0,0 @@
1
- module Gollum
2
- module Rails
3
- class Validations
4
- include ActiveModel::Validations
5
- def self.is_boolean?(variable)
6
- variable.is_a?(TrueClass) || variable.is_a?(FalseClass)
7
- end
8
- end
9
- end
10
- end
@@ -1,5 +0,0 @@
1
- module Gollum
2
- module Rails
3
- VERSION = "0.0.1"
4
- end
5
- end