mount_doc 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -4,7 +4,7 @@ Railsアプリケーション組み込み型ドキュメント生成ツール
4
4
 
5
5
  ## Configure
6
6
 
7
- `MountDoc::Config`に書き込み
7
+ config/initialzier/mount_doc.rb に書き込み
8
8
 
9
9
  - `auto_mount`: 自動でマウントするか否か(default: false)
10
10
  - `auto_mount_path`: 自動でマウントする先のパス(default: /doc)
@@ -28,12 +28,17 @@ Or install it yourself as:
28
28
 
29
29
  $ gem install mount_doc
30
30
 
31
+ And then generate initializer file
32
+
33
+ rails generator mount_doc:install
34
+
31
35
  And added config/routes.rb
32
36
 
33
37
  mount MountDoc::Engine => '/prefix'
34
38
 
35
39
  access to http://localhost:3000/prefix !
36
40
 
41
+
37
42
  ## Usage
38
43
 
39
44
  1. Installation
@@ -0,0 +1,14 @@
1
+ require 'rails/generators/base'
2
+
3
+ module MountDoc
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../../templates", __FILE__)
7
+
8
+ desc "create initializer file for mount_doc."
9
+ def copy_initializer
10
+ template "initializer.rb", "config/initializers/mount_doc.rb"
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,46 @@
1
+ MountDoc.config do |conf|
2
+ #############
3
+ # auto_mount
4
+ #############
5
+ # set true if you want to mount automaticaly (default false)
6
+ #
7
+ # conf.auto_mount = true
8
+ #
9
+
10
+ ##################
11
+ # auto_mount_path
12
+ ##################
13
+ # path to mount document (default: /doc)
14
+ #
15
+ # conf.auto_mont_path = '/documents'
16
+ #
17
+
18
+ #####################
19
+ # visible_components
20
+ #####################
21
+ # document component types you want to include into menu
22
+ # types: [:files, :urls, :controllers, :models]
23
+ # default: [:files, :urls, :controllers]
24
+ #
25
+ # conf.visible_components = [:files, :controllers]
26
+ #
27
+
28
+ ################
29
+ # doc_file_path
30
+ ################
31
+ # path to static documents (default: doc)
32
+ #
33
+ # conf.doc_file_path = 'app/view/statics'
34
+
35
+ #########
36
+ # markup
37
+ #########
38
+ # format of comments (default: rdoc)
39
+ #
40
+ # ** you must include gem into Gemfile, like
41
+ # gem 'github-markdown'
42
+ #
43
+ # config.markup = 'markdown'
44
+ #
45
+
46
+ end
@@ -4,6 +4,10 @@ module MountDoc
4
4
  autoload :VERSION, "mount_doc/version"
5
5
  autoload :Config, "mount_doc/config"
6
6
  autoload :Document, "mount_doc/document"
7
+
8
+ def self.config(&block)
9
+ yield(MountDoc::Config)
10
+ end
7
11
  end
8
12
 
9
13
  require 'mount_doc/string_patch'
@@ -1,3 +1,3 @@
1
1
  module MountDoc
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -3,9 +3,9 @@ require 'spec_helper'
3
3
  describe MountDoc::Config do
4
4
  describe :auto_mount do
5
5
  subject{ MountDoc::Config.auto_mount? }
6
- it("default: false"){ should be_false }
6
+ it("default: false") { should be_false }
7
7
 
8
- it("writable boolean"){
8
+ it("writable boolean") {
9
9
  MountDoc::Config.auto_mount = 1
10
10
  should be_true
11
11
  }
@@ -57,17 +57,27 @@ describe MountDoc::Config do
57
57
 
58
58
  describe :doc_file_path do
59
59
  subject{ MountDoc::Config.doc_file_path }
60
-
60
+
61
61
  it("default: 'doc'"){ should == 'doc' }
62
62
  end
63
63
 
64
64
  describe :defaults! do
65
65
  subject{ MountDoc::Config }
66
66
 
67
- it("set default"){
67
+ it("set default"){
68
68
  subject.visible_protected_methods = true
69
69
  subject.defaults!
70
70
  subject.visible_protected_methods.should be_false
71
71
  }
72
72
  end
73
+
74
+ describe :cool_config do
75
+ it "change config" do
76
+ lambda{
77
+ MountDoc.config do |conf|
78
+ conf.visible_components = [:files]
79
+ end
80
+ }.should change(MountDoc::Config, :visible_components).to([:files])
81
+ end
82
+ end
73
83
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mount_doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-19 00:00:00.000000000 Z
12
+ date: 2012-09-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -114,6 +114,8 @@ files:
114
114
  - app/views/mount_doc/mount_doc/index.slim
115
115
  - app/views/mount_doc/mount_doc/not_found.slim
116
116
  - config/routes.rb
117
+ - lib/generators/mount_doc/install_generator.rb
118
+ - lib/generators/templates/initializer.rb
117
119
  - lib/mount_doc.rb
118
120
  - lib/mount_doc/config.rb
119
121
  - lib/mount_doc/document.rb
@@ -185,7 +187,6 @@ files:
185
187
  - spec/mock/rails_3.2.3/db/schema.rb
186
188
  - spec/mock/rails_3.2.3/db/seeds.rb
187
189
  - spec/mock/rails_3.2.3/doc/README_FOR_APP
188
- - spec/mock/rails_3.2.3/doc/うんこしたい.rdoc
189
190
  - spec/mock/rails_3.2.3/lib/assets/.gitkeep
190
191
  - spec/mock/rails_3.2.3/lib/tasks/.gitkeep
191
192
  - spec/mock/rails_3.2.3/log/.gitkeep
@@ -222,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
222
223
  version: '0'
223
224
  requirements: []
224
225
  rubyforge_project:
225
- rubygems_version: 1.8.22
226
+ rubygems_version: 1.8.23
226
227
  signing_key:
227
228
  specification_version: 3
228
229
  summary: Railsで書かれたアクションにコメントを書くと、動的にドキュメントを生成し、その結果をRailsアプリにマウントする
@@ -287,7 +288,6 @@ test_files:
287
288
  - spec/mock/rails_3.2.3/db/schema.rb
288
289
  - spec/mock/rails_3.2.3/db/seeds.rb
289
290
  - spec/mock/rails_3.2.3/doc/README_FOR_APP
290
- - spec/mock/rails_3.2.3/doc/うんこしたい.rdoc
291
291
  - spec/mock/rails_3.2.3/lib/assets/.gitkeep
292
292
  - spec/mock/rails_3.2.3/lib/tasks/.gitkeep
293
293
  - spec/mock/rails_3.2.3/log/.gitkeep