<commit_before># ilohv

ilohv is a simple file manager, implemented as a mountable engine for Rails apps.

## Dat name, though?

```
ruby -e "puts 'ilohv'.chars.map { |c| (c.ord - 3).chr }.join"
```

## Usage

ilohv requires Rails version 3.2.1 or higher. This is due to the fact that it uses Rails' [ActiveRecord::Store](http://apidock.com/rails/ActiveRecord/Store) feature which was added in that version.

ilohv uses the Ruby 1.9+ hash syntax so Ruby 1.8 is explicitly not supported.

To use ilohv add it to your Gemfile, configure the URL root in an initializer and mount it in your application:

``` ruby
# Gemfile:
gem 'ilohv'

# config/initializers/ilohv.rb
Ilohv::Engine.config.url_root = '/admin/files'

# config/routes.rb
mount Ilohv::Engine, at: Ilohv::Engine.config.url_root
```

ilohv is then usable at the specified URL root, e.g. `http://localhost:3000/admin/files`.

## Additional configuration

ilohv makes no assumptions on how or where you want to store your files: It uses CarrierWave underneath and the configuration is entirely up to you and your application.

ilohv will pick up your default CarrierWave configuration if you're already using CarrierWave in your application. Otherwise you can just add an initializer to configure CarrierWave (check the [Configuration section of the CarrierWave readme](https://github.com/carrierwaveuploader/carrierwave#configuring-carrierwave) for details).

You can also have a specific configuration for just the `Ilohv::FileUploader`. If you want to take this approach, just use `class_eval` to do the configuration:

``` ruby
# config/initializers/ilohv.rb
Ilohv::FileUploader.class_eval do
  storage :fog # put files on some cloud provider like S3 instead of a local directory

  def store_dir
    'ilohv_files' # put files in a subdirectory instead of right in the root
  end
end<commit_msg>Update readme with info regarding UUID-based filenames<commit_after># ilohv

ilohv is a simple file manager, implemented as a mountable engine for Rails apps.

## Dat name, though?

```
ruby -e "puts 'ilohv'.chars.map { |c| (c.ord - 3).chr }.join"
```

## Usage

ilohv requires Rails version 3.2.1 or higher. This is due to the fact that it uses Rails' [ActiveRecord::Store](http://apidock.com/rails/ActiveRecord/Store) feature which was added in that version.

ilohv uses the Ruby 1.9+ hash syntax so Ruby 1.8 is explicitly not supported.

To use ilohv add it to your Gemfile, configure the URL root in an initializer and mount it in your application:

``` ruby
# Gemfile:
gem 'ilohv'

# config/initializers/ilohv.rb
Ilohv::Engine.config.url_root = '/admin/files'

# config/routes.rb
mount Ilohv::Engine, at: Ilohv::Engine.config.url_root
```

ilohv is then usable at the specified URL root, e.g. `http://localhost:3000/admin/files`.

## Additional configuration

ilohv uses CarrierWave underneath and the configuration is entirely up to you and your application.

There are no assumptions on how or where you want to store your files except for generating unique filenames. This is done to ensure that your application doesn't accidentally overwrite files with the same name if your storage settings don't ensure unique file paths. By default, UUIDs are generated when a file is being created (using `SecureRandom.uuid`). You can turn UUID-based filenames off or change it by just overriding the `Ilohv::FileUploader#filename` method:

``` ruby
# config/initializers/ilohv.rb
Ilohv::FileUploader.class_eval do
  def filename
    super # restore default behavior
  end
end

**In this case, it's up to your application to ensure that name clashes are prevented.**

All other configuration (e.g. where your files are stored, which file types are allowed...) is entirely up to your application.

ilohv will pick up your default CarrierWave configuration if you're already using CarrierWave in your application. Otherwise you can just add an initializer to configure CarrierWave (check the [Configuration section of the CarrierWave readme](https://github.com/carrierwaveuploader/carrierwave#configuring-carrierwave) for details).

You can also have a specific configuration for just the `Ilohv::FileUploader`:

``` ruby
# config/initializers/ilohv.rb
Ilohv::FileUploader.class_eval do
  storage :fog # put files on some cloud provider like S3 instead of a local directory

  def store_dir
    'ilohv_files' # put files in a subdirectory instead of right in the root
  end
end
{'fraction_non_alphanumeric': 0.07702733227919584, 'fraction_numerical': 0.005873051728032527, 'mean_word_length': 4.555834378920953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1129362', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1257, 'n_words': 572}