Giter Site home page Giter Site logo

smart_dev_test's Introduction

Smart_Dev_Test

Requirements | Getting Started | Prerequisites | Installing | Use | Running Tests | Author

Requirements

  1. Write a program that:
  • Receives a log file as an argument (webserver.log is provided) e.g.: ./ webserver.log

  • Returns the following:

    • list of webpages with most page views ordered from most pages views to less page views e.g.: /home 90 visits /index 80 visits etc...

    • list of webpages with most unique page views also ordered e.g.: /about/2 8 unique views /index 5 unique views etc...

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • You will need to be using Ruby version 2.6.0 (type ruby -v into your terminal to see your current version)
    • To download Ruby (if not installed) I use homebrew, but you can find details on all methods here
    • To update your Ruby version you can use RVM (Ruby Version Manager). In your terminal type rvm install ruby-2.6.0
  • This program is tested using Rspec

Installing

  1. Clone this repo to your local machine
  2. Use bundle install
  3. Open you REPL, I have used IRB as an example, you may use PRY or another alternative

Use

  • Require the file in irb > require './lib/parse.rb'

    • you should see => true if the file has been loaded
  • Create a new instance of the Parse class > file = Parse.new

    • you will see something similar to this => #<Parse:0x00007f81921a1f10 @file=[], @webpage_views=[], @unique_views=[]>
  • Call the parse_file method on the file and insert the log file to be parsed as the argument

    • example > file.parse_file("webserver.log")
  • You will see the file split into webpages and IP adresses

    • example ["/home", "126.318.035.038"]
  • You can now call either of the following two methods on the file, depending on what you want to view.

    • show how many times a webpage was visited views_of_pages
    • show unique webpage visits unique_page_visits
  • Use quit to end your IRB session

Running Tests

  1. If not already done, clone the repo
  2. Use bundle install
  3. Run rspec from the terminal

Author

Stuart Pethurst

smart_dev_test's People

Contributors

stuartpet avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.