index_html 0.0.7 → 0.0.8
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 +34 -15
- data/index_html.gemspec +18 -15
- data/lib/active_support/core_ext/kernel/reporting.rb +0 -2
- data/lib/index_html/cli.rb +38 -20
- data/lib/index_html/version.rb +1 -1
- data/lib/index_html.rb +11 -23
- data/spec/index_html/index_html_spec.rb +32 -34
- data/spec/spec_helper.rb +0 -1
- metadata +67 -27
- data/Changelogs.md +0 -3
- data/lib/index_html/main.rb +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c7dae9bda9023bfd9bc153c250d53dc23f837d4
|
|
4
|
+
data.tar.gz: 974ac9aa96d5789c7dcc3b284939de4c598eb036
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3d2e9c0a693df56b8b8b1f7e64ef5f73b0d7668bc5f4ac9eff935531476ec6076cf2456610a323968aba20c9c8f34d43ba6bcbe2b1affc5054c833b77f36f0fd
|
|
7
|
+
data.tar.gz: ffe220b4345302c254dd79eb5c0bf861540ce869412353893978bb77782d6071a9227716c4ddd28ee8eeeacdc631e3fa4cd76177ca0b88330ae2502da4caf7cd
|
data/README.md
CHANGED
|
@@ -21,9 +21,9 @@ Or install it yourself as:
|
|
|
21
21
|
### Usage
|
|
22
22
|
|
|
23
23
|
Say you have lots of ebook files (pdf, epub, or mobi) and you have properly named them
|
|
24
|
-
with something like [ebook_renamer]
|
|
24
|
+
with something like [ebook_renamer][].
|
|
25
25
|
|
|
26
|
-
Now that you have the good
|
|
26
|
+
Now that you have the good data, if you like to create a quick index to all of the files
|
|
27
27
|
that have the specific word 'Android' in the title you could perhap try something like the following:
|
|
28
28
|
|
|
29
29
|
```sh
|
|
@@ -46,19 +46,20 @@ Usage:
|
|
|
46
46
|
Options:
|
|
47
47
|
-b, [--base-dir=BASE_DIR] # Base directory
|
|
48
48
|
# Default: . (current directory)
|
|
49
|
-
-
|
|
49
|
+
-f, [--non-exts=one two three] # List of files without extension to search for
|
|
50
50
|
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
|
51
51
|
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
|
52
52
|
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
|
|
53
53
|
# Default: true
|
|
54
54
|
-r, [--recursive], [--no-recursive] # Search for files recursively
|
|
55
55
|
# Default: true
|
|
56
|
+
-v, [--version], [--no-version] # Display version information
|
|
56
57
|
-p, [--prefix=PREFIX] # Prefix string to the URL
|
|
57
|
-
|
|
58
|
+
# Default: .
|
|
59
|
+
-d, [--indent=N] # Indentation to each list item in the output
|
|
58
60
|
# Default: 6
|
|
59
61
|
-o, [--output=OUTPUT] # Output file name
|
|
60
62
|
# Default: index.html
|
|
61
|
-
-v, [--version], [--no-version] # Display version information
|
|
62
63
|
|
|
63
64
|
Generate the index.html base on simple criteria
|
|
64
65
|
```
|
|
@@ -95,7 +96,7 @@ The output file `index.html` should be generated with something like
|
|
|
95
96
|
- Run with simple prefix option
|
|
96
97
|
|
|
97
98
|
```shell
|
|
98
|
-
index_html generate --base-dir spec/fixtures --exts rb java --recursive --prefix http://localhost
|
|
99
|
+
index_html generate --base-dir spec/fixtures --exts rb java --recursive --prefix http://localhost
|
|
99
100
|
```
|
|
100
101
|
|
|
101
102
|
The output file `index.html` should be something like
|
|
@@ -106,14 +107,14 @@ The output file `index.html` should be something like
|
|
|
106
107
|
<header>File List</header>
|
|
107
108
|
<body>
|
|
108
109
|
<ol>
|
|
109
|
-
<li><a href="http://localhost
|
|
110
|
-
<li><a href="http://localhost
|
|
111
|
-
<li><a href="http://localhost
|
|
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
|
|
110
|
+
<li><a href="http://localhost/spec/fixtures/demo1.xxx.java" target="_blank">http://localhost/spec/fixtures/demo1.xxx.java</li>
|
|
111
|
+
<li><a href="http://localhost/spec/fixtures/demo1.xxx.rb" target="_blank">http://localhost/spec/fixtures/demo1.xxx.rb</li>
|
|
112
|
+
<li><a href="http://localhost/spec/fixtures/demo2.xxx.java" target="_blank">http://localhost/spec/fixtures/demo2.xxx.java</li>
|
|
113
|
+
<li><a href="http://localhost/spec/fixtures/demo2.xxx.rb" target="_blank">http://localhost/spec/fixtures/demo2.xxx.rb</li>
|
|
114
|
+
<li><a href="http://localhost/spec/fixtures/sub-dir/demo3.yyy.java" target="_blank">http:/localhost/spec/fixtures/sub-dir/demo3.yyy.java</li>
|
|
115
|
+
<li><a href="http://localhost/spec/fixtures/sub-dir/demo3.yyy.rb" target="_blank">http://localhost/spec/fixtures/sub-dir/demo3.yyy.rb</li>
|
|
116
|
+
<li><a href="http://localhost/spec/fixtures/sub-dir/demo4.yyy.java" target="_blank">http://localhost/spec/fixtures/sub-dir/demo4.yyy.java</li>
|
|
117
|
+
<li><a href="http://localhost/spec/fixtures/sub-dir/demo4.yyy.rb" target="_blank">http://localhost/spec/fixtures/sub-dir/demo4.yyy.rb</li>
|
|
117
118
|
</ol>
|
|
118
119
|
</body>
|
|
119
120
|
</html>
|
|
@@ -124,6 +125,14 @@ The output file `index.html` should be something like
|
|
|
124
125
|
|
|
125
126
|
### Changelogs
|
|
126
127
|
|
|
128
|
+
#### 0.0.8
|
|
129
|
+
|
|
130
|
+
- Upgrade to [code_lister][] version 0.0.7
|
|
131
|
+
|
|
132
|
+
- Use the [agile_utils][] for shared option
|
|
133
|
+
|
|
134
|
+
- Fix style using [rubocop][] gem
|
|
135
|
+
|
|
127
136
|
#### 0.0.7
|
|
128
137
|
|
|
129
138
|
- Fix the bug in 'make_links' logic to make it generate the link properly
|
|
@@ -138,7 +147,9 @@ The output file `index.html` should be something like
|
|
|
138
147
|
|
|
139
148
|
#### 0.0.4
|
|
140
149
|
|
|
141
|
-
- Update code_lister to 0.0.6 for new option
|
|
150
|
+
- Update [code_lister][] to 0.0.6 for new option
|
|
151
|
+
|
|
152
|
+
- Fix the mistake in '-d' option
|
|
142
153
|
|
|
143
154
|
#### 0.0.3
|
|
144
155
|
|
|
@@ -150,8 +161,16 @@ The output file `index.html` should be something like
|
|
|
150
161
|
|
|
151
162
|
### Contributing
|
|
152
163
|
|
|
164
|
+
Bug reports and suggestions for improvements are always welcome,
|
|
165
|
+
GitHub pull requests are even better!.
|
|
166
|
+
|
|
153
167
|
1. Fork it
|
|
154
168
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
155
169
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
156
170
|
4. Push to the branch (`git push origin my-new-feature`)
|
|
157
171
|
5. Create new Pull Request
|
|
172
|
+
|
|
173
|
+
[agile_utils]: https://rubygems.org/gems/agile_utils
|
|
174
|
+
[code_lister]: https://rubygems.org/gems/code_lister
|
|
175
|
+
[ebook_renamer]: https://rubygems.org/gems/ebook_renamer
|
|
176
|
+
[rubocop]: https://github.com/bbatsov/rubocop
|
data/index_html.gemspec
CHANGED
|
@@ -4,27 +4,30 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
require 'index_html/version'
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |spec|
|
|
7
|
-
spec.name =
|
|
7
|
+
spec.name = 'index_html'
|
|
8
8
|
spec.version = IndexHtml::VERSION
|
|
9
|
-
spec.authors = [
|
|
10
|
-
spec.email = [
|
|
9
|
+
spec.authors = ['Burin Choomnuan']
|
|
10
|
+
spec.email = ['agilecreativity@gmail.com']
|
|
11
11
|
spec.description = %q{Generate the index.html from list of files}
|
|
12
|
-
spec.summary = %q{Generate simple index.html from list of files}
|
|
13
|
-
spec.homepage =
|
|
14
|
-
spec.license =
|
|
12
|
+
spec.summary = %q{Generate simple index.html from list of files based on simple criteria}
|
|
13
|
+
spec.homepage = 'https://github.com/agilecreativity/index_html'
|
|
14
|
+
spec.license = 'MIT'
|
|
15
15
|
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
-
spec.require_paths = [
|
|
19
|
+
spec.require_paths = ['lib']
|
|
20
20
|
|
|
21
|
-
spec.add_runtime_dependency
|
|
22
|
-
spec.
|
|
23
|
-
spec.
|
|
24
|
-
spec.add_development_dependency "rspec", "~> 2.14"
|
|
25
|
-
spec.add_development_dependency "guard-rspec", "~> 4.2"
|
|
26
|
-
spec.add_development_dependency "awesome_print", "~> 1.2"
|
|
27
|
-
spec.add_development_dependency "pry", "~> 0.9"
|
|
28
|
-
spec.add_development_dependency "fuubar", "~> 1.3"
|
|
21
|
+
spec.add_runtime_dependency 'thor', '~> 0.19'
|
|
22
|
+
spec.add_runtime_dependency 'agile_utils', '~> 0.0.7'
|
|
23
|
+
spec.add_runtime_dependency 'code_lister', '~> 0.0.7'
|
|
29
24
|
|
|
25
|
+
spec.add_development_dependency 'awesome_print', '~> 1.2'
|
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
|
27
|
+
spec.add_development_dependency 'fuubar', '~> 1.3'
|
|
28
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.2'
|
|
29
|
+
spec.add_development_dependency 'pry', '~> 0.9'
|
|
30
|
+
spec.add_development_dependency 'rake'
|
|
31
|
+
spec.add_development_dependency 'rspec', '~> 2.14'
|
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 0.21.0'
|
|
30
33
|
end
|
data/lib/index_html/cli.rb
CHANGED
|
@@ -1,39 +1,45 @@
|
|
|
1
1
|
require 'thor'
|
|
2
|
+
require 'agile_utils'
|
|
2
3
|
require_relative '../index_html'
|
|
3
4
|
|
|
4
5
|
module IndexHtml
|
|
5
|
-
|
|
6
|
-
class CLI < CodeLister::BaseCLI
|
|
6
|
+
class CLI < Thor
|
|
7
7
|
desc 'generate', 'Generate the index.html base on simple criteria'
|
|
8
|
+
# Common shared options
|
|
9
|
+
method_option *AgileUtils::Options::BASE_DIR
|
|
10
|
+
method_option *AgileUtils::Options::EXTS
|
|
11
|
+
method_option *AgileUtils::Options::NON_EXTS
|
|
12
|
+
method_option *AgileUtils::Options::INC_WORDS
|
|
13
|
+
method_option *AgileUtils::Options::EXC_WORDS
|
|
14
|
+
method_option *AgileUtils::Options::IGNORE_CASE
|
|
15
|
+
method_option *AgileUtils::Options::RECURSIVE
|
|
16
|
+
method_option *AgileUtils::Options::VERSION
|
|
8
17
|
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
# specific to this action only
|
|
11
19
|
method_option :prefix,
|
|
12
|
-
aliases:
|
|
13
|
-
desc:
|
|
14
|
-
default:
|
|
15
|
-
|
|
20
|
+
aliases: '-p',
|
|
21
|
+
desc: 'Prefix string to the URL',
|
|
22
|
+
default: '.'
|
|
16
23
|
method_option :indent,
|
|
17
|
-
aliases:
|
|
18
|
-
desc:
|
|
24
|
+
aliases: '-d',
|
|
25
|
+
desc: 'Indentation to each list item in the output',
|
|
19
26
|
type: :numeric,
|
|
20
27
|
default: 6
|
|
21
|
-
|
|
22
28
|
method_option :output,
|
|
23
|
-
aliases:
|
|
24
|
-
desc:
|
|
29
|
+
aliases: '-o',
|
|
30
|
+
desc: 'Output file name',
|
|
25
31
|
type: :string,
|
|
26
|
-
default:
|
|
27
|
-
|
|
32
|
+
default: 'index.html'
|
|
28
33
|
def generate
|
|
29
|
-
|
|
34
|
+
opts = options.symbolize_keys
|
|
35
|
+
if opts[:version]
|
|
30
36
|
puts "You are using IndexHtml Version #{IndexHtml::VERSION}"
|
|
31
37
|
exit
|
|
32
38
|
end
|
|
33
|
-
|
|
39
|
+
run(opts)
|
|
34
40
|
end
|
|
35
41
|
|
|
36
|
-
desc
|
|
42
|
+
desc 'usage', 'Display help screen'
|
|
37
43
|
def usage
|
|
38
44
|
puts <<-EOS
|
|
39
45
|
Usage:
|
|
@@ -41,8 +47,7 @@ Usage:
|
|
|
41
47
|
|
|
42
48
|
Options:
|
|
43
49
|
-b, [--base-dir=BASE_DIR] # Base directory
|
|
44
|
-
# Default:
|
|
45
|
-
-e, [--exts=one two three] # List of extensions to search for
|
|
50
|
+
# Default: . (current directory)
|
|
46
51
|
-f, [--non-exts=one two three] # List of files without extension to search for
|
|
47
52
|
-n, [--inc-words=one two three] # List of words to be included in the result if any
|
|
48
53
|
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
|
|
@@ -52,6 +57,7 @@ Options:
|
|
|
52
57
|
# Default: true
|
|
53
58
|
-v, [--version], [--no-version] # Display version information
|
|
54
59
|
-p, [--prefix=PREFIX] # Prefix string to the URL
|
|
60
|
+
# Default: .
|
|
55
61
|
-d, [--indent=N] # Indentation to each list item in the output
|
|
56
62
|
# Default: 6
|
|
57
63
|
-o, [--output=OUTPUT] # Output file name
|
|
@@ -62,5 +68,17 @@ Generate the index.html base on simple criteria
|
|
|
62
68
|
end
|
|
63
69
|
|
|
64
70
|
default_task :usage
|
|
71
|
+
|
|
72
|
+
private
|
|
73
|
+
|
|
74
|
+
def run(options = {})
|
|
75
|
+
files = CodeLister.files options || []
|
|
76
|
+
if files.empty?
|
|
77
|
+
puts "No match found for your options :#{options}"
|
|
78
|
+
else
|
|
79
|
+
IndexHtml.htmlify files, options
|
|
80
|
+
puts "FYI: your result is in #{options[:output]}"
|
|
81
|
+
end
|
|
82
|
+
end
|
|
65
83
|
end
|
|
66
84
|
end
|
data/lib/index_html/version.rb
CHANGED
data/lib/index_html.rb
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
require 'uri'
|
|
2
2
|
require 'code_lister'
|
|
3
|
-
require_relative
|
|
4
|
-
require_relative
|
|
5
|
-
require_relative
|
|
6
|
-
require_relative
|
|
7
|
-
require_relative "./active_support/core_ext/kernel/reporting"
|
|
3
|
+
require_relative './index_html/version'
|
|
4
|
+
require_relative './index_html/cli'
|
|
5
|
+
require_relative './active_support/core_ext/hash/hash'
|
|
6
|
+
require_relative './active_support/core_ext/kernel/reporting'
|
|
8
7
|
|
|
9
8
|
module IndexHtml
|
|
10
|
-
|
|
11
9
|
CustomError = Class.new(StandardError)
|
|
12
|
-
|
|
13
10
|
class << self
|
|
14
|
-
|
|
15
11
|
# Create html links to list of files
|
|
16
12
|
def htmlify(file_list, args = {})
|
|
17
13
|
|
|
@@ -29,11 +25,11 @@ module IndexHtml
|
|
|
29
25
|
|</html>
|
|
30
26
|
END
|
|
31
27
|
|
|
32
|
-
prefix = args.fetch(:prefix,
|
|
28
|
+
prefix = args.fetch(:prefix, '.')
|
|
33
29
|
indent = args.fetch(:indent, 6)
|
|
34
|
-
output = args.fetch(:output,
|
|
30
|
+
output = args.fetch(:output, 'index.html')
|
|
35
31
|
|
|
36
|
-
File.open(output,
|
|
32
|
+
File.open(output, 'w') do |f|
|
|
37
33
|
f.write(header)
|
|
38
34
|
links = make_links file_list, prefix: prefix, base_dir: args[:base_dir]
|
|
39
35
|
links.each { |i| f.write("#{' ' * indent}#{i}\n") }
|
|
@@ -66,27 +62,19 @@ module IndexHtml
|
|
|
66
62
|
#
|
|
67
63
|
# @return [Array<String>] the list of valid <li> tags
|
|
68
64
|
def make_links(file_list, args)
|
|
69
|
-
|
|
70
|
-
prefix = args.fetch(:prefix, ".")
|
|
71
|
-
base_dir = args[:base_dir]
|
|
65
|
+
prefix = args.fetch(:prefix, '.')
|
|
72
66
|
result = []
|
|
73
67
|
|
|
74
68
|
file_list.each do |i|
|
|
75
|
-
|
|
76
|
-
path = File.absolute_path(i).gsub(Dir.pwd, "")
|
|
77
|
-
|
|
69
|
+
path = File.absolute_path(i).gsub(Dir.pwd, '')
|
|
78
70
|
if prefix
|
|
79
|
-
link = %Q{<li><a href="#{prefix}#{path}" target=
|
|
71
|
+
link = %Q{<li><a href="#{prefix}#{path}" target='_blank'>#{prefix}#{path}</li>}
|
|
80
72
|
else
|
|
81
|
-
|
|
82
|
-
link = %Q{<li><a href=".#{path}" target="_blank">#{path.gsub(/^\//,"")}</li>}
|
|
73
|
+
link = %Q{<li><a href=".#{path}" target='_blank'>#{path.gsub(/^\//,'')}</li>}
|
|
83
74
|
end
|
|
84
|
-
|
|
85
75
|
result << link
|
|
86
76
|
end
|
|
87
|
-
|
|
88
77
|
result
|
|
89
78
|
end
|
|
90
|
-
|
|
91
79
|
end
|
|
92
80
|
end
|
|
@@ -2,7 +2,6 @@ require 'fileutils'
|
|
|
2
2
|
require_relative '../spec_helper'
|
|
3
3
|
|
|
4
4
|
describe IndexHtml do
|
|
5
|
-
|
|
6
5
|
let(:files) {
|
|
7
6
|
CodeLister.files base_dir: 'spec/fixtures',
|
|
8
7
|
exts: %w(xxx.rb), recursive: true
|
|
@@ -10,22 +9,22 @@ describe IndexHtml do
|
|
|
10
9
|
|
|
11
10
|
context '#basenames!' do
|
|
12
11
|
it 'excludes full path of the files' do
|
|
13
|
-
expect(IndexHtml.basenames!(files, basename: true)).to eq [
|
|
14
|
-
|
|
12
|
+
expect(IndexHtml.basenames!(files, basename: true)).to eq ['demo1.xxx.rb',
|
|
13
|
+
'demo2.xxx.rb']
|
|
15
14
|
end
|
|
16
15
|
|
|
17
16
|
it 'includes full path of the files' do
|
|
18
|
-
expect(IndexHtml.basenames!(files)).to eq [
|
|
19
|
-
|
|
20
|
-
expect(IndexHtml.basenames!(files, basename: false)).to eq [
|
|
21
|
-
|
|
17
|
+
expect(IndexHtml.basenames!(files)).to eq ['spec/fixtures/demo1.xxx.rb',
|
|
18
|
+
'spec/fixtures/demo2.xxx.rb']
|
|
19
|
+
expect(IndexHtml.basenames!(files, basename: false)).to eq ['spec/fixtures/demo1.xxx.rb',
|
|
20
|
+
'spec/fixtures/demo2.xxx.rb']
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
context '#escape_uris!' do
|
|
26
25
|
it 'works correctly with full path' do
|
|
27
|
-
expect(IndexHtml.escape_uris!(files, encoded: true)).to eq [
|
|
28
|
-
|
|
26
|
+
expect(IndexHtml.escape_uris!(files, encoded: true)).to eq ['spec%2Ffixtures%2Fdemo1.xxx.rb',
|
|
27
|
+
'spec%2Ffixtures%2Fdemo2.xxx.rb']
|
|
29
28
|
end
|
|
30
29
|
end
|
|
31
30
|
|
|
@@ -49,14 +48,14 @@ describe IndexHtml do
|
|
|
49
48
|
<header>File List</header>
|
|
50
49
|
<body>
|
|
51
50
|
<ol>
|
|
52
|
-
<li><a href="./spec/fixtures/demo1.xxx.java" target=
|
|
53
|
-
<li><a href="./spec/fixtures/demo1.xxx.rb" target=
|
|
54
|
-
<li><a href="./spec/fixtures/demo2.xxx.java" target=
|
|
55
|
-
<li><a href="./spec/fixtures/demo2.xxx.rb" target=
|
|
56
|
-
<li><a href="./spec/fixtures/sub-dir/demo3.yyy.java" target=
|
|
57
|
-
<li><a href="./spec/fixtures/sub-dir/demo3.yyy.rb" target=
|
|
58
|
-
<li><a href="./spec/fixtures/sub-dir/demo4.yyy.java" target=
|
|
59
|
-
<li><a href="./spec/fixtures/sub-dir/demo4.yyy.rb" target=
|
|
51
|
+
<li><a href="./spec/fixtures/demo1.xxx.java" target='_blank'>./spec/fixtures/demo1.xxx.java</li>
|
|
52
|
+
<li><a href="./spec/fixtures/demo1.xxx.rb" target='_blank'>./spec/fixtures/demo1.xxx.rb</li>
|
|
53
|
+
<li><a href="./spec/fixtures/demo2.xxx.java" target='_blank'>./spec/fixtures/demo2.xxx.java</li>
|
|
54
|
+
<li><a href="./spec/fixtures/demo2.xxx.rb" target='_blank'>./spec/fixtures/demo2.xxx.rb</li>
|
|
55
|
+
<li><a href="./spec/fixtures/sub-dir/demo3.yyy.java" target='_blank'>./spec/fixtures/sub-dir/demo3.yyy.java</li>
|
|
56
|
+
<li><a href="./spec/fixtures/sub-dir/demo3.yyy.rb" target='_blank'>./spec/fixtures/sub-dir/demo3.yyy.rb</li>
|
|
57
|
+
<li><a href="./spec/fixtures/sub-dir/demo4.yyy.java" target='_blank'>./spec/fixtures/sub-dir/demo4.yyy.java</li>
|
|
58
|
+
<li><a href="./spec/fixtures/sub-dir/demo4.yyy.rb" target='_blank'>./spec/fixtures/sub-dir/demo4.yyy.rb</li>
|
|
60
59
|
</ol>
|
|
61
60
|
</body>
|
|
62
61
|
</html>
|
|
@@ -77,14 +76,14 @@ describe IndexHtml do
|
|
|
77
76
|
<header>File List</header>
|
|
78
77
|
<body>
|
|
79
78
|
<ol>
|
|
80
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo1.xxx.java" target=
|
|
81
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo1.xxx.rb" target=
|
|
82
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo2.xxx.java" target=
|
|
83
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo2.xxx.rb" target=
|
|
84
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.java" target=
|
|
85
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.rb" target=
|
|
86
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.java" target=
|
|
87
|
-
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.rb" target=
|
|
79
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo1.xxx.java" target='_blank'>http://agilecreativity.com/public/spec/fixtures/demo1.xxx.java</li>
|
|
80
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo1.xxx.rb" target='_blank'>http://agilecreativity.com/public/spec/fixtures/demo1.xxx.rb</li>
|
|
81
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo2.xxx.java" target='_blank'>http://agilecreativity.com/public/spec/fixtures/demo2.xxx.java</li>
|
|
82
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/demo2.xxx.rb" target='_blank'>http://agilecreativity.com/public/spec/fixtures/demo2.xxx.rb</li>
|
|
83
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.java" target='_blank'>http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.java</li>
|
|
84
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.rb" target='_blank'>http://agilecreativity.com/public/spec/fixtures/sub-dir/demo3.yyy.rb</li>
|
|
85
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.java" target='_blank'>http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.java</li>
|
|
86
|
+
<li><a href="http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.rb" target='_blank'>http://agilecreativity.com/public/spec/fixtures/sub-dir/demo4.yyy.rb</li>
|
|
88
87
|
</ol>
|
|
89
88
|
</body>
|
|
90
89
|
</html>
|
|
@@ -97,8 +96,8 @@ describe IndexHtml do
|
|
|
97
96
|
result = IndexHtml.make_links files, base_dir: "spec/fixtures", prefix: 'public'
|
|
98
97
|
expect(capture(:stdout) { puts result }).to eq \
|
|
99
98
|
<<-EOT
|
|
100
|
-
<li><a href="public/spec/fixtures/demo1.xxx.rb" target=
|
|
101
|
-
<li><a href="public/spec/fixtures/demo2.xxx.rb" target=
|
|
99
|
+
<li><a href="public/spec/fixtures/demo1.xxx.rb" target='_blank'>public/spec/fixtures/demo1.xxx.rb</li>
|
|
100
|
+
<li><a href="public/spec/fixtures/demo2.xxx.rb" target='_blank'>public/spec/fixtures/demo2.xxx.rb</li>
|
|
102
101
|
EOT
|
|
103
102
|
end
|
|
104
103
|
|
|
@@ -106,8 +105,8 @@ describe IndexHtml do
|
|
|
106
105
|
result = IndexHtml.make_links(files, base_dir: "spec/fixtures")
|
|
107
106
|
expect(capture(:stdout) { puts result }).to eq \
|
|
108
107
|
<<-EOT
|
|
109
|
-
<li><a href="./spec/fixtures/demo1.xxx.rb" target=
|
|
110
|
-
<li><a href="./spec/fixtures/demo2.xxx.rb" target=
|
|
108
|
+
<li><a href="./spec/fixtures/demo1.xxx.rb" target='_blank'>./spec/fixtures/demo1.xxx.rb</li>
|
|
109
|
+
<li><a href="./spec/fixtures/demo2.xxx.rb" target='_blank'>./spec/fixtures/demo2.xxx.rb</li>
|
|
111
110
|
EOT
|
|
112
111
|
end
|
|
113
112
|
|
|
@@ -117,8 +116,8 @@ describe IndexHtml do
|
|
|
117
116
|
result = IndexHtml.make_links(files, base_dir: "./spec/fixtures/")
|
|
118
117
|
expect(capture(:stdout) { puts result }).to eq \
|
|
119
118
|
<<-EOT
|
|
120
|
-
<li><a href="./spec/fixtures/demo1.xxx.rb" target=
|
|
121
|
-
<li><a href="./spec/fixtures/demo2.xxx.rb" target=
|
|
119
|
+
<li><a href="./spec/fixtures/demo1.xxx.rb" target='_blank'>./spec/fixtures/demo1.xxx.rb</li>
|
|
120
|
+
<li><a href="./spec/fixtures/demo2.xxx.rb" target='_blank'>./spec/fixtures/demo2.xxx.rb</li>
|
|
122
121
|
EOT
|
|
123
122
|
end
|
|
124
123
|
|
|
@@ -128,10 +127,9 @@ describe IndexHtml do
|
|
|
128
127
|
result = IndexHtml.make_links(files, base_dir: "spec/fixtures/")
|
|
129
128
|
expect(capture(:stdout) { puts result }).to eq \
|
|
130
129
|
<<-EOT
|
|
131
|
-
<li><a href="./spec/fixtures/demo1.xxx.rb" target=
|
|
132
|
-
<li><a href="./spec/fixtures/demo2.xxx.rb" target=
|
|
130
|
+
<li><a href="./spec/fixtures/demo1.xxx.rb" target='_blank'>./spec/fixtures/demo1.xxx.rb</li>
|
|
131
|
+
<li><a href="./spec/fixtures/demo2.xxx.rb" target='_blank'>./spec/fixtures/demo2.xxx.rb</li>
|
|
133
132
|
EOT
|
|
134
133
|
end
|
|
135
|
-
|
|
136
134
|
end
|
|
137
135
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,71 +1,99 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: index_html
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
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-04-
|
|
11
|
+
date: 2014-04-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: thor
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0.19'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.19'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: agile_utils
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.0.7
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.0.7
|
|
13
41
|
- !ruby/object:Gem::Dependency
|
|
14
42
|
name: code_lister
|
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
|
16
44
|
requirements:
|
|
17
45
|
- - "~>"
|
|
18
46
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.0.
|
|
47
|
+
version: 0.0.7
|
|
20
48
|
type: :runtime
|
|
21
49
|
prerelease: false
|
|
22
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
51
|
requirements:
|
|
24
52
|
- - "~>"
|
|
25
53
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.0.
|
|
54
|
+
version: 0.0.7
|
|
27
55
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
56
|
+
name: awesome_print
|
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
|
30
58
|
requirements:
|
|
31
59
|
- - "~>"
|
|
32
60
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1.
|
|
61
|
+
version: '1.2'
|
|
34
62
|
type: :development
|
|
35
63
|
prerelease: false
|
|
36
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
65
|
requirements:
|
|
38
66
|
- - "~>"
|
|
39
67
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1.
|
|
68
|
+
version: '1.2'
|
|
41
69
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
70
|
+
name: bundler
|
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
|
44
72
|
requirements:
|
|
45
|
-
- - "
|
|
73
|
+
- - "~>"
|
|
46
74
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
75
|
+
version: '1.3'
|
|
48
76
|
type: :development
|
|
49
77
|
prerelease: false
|
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
79
|
requirements:
|
|
52
|
-
- - "
|
|
80
|
+
- - "~>"
|
|
53
81
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
82
|
+
version: '1.3'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
84
|
+
name: fuubar
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
58
86
|
requirements:
|
|
59
87
|
- - "~>"
|
|
60
88
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
89
|
+
version: '1.3'
|
|
62
90
|
type: :development
|
|
63
91
|
prerelease: false
|
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
93
|
requirements:
|
|
66
94
|
- - "~>"
|
|
67
95
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
96
|
+
version: '1.3'
|
|
69
97
|
- !ruby/object:Gem::Dependency
|
|
70
98
|
name: guard-rspec
|
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -81,47 +109,61 @@ dependencies:
|
|
|
81
109
|
- !ruby/object:Gem::Version
|
|
82
110
|
version: '4.2'
|
|
83
111
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
112
|
+
name: pry
|
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
|
86
114
|
requirements:
|
|
87
115
|
- - "~>"
|
|
88
116
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '
|
|
117
|
+
version: '0.9'
|
|
90
118
|
type: :development
|
|
91
119
|
prerelease: false
|
|
92
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
121
|
requirements:
|
|
94
122
|
- - "~>"
|
|
95
123
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '
|
|
124
|
+
version: '0.9'
|
|
97
125
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
126
|
+
name: rake
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - ">="
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
type: :development
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - ">="
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: '0'
|
|
139
|
+
- !ruby/object:Gem::Dependency
|
|
140
|
+
name: rspec
|
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
|
100
142
|
requirements:
|
|
101
143
|
- - "~>"
|
|
102
144
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
145
|
+
version: '2.14'
|
|
104
146
|
type: :development
|
|
105
147
|
prerelease: false
|
|
106
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
149
|
requirements:
|
|
108
150
|
- - "~>"
|
|
109
151
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
152
|
+
version: '2.14'
|
|
111
153
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
154
|
+
name: rubocop
|
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
|
114
156
|
requirements:
|
|
115
157
|
- - "~>"
|
|
116
158
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
159
|
+
version: 0.21.0
|
|
118
160
|
type: :development
|
|
119
161
|
prerelease: false
|
|
120
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
163
|
requirements:
|
|
122
164
|
- - "~>"
|
|
123
165
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
166
|
+
version: 0.21.0
|
|
125
167
|
description: Generate the index.html from list of files
|
|
126
168
|
email:
|
|
127
169
|
- agilecreativity@gmail.com
|
|
@@ -132,7 +174,6 @@ extra_rdoc_files: []
|
|
|
132
174
|
files:
|
|
133
175
|
- ".gitignore"
|
|
134
176
|
- ".ruby-version"
|
|
135
|
-
- Changelogs.md
|
|
136
177
|
- Gemfile
|
|
137
178
|
- Guardfile
|
|
138
179
|
- LICENSE.txt
|
|
@@ -144,7 +185,6 @@ files:
|
|
|
144
185
|
- lib/active_support/core_ext/kernel/reporting.rb
|
|
145
186
|
- lib/index_html.rb
|
|
146
187
|
- lib/index_html/cli.rb
|
|
147
|
-
- lib/index_html/main.rb
|
|
148
188
|
- lib/index_html/version.rb
|
|
149
189
|
- spec/fixtures/demo1.xxx.java
|
|
150
190
|
- spec/fixtures/demo1.xxx.rb
|
|
@@ -179,7 +219,7 @@ rubyforge_project:
|
|
|
179
219
|
rubygems_version: 2.2.2
|
|
180
220
|
signing_key:
|
|
181
221
|
specification_version: 4
|
|
182
|
-
summary: Generate simple index.html from list of files
|
|
222
|
+
summary: Generate simple index.html from list of files based on simple criteria
|
|
183
223
|
test_files:
|
|
184
224
|
- spec/fixtures/demo1.xxx.java
|
|
185
225
|
- spec/fixtures/demo1.xxx.rb
|
data/Changelogs.md
DELETED
data/lib/index_html/main.rb
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module IndexHtml
|
|
2
|
-
class Main
|
|
3
|
-
class << self
|
|
4
|
-
def run(options = {})
|
|
5
|
-
files = CodeLister.files options || []
|
|
6
|
-
unless files.empty?
|
|
7
|
-
puts "FYI: your options #{options}"
|
|
8
|
-
IndexHtml.htmlify files, options
|
|
9
|
-
puts "FYI: your result is in #{options[:output]}"
|
|
10
|
-
else
|
|
11
|
-
puts "No match found for your options :#{options}"
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|