Browse Source

Basic maintenance

master
Ben Kurtovic 8 years ago
parent
commit
7a29b1d145
3 changed files with 26 additions and 12 deletions
  1. +0
    -10
      kgrader.rb
  2. +14
    -2
      lib/kgrader/cli.rb
  3. +12
    -0
      rakefile

+ 0
- 10
kgrader.rb View File

@@ -1,10 +0,0 @@
#! /usr/bin/env ruby

require_relative 'lib/kgrader'

def main
cli = KGrader::CLI.new
cli.test
end

main

+ 14
- 2
lib/kgrader/cli.rb View File

@@ -1,8 +1,20 @@
module KGrader
class CLI

def test
puts 'Hello, world!'
def initialize(dir)
@dir = dir
end

def reset_jail
jail_dir = File.join(@dir, 'jail')
FileUtils.rm_rf jail_dir
FileUtils.mkdir jail_dir
FileUtils.touch File.join(jail_dir, '.gitkeep')
end

def reset_desk
desk_dir = File.join(@dir, 'desk')
FileUtils.rm_rf Dir.glob(File.join(desk_dir, '*', ''))
end
end
end

+ 12
- 0
rakefile View File

@@ -0,0 +1,12 @@
require_relative 'lib/kgrader'

task :clean do
cli = KGrader::CLI.new Rake.application.original_dir
cli.reset_jail
end

task :clobber do
cli = KGrader::CLI.new Rake.application.original_dir
cli.reset_jail
cli.reset_desk
end

Loading…
Cancel
Save