index_html 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOGS.md +12 -41
- data/Gemfile +0 -3
- data/{LICENSE.txt → LICENSE} +0 -0
- data/README.md +13 -7
- data/index_html.gemspec +13 -5
- data/lib/index_html/cli.rb +2 -1
- data/lib/index_html/version.rb +1 -1
- data/rubocop-todo.yml +67 -0
- metadata +15 -36
- data/.ruby-version +0 -1
- data/Guardfile +0 -9
- data/spec/fixtures/demo1.xxx.java +0 -1
- data/spec/fixtures/demo1.xxx.rb +0 -1
- data/spec/fixtures/demo2.xxx.java +0 -1
- data/spec/fixtures/demo2.xxx.rb +0 -1
- data/spec/fixtures/sub-dir/demo3.yyy.java +0 -1
- data/spec/fixtures/sub-dir/demo3.yyy.rb +0 -1
- data/spec/fixtures/sub-dir/demo4.yyy.java +0 -0
- data/spec/fixtures/sub-dir/demo4.yyy.rb +0 -0
- data/spec/index_html/index_html_spec.rb +0 -135
- data/spec/spec_helper.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9fe1b61b2b205fb5a038dc97cbc381d133bfe78
|
4
|
+
data.tar.gz: 2a99fd50389fe228666b1129d807bd279e3a2e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bfcb95a89184d513f8118005e053aec89d6c8045b66f7b0a719c3ca3271a3dda19d5580975c442bab58b499514e8740c27062032eee685162a8177faeaed235
|
7
|
+
data.tar.gz: cbd9a3ec2bdaf0e2b091dac447564f90c39561d4889d57e8833253b0ffd4bb1d0586a4e082ae8d5f74e52557e42a8a9860744e446990216155e9cd0da5eba3f1
|
data/CHANGELOGS.md
CHANGED
@@ -1,47 +1,18 @@
|
|
1
1
|
### Changelogs
|
2
2
|
|
3
|
-
#### 0.1.
|
3
|
+
#### 0.1.2
|
4
4
|
|
5
|
-
-
|
6
|
-
-
|
5
|
+
- First release based on the [Semantic Versioning][] convention.
|
6
|
+
- Update the default usage information in CLI and README.md file
|
7
7
|
|
8
|
-
#### 0.1.
|
8
|
+
#### 0.0.1 - 0.1.1
|
9
9
|
|
10
|
-
-
|
10
|
+
- Release prior to [Semantic Versioning][]
|
11
|
+
- Implement features and fix a few bugs along the way
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
#### 0.0.8
|
19
|
-
|
20
|
-
- Upgrade to [code_lister][] version 0.0.7
|
21
|
-
- Use the [agile_utils][] for shared option
|
22
|
-
- Fix style using [rubocop][] gem
|
23
|
-
|
24
|
-
#### 0.0.7
|
25
|
-
|
26
|
-
- Fix the bug in 'make_links' logic to make it generate the link properly
|
27
|
-
|
28
|
-
#### 0.0.6
|
29
|
-
|
30
|
-
- Fix the Rakefile to include the correct library
|
31
|
-
|
32
|
-
#### 0.0.5
|
33
|
-
|
34
|
-
- Always make the url relative in `make_links` method.
|
35
|
-
|
36
|
-
#### 0.0.4
|
37
|
-
|
38
|
-
- Update [code_lister][] to 0.0.6 for new option
|
39
|
-
- Fix the mistake in '-d' option
|
40
|
-
|
41
|
-
#### 0.0.3
|
42
|
-
|
43
|
-
- Remove the code duplication by using the shared_option from code_lister gem
|
44
|
-
|
45
|
-
#### 0.0.2
|
46
|
-
|
47
|
-
- Initial release
|
13
|
+
[agile_utils]: https://rubygems.org/gems/agile_utils
|
14
|
+
[code_lister]: https://rubygems.org/gems/code_lister
|
15
|
+
[ebook_renamer]: https://rubygems.org/gems/ebook_renamer
|
16
|
+
[rubocop]: https://github.com/bbatsov/rubocop
|
17
|
+
[gemnasium]: https://gemnasium.com/agilecreativity/index_html
|
18
|
+
[Semantic Versioning]: http://semver.org
|
data/Gemfile
CHANGED
data/{LICENSE.txt → LICENSE}
RENAMED
File without changes
|
data/README.md
CHANGED
@@ -1,11 +1,17 @@
|
|
1
|
-
##
|
1
|
+
## index_html
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/index_html.svg)]
|
4
|
-
[![Dependency Status](https://gemnasium.com/agilecreativity/index_html.png)]
|
5
|
-
[![Code Climate](https://codeclimate.com/github/agilecreativity/index_html.png)]
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/index_html.svg)][gem]
|
4
|
+
[![Dependency Status](https://gemnasium.com/agilecreativity/index_html.png)][gemnasium]
|
5
|
+
[![Code Climate](https://codeclimate.com/github/agilecreativity/index_html.png)][codeclimate]
|
6
|
+
|
7
|
+
[gem]: http://badge.fury.io/rb/index_html
|
8
|
+
[gemnasium]: https://gemnasium.com/agilecreativity/index_html
|
9
|
+
[codeclimate]: https://codeclimate.com/github/agilecreativity/index_html
|
6
10
|
|
7
11
|
Quickly generate the index.html files based on your simple criteria.
|
8
12
|
|
13
|
+
Note: start from version `0.1.2` this gem will follow the [Semantic Versioning][] release schedule.
|
14
|
+
|
9
15
|
### Installation
|
10
16
|
|
11
17
|
Add this line to your application's Gemfile:
|
@@ -43,11 +49,12 @@ Just type `index_html` without any options to see the list of help
|
|
43
49
|
|
44
50
|
```
|
45
51
|
Usage:
|
46
|
-
index_html generate
|
52
|
+
index_html generate
|
47
53
|
|
48
54
|
Options:
|
49
55
|
-b, [--base-dir=BASE_DIR] # Base directory
|
50
56
|
# Default: . (current directory)
|
57
|
+
-e, [--exts=one two three] # List of extensions to search for
|
51
58
|
-f, [--non-exts=one two three] # List of files without extension to search for
|
52
59
|
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
53
60
|
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
@@ -136,5 +143,4 @@ GitHub pull requests are even better!.
|
|
136
143
|
[code_lister]: https://rubygems.org/gems/code_lister
|
137
144
|
[ebook_renamer]: https://rubygems.org/gems/ebook_renamer
|
138
145
|
[rubocop]: https://github.com/bbatsov/rubocop
|
139
|
-
[
|
140
|
-
[codeclimate]: https://codeclimate.com/github/agilecreativity/index_html
|
146
|
+
[Semantic Versioning]: http://semver.org
|
data/index_html.gemspec
CHANGED
@@ -12,19 +12,27 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.summary = %q{Generate simple index.html from list of files based on simple criteria}
|
13
13
|
spec.homepage = 'https://github.com/agilecreativity/index_html'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.files =
|
15
|
+
spec.files = Dir.glob('{bin,lib}/**/*') + %w(Gemfile
|
16
|
+
Rakefile
|
17
|
+
index_html.gemspec
|
18
|
+
README.md
|
19
|
+
CHANGELOGS.md
|
20
|
+
LICENSE
|
21
|
+
.rubocop.yml
|
22
|
+
.gitignore
|
23
|
+
rubocop-todo.yml)
|
16
24
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
26
|
spec.require_paths = ['lib']
|
19
27
|
spec.add_runtime_dependency 'thor', '~> 0.19'
|
20
|
-
spec.add_runtime_dependency 'agile_utils', '~> 0.
|
21
|
-
spec.add_runtime_dependency 'code_lister', '~> 0.
|
28
|
+
spec.add_runtime_dependency 'agile_utils', '~> 0.1'
|
29
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.1'
|
22
30
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
23
31
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
32
|
spec.add_development_dependency 'fuubar', '~> 1.3'
|
25
33
|
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
26
34
|
spec.add_development_dependency 'pry', '~> 0.9'
|
27
|
-
spec.add_development_dependency 'rake'
|
35
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
28
36
|
spec.add_development_dependency 'rspec', '~> 2.14'
|
29
|
-
spec.add_development_dependency 'rubocop', '~> 0.20
|
37
|
+
spec.add_development_dependency 'rubocop', '~> 0.20'
|
30
38
|
end
|
data/lib/index_html/cli.rb
CHANGED
@@ -43,11 +43,12 @@ module IndexHtml
|
|
43
43
|
def usage
|
44
44
|
puts <<-EOS
|
45
45
|
Usage:
|
46
|
-
index_html generate
|
46
|
+
index_html generate
|
47
47
|
|
48
48
|
Options:
|
49
49
|
-b, [--base-dir=BASE_DIR] # Base directory
|
50
50
|
# Default: . (current directory)
|
51
|
+
-e, [--exts=one two three] # List of extensions to search for
|
51
52
|
-f, [--non-exts=one two three] # List of files without extension to search for
|
52
53
|
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
53
54
|
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
data/lib/index_html/version.rb
CHANGED
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`
|
2
|
+
# on 2014-05-09 23:59:42 +1000 using RuboCop version 0.21.0.
|
3
|
+
# The point is for the user to remove these configuration records
|
4
|
+
# one by one as the offenses are removed from the code base.
|
5
|
+
# Note that changes in the inspected code, or installation of new
|
6
|
+
# versions of RuboCop, may require this file to be generated again.
|
7
|
+
|
8
|
+
# Offense count: 8
|
9
|
+
AmbiguousOperator:
|
10
|
+
Enabled: false
|
11
|
+
|
12
|
+
# Offense count: 1
|
13
|
+
# Cop supports --auto-correct.
|
14
|
+
Blocks:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
# Offense count: 3
|
18
|
+
Documentation:
|
19
|
+
Enabled: false
|
20
|
+
|
21
|
+
# Offense count: 1
|
22
|
+
# Cop supports --auto-correct.
|
23
|
+
EmptyLinesAroundBody:
|
24
|
+
Enabled: true
|
25
|
+
|
26
|
+
# Offense count: 1
|
27
|
+
# Cop supports --auto-correct.
|
28
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
29
|
+
HashSyntax:
|
30
|
+
Enabled: true
|
31
|
+
|
32
|
+
# Offense count: 2
|
33
|
+
# Cop supports --auto-correct.
|
34
|
+
LeadingCommentSpace:
|
35
|
+
Enabled: true
|
36
|
+
|
37
|
+
# Offense count: 40
|
38
|
+
LineLength:
|
39
|
+
Max: 182
|
40
|
+
|
41
|
+
# Offense count: 3
|
42
|
+
# Configuration parameters: CountComments.
|
43
|
+
MethodLength:
|
44
|
+
Max: 21
|
45
|
+
|
46
|
+
# Offense count: 2
|
47
|
+
# Cop supports --auto-correct.
|
48
|
+
# Configuration parameters: PreferredDelimiters.
|
49
|
+
PercentLiteralDelimiters:
|
50
|
+
Enabled: true
|
51
|
+
|
52
|
+
# Offense count: 1
|
53
|
+
# Cop supports --auto-correct.
|
54
|
+
SpaceAfterComma:
|
55
|
+
Enabled: true
|
56
|
+
|
57
|
+
# Offense count: 2
|
58
|
+
# Cop supports --auto-correct.
|
59
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
60
|
+
SpaceBeforeBlockBraces:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
# Offense count: 6
|
64
|
+
# Cop supports --auto-correct.
|
65
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
66
|
+
StringLiterals:
|
67
|
+
Enabled: true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: index_html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Burin Choomnuan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: code_lister
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: '0.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: '0.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: awesome_print
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +126,16 @@ dependencies:
|
|
126
126
|
name: rake
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - "
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: '
|
131
|
+
version: '10.3'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - "
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: '
|
138
|
+
version: '10.3'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,14 +156,14 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - "~>"
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.20
|
159
|
+
version: '0.20'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0.20
|
166
|
+
version: '0.20'
|
167
167
|
description: Generate the index.html from list of files
|
168
168
|
email:
|
169
169
|
- agilecreativity@gmail.com
|
@@ -174,11 +174,9 @@ extra_rdoc_files: []
|
|
174
174
|
files:
|
175
175
|
- ".gitignore"
|
176
176
|
- ".rubocop.yml"
|
177
|
-
- ".ruby-version"
|
178
177
|
- CHANGELOGS.md
|
179
178
|
- Gemfile
|
180
|
-
-
|
181
|
-
- LICENSE.txt
|
179
|
+
- LICENSE
|
182
180
|
- README.md
|
183
181
|
- Rakefile
|
184
182
|
- bin/index_html
|
@@ -186,16 +184,7 @@ files:
|
|
186
184
|
- lib/index_html.rb
|
187
185
|
- lib/index_html/cli.rb
|
188
186
|
- lib/index_html/version.rb
|
189
|
-
-
|
190
|
-
- spec/fixtures/demo1.xxx.rb
|
191
|
-
- spec/fixtures/demo2.xxx.java
|
192
|
-
- spec/fixtures/demo2.xxx.rb
|
193
|
-
- spec/fixtures/sub-dir/demo3.yyy.java
|
194
|
-
- spec/fixtures/sub-dir/demo3.yyy.rb
|
195
|
-
- spec/fixtures/sub-dir/demo4.yyy.java
|
196
|
-
- spec/fixtures/sub-dir/demo4.yyy.rb
|
197
|
-
- spec/index_html/index_html_spec.rb
|
198
|
-
- spec/spec_helper.rb
|
187
|
+
- rubocop-todo.yml
|
199
188
|
homepage: https://github.com/agilecreativity/index_html
|
200
189
|
licenses:
|
201
190
|
- MIT
|
@@ -220,15 +209,5 @@ rubygems_version: 2.2.2
|
|
220
209
|
signing_key:
|
221
210
|
specification_version: 4
|
222
211
|
summary: Generate simple index.html from list of files based on simple criteria
|
223
|
-
test_files:
|
224
|
-
- spec/fixtures/demo1.xxx.java
|
225
|
-
- spec/fixtures/demo1.xxx.rb
|
226
|
-
- spec/fixtures/demo2.xxx.java
|
227
|
-
- spec/fixtures/demo2.xxx.rb
|
228
|
-
- spec/fixtures/sub-dir/demo3.yyy.java
|
229
|
-
- spec/fixtures/sub-dir/demo3.yyy.rb
|
230
|
-
- spec/fixtures/sub-dir/demo4.yyy.java
|
231
|
-
- spec/fixtures/sub-dir/demo4.yyy.rb
|
232
|
-
- spec/index_html/index_html_spec.rb
|
233
|
-
- spec/spec_helper.rb
|
212
|
+
test_files: []
|
234
213
|
has_rdoc:
|
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.1
|
data/Guardfile
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
# A sample Guardfile
|
2
|
-
# More info at https://github.com/guard/guard#readme
|
3
|
-
guard :rspec do
|
4
|
-
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
5
|
-
watch(%r{^lib/index_html/(.+)\.rb$}) { |m| "spec/lib/index_html/#{m[1]}_spec.rb" }
|
6
|
-
watch(%r{^spec/.+_spec\.rb$})
|
7
|
-
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
8
|
-
watch('spec/spec_helper.rb') { 'spec' }
|
9
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
#file: spec/fixtures/demo1.xxx.rb
|
data/spec/fixtures/demo1.xxx.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo1.xxx.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
#file: spec/fixtures/demo2.xxx.rb
|
data/spec/fixtures/demo2.xxx.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/demo2.xxx.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/sub-dir/demo3.yyy.java
|
@@ -1 +0,0 @@
|
|
1
|
-
# file: spec/fixtures/sub-dir/demo3.yyy.java
|
File without changes
|
File without changes
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require_relative '../spec_helper'
|
3
|
-
|
4
|
-
describe IndexHtml do
|
5
|
-
let(:files) do
|
6
|
-
CodeLister.files base_dir: 'spec/fixtures',
|
7
|
-
exts: %w(xxx.rb), recursive: true
|
8
|
-
end
|
9
|
-
|
10
|
-
context '#basenames!' do
|
11
|
-
it 'excludes full path of the files' do
|
12
|
-
expect(IndexHtml.basenames!(files, basename: true)).to eq ['demo1.xxx.rb',
|
13
|
-
'demo2.xxx.rb']
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'includes full path of the files' do
|
17
|
-
expect(IndexHtml.basenames!(files)).to eq ['./demo1.xxx.rb',
|
18
|
-
'./demo2.xxx.rb']
|
19
|
-
expect(IndexHtml.basenames!(files, basename: false)).to eq ['./demo1.xxx.rb',
|
20
|
-
'./demo2.xxx.rb']
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context '#escape_uris!' do
|
25
|
-
it 'works correctly with full path' do
|
26
|
-
expect(IndexHtml.escape_uris!(files, encoded: true)).to eq ['.%2Fdemo1.xxx.rb',
|
27
|
-
'.%2Fdemo2.xxx.rb']
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context '#htmlify' do
|
32
|
-
let :files do
|
33
|
-
CodeLister.files base_dir: 'spec/fixtures',
|
34
|
-
exts: %w(rb java),
|
35
|
-
recursive: true
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'generates simple index file' do
|
39
|
-
FileUtils.rm_rf('index.html')
|
40
|
-
IndexHtml.htmlify files,
|
41
|
-
indent: 6,
|
42
|
-
output: 'index.html',
|
43
|
-
base_dir: 'spec/fixtures'
|
44
|
-
expect(capture(:stdout) { system('cat index.html') }).to eq \
|
45
|
-
<<-EOT
|
46
|
-
<html>
|
47
|
-
<title>File Listing</title>
|
48
|
-
<header>File List</header>
|
49
|
-
<body>
|
50
|
-
<ol>
|
51
|
-
<li><a href="./demo1.xxx.java" target='_blank'>./demo1.xxx.java</li>
|
52
|
-
<li><a href="./demo1.xxx.rb" target='_blank'>./demo1.xxx.rb</li>
|
53
|
-
<li><a href="./demo2.xxx.java" target='_blank'>./demo2.xxx.java</li>
|
54
|
-
<li><a href="./demo2.xxx.rb" target='_blank'>./demo2.xxx.rb</li>
|
55
|
-
<li><a href="./sub-dir/demo3.yyy.java" target='_blank'>./sub-dir/demo3.yyy.java</li>
|
56
|
-
<li><a href="./sub-dir/demo3.yyy.rb" target='_blank'>./sub-dir/demo3.yyy.rb</li>
|
57
|
-
<li><a href="./sub-dir/demo4.yyy.java" target='_blank'>./sub-dir/demo4.yyy.java</li>
|
58
|
-
<li><a href="./sub-dir/demo4.yyy.rb" target='_blank'>./sub-dir/demo4.yyy.rb</li>
|
59
|
-
</ol>
|
60
|
-
</body>
|
61
|
-
</html>
|
62
|
-
EOT
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'generates simple index file with prefix' do
|
66
|
-
FileUtils.rm_rf('index.html')
|
67
|
-
IndexHtml.htmlify files,
|
68
|
-
indent: 6,
|
69
|
-
output: 'index.html',
|
70
|
-
prefix: 'http://agilecreativity.com/public',
|
71
|
-
base_dir: 'spec/fixtures' # Note: must not puts the '/' at the end!
|
72
|
-
expect(capture(:stdout) { system('cat index.html') }).to eq \
|
73
|
-
<<-EOT
|
74
|
-
<html>
|
75
|
-
<title>File Listing</title>
|
76
|
-
<header>File List</header>
|
77
|
-
<body>
|
78
|
-
<ol>
|
79
|
-
<li><a href="http://agilecreativity.com/public/demo1.xxx.java" target='_blank'>http://agilecreativity.com/public/demo1.xxx.java</li>
|
80
|
-
<li><a href="http://agilecreativity.com/public/demo1.xxx.rb" target='_blank'>http://agilecreativity.com/public/demo1.xxx.rb</li>
|
81
|
-
<li><a href="http://agilecreativity.com/public/demo2.xxx.java" target='_blank'>http://agilecreativity.com/public/demo2.xxx.java</li>
|
82
|
-
<li><a href="http://agilecreativity.com/public/demo2.xxx.rb" target='_blank'>http://agilecreativity.com/public/demo2.xxx.rb</li>
|
83
|
-
<li><a href="http://agilecreativity.com/public/sub-dir/demo3.yyy.java" target='_blank'>http://agilecreativity.com/public/sub-dir/demo3.yyy.java</li>
|
84
|
-
<li><a href="http://agilecreativity.com/public/sub-dir/demo3.yyy.rb" target='_blank'>http://agilecreativity.com/public/sub-dir/demo3.yyy.rb</li>
|
85
|
-
<li><a href="http://agilecreativity.com/public/sub-dir/demo4.yyy.java" target='_blank'>http://agilecreativity.com/public/sub-dir/demo4.yyy.java</li>
|
86
|
-
<li><a href="http://agilecreativity.com/public/sub-dir/demo4.yyy.rb" target='_blank'>http://agilecreativity.com/public/sub-dir/demo4.yyy.rb</li>
|
87
|
-
</ol>
|
88
|
-
</body>
|
89
|
-
</html>
|
90
|
-
EOT
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
context '#make_links' do
|
95
|
-
it 'works with prefix' do
|
96
|
-
result = IndexHtml.make_links files, base_dir: 'spec/fixtures', prefix: 'public'
|
97
|
-
expect(capture(:stdout) { puts result }).to eq \
|
98
|
-
<<-EOT
|
99
|
-
<li><a href="public/demo1.xxx.rb" target='_blank'>public/demo1.xxx.rb</li>
|
100
|
-
<li><a href="public/demo2.xxx.rb" target='_blank'>public/demo2.xxx.rb</li>
|
101
|
-
EOT
|
102
|
-
end
|
103
|
-
|
104
|
-
it 'works without prefix' do
|
105
|
-
result = IndexHtml.make_links(files, base_dir: 'spec/fixtures')
|
106
|
-
expect(capture(:stdout) { puts result }).to eq \
|
107
|
-
<<-EOT
|
108
|
-
<li><a href="./demo1.xxx.rb" target='_blank'>./demo1.xxx.rb</li>
|
109
|
-
<li><a href="./demo2.xxx.rb" target='_blank'>./demo2.xxx.rb</li>
|
110
|
-
EOT
|
111
|
-
end
|
112
|
-
|
113
|
-
it 'works with base_dir starting with dot' do
|
114
|
-
files = CodeLister.files base_dir: './spec/fixtures',
|
115
|
-
exts: %w(xxx.rb), recursive: true
|
116
|
-
result = IndexHtml.make_links(files, base_dir: './spec/fixtures/')
|
117
|
-
expect(capture(:stdout) { puts result }).to eq \
|
118
|
-
<<-EOT
|
119
|
-
<li><a href="./demo1.xxx.rb" target='_blank'>./demo1.xxx.rb</li>
|
120
|
-
<li><a href="./demo2.xxx.rb" target='_blank'>./demo2.xxx.rb</li>
|
121
|
-
EOT
|
122
|
-
end
|
123
|
-
|
124
|
-
it 'works with base_dir not starting with dot' do
|
125
|
-
files = CodeLister.files base_dir: 'spec/fixtures',
|
126
|
-
exts: %w(xxx.rb), recursive: true
|
127
|
-
result = IndexHtml.make_links(files, base_dir: 'spec/fixtures/')
|
128
|
-
expect(capture(:stdout) { puts result }).to eq \
|
129
|
-
<<-EOT
|
130
|
-
<li><a href="./demo1.xxx.rb" target='_blank'>./demo1.xxx.rb</li>
|
131
|
-
<li><a href="./demo2.xxx.rb" target='_blank'>./demo2.xxx.rb</li>
|
132
|
-
EOT
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
-
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
-
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
-
# loaded once.
|
5
|
-
#
|
6
|
-
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
-
RSpec.configure do |config|
|
8
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
-
config.run_all_when_everything_filtered = true
|
10
|
-
config.filter_run :focus
|
11
|
-
|
12
|
-
# Run specs in random order to surface order dependencies. If you find an
|
13
|
-
# order dependency and want to debug it, you can fix the order by providing
|
14
|
-
# the seed, which is printed after each run.
|
15
|
-
# --seed 1234
|
16
|
-
config.order = 'random'
|
17
|
-
end
|
18
|
-
|
19
|
-
require_relative '../lib/index_html'
|
20
|
-
require 'agile_utils'
|
21
|
-
require 'code_lister'
|
22
|
-
include CodeLister
|
23
|
-
include IndexHtml
|