document_generator 0.0.5 → 0.0.6
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/assets/_layouts/default.html +5 -1
- data/lib/document_generator/commit.rb +1 -0
- data/lib/document_generator/diff_file.rb +4 -5
- data/lib/document_generator/output.rb +1 -17
- data/lib/document_generator/version.rb +1 -1
- data/spec/lib/document_generator/commit_spec.rb +4 -0
- data/spec/lib/document_generator/diff_file_spec.rb +62 -48
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e1a30220973a3ce1fee7ada798bc6c8879c201e
|
4
|
+
data.tar.gz: f03e4a2935bbf25d255e66aa334d12a77dd76615
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3b062f4a55ce16327f4eba5eeed89443552a368bbd4ac6a2d9c14a33bd8deb5d1f35ceb669b2b1af815c8f4fcfa098e33de94b5c18cb1b5d89ba2040adb261c
|
7
|
+
data.tar.gz: 51dd31fa042c3d48057cc561978f84a6657949b4ba6ebcae2bfa52f73f21076fed55abf4a6664573b03a08d0df985ade873d4cc0ac2313c2c9381f1baadaf04f
|
@@ -14,7 +14,6 @@
|
|
14
14
|
body {
|
15
15
|
padding-top: 0;
|
16
16
|
}
|
17
|
-
|
18
17
|
h1 {
|
19
18
|
font-size: 22px;
|
20
19
|
}
|
@@ -23,6 +22,11 @@
|
|
23
22
|
}
|
24
23
|
h3 {
|
25
24
|
font-size: 16px;
|
25
|
+
margin-top: 30px;
|
26
|
+
}
|
27
|
+
h4 {
|
28
|
+
font-size: 14px;
|
29
|
+
margin-top: 25px;
|
26
30
|
}
|
27
31
|
h1, h2 {
|
28
32
|
text-transform: uppercase;
|
@@ -39,14 +39,14 @@ module DocumentGenerator
|
|
39
39
|
outputs.each do |output|
|
40
40
|
if output.escaped_content.length > 0
|
41
41
|
temp << "\n\n"
|
42
|
-
temp << output.description
|
43
|
-
temp << "\n
|
42
|
+
temp << "#####{output.description}"
|
43
|
+
temp << "\n```\n"
|
44
44
|
if output.description == "Becomes"
|
45
45
|
temp << output.content.join("\n") + "\n"
|
46
46
|
else
|
47
47
|
temp << output.escaped_content
|
48
48
|
end
|
49
|
-
temp << "
|
49
|
+
temp << "\n```\n"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -62,7 +62,7 @@ module DocumentGenerator
|
|
62
62
|
git_diff_file_hunks.each do |hunk|
|
63
63
|
clean_hunks << ending_code_for(hunk).join("\n")
|
64
64
|
end
|
65
|
-
|
65
|
+
clean_hunks.join("\n")
|
66
66
|
end
|
67
67
|
|
68
68
|
def ending_code_for(hunk) # The unescaped end result code for a particular hunk returned as array
|
@@ -76,7 +76,6 @@ module DocumentGenerator
|
|
76
76
|
if (line[0]) == "+"
|
77
77
|
line = remove_first_character(line)
|
78
78
|
end
|
79
|
-
line = CGI.unescapeHTML(line) # Shouldn't be necessary?
|
80
79
|
clean_lines << line
|
81
80
|
end
|
82
81
|
clean_lines
|
@@ -2,22 +2,6 @@ module DocumentGenerator
|
|
2
2
|
class Output
|
3
3
|
attr_accessor :description, :content
|
4
4
|
|
5
|
-
# TODO: This is due to a bug in maruku. We should create
|
6
|
-
# an issue there--and possibly a PR to fix?
|
7
|
-
def self.no_really_escape(value)
|
8
|
-
value.split("\n").map do |line|
|
9
|
-
if line.strip.size.zero?
|
10
|
-
" "
|
11
|
-
else
|
12
|
-
line
|
13
|
-
end
|
14
|
-
end.join("\n")
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.no_really_unescape(value)
|
18
|
-
value.gsub(' ', ' ')
|
19
|
-
end
|
20
|
-
|
21
5
|
def escaped_content
|
22
6
|
temp = []
|
23
7
|
content.each do |line|
|
@@ -25,7 +9,7 @@ module DocumentGenerator
|
|
25
9
|
temp << "\n"
|
26
10
|
end
|
27
11
|
|
28
|
-
|
12
|
+
temp.join.rstrip
|
29
13
|
end
|
30
14
|
end
|
31
15
|
end
|
@@ -72,6 +72,7 @@ title: first commit
|
|
72
72
|
|
73
73
|
<h1 id="main">first commit</h1>
|
74
74
|
|
75
|
+
|
75
76
|
### Additional Resources
|
76
77
|
|
77
78
|
* [Changes in this step in `diff` format](http://github.com/stevenhallen/commit/da39a3ee5e6b4b0d3255bfef95601890afd80709)
|
@@ -104,6 +105,7 @@ title: some commit message
|
|
104
105
|
---
|
105
106
|
|
106
107
|
<h1 id="main">some commit message</h1>
|
108
|
+
|
107
109
|
the diff_file content
|
108
110
|
### Additional Resources
|
109
111
|
|
@@ -130,6 +132,7 @@ title: This is one line
|
|
130
132
|
---
|
131
133
|
|
132
134
|
<h1 id="main">This is one line</h1>
|
135
|
+
|
133
136
|
EXPECTED
|
134
137
|
end
|
135
138
|
|
@@ -148,6 +151,7 @@ title: This is one line
|
|
148
151
|
---
|
149
152
|
|
150
153
|
<h1 id="main">This is one line</h1>
|
154
|
+
|
151
155
|
EXPECTED
|
152
156
|
end
|
153
157
|
|
@@ -31,8 +31,10 @@ EXPECTED
|
|
31
31
|
<<-EXPECTED_CONTENT
|
32
32
|
###Create file `/spec/support/capybara.rb`
|
33
33
|
|
34
|
-
Add
|
35
|
-
|
34
|
+
####Add
|
35
|
+
```
|
36
|
+
Capybara.javascript_driver = :webkit
|
37
|
+
```
|
36
38
|
|
37
39
|
|
38
40
|
EXPECTED_CONTENT
|
@@ -65,7 +67,7 @@ EXPECTED_CONTENT
|
|
65
67
|
describe '#markdown_outputs' do
|
66
68
|
it 'has correct markdown outputs' do
|
67
69
|
expect(diff_file.markdown_outputs.first.description).to eq "Add"
|
68
|
-
expect(diff_file.markdown_outputs.first.escaped_content).to eq
|
70
|
+
expect(diff_file.markdown_outputs.first.escaped_content).to eq " Capybara.javascript_driver = :webkit"
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -153,7 +155,7 @@ EXPECTED_CONTENT
|
|
153
155
|
|
154
156
|
describe '#ending_code' do
|
155
157
|
it 'contains the ending_code' do
|
156
|
-
expect(diff_file.ending_code).to eq
|
158
|
+
expect(diff_file.ending_code).to eq ending.strip
|
157
159
|
end
|
158
160
|
end
|
159
161
|
|
@@ -166,10 +168,10 @@ EXPECTED_CONTENT
|
|
166
168
|
describe '#markdown_outputs' do
|
167
169
|
it 'has correct markdown outputs' do
|
168
170
|
expect(diff_file.markdown_outputs.first.description).to eq "Change"
|
169
|
-
expect(diff_file.markdown_outputs.first.escaped_content).to eq
|
171
|
+
expect(diff_file.markdown_outputs.first.escaped_content).to eq " <%= form_for :post do |f| %>"
|
170
172
|
|
171
173
|
expect(diff_file.markdown_outputs[1].description).to eq "To"
|
172
|
-
expect(diff_file.markdown_outputs[1].escaped_content).to eq
|
174
|
+
expect(diff_file.markdown_outputs[1].escaped_content).to eq " <%= form_for :post, url: posts_path do |f| %>"
|
173
175
|
|
174
176
|
expect(diff_file.markdown_outputs[2].description).to eq "Becomes"
|
175
177
|
expect(diff_file.markdown_outputs[2].escaped_content).to eq diff_file.ending_code
|
@@ -236,41 +238,53 @@ ENDING
|
|
236
238
|
<<-EXPECTED_CONTENT
|
237
239
|
###Update file `/spec/controllers/posts_controller_spec.rb`
|
238
240
|
|
239
|
-
Change
|
240
|
-
|
241
|
+
####Change
|
242
|
+
```
|
243
|
+
response.should be_success
|
244
|
+
```
|
241
245
|
|
242
246
|
|
243
|
-
To
|
244
|
-
|
247
|
+
####To
|
248
|
+
```
|
249
|
+
expect(response).to be_success
|
250
|
+
```
|
245
251
|
|
246
252
|
|
247
|
-
Becomes
|
248
|
-
|
253
|
+
####Becomes
|
254
|
+
```
|
255
|
+
describe 'GET #new' do
|
249
256
|
it "returns http success" do
|
250
257
|
get :new
|
251
258
|
expect(response).to be_success
|
252
259
|
end
|
253
260
|
end
|
254
|
-
</code></pre>
|
255
261
|
|
262
|
+
```
|
256
263
|
|
257
|
-
Change
|
258
|
-
<pre><code> response.should be_success</code></pre>
|
259
264
|
|
265
|
+
####Change
|
266
|
+
```
|
267
|
+
response.should be_success
|
268
|
+
```
|
260
269
|
|
261
|
-
|
262
|
-
|
270
|
+
|
271
|
+
####To
|
272
|
+
```
|
273
|
+
expect(response).to be_success
|
274
|
+
```
|
263
275
|
|
264
276
|
|
265
|
-
Becomes
|
266
|
-
|
277
|
+
####Becomes
|
278
|
+
```
|
279
|
+
describe 'GET #index' do
|
267
280
|
it "returns http success" do
|
268
281
|
get :index
|
269
282
|
expect(response).to be_success
|
270
283
|
end
|
271
284
|
end
|
272
285
|
end
|
273
|
-
|
286
|
+
|
287
|
+
```
|
274
288
|
|
275
289
|
|
276
290
|
EXPECTED_CONTENT
|
@@ -284,7 +298,7 @@ EXPECTED_CONTENT
|
|
284
298
|
|
285
299
|
describe '#ending_code' do
|
286
300
|
it 'contains the ending_code' do
|
287
|
-
expect(diff_file.ending_code).to eq
|
301
|
+
expect(diff_file.ending_code).to eq ending.rstrip
|
288
302
|
end
|
289
303
|
end
|
290
304
|
|
@@ -358,24 +372,33 @@ ENDING
|
|
358
372
|
<<-EXPECTED_CONTENT
|
359
373
|
###Update file `/spec/controllers/posts_controller_spec.rb`
|
360
374
|
|
361
|
-
Change
|
362
|
-
|
375
|
+
####Change
|
376
|
+
```
|
377
|
+
describe GET new do
|
378
|
+
```
|
363
379
|
|
364
380
|
|
365
|
-
To
|
366
|
-
|
381
|
+
####To
|
382
|
+
```
|
383
|
+
describe GET new do
|
384
|
+
```
|
367
385
|
|
368
386
|
|
369
|
-
Change
|
370
|
-
|
387
|
+
####Change
|
388
|
+
```
|
389
|
+
get new
|
390
|
+
```
|
371
391
|
|
372
392
|
|
373
|
-
To
|
374
|
-
|
393
|
+
####To
|
394
|
+
```
|
395
|
+
get new
|
396
|
+
```
|
375
397
|
|
376
398
|
|
377
|
-
Becomes
|
378
|
-
|
399
|
+
####Becomes
|
400
|
+
```
|
401
|
+
describe PostsController do
|
379
402
|
|
380
403
|
describe GET new do
|
381
404
|
it returns http success do
|
@@ -383,7 +406,8 @@ Becomes
|
|
383
406
|
response.should be_success
|
384
407
|
end
|
385
408
|
end
|
386
|
-
|
409
|
+
|
410
|
+
```
|
387
411
|
|
388
412
|
|
389
413
|
EXPECTED_CONTENT
|
@@ -397,7 +421,7 @@ EXPECTED_CONTENT
|
|
397
421
|
|
398
422
|
describe '#ending_code' do
|
399
423
|
it 'contains the ending_code' do
|
400
|
-
expect(diff_file.ending_code).to eq
|
424
|
+
expect(diff_file.ending_code).to eq ending.strip
|
401
425
|
end
|
402
426
|
end
|
403
427
|
|
@@ -455,7 +479,7 @@ EXPECTED
|
|
455
479
|
|
456
480
|
describe '#ending_code' do
|
457
481
|
it 'contains the ending_code' do
|
458
|
-
expect(diff_file.ending_code).to eq
|
482
|
+
expect(diff_file.ending_code).to eq ending.strip
|
459
483
|
end
|
460
484
|
end
|
461
485
|
|
@@ -493,8 +517,10 @@ PATCH
|
|
493
517
|
<<-EXPECTED_CONTENT
|
494
518
|
###Create file `/spec/support/capybara.rb`
|
495
519
|
|
496
|
-
Add
|
497
|
-
|
520
|
+
####Add
|
521
|
+
```
|
522
|
+
Capybara.javascript_driver = :webkit
|
523
|
+
```
|
498
524
|
|
499
525
|
|
500
526
|
EXPECTED_CONTENT
|
@@ -525,18 +551,6 @@ index 0000000..12cefac
|
|
525
551
|
PATCH
|
526
552
|
end
|
527
553
|
|
528
|
-
let(:expected_content) do
|
529
|
-
<<-EXPECTED_CONTENT
|
530
|
-
Create file `/spec/support/capybara.rb`
|
531
|
-
|
532
|
-
Add
|
533
|
-
|
534
|
-
Capybara.javascript_driver = :webkit
|
535
|
-
|
536
|
-
|
537
|
-
EXPECTED_CONTENT
|
538
|
-
end
|
539
|
-
|
540
554
|
describe '#markdown_outputs' do
|
541
555
|
it 'has correct markdown outputs' do
|
542
556
|
expect(diff_file.markdown_outputs.size).to eq 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: document_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wiscoDude
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-01-
|
13
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: addressable
|