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.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -6
  3. data/Gemfile.lock +2 -1
  4. data/HISTORY.md +91 -91
  5. data/LICENSE +661 -661
  6. data/README.md +74 -74
  7. data/Rakefile +170 -170
  8. data/gollum_rails.gemspec +1 -1
  9. data/lib/core_ext/string.rb +7 -10
  10. data/lib/generators/gollum_rails/install/install_generator.rb +27 -27
  11. data/lib/generators/gollum_rails/install/templates/gollum_initializer.rb +22 -22
  12. data/lib/generators/gollum_rails/language/language_generator.rb +81 -81
  13. data/lib/generators/gollum_rails/model/model_generator.rb +51 -51
  14. data/lib/generators/gollum_rails/model/templates/model_template.erb +13 -13
  15. data/lib/gollum_rails.rb +1 -1
  16. data/lib/gollum_rails/adapters/activemodel.rb +36 -36
  17. data/lib/gollum_rails/adapters/activemodel/boolean.rb +15 -15
  18. data/lib/gollum_rails/adapters/activemodel/error.rb +27 -27
  19. data/lib/gollum_rails/adapters/activemodel/naming.rb +42 -42
  20. data/lib/gollum_rails/adapters/gollum.rb +54 -54
  21. data/lib/gollum_rails/adapters/gollum/.gitkeep +0 -0
  22. data/lib/gollum_rails/adapters/gollum/error.rb +19 -19
  23. data/lib/gollum_rails/adapters/gollum/page.rb +177 -177
  24. data/lib/gollum_rails/adapters/gollum/wiki.rb +42 -42
  25. data/lib/gollum_rails/modules/hash.rb +33 -33
  26. data/lib/gollum_rails/modules/loader.rb +5 -5
  27. data/lib/gollum_rails/page.rb +266 -266
  28. data/lib/gollum_rails/setup.rb +81 -81
  29. data/lib/grit/git-ruby/internal/pack.rb +397 -397
  30. data/spec/gollum_rails/adapters/activemodel/error_spec.rb +11 -11
  31. data/spec/gollum_rails/adapters/activemodel/naming_spec.rb +27 -27
  32. data/spec/gollum_rails/adapters/activemodel/validation_unused.rb +102 -102
  33. data/spec/gollum_rails/adapters/gollum/committer_spec.rb +0 -0
  34. data/spec/gollum_rails/adapters/gollum/connector_spec.rb +15 -15
  35. data/spec/gollum_rails/adapters/gollum/error_spec.rb +7 -7
  36. data/spec/gollum_rails/adapters/gollum/page_spec.rb +89 -89
  37. data/spec/gollum_rails/adapters/gollum/wiki_spec.rb +27 -27
  38. data/spec/gollum_rails/modules/hash_spec.rb +31 -31
  39. data/spec/gollum_rails/page_spec.rb +207 -207
  40. data/spec/gollum_rails/respository_spec.rb +0 -0
  41. data/spec/gollum_rails/setup_spec.rb +44 -44
  42. data/spec/gollum_rails/wiki_spec.rb +0 -0
  43. data/spec/spec.opts +3 -3
  44. data/spec/spec_helper.rb +43 -43
  45. metadata +2 -2
