Giter Site home page Giter Site logo

moss_ruby's Introduction

Description

Ruby gem to submit files to MOSS.

This is a fork!

Credits to Andrew Cain, who worked in this gem development in his Bitbucket repository.

What this fork brings new:

  • The possibility to upload directly a string whit the source code content, as content to check or as base content too (for more information about what is a base content/file, please check the usage instructions in the original script);
  • to_check is a object to store a hash with the files to be analyzed, and now is treated as an instance object;
  • Methods to add file/content are now instance methods;
  • Moss class name changed to only Moss (rather than MossRuby);
  • Updated gem structure;
  • A bit of code refactoring in check method.

What follow below is the original README, where only the usage section is updated. Please note: is pointed as requirements the creation of a MOSS account, because the usage require a user_id. However, whit the specified user_id of usage example, you are able to access MOSS server without problems (MOSS is public to everyone, but it wasn't always so, and maybe this requirement isn't more, in fact, a requirement).

What is Moss?

Moss (for a Measure Of Software Similarity) is an automatic system for determining the similarity of programs. To date, the main application of Moss has been in detecting plagiarism in programming classes. Since its development in 1994, Moss has been very effective in this role. The algorithm behind moss is a significant improvement over other cheating detection algorithms (at least, over those known to us).

More about MOSS

Supported Languages

C, C++, Java, C#, Python, Visual Basic, Javascript, FORTRAN, ML, Haskell, Lisp, Scheme, Pascal, Modula2, Ada, Perl, TCL, Matlab, VHDL, Verilog, Spice, MIPS assembly, a8086 assembly, a8086 assembly, MIPS assembly, HCL2.

Requirements

Usage

Usage involves the following steps:

  • Install gem
  • Create a Moss object using your MOSS user id.
  • Configure MOSS options on your MossRuby object
  • Fill a dictionary with the file details to check
  • Call check from the Moss object to post the files to the server for processing. The response is the URL of the results.
  • Optionally, call extract_results on the Moss object to get a Ruby dictionary (hash) containing the list of matches.
gem 'moss_ruby', git: 'https://github.com/rwehresmann/moss_ruby.git'
# Create the Moss object
moss = Moss.new(000000000) #replace 000000000 with your user id, if you have it

# Set options  -- the options will already have these default values
moss.options[:max_matches] = 10
moss.options[:directory_submission] =  false
moss.options[:show_num_matches] = 250
moss.options[:experimental_server] =    false
moss.options[:comment] = ""
moss.options[:language] = "c"

# Add files to compare
moss.add_file("The/Files/Path/MyFile.c")
moss.add_file("Other/Files/Path/*.c")
moss.add_file("Many/Files/Paths/**/*.h")

# Or even string contents
moss.add_content(IO.read("The/Files/Path/MyOtherFile.c"))

# Get server to process files
url = moss.check

# Get results
results = moss.extract_results url

# Use results
puts "Got results from #{url}"
results.each { |match|
    puts "----"
    match.each { |file|
        puts "#{file[:filename]} #{file[:pct]} #{file[:html]}"
    }
}

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

moss_ruby's People

Contributors

rwehresmann avatar

Stargazers

 avatar

Watchers

 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.