smashing_docs 1.2.1 → 1.3.1
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/README.md +22 -12
- data/gem_rspec/base_spec.rb +10 -2
- data/lib/base.rb +1 -0
- data/lib/conf.rb +2 -2
- data/lib/generators/{smashing_documentation → docs}/build_docs_generator.rb +1 -1
- data/lib/generators/{smashing_documentation → docs}/install_generator.rb +2 -1
- data/smashing_docs.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0809fc6581579eaf8ff1e180d884f6b3ffc46b08
|
4
|
+
data.tar.gz: f6e7337a0b38d97ee845fc4406bb02ebe1aba3b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4553669d45deb07c858190c8e50d31394b4df68aa401570919f9d5ac977f340dab366794f79933b8e06f99315d474bbd184695f15e28727ecb2cd204c85bb008
|
7
|
+
data.tar.gz: b97a4348ab97f69df777043d1f9397c308485436a3e8e4e93dc019e16969ba96f203831b40241c7bad0ccad49a4284ece0bc6cc1e562ed541199399adc416b85
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
In your gemfile add the following to your test group:
|
8
8
|
|
9
|
-
`gem 'smashing_docs', '~>
|
9
|
+
`gem 'smashing_docs', '~> 1.3.1'`
|
10
10
|
|
11
11
|
Installation differs for RSpec/Minitest, so scroll to the appropriate section for guidance.
|
12
12
|
|
@@ -14,7 +14,7 @@ Installation differs for RSpec/Minitest, so scroll to the appropriate section fo
|
|
14
14
|
|
15
15
|
After you bundle, run:
|
16
16
|
|
17
|
-
`rails
|
17
|
+
`rails g docs:install`
|
18
18
|
|
19
19
|
SmashingDocs will be configured to run on all your controller tests with the default
|
20
20
|
template.
|
@@ -25,7 +25,7 @@ If you're using RSpec and you haven't required `rails_helper` in your tests, do
|
|
25
25
|
|
26
26
|
#### To generate your docs
|
27
27
|
|
28
|
-
Run `rails g
|
28
|
+
Run `rails g docs:build_docs`, and your docs will be waiting for you in the `smashing_docs` folder.
|
29
29
|
|
30
30
|
## Manual RSpec Installation
|
31
31
|
|
@@ -37,6 +37,7 @@ SmashingDocs.config do |c|
|
|
37
37
|
c.output_file = 'smashing_docs/api_docs.md'
|
38
38
|
c.run_all = true
|
39
39
|
c.auto_push = false
|
40
|
+
c.wiki_folder = nil
|
40
41
|
end
|
41
42
|
```
|
42
43
|
|
@@ -59,10 +60,9 @@ end
|
|
59
60
|
Set the `c.run_all` line to `false` in `rails_helper.rb`
|
60
61
|
```ruby
|
61
62
|
SmashingDocs.config do |c|
|
62
|
-
|
63
|
-
c.output_file = 'smashing_docs/api_docs.md'
|
63
|
+
# configs
|
64
64
|
c.run_all = false
|
65
|
-
|
65
|
+
# configs
|
66
66
|
end
|
67
67
|
```
|
68
68
|
|
@@ -86,6 +86,7 @@ class ActiveSupport::TestCase
|
|
86
86
|
c.output_file = 'smashing_docs/api_docs.md'
|
87
87
|
c.run_all = true
|
88
88
|
c.auto_push = false
|
89
|
+
c.wiki_folder = nil
|
89
90
|
end
|
90
91
|
# More code
|
91
92
|
end
|
@@ -103,10 +104,9 @@ MiniTest::Unit.after_tests { SmashingDocs.finish! }
|
|
103
104
|
Set the `c.run_all` line to `false` in `test_helper.rb`
|
104
105
|
```ruby
|
105
106
|
SmashingDocs.config do |c|
|
106
|
-
|
107
|
-
c.output_file = 'smashing_docs/api_docs.md'
|
107
|
+
# configs
|
108
108
|
c.run_all = false
|
109
|
-
|
109
|
+
# configs
|
110
110
|
end
|
111
111
|
```
|
112
112
|
|
@@ -176,20 +176,30 @@ SmashingDocs can automatically push your generated docs to your project wiki.
|
|
176
176
|
|
177
177
|
Your folder structure should be
|
178
178
|
|
179
|
-
../projects/
|
179
|
+
../projects/rails_app
|
180
180
|
|
181
181
|
../projects/my_rails_app.wiki
|
182
182
|
|
183
|
-
2. Set
|
183
|
+
2. Set the name of your wiki folder (do **not** include '.wiki')
|
184
|
+
|
185
|
+
``` ruby
|
186
|
+
SmashingDocs.config do |c|
|
187
|
+
# configs
|
188
|
+
c.wiki_folder = "my_rails_app"
|
189
|
+
end
|
190
|
+
```
|
191
|
+
|
192
|
+
3. Set auto_push to true in `rails_helper.rb` or `test_helper.rb`
|
184
193
|
|
185
194
|
``` ruby
|
186
195
|
SmashingDocs.config do |c|
|
187
196
|
# configs
|
188
197
|
c.auto_push = true
|
198
|
+
# configs
|
189
199
|
end
|
190
200
|
```
|
191
201
|
|
192
|
-
|
202
|
+
4. Build your docs with `rails g docs:build_docs`
|
193
203
|
|
194
204
|
#### Generate Docs on Every Test Suite Run
|
195
205
|
|
data/gem_rspec/base_spec.rb
CHANGED
@@ -117,8 +117,16 @@ RSpec.describe SmashingDocs do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
describe "#app_name" do
|
120
|
-
|
121
|
-
|
120
|
+
context "when wiki_folder config is set" do
|
121
|
+
let!(:config) { SmashingDocs.config { |c| c.wiki_folder = "different_folder" } }
|
122
|
+
it "returns the name of the wiki folder" do
|
123
|
+
expect(SmashingDocs.current.send(:app_name)).to eq("different_folder")
|
124
|
+
end
|
125
|
+
end
|
126
|
+
context "when wiki_folder config is nil" do
|
127
|
+
it "returns the name of the app it is installed in" do
|
128
|
+
expect(SmashingDocs.current.send(:app_name)).to eq("smashing_docs")
|
129
|
+
end
|
122
130
|
end
|
123
131
|
end
|
124
132
|
|
data/lib/base.rb
CHANGED
data/lib/conf.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
class SmashingDocs::Conf
|
2
2
|
class << self
|
3
|
-
attr_accessor :template_file, :output_file, :auto_push, :run_all
|
3
|
+
attr_accessor :template_file, :output_file, :auto_push, :run_all, :wiki_folder
|
4
4
|
@output_file = 'documentation.md'
|
5
|
-
|
5
|
+
|
6
6
|
def template
|
7
7
|
raise 'You must set a template file.' unless template_file
|
8
8
|
File.read(template_file)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rails/generators'
|
2
|
-
module
|
2
|
+
module Docs
|
3
3
|
module Generators
|
4
4
|
class InstallGenerator < Rails::Generators::Base
|
5
5
|
source_root File.expand_path("../../../templates/", __FILE__)
|
@@ -75,6 +75,7 @@ module SmashingDocumentation
|
|
75
75
|
" c.output_file = 'smashing_docs/api_docs.md'\n"\
|
76
76
|
" c.run_all = true\n"\
|
77
77
|
" c.auto_push = false\n"\
|
78
|
+
" c.wiki_folder = nil\n"\
|
78
79
|
"end\n"
|
79
80
|
if using_minitest?
|
80
81
|
insert_into_file(@config_file, config, after: "class ActiveSupport::TestCase\n")
|
data/smashing_docs.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.require_paths = ['lib']
|
11
11
|
s.summary = "Uses your test cases to write example documentation for your API."
|
12
12
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
13
|
-
s.version = '1.
|
13
|
+
s.version = '1.3.1'
|
14
14
|
|
15
15
|
s.add_development_dependency "bundler", "~> 1.11"
|
16
16
|
s.add_development_dependency "rake", "~> 10.0"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smashing_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Rockwell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-03-
|
13
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -90,8 +90,8 @@ files:
|
|
90
90
|
- gem_rspec/test_case_spec.rb
|
91
91
|
- lib/base.rb
|
92
92
|
- lib/conf.rb
|
93
|
-
- lib/generators/
|
94
|
-
- lib/generators/
|
93
|
+
- lib/generators/docs/build_docs_generator.rb
|
94
|
+
- lib/generators/docs/install_generator.rb
|
95
95
|
- lib/smashing_docs.rb
|
96
96
|
- lib/templates/real_template.md
|
97
97
|
- lib/test_case.rb
|