Project which is analyses webserver's logs to list page's visits in total mode and unique mode.
3.0.0
- clone the project
- If you don't have the compatible version of ruby use the command to install this using rbenv
rbenv install 3.0.0Note: You can find installed ruby version in your system with the below command:
ruby -v- install dependencies using Bundler
bundle installNow you can run the project with below command:
./parser.rb log/webserver.logNote: If you face with an permission denied error you can fix this with the below command:
chmod +x parser.rbThis project written in TDD by rspec gem. The project has unit and integration test. If you want you can run Rspec and generate code coverage with below command:
bundle exec rspecFor the generate test coverate we use SimpleCov gem which reports 193 relevant lines, 192 lines covered and 1 lines missed. ( 99.48% )
- The entry point of the project is
parser.rbwhich get a file to parse it. - At the first we have a service named
ArgsReaderwhich checks the given arguments and returnspathas a main file path which must be parsed. - Then there is a service named
FileLoaderwhich in charge of loads the given file and then will pass the file toFileReader. FileReaderreads given file line by line and will extractpathandipfrom each line.Repositoryservice which in charge of storepathandip. The service implements two methods for return count visits and uniuqe count visits.- Our main service is
Analyserwhich depneds on two servicesFileReaderandRepository. The service sends message toFileReaderto read given file line by line then will send message toRepositoryto store given data. - Finally as we have to display the result, we have a service named
Presenterwhich will display the output.
- Better exception handling.
- To improve performance we can use cache mechanism.
- Implement a bin file to interactive more efficient and clear with client
- Better implementation of Presenter service.