data/README.md CHANGED
@@ -1,74 +1,74 @@
1
- Gollum for Rails
2
- ================
3
- [![Build Status](https://travis-ci.org/nirnanaaa/gollum_rails.png?branch=master)](https://travis-ci.org/nirnanaaa/gollum_rails)
4
- [![Dependency Status](https://gemnasium.com/nirnanaaa/gollum_rails.png)](https://gemnasium.com/nirnanaaa/gollum_rails)
5
- [![Gem Version](https://badge.fury.io/rb/gollum_rails.png)](http://badge.fury.io/rb/gollum_rails)
6
- [![Coverage Status](https://coveralls.io/repos/nirnanaaa/gollum_rails/badge.png?branch=master)](https://coveralls.io/r/nirnanaaa/gollum_rails)
7
-
8
-
9
- gollum_rails combines the git-powered wiki software gollum with the extremely popular webframework rails.
10
- It improves the lightweight "gollum" experience which is quite awesome.
11
-
12
- with gollum_rails you can:
13
-
14
- * Define your own views
15
- * Use your Rails layouts
16
- * Embed gollum it without mounting any rack application
17
- * Use own preprocession e.g. background workers for data procession
18
- * Use user authentication e.g. Devise or Authlogic
19
-
20
- ## SYSTEM REQUIREMENTS
21
- - Python 2.5+ (2.7.3 recommended)
22
- - Ruby 1.9.3+ (2.0.0 recommended)
23
- - Unix like operating system (OS X, Ubuntu, Debian, and more)
24
- - Will not work on Windows (see [gollum](https://github.com/github/gollum/blob/master/README.md#system-requirements))
25
-
26
- ## [Installation](https://github.com/nirnanaaa/gollum_rails/wiki/Installation)
27
-
28
- ## [Usage](https://github.com/nirnanaaa/gollum_rails/wiki/Usage)
29
-
30
-
31
- ## DEVELOPER
32
-
33
- Very cool. Just fork this repository and send me pull requests.
34
-
35
- ### QUICK START
36
-
37
- Clone the repository:
38
-
39
- $ git clone git://github.com/nirnanaaa/gollum_rails.git
40
-
41
- Run the [Bundler](http://gembundler.com/):
42
-
43
- $ bundle install
44
-
45
-
46
- ### TESTING
47
-
48
- First use the Quick Start to install all dependencies.
49
- All tests are stored under the `spec/` directory.
50
-
51
- To run tests just use the `rspec` command:
52
-
53
- $ bundle exec rspec
54
-
55
- ## LICENSE
56
-
57
- [![AGPLv3](http://www.gnu.org/graphics/agplv3-155x51.png)](http://www.gnu.org/licenses/agpl-3.0.en.html)
58
-
59
- gollum_rails is licensed under the AGPL license.
60
-
61
- Copyright (C) 2013 Florian Kasper
62
-
63
- This program is free software: you can redistribute it and/or modify
64
- it under the terms of the GNU Affero General Public License as published by
65
- the Free Software Foundation, either version 3 of the License, or
66
- (at your option) any later version.
67
-
68
- This program is distributed in the hope that it will be useful,
69
- but WITHOUT ANY WARRANTY; without even the implied warranty of
70
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71
- GNU Affero General Public License for more details.
72
-
73
- You should have received a copy of the GNU Affero General Public License
74
- along with this program. If not, see <http://www.gnu.org/licenses/>.
1
+ Gollum for Rails
2
+ ================
3
+ [![Build Status](https://travis-ci.org/nirnanaaa/gollum_rails.png?branch=master)](https://travis-ci.org/nirnanaaa/gollum_rails)
4
+ [![Dependency Status](https://gemnasium.com/nirnanaaa/gollum_rails.png)](https://gemnasium.com/nirnanaaa/gollum_rails)
5
+ [![Gem Version](https://badge.fury.io/rb/gollum_rails.png)](http://badge.fury.io/rb/gollum_rails)
6
+ [![Coverage Status](https://coveralls.io/repos/nirnanaaa/gollum_rails/badge.png?branch=master)](https://coveralls.io/r/nirnanaaa/gollum_rails)
7
+
8
+
9
+ gollum_rails combines the git-powered wiki software gollum with the extremely popular webframework rails.
10
+ It improves the lightweight "gollum" experience which is quite awesome.
11
+
12
+ with gollum_rails you can:
13
+
14
+ * Define your own views
15
+ * Use your Rails layouts
16
+ * Embed gollum it without mounting any rack application
17
+ * Use own preprocession e.g. background workers for data procession
18
+ * Use user authentication e.g. Devise or Authlogic
19
+
20
+ ## SYSTEM REQUIREMENTS
21
+ - Python 2.5+ (2.7.3 recommended)
22
+ - Ruby 1.9.3+ (2.0.0 recommended)
23
+ - Unix like operating system (OS X, Ubuntu, Debian, and more)
24
+ - Will not work on Windows (see [gollum](https://github.com/github/gollum/blob/master/README.md#system-requirements))
25
+
26
+ ## [Installation](https://github.com/nirnanaaa/gollum_rails/wiki/Installation)
27
+
28
+ ## [Usage](https://github.com/nirnanaaa/gollum_rails/wiki/Usage)
29
+
30
+
31
+ ## DEVELOPER
32
+
33
+ Very cool. Just fork this repository and send me pull requests.
34
+
35
+ ### QUICK START
36
+
37
+ Clone the repository:
38
+
39
+ $ git clone git://github.com/nirnanaaa/gollum_rails.git
40
+
41
+ Run the [Bundler](http://gembundler.com/):
42
+
43
+ $ bundle install
44
+
45
+
46
+ ### TESTING
47
+
48
+ First use the Quick Start to install all dependencies.
49
+ All tests are stored under the `spec/` directory.
50
+
51
+ To run tests just use the `rspec` command:
52
+
53
+ $ bundle exec rspec
54
+
55
+ ## LICENSE
56
+
57
+ [![AGPLv3](http://www.gnu.org/graphics/agplv3-155x51.png)](http://www.gnu.org/licenses/agpl-3.0.en.html)
58
+
59
+ gollum_rails is licensed under the AGPL license.
60
+
61
+ Copyright (C) 2013 Florian Kasper
62
+
63
+ This program is free software: you can redistribute it and/or modify
64
+ it under the terms of the GNU Affero General Public License as published by
65
+ the Free Software Foundation, either version 3 of the License, or
66
+ (at your option) any later version.
67
+
68
+ This program is distributed in the hope that it will be useful,
69
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
70
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71
+ GNU Affero General Public License for more details.
72
+
73
+ You should have received a copy of the GNU Affero General Public License
74
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
data/Rakefile CHANGED
@@ -1,170 +1,170 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'date'
4
- require 'rspec/core/rake_task'
5
-
6
-
7
- #############################################################################
8
- #
9
- # Helper functions
10
- #
11
- #############################################################################
12
-
13
- def name
14
- @name ||= Dir['*.gemspec'].first.split('.').first
15
- end
16
-
17
- def version
18
- line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
19
- line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
20
- end
21
-
22
- # assumes x.y.z all digit version
23
- def next_version
24
- # x.y.z
25
- v = version.split '.'
26
- # bump z
27
- v[-1] = v[-1].to_i + 1
28
- v.join '.'
29
- end
30
-
31
- def bump_version
32
- old_file = File.read("lib/#{name}.rb")
33
- old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
34
- new_version = next_version
35
- # replace first match of old vesion with new version
36
- old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
37
-
38
- File.write("lib/#{name}.rb", old_file)
39
-
40
- new_version
41
- end
42
-
43
- def date
44
- Date.today.to_s
45
- end
46
-
47
- def rubyforge_project
48
- name
49
- end
50
-
51
- def gemspec_file
52
- "#{name}.gemspec"
53
- end
54
-
55
- def gem_file
56
- "#{name}-#{version}.gem"
57
- end
58
-
59
- def replace_header(head, header_name)
60
- head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
61
- end
62
-
63
- #############################################################################
64
- #
65
- # Standard tasks
66
- #
67
- #############################################################################
68
-
69
- task :default => :spec_run
70
-
71
- desc "Run RSpec"
72
- RSpec::Core::RakeTask.new do |t|
73
- t.verbose = false
74
- end
75
-
76
- desc "Run specs"
77
- task :spec_run do
78
- begin
79
- sh "rake spec"
80
- rescue RuntimeError => e
81
- puts e.message
82
- exit(1)
83
- end
84
- end
85
-
86
-
87
- desc "Open an irb session preloaded with this library"
88
- task :console do
89
- sh "irb -rubygems -r ./lib/#{name}.rb"
90
- end
91
-
92
- #############################################################################
93
- #
94
- # Custom tasks (add your own tasks here)
95
- #
96
- #############################################################################
97
-
98
- desc "Update version number and gemspec"
99
- task :bump do
100
- puts "Updated version to #{bump_version}"
101
- # Execute does not invoke dependencies.
102
- # Manually invoke gemspec then validate.
103
- Rake::Task[:gemspec].execute
104
- Rake::Task[:validate].execute
105
- end
106
-
107
- #############################################################################
108
- #
109
- # Packaging tasks
110
- #
111
- #############################################################################
112
-
113
- desc 'Create a release build'
114
- task :release => :build do
115
- unless `git branch` =~ /^\* master$/
116
- puts "You must be on the master branch to release!"
117
- exit!
118
- end
119
- sh "git commit --allow-empty -a -m 'Release #{version}'"
120
- sh "git pull"
121
- sh "git tag v#{version}"
122
- sh "git push origin master"
123
- sh "git push origin v#{version}"
124
- sh "gem push pkg/#{name}-#{version}.gem"
125
- end
126
-
127
- desc 'Build gem'
128
- task :build => :gemspec do
129
- sh "mkdir -p pkg"
130
- sh "gem build #{gemspec_file}"
131
- sh "mv #{gem_file} pkg"
132
- end
133
-
134
- desc 'Update gemspec'
135
- task :gemspec => :validate do
136
- # read spec file and split out manifest section
137
- spec = File.read(gemspec_file)
138
- head, manifest, tail = spec.split(" # = MANIFEST =\n")
139
- # replace name version and date
140
- replace_header(head, :name)
141
- replace_header(head, :version)
142
- replace_header(head, :date)
143
- #comment this out if your rubyforge_project has a different name
144
- replace_header(head, :rubyforge_project)
145
-
146
- # determine file list from git ls-files
147
- files = `git ls-files`.
148
- split("\n").
149
- sort.
150
- reject { |file| file =~ /^\./ }.
151
- reject { |file| file =~ /^(doc|pkg|script|config|Home\.md|\.gitattributes)/ }.
152
- map { |file| " #{file}" }.
153
- join("\n")
154
-
155
- # piece file back together and write
156
- manifest = " s.files = %w[\n#{files}\n ]\n"
157
- spec = [head, manifest, tail].join(" # = MANIFEST =\n")
158
- File.open(gemspec_file, 'w') { |io| io.write(spec) }
159
- puts "Updated #{gemspec_file}"
160
- end
161
-
162
- desc 'Validate lib files and version file'
163
- task :validate do
164
- libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/generators"]
165
- unless Dir['VERSION*'].empty?
166
- puts "A `VERSION` file at root level violates Gem best practices."
167
- exit!
168
- end
169
- end
170
-
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'date'
4
+ require 'rspec/core/rake_task'
5
+
6
+
7
+ #############################################################################
8
+ #
9
+ # Helper functions
10
+ #
11
+ #############################################################################
12
+
13
+ def name
14
+ @name ||= Dir['*.gemspec'].first.split('.').first
15
+ end
16
+
17
+ def version
18
+ line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
19
+ line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
20
+ end
21
+
22
+ # assumes x.y.z all digit version
23
+ def next_version
24
+ # x.y.z
25
+ v = version.split '.'
26
+ # bump z
27
+ v[-1] = v[-1].to_i + 1
28
+ v.join '.'
29
+ end
30
+
31
+ def bump_version
32
+ old_file = File.read("lib/#{name}.rb")
33
+ old_version_line = old_file[/^\s*VERSION\s*=\s*.*/]
34
+ new_version = next_version
35
+ # replace first match of old vesion with new version
36
+ old_file.sub!(old_version_line, " VERSION = '#{new_version}'")
37
+
38
+ File.write("lib/#{name}.rb", old_file)
39
+
40
+ new_version
41
+ end
42
+
43
+ def date
44
+ Date.today.to_s
45
+ end
46
+
47
+ def rubyforge_project
48
+ name
49
+ end
50
+
51
+ def gemspec_file
52
+ "#{name}.gemspec"
53
+ end
54
+
55
+ def gem_file
56
+ "#{name}-#{version}.gem"
57
+ end
58
+
59
+ def replace_header(head, header_name)
60
+ head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
61
+ end
62
+
63
+ #############################################################################
64
+ #
65
+ # Standard tasks
66
+ #
67
+ #############################################################################
68
+
69
+ task :default => :spec_run
70
+
71
+ desc "Run RSpec"
72
+ RSpec::Core::RakeTask.new do |t|
73
+ t.verbose = false
74
+ end
75
+
76
+ desc "Run specs"
77
+ task :spec_run do
78
+ begin
79
+ sh "rake spec"
80
+ rescue RuntimeError => e
81
+ puts e.message
82
+ exit(1)
83
+ end
84
+ end
85
+
86
+
87
+ desc "Open an irb session preloaded with this library"
88
+ task :console do
89
+ sh "irb -rubygems -r ./lib/#{name}.rb"
90
+ end
91
+
92
+ #############################################################################
93
+ #
94
+ # Custom tasks (add your own tasks here)
95
+ #
96
+ #############################################################################
97
+
98
+ desc "Update version number and gemspec"
99
+ task :bump do
100
+ puts "Updated version to #{bump_version}"
101
+ # Execute does not invoke dependencies.
102
+ # Manually invoke gemspec then validate.
103
+ Rake::Task[:gemspec].execute
104
+ Rake::Task[:validate].execute
105
+ end
106
+
107
+ #############################################################################
108
+ #
109
+ # Packaging tasks
110
+ #
111
+ #############################################################################
112
+
113
+ desc 'Create a release build'
114
+ task :release => :build do
115
+ unless `git branch` =~ /^\* master$/
116
+ puts "You must be on the master branch to release!"
117
+ exit!
118
+ end
119
+ sh "git commit --allow-empty -a -m 'Release #{version}'"
120
+ sh "git pull"
121
+ sh "git tag v#{version}"
122
+ sh "git push origin master"
123
+ sh "git push origin v#{version}"
124
+ sh "gem push pkg/#{name}-#{version}.gem"
125
+ end
126
+
127
+ desc 'Build gem'
128
+ task :build => :gemspec do
129
+ sh "mkdir -p pkg"
130
+ sh "gem build #{gemspec_file}"
131
+ sh "mv #{gem_file} pkg"
132
+ end
133
+
134
+ desc 'Update gemspec'
135
+ task :gemspec => :validate do
136
+ # read spec file and split out manifest section
137
+ spec = File.read(gemspec_file)
138
+ head, manifest, tail = spec.split(" # = MANIFEST =\n")
139
+ # replace name version and date
140
+ replace_header(head, :name)
141
+ replace_header(head, :version)
142
+ replace_header(head, :date)
143
+ #comment this out if your rubyforge_project has a different name
144
+ replace_header(head, :rubyforge_project)
145
+
146
+ # determine file list from git ls-files
147
+ files = `git ls-files`.
148
+ split("\n").
149
+ sort.
150
+ reject { |file| file =~ /^\./ }.
151
+ reject { |file| file =~ /^(doc|pkg|script|config|Home\.md|\.gitattributes)/ }.
152
+ map { |file| " #{file}" }.
153
+ join("\n")
154
+
155
+ # piece file back together and write
156
+ manifest = " s.files = %w[\n#{files}\n ]\n"
157
+ spec = [head, manifest, tail].join(" # = MANIFEST =\n")
158
+ File.open(gemspec_file, 'w') { |io| io.write(spec) }
159
+ puts "Updated #{gemspec_file}"
160
+ end
161
+
162
+ desc 'Validate lib files and version file'
163
+ task :validate do
164
+ libfiles = Dir['lib/*'] - ["lib/#{name}.rb", "lib/#{name}", "lib/generators"]
165
+ unless Dir['VERSION*'].empty?
166
+ puts "A `VERSION` file at root level violates Gem best practices."
167
+ exit!
168
+ end
169
+ end
170
+