## IndexHtml
[](http://badge.fury.io/rb/index_html)
[](https://gemnasium.com/agilecreativity/index_html)
[](https://codeclimate.com/github/agilecreativity/index_html)
Quickly generate the index.html files based on your simple criteria.
### Installation
Add this line to your application's Gemfile:
gem 'index_html'
And then execute:
$ bundle
Or install it yourself as:
$ gem install index_html
### Usage
Say you have lots of ebook files (pdf, epub, or mobi) and you have properly named them
with something like [ebook_renamer][].
Now that you have the good data, if you like to create a quick index to all of the files
that have the specific word 'Android' in the title you could perhap try something like the following:
```sh
gem install index_html
cd ~/Dropbox/ebooks/
index_html generate --base-dir . \
--exts epub pdf mobi \
--inc-words android \
--recursive
```
### Help/Usage:
Just type `index_html` without any options to see the list of help
```
Usage:
index_html generate [OPTIONS]
Options:
-b, [--base-dir=BASE_DIR] # Base directory
# Default: . (current directory)
-f, [--non-exts=one two three] # List of files without extension to search for
-n, [--inc-words=one two three] # List of words to be included in the result if any
-x, [--exc-words=one two three] # List of words to be excluded from the result if any
-i, [--ignore-case], [--no-ignore-case] # Match case insensitively
# Default: true
-r, [--recursive], [--no-recursive] # Search for files recursively
# Default: true
-v, [--version], [--no-version] # Display version information
-p, [--prefix=PREFIX] # Prefix string to the URL
# Default: .
-d, [--indent=N] # Indentation to each list item in the output
# Default: 6
-o, [--output=OUTPUT] # Output file name
# Default: index.html
Generate the index.html base on simple criteria
```
This will generate the file `index.html` that you can open from your favourite browser.
### Sample output
- Sample list of files from a given directory
```shell
$index_html generate --base-dir=spec/fixtures --exts=rb java --recursive
```
The output file `index.html` should be generated with something like
```html
File Listing
- ./spec/fixtures/demo1.xxx.java
- ./spec/fixtures/demo1.xxx.rb
- ./spec/fixtures/demo2.xxx.java
- ./spec/fixtures/demo2.xxx.rb
- ./spec/fixtures/sub-dir/demo3.yyy.java
- ./spec/fixtures/sub-dir/demo3.yyy.rb
- ./spec/fixtures/sub-dir/demo4.yyy.java
- ./spec/fixtures/sub-dir/demo4.yyy.rb
```
- Run with simple prefix option
```shell
index_html generate --base-dir spec/fixtures --exts rb java --recursive --prefix http://localhost
```
The output file `index.html` should be something like
```html
File Listing
- http://localhost/spec/fixtures/demo1.xxx.java
- http://localhost/spec/fixtures/demo1.xxx.rb
- http://localhost/spec/fixtures/demo2.xxx.java
- http://localhost/spec/fixtures/demo2.xxx.rb
- http:/localhost/spec/fixtures/sub-dir/demo3.yyy.java
- http://localhost/spec/fixtures/sub-dir/demo3.yyy.rb
- http://localhost/spec/fixtures/sub-dir/demo4.yyy.java
- http://localhost/spec/fixtures/sub-dir/demo4.yyy.rb
```
### Known Issues
- Will be listed here if any
### Changelogs
#### 0.1.0
- Update to the latest dependency
#### 0.0.9
- Update gem dependencies
- Make use of shared library from [agile_utils][]
- Add links to [codeclimate][] and [gemnasium][]
#### 0.0.8
- Upgrade to [code_lister][] version 0.0.7
- Use the [agile_utils][] for shared option
- Fix style using [rubocop][] gem
#### 0.0.7
- Fix the bug in 'make_links' logic to make it generate the link properly
#### 0.0.6
- Fix the Rakefile to include the correct library
#### 0.0.5
- Always make the url relative in `make_links` method.
#### 0.0.4
- Update [code_lister][] to 0.0.6 for new option
- Fix the mistake in '-d' option
#### 0.0.3
- Remove the code duplication by using the shared_option from code_lister gem
#### 0.0.2
- Initial release
### Contributing
Bug reports and suggestions for improvements are always welcome,
GitHub pull requests are even better!.
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
[agile_utils]: https://rubygems.org/gems/agile_utils
[code_lister]: https://rubygems.org/gems/code_lister
[ebook_renamer]: https://rubygems.org/gems/ebook_renamer
[rubocop]: https://github.com/bbatsov/rubocop
[gemnasium]: https://gemnasium.com/agilecreativity/index_html
[codeclimate]: https://codeclimate.com/github/agilecreativity/index_html