Sequential File makes determination of which file to process (read or write) easy!
| Project | Sequential File |
|---|---|
| gem name | sequential_file |
| license | MIT |
| expert support | |
| download rank | |
| version | ![]() |
| dependencies | ![]() |
| code quality | ![]() |
| inline documenation | ![]() |
| continuous integration | ![]() |
| test coverage | ![]() |
| homepage | https://github.com/pboling/sequential_file |
| documentation | http://rdoc.info/github/pboling/sequential_file/frames |
| live chat | |
| Spread |
on Coderbits, on Coderwall |
It allows you to create files that are named sequentially and intelligently.
Files will have four primary parts in their filenames:
- First part, which will be useful for list files in the shell.
- Second part is a date stamp, which will be useful in not having unwanted junk in our globs.
- Third part makes it easy to find the counter
- Fourth part is the counter
Tested with Ruby 2.0.0+. Due to the use of Ruby's 'prepend' initialization feature, will not work with anything older.
There are no dependencies, gem or otherwise, this is a pure Ruby library, and will work with any sort of File-type class.
Add this line to your application's Gemfile:
gem 'sequential_file'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sequential_file
If you have your own File-like class then you may just need to use the SequentialFile::Namer by including it.
class MyFileLikeThing
include SequentialFile::Namer
end
This gem ships with a reference implementation of a File-wrapper class that uses the Namer to determine which file to process.
Have a look at lib/sequential_file/base.rb or require it and play with it:
require 'sequential_file/base'
file = SequentialFile::Base.new({
directory_path: '/tmp',
name: 'access_log.FileBase.csv',
process_date: Date.today
})
file.write('this is new text') # => write ensures that the file is open for writing, but you have to remember to close!
file.close
file.write('this is after close text')
file.read =~ /this is after close text/ # => integer representation of the position in the file where the text match starts
file.close
Also, see the specs.
See the Network View and the CHANGELOG
Take a look at the reek and roodi lists. These are the files names REEK and ROODI in the root of the gem.
Currently they are clean, and we like to keep them that way! Once you complete a change, run the tests:
bundle exec rake spec
If the tests pass refresh the reek and roodi lists and make sure things have not gotten worse:
bundle exec rake reek > REEK
bundle exec rake reek > ROODI
Follow the instructions for "Contributing" below.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions.
As a result of this policy, you can (and should) specify a dependency on this gem using the Pessimistic Version Constraint with two digits of precision.
For example:
spec.add_dependency 'sequential_file', '~> 1.0.8'
- MIT License - See LICENSE file in this project
- Copyright (c) 2014 Peter H. Boling of Rails Bling





