index_html 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +10 -0
- data/CHANGELOGS.md +47 -0
- data/Gemfile +1 -1
- data/Guardfile +4 -3
- data/README.md +16 -63
- data/Rakefile +2 -2
- data/index_html.gemspec +1 -1
- data/lib/index_html/version.rb +1 -1
- data/lib/index_html.rb +4 -5
- data/spec/fixtures/demo1.xxx.rb +1 -1
- data/spec/fixtures/demo2.xxx.rb +1 -1
- data/spec/index_html/index_html_spec.rb +36 -36
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdb734aa60b379055317a04eea2ff21a0d781310
|
4
|
+
data.tar.gz: e2ab02110431f61d1a0eb52e4fcc0aec68f3a48e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8f8bdccfc5c3f77005da663205b528079fac13190a14e0ddabf48750ef22f43ae630f4d7da1bef1cae900cb9c9ad9f1cf63dca4ea4f4d93985771a188e1be63
|
7
|
+
data.tar.gz: 41d094113a76a6e4745a512e1bd5af1eabd14776615fa57381e932dca333d9f2e16f88997700b0b31fd9ac35a6040fcee4d8404b1fcb58dc423b8ea5067a6ba3
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
data/CHANGELOGS.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
### Changelogs
|
2
|
+
|
3
|
+
#### 0.1.1
|
4
|
+
|
5
|
+
- Use the latest verion of [code_lister][] gem
|
6
|
+
- Replace the `--base-dir` value with `.` in the output
|
7
|
+
|
8
|
+
#### 0.1.0
|
9
|
+
|
10
|
+
- Update to the latest dependency
|
11
|
+
|
12
|
+
#### 0.0.9
|
13
|
+
|
14
|
+
- Update gem dependencies
|
15
|
+
- Make use of shared library from [agile_utils][]
|
16
|
+
- Add links to [codeclimate][] and [gemnasium][]
|
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
|
data/Gemfile
CHANGED
data/Guardfile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# A sample Guardfile
|
2
2
|
# More info at https://github.com/guard/guard#readme
|
3
3
|
guard :rspec do
|
4
|
-
watch(%r{^lib/(.+)\.rb$})
|
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" }
|
5
6
|
watch(%r{^spec/.+_spec\.rb$})
|
6
|
-
watch(%r{^spec/support/(.+)\.rb$})
|
7
|
-
watch('spec/spec_helper.rb')
|
7
|
+
watch(%r{^spec/support/(.+)\.rb$}) { 'spec' }
|
8
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
8
9
|
end
|
data/README.md
CHANGED
@@ -83,14 +83,14 @@ The output file `index.html` should be generated with something like
|
|
83
83
|
<header>File List</header>
|
84
84
|
<body>
|
85
85
|
<ol>
|
86
|
-
<li><a href="./
|
87
|
-
<li><a href="./
|
88
|
-
<li><a href="./
|
89
|
-
<li><a href="./
|
90
|
-
<li><a href="./
|
91
|
-
<li><a href="./
|
92
|
-
<li><a href="./
|
93
|
-
<li><a href="./
|
86
|
+
<li><a href="./demo1.xxx.java" target="_blank">./demo1.xxx.java</li>
|
87
|
+
<li><a href="./demo1.xxx.rb" target="_blank">./demo1.xxx.rb</li>
|
88
|
+
<li><a href="./demo2.xxx.java" target="_blank">./demo2.xxx.java</li>
|
89
|
+
<li><a href="./demo2.xxx.rb" target="_blank">./demo2.xxx.rb</li>
|
90
|
+
<li><a href="./sub-dir/demo3.yyy.java" target="_blank">./sub-dir/demo3.yyy.java</li>
|
91
|
+
<li><a href="./sub-dir/demo3.yyy.rb" target="_blank">./sub-dir/demo3.yyy.rb</li>
|
92
|
+
<li><a href="./sub-dir/demo4.yyy.java" target="_blank">./sub-dir/demo4.yyy.java</li>
|
93
|
+
<li><a href="./sub-dir/demo4.yyy.rb" target="_blank">./sub-dir/demo4.yyy.rb</li>
|
94
94
|
</ol>
|
95
95
|
</body>
|
96
96
|
</html>
|
@@ -109,65 +109,18 @@ The output file `index.html` should be something like
|
|
109
109
|
<header>File List</header>
|
110
110
|
<body>
|
111
111
|
<ol>
|
112
|
-
<li><a href="http://localhost/
|
113
|
-
<li><a href="http://localhost/
|
114
|
-
<li><a href="http://localhost/
|
115
|
-
<li><a href="http://localhost/
|
116
|
-
<li><a href="http://localhost/
|
117
|
-
<li><a href="http://localhost/
|
118
|
-
<li><a href="http://localhost/
|
119
|
-
<li><a href="http://localhost/
|
112
|
+
<li><a href="http://localhost/demo1.xxx.java" target="_blank">http://localhost/demo1.xxx.java</li>
|
113
|
+
<li><a href="http://localhost/demo1.xxx.rb" target="_blank">http://localhost/demo1.xxx.rb</li>
|
114
|
+
<li><a href="http://localhost/demo2.xxx.java" target="_blank">http://localhost/demo2.xxx.java</li>
|
115
|
+
<li><a href="http://localhost/demo2.xxx.rb" target="_blank">http://localhost/demo2.xxx.rb</li>
|
116
|
+
<li><a href="http://localhost/sub-dir/demo3.yyy.java" target="_blank">http:/localhost/sub-dir/demo3.yyy.java</li>
|
117
|
+
<li><a href="http://localhost/sub-dir/demo3.yyy.rb" target="_blank">http://localhost/sub-dir/demo3.yyy.rb</li>
|
118
|
+
<li><a href="http://localhost/sub-dir/demo4.yyy.java" target="_blank">http://localhost/sub-dir/demo4.yyy.java</li>
|
119
|
+
<li><a href="http://localhost/sub-dir/demo4.yyy.rb" target="_blank">http://localhost/sub-dir/demo4.yyy.rb</li>
|
120
120
|
</ol>
|
121
121
|
</body>
|
122
122
|
</html>
|
123
123
|
```
|
124
|
-
### Known Issues
|
125
|
-
|
126
|
-
- Will be listed here if any
|
127
|
-
|
128
|
-
### Changelogs
|
129
|
-
|
130
|
-
#### 0.1.0
|
131
|
-
|
132
|
-
- Update to the latest dependency
|
133
|
-
|
134
|
-
#### 0.0.9
|
135
|
-
|
136
|
-
- Update gem dependencies
|
137
|
-
- Make use of shared library from [agile_utils][]
|
138
|
-
- Add links to [codeclimate][] and [gemnasium][]
|
139
|
-
|
140
|
-
#### 0.0.8
|
141
|
-
|
142
|
-
- Upgrade to [code_lister][] version 0.0.7
|
143
|
-
- Use the [agile_utils][] for shared option
|
144
|
-
- Fix style using [rubocop][] gem
|
145
|
-
|
146
|
-
#### 0.0.7
|
147
|
-
|
148
|
-
- Fix the bug in 'make_links' logic to make it generate the link properly
|
149
|
-
|
150
|
-
#### 0.0.6
|
151
|
-
|
152
|
-
- Fix the Rakefile to include the correct library
|
153
|
-
|
154
|
-
#### 0.0.5
|
155
|
-
|
156
|
-
- Always make the url relative in `make_links` method.
|
157
|
-
|
158
|
-
#### 0.0.4
|
159
|
-
|
160
|
-
- Update [code_lister][] to 0.0.6 for new option
|
161
|
-
- Fix the mistake in '-d' option
|
162
|
-
|
163
|
-
#### 0.0.3
|
164
|
-
|
165
|
-
- Remove the code duplication by using the shared_option from code_lister gem
|
166
|
-
|
167
|
-
#### 0.0.2
|
168
|
-
|
169
|
-
- Initial release
|
170
|
-
|
171
124
|
### Contributing
|
172
125
|
|
173
126
|
Bug reports and suggestions for improvements are always welcome,
|
data/Rakefile
CHANGED
data/index_html.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ['lib']
|
19
19
|
spec.add_runtime_dependency 'thor', '~> 0.19'
|
20
20
|
spec.add_runtime_dependency 'agile_utils', '~> 0.0.9'
|
21
|
-
spec.add_runtime_dependency 'code_lister', '~> 0.0.
|
21
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.0.9'
|
22
22
|
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
23
23
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
24
|
spec.add_development_dependency 'fuubar', '~> 1.3'
|
data/lib/index_html/version.rb
CHANGED
data/lib/index_html.rb
CHANGED
@@ -7,7 +7,6 @@ module IndexHtml
|
|
7
7
|
class << self
|
8
8
|
# Create html links to list of files
|
9
9
|
def htmlify(file_list, args = {})
|
10
|
-
|
11
10
|
header = <<-END.gsub(/^\s+\|/, '')
|
12
11
|
|<html>
|
13
12
|
|<title>File Listing</title>
|
@@ -41,13 +40,13 @@ module IndexHtml
|
|
41
40
|
#
|
42
41
|
# @return [Array<String>] list of basename of a given input file
|
43
42
|
def basenames!(file_list, args = {})
|
44
|
-
file_list.map!{ |file| File.basename(file) } if args.fetch(:basename, false)
|
43
|
+
file_list.map! { |file| File.basename(file) } if args.fetch(:basename, false)
|
45
44
|
file_list
|
46
45
|
end
|
47
46
|
|
48
47
|
def escape_uris!(file_list, args = {})
|
49
48
|
if args.fetch(:encoded, false)
|
50
|
-
file_list.map!{ |file| URI.escape(file, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) }
|
49
|
+
file_list.map! { |file| URI.escape(file, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")) }
|
51
50
|
end
|
52
51
|
file_list
|
53
52
|
end
|
@@ -65,9 +64,9 @@ module IndexHtml
|
|
65
64
|
file_list.each do |i|
|
66
65
|
path = File.absolute_path(i).gsub(Dir.pwd, '')
|
67
66
|
if prefix
|
68
|
-
link = %Q
|
67
|
+
link = %Q(<li><a href="#{prefix}#{path}" target='_blank'>#{prefix}#{path}</li>)
|
69
68
|
else
|
70
|
-
link = %Q
|
69
|
+
link = %Q(<li><a href=".#{path}" target='_blank'>#{path.gsub(/^\//, '')}</li>)
|
71
70
|
end
|
72
71
|
result << link
|
73
72
|
end
|
data/spec/fixtures/demo1.xxx.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
#file: spec/fixtures/demo1.xxx.rb
|
1
|
+
# file: spec/fixtures/demo1.xxx.rb
|
data/spec/fixtures/demo2.xxx.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
#file: spec/fixtures/demo2.xxx.rb
|
1
|
+
# file: spec/fixtures/demo2.xxx.rb
|
@@ -2,10 +2,10 @@ require 'fileutils'
|
|
2
2
|
require_relative '../spec_helper'
|
3
3
|
|
4
4
|
describe IndexHtml do
|
5
|
-
let(:files)
|
5
|
+
let(:files) do
|
6
6
|
CodeLister.files base_dir: 'spec/fixtures',
|
7
7
|
exts: %w(xxx.rb), recursive: true
|
8
|
-
|
8
|
+
end
|
9
9
|
|
10
10
|
context '#basenames!' do
|
11
11
|
it 'excludes full path of the files' do
|
@@ -14,17 +14,17 @@ describe IndexHtml do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'includes full path of the files' do
|
17
|
-
expect(IndexHtml.basenames!(files)).to eq ['
|
18
|
-
'
|
19
|
-
expect(IndexHtml.basenames!(files, basename: false)).to eq ['
|
20
|
-
'
|
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
21
|
end
|
22
22
|
end
|
23
23
|
|
24
24
|
context '#escape_uris!' do
|
25
25
|
it 'works correctly with full path' do
|
26
|
-
expect(IndexHtml.escape_uris!(files, encoded: true)).to eq ['
|
27
|
-
'
|
26
|
+
expect(IndexHtml.escape_uris!(files, encoded: true)).to eq ['.%2Fdemo1.xxx.rb',
|
27
|
+
'.%2Fdemo2.xxx.rb']
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -48,14 +48,14 @@ describe IndexHtml do
|
|
48
48
|
<header>File List</header>
|
49
49
|
<body>
|
50
50
|
<ol>
|
51
|
-
<li><a href="./
|
52
|
-
<li><a href="./
|
53
|
-
<li><a href="./
|
54
|
-
<li><a href="./
|
55
|
-
<li><a href="./
|
56
|
-
<li><a href="./
|
57
|
-
<li><a href="./
|
58
|
-
<li><a href="./
|
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
59
|
</ol>
|
60
60
|
</body>
|
61
61
|
</html>
|
@@ -76,14 +76,14 @@ describe IndexHtml do
|
|
76
76
|
<header>File List</header>
|
77
77
|
<body>
|
78
78
|
<ol>
|
79
|
-
<li><a href="http://agilecreativity.com/public/
|
80
|
-
<li><a href="http://agilecreativity.com/public/
|
81
|
-
<li><a href="http://agilecreativity.com/public/
|
82
|
-
<li><a href="http://agilecreativity.com/public/
|
83
|
-
<li><a href="http://agilecreativity.com/public/
|
84
|
-
<li><a href="http://agilecreativity.com/public/
|
85
|
-
<li><a href="http://agilecreativity.com/public/
|
86
|
-
<li><a href="http://agilecreativity.com/public/
|
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
87
|
</ol>
|
88
88
|
</body>
|
89
89
|
</html>
|
@@ -93,42 +93,42 @@ describe IndexHtml do
|
|
93
93
|
|
94
94
|
context '#make_links' do
|
95
95
|
it 'works with prefix' do
|
96
|
-
result = IndexHtml.make_links files, base_dir:
|
96
|
+
result = IndexHtml.make_links files, base_dir: 'spec/fixtures', prefix: 'public'
|
97
97
|
expect(capture(:stdout) { puts result }).to eq \
|
98
98
|
<<-EOT
|
99
|
-
<li><a href="public/
|
100
|
-
<li><a href="public/
|
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
101
|
EOT
|
102
102
|
end
|
103
103
|
|
104
104
|
it 'works without prefix' do
|
105
|
-
result = IndexHtml.make_links(files, base_dir:
|
105
|
+
result = IndexHtml.make_links(files, base_dir: 'spec/fixtures')
|
106
106
|
expect(capture(:stdout) { puts result }).to eq \
|
107
107
|
<<-EOT
|
108
|
-
<li><a href="./
|
109
|
-
<li><a href="./
|
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
110
|
EOT
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'works with base_dir starting with dot' do
|
114
114
|
files = CodeLister.files base_dir: './spec/fixtures',
|
115
115
|
exts: %w(xxx.rb), recursive: true
|
116
|
-
result = IndexHtml.make_links(files, base_dir:
|
116
|
+
result = IndexHtml.make_links(files, base_dir: './spec/fixtures/')
|
117
117
|
expect(capture(:stdout) { puts result }).to eq \
|
118
118
|
<<-EOT
|
119
|
-
<li><a href="./
|
120
|
-
<li><a href="./
|
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
121
|
EOT
|
122
122
|
end
|
123
123
|
|
124
124
|
it 'works with base_dir not starting with dot' do
|
125
125
|
files = CodeLister.files base_dir: 'spec/fixtures',
|
126
126
|
exts: %w(xxx.rb), recursive: true
|
127
|
-
result = IndexHtml.make_links(files, base_dir:
|
127
|
+
result = IndexHtml.make_links(files, base_dir: 'spec/fixtures/')
|
128
128
|
expect(capture(:stdout) { puts result }).to eq \
|
129
129
|
<<-EOT
|
130
|
-
<li><a href="./
|
131
|
-
<li><a href="./
|
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
132
|
EOT
|
133
133
|
end
|
134
134
|
end
|
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.1
|
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-
|
11
|
+
date: 2014-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.0.
|
47
|
+
version: 0.0.9
|
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.0.
|
54
|
+
version: 0.0.9
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: awesome_print
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,7 +173,9 @@ extensions: []
|
|
173
173
|
extra_rdoc_files: []
|
174
174
|
files:
|
175
175
|
- ".gitignore"
|
176
|
+
- ".rubocop.yml"
|
176
177
|
- ".ruby-version"
|
178
|
+
- CHANGELOGS.md
|
177
179
|
- Gemfile
|
178
180
|
- Guardfile
|
179
181
|
- LICENSE.txt
|