reviser 0.0.1.1.pre.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/reviser.rb ADDED
@@ -0,0 +1,68 @@
1
+ #
2
+ # Author:: Renan Strauss
3
+ #
4
+ # This class is basically here to give the user
5
+ # a generic and comprehensive way to use and
6
+ # customize the behavior of our tool.
7
+ # The main idea is that the user should not
8
+ # instantiate components himself, nor worry
9
+ # about the data these components exchange.
10
+ #
11
+ require 'mkmf'
12
+
13
+ require_relative 'component'
14
+ require_relative 'config'
15
+
16
+ class Reviser
17
+ @@setup = false
18
+ @@loaded_components = {}
19
+
20
+ #
21
+ # Adds an entry with the specified data.
22
+ # At this time, we assume the user has given us
23
+ # a Cfg that makes sense.
24
+ # TODO : check data
25
+ #
26
+ def self.load(data)
27
+ @@loaded_components[data[:component]] = {inputFrom: data[:inputFrom], data: nil}
28
+ end
29
+
30
+ def self.setup(config_file)
31
+ @@setup = true
32
+ Cfg.load config_file
33
+ end
34
+
35
+ #
36
+ # Basically runs each loaded component.
37
+ # The exection order is based on the loading order.
38
+ #
39
+ def self.run
40
+ raise ArgumentError unless @@setup
41
+
42
+ if Cfg.has_key?(:options) && Cfg[:options].has_key?(:log_dir)
43
+ FileUtils.mkdir Cfg[:options][:log_dir] unless Dir.exist? Cfg[:options][:log_dir]
44
+ end
45
+
46
+ @@loaded_components.each do |comp, conf|
47
+ puts "Reviser is now running #{Reviser.titleize comp}..."
48
+
49
+ require_relative "components/#{comp}"
50
+ c = eval("Components::#{Reviser.titleize comp}").new ((conf[:inputFrom] != nil) && @@loaded_components[conf[:inputFrom]][:data]) || nil
51
+
52
+ @@loaded_components[comp][:data] = c.work
53
+
54
+ puts 'Done'
55
+ end
56
+
57
+ # To handle multiple loads
58
+ # and calls to run
59
+ @@loaded_components = {}
60
+ end
61
+
62
+ #
63
+ # Quite handy
64
+ #
65
+ def self.titleize(str)
66
+ str.split(/ |\_/).map(&:capitalize).join('')
67
+ end
68
+ end
@@ -0,0 +1,115 @@
1
+ /* Component styles */
2
+ @font-face {
3
+ font-family: 'Blokk';
4
+ src: url('../fonts/blokk/BLOKKRegular.eot');
5
+ src: url('../fonts/blokk/BLOKKRegular.eot?#iefix') format('embedded-opentype'),
6
+ url('../fonts/blokk/BLOKKRegular.woff') format('woff'),
7
+ url('../fonts/blokk/BLOKKRegular.svg#BLOKKRegular') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+ .component {
12
+ line-height: 1.5em;
13
+ margin: 0 auto;
14
+ padding: 2em 0 3em;
15
+ width: 90%;
16
+ max-width: 1000px;
17
+ overflow: hidden;
18
+ }
19
+ .component .filler {
20
+ font-family: "Blokk", Arial, sans-serif;
21
+ color: #d3d3d3;
22
+ }
23
+ table {
24
+ border-collapse: collapse;
25
+ margin-bottom: 3em;
26
+ width: 100%;
27
+ background: #fff;
28
+ }
29
+ td, th {
30
+ padding: 0.75em 1.5em;
31
+ text-align: center;
32
+
33
+ }
34
+ td.err {
35
+ background-color: #e992b9;
36
+ color: #fff;
37
+ font-size: 0.75em;
38
+ text-align: center;
39
+ line-height: 1;
40
+ }
41
+ th {
42
+ background-color: #31bc86;
43
+ font-weight: bold;
44
+ color: #fff;
45
+ white-space: nowrap;
46
+ }
47
+ tbody th {
48
+ background-color: #2ea879;
49
+ }
50
+ tbody tr:nth-child(2n-1) {
51
+ background-color: #f5f5f5;
52
+ transition: all .125s ease-in-out;
53
+ }
54
+ tbody tr:hover {
55
+ background-color: rgba(129,208,177,.3);
56
+ }
57
+
58
+ /* For appearance */
59
+ .sticky-wrap {
60
+ overflow-x: auto;
61
+ overflow-y: hidden;
62
+ position: relative;
63
+ margin: 3em 0;
64
+ width: 100%;
65
+ }
66
+ .sticky-wrap .sticky-thead,
67
+ .sticky-wrap .sticky-col,
68
+ .sticky-wrap .sticky-intersect {
69
+ opacity: 0;
70
+ position: absolute;
71
+ top: 0;
72
+ left: 0;
73
+ transition: all .125s ease-in-out;
74
+ z-index: 50;
75
+ width: auto; /* Prevent table from stretching to full size */
76
+ }
77
+ .sticky-wrap .sticky-thead {
78
+ box-shadow: 0 0.25em 0.1em -0.1em rgba(0,0,0,.125);
79
+ z-index: 100;
80
+ width: 100%; /* Force stretch */
81
+ }
82
+ .sticky-wrap .sticky-intersect {
83
+ opacity: 1;
84
+ z-index: 150;
85
+
86
+ }
87
+ .sticky-wrap .sticky-intersect th {
88
+ background-color: #666;
89
+ color: #eee;
90
+ }
91
+ .sticky-wrap td,
92
+ .sticky-wrap th {
93
+ box-sizing: border-box;
94
+ }
95
+
96
+ /* Not needed for sticky header/column functionality */
97
+ td.user-name {
98
+ text-transform: capitalize;
99
+ }
100
+ .sticky-wrap.overflow-y {
101
+ overflow-y: auto;
102
+ max-height: 50vh;
103
+ }
104
+
105
+ .console {
106
+ font-family:Courier;
107
+ white-space: pre;
108
+ text-align: left;
109
+ color: #CCCCCC;
110
+ background: #000000;
111
+ border: 3px double #CCCCCC;
112
+ padding: 10px;
113
+
114
+ height: 100%;
115
+ }
@@ -0,0 +1 @@
1
+ article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block;}audio,canvas,video{display:inline-block;}audio:not([controls]){display:none;height:0;}[hidden]{display:none;}html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;}body{margin:0;}a:focus{outline:thin dotted;}a:active,a:hover{outline:0;}h1{font-size:2em;margin:0.67em 0;}abbr[title]{border-bottom:1px dotted;}b,strong{font-weight:bold;}dfn{font-style:italic;}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0;}mark{background:#ff0;color:#000;}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em;}pre{white-space:pre-wrap;}q{quotes:"\201C" "\201D" "\2018" "\2019";}small{font-size:80%;}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline;}sup{top:-0.5em;}sub{bottom:-0.25em;}img{border:0;}svg:not(:root){overflow:hidden;}figure{margin:0;}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend{border:0;padding:0;}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0;}button,input{line-height:normal;}button,select{text-transform:none;}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer;}button[disabled],html input[disabled]{cursor:default;}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0;}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box;}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none;}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0;}textarea{overflow:auto;vertical-align:top;}table{border-collapse:collapse;border-spacing:0;}
@@ -0,0 +1,149 @@
1
+ $(function(){
2
+ $('table').each(function() {
3
+ if($(this).find('thead').length > 0 && $(this).find('th').length > 0) {
4
+ // Clone <thead>
5
+ var $w = $(window),
6
+ $t = $(this),
7
+ $thead = $t.find('thead').clone(),
8
+ $col = $t.find('thead, tbody').clone();
9
+
10
+ // Add class, remove margins, reset width and wrap table
11
+ $t
12
+ .addClass('sticky-enabled')
13
+ .css({
14
+ margin: 0,
15
+ width: '100%'
16
+ }).wrap('<div class="sticky-wrap" />');
17
+
18
+ if($t.hasClass('overflow-y')) $t.removeClass('overflow-y').parent().addClass('overflow-y');
19
+
20
+ // Create new sticky table head (basic)
21
+ $t.after('<table class="sticky-thead" />');
22
+
23
+ // If <tbody> contains <th>, then we create sticky column and intersect (advanced)
24
+ if($t.find('tbody th').length > 0) {
25
+ $t.after('<table class="sticky-col" /><table class="sticky-intersect" />');
26
+ }
27
+
28
+ // Create shorthand for things
29
+ var $stickyHead = $(this).siblings('.sticky-thead'),
30
+ $stickyCol = $(this).siblings('.sticky-col'),
31
+ $stickyInsct = $(this).siblings('.sticky-intersect'),
32
+ $stickyWrap = $(this).parent('.sticky-wrap');
33
+
34
+ $stickyHead.append($thead);
35
+
36
+ $stickyCol
37
+ .append($col)
38
+ .find('thead th:gt(0)').remove()
39
+ .end()
40
+ .find('tbody td').remove();
41
+
42
+ $stickyInsct.html('<thead><tr><th>'+$t.find('thead th:first-child').html()+'</th></tr></thead>');
43
+
44
+ // Set widths
45
+ var setWidths = function () {
46
+ $t
47
+ .find('thead th').each(function (i) {
48
+ $stickyHead.find('th').eq(i).width($(this).width());
49
+ })
50
+ .end()
51
+ .find('tr').each(function (i) {
52
+ $stickyCol.find('tr').eq(i).height($(this).height());
53
+ });
54
+
55
+ // Set width of sticky table head
56
+ $stickyHead.width($t.width());
57
+
58
+ // Set width of sticky table col
59
+ $stickyCol.find('th').add($stickyInsct.find('th')).width($t.find('thead th').width())
60
+ },
61
+ repositionStickyHead = function () {
62
+ // Return value of calculated allowance
63
+ var allowance = calcAllowance();
64
+
65
+ // Check if wrapper parent is overflowing along the y-axis
66
+ if($t.height() > $stickyWrap.height()) {
67
+ // If it is overflowing (advanced layout)
68
+ // Position sticky header based on wrapper scrollTop()
69
+ if($stickyWrap.scrollTop() > 0) {
70
+ // When top of wrapping parent is out of view
71
+ $stickyHead.add($stickyInsct).css({
72
+ opacity: 1,
73
+ top: $stickyWrap.scrollTop()
74
+ });
75
+ } else {
76
+ // When top of wrapping parent is in view
77
+ $stickyHead.add($stickyInsct).css({
78
+ opacity: 0,
79
+ top: 0
80
+ });
81
+ }
82
+ } else {
83
+ // If it is not overflowing (basic layout)
84
+ // Position sticky header based on viewport scrollTop
85
+ if($w.scrollTop() > $t.offset().top && $w.scrollTop() < $t.offset().top + $t.outerHeight() - allowance) {
86
+ // When top of viewport is in the table itself
87
+ $stickyHead.add($stickyInsct).css({
88
+ opacity: 1,
89
+ top: $w.scrollTop() - $t.offset().top
90
+ });
91
+ } else {
92
+ // When top of viewport is above or below table
93
+ $stickyHead.add($stickyInsct).css({
94
+ opacity: 0,
95
+ top: 0
96
+ });
97
+ }
98
+ }
99
+ },
100
+ repositionStickyCol = function () {
101
+ if($stickyWrap.scrollLeft() > 0) {
102
+ // When left of wrapping parent is out of view
103
+ $stickyCol.add($stickyInsct).css({
104
+ opacity: 1,
105
+ left: $stickyWrap.scrollLeft()
106
+ });
107
+ } else {
108
+ // When left of wrapping parent is in view
109
+ $stickyCol
110
+ .css({ opacity: 0 })
111
+ .add($stickyInsct).css({ left: 0 });
112
+ }
113
+ },
114
+ calcAllowance = function () {
115
+ var a = 0;
116
+ // Calculate allowance
117
+ $t.find('tbody tr:lt(3)').each(function () {
118
+ a += $(this).height();
119
+ });
120
+
121
+ // Set fail safe limit (last three row might be too tall)
122
+ // Set arbitrary limit at 0.25 of viewport height, or you can use an arbitrary pixel value
123
+ if(a > $w.height()*0.25) {
124
+ a = $w.height()*0.25;
125
+ }
126
+
127
+ // Add the height of sticky header
128
+ a += $stickyHead.height();
129
+ return a;
130
+ };
131
+
132
+ setWidths();
133
+
134
+ $t.parent('.sticky-wrap').scroll($.throttle(250, function() {
135
+ repositionStickyHead();
136
+ repositionStickyCol();
137
+ }));
138
+
139
+ $w
140
+ .load(setWidths)
141
+ .resize($.debounce(250, function () {
142
+ setWidths();
143
+ repositionStickyHead();
144
+ repositionStickyCol();
145
+ }))
146
+ .scroll($.throttle(250, repositionStickyHead));
147
+ }
148
+ });
149
+ });
data/type/CProject.yml ADDED
@@ -0,0 +1,32 @@
1
+ ---
2
+ # C Project sort
3
+
4
+ language: C
5
+
6
+ # The first command to try
7
+ preferred_build_command: make
8
+
9
+ # Required files
10
+ # Here, it's only the Makefile
11
+ # Can also be a regex.
12
+ required_files:
13
+ - /(M|m)akefile/
14
+
15
+ # For interpreted languages
16
+ # execute_command:
17
+
18
+ # If not specified, the first
19
+ # executable file found will be executed
20
+ # program_name:
21
+
22
+ # Number of times to run execute_command
23
+ # (not needed here, as explained below)
24
+ # execution_count: 3
25
+
26
+ # One arg per execution,
27
+ # only one value will be passed
28
+ # execution_count times to the
29
+ # program.
30
+ # But if it's a list, execution_count
31
+ # will be replaced by its size
32
+ # execution_value:
@@ -0,0 +1,2 @@
1
+ language: Ruby
2
+ execution_count: 2
@@ -0,0 +1 @@
1
+ language: HTML
@@ -0,0 +1,42 @@
1
+ ---
2
+ # Labyrinthe
3
+ # (test data we got)
4
+
5
+ language: C
6
+
7
+ # The first command to try
8
+ preferred_build_command: make
9
+
10
+ # Required files
11
+ # Can also be a regex
12
+ required_files:
13
+ - !ruby/regexp '/(M|m)akefile/'
14
+
15
+ #
16
+ # The extensions you want
17
+ # In this case, ext/valgrind.rb
18
+ # must exist
19
+ #
20
+ extensions:
21
+ #valgrind:
22
+ - memleaks: Fuites memoire
23
+
24
+ # For interpreted languages
25
+ # execute_command:
26
+
27
+ # If not specified, the first
28
+ # executable file found will be executed
29
+ # program_name:
30
+
31
+ # Number of times to execute
32
+ # (not needed here, as explained below)
33
+ # execution_count:
34
+
35
+ # One arg per execution,
36
+ # only one value will be passed
37
+ # execution_count times to the
38
+ # program.
39
+ # But if it's a list, execution_count
40
+ # will be replaced by its size
41
+ execution_value:
42
+ - ../../res/labys/labfich11.txt
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: reviser
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.1.pre.beta
5
+ platform: ruby
6
+ authors:
7
+ - Renan Strauss
8
+ - Yann Prono
9
+ - Anthony Cerf
10
+ - Romain Ruez
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+ date: 2015-03-16 00:00:00.000000000 Z
15
+ dependencies: []
16
+ description: A semi-automatic tool for student's projects evaluation
17
+ email: renan.strauss@gmail.com
18
+ executables:
19
+ - reviser
20
+ extensions: []
21
+ extra_rdoc_files: []
22
+ files:
23
+ - bin/reviser
24
+ - config.yml
25
+ - ext/html_validator.rb
26
+ - ext/valgrind.rb
27
+ - labels.yml
28
+ - lang/C.yml
29
+ - lang/HTML.yml
30
+ - lang/Java.yml
31
+ - lang/Ruby.yml
32
+ - lib/component.rb
33
+ - lib/components/archiver.rb
34
+ - lib/components/checker.rb
35
+ - lib/components/extractors.rb
36
+ - lib/components/generator.rb
37
+ - lib/components/generators.rb
38
+ - lib/components/organiser.rb
39
+ - lib/config.rb
40
+ - lib/exec.rb
41
+ - lib/helpers/code_analysis.rb
42
+ - lib/helpers/compilation.rb
43
+ - lib/helpers/criteria.rb
44
+ - lib/helpers/execution.rb
45
+ - lib/helpers/git.rb
46
+ - lib/helpers/project.rb
47
+ - lib/helpers/system.rb
48
+ - lib/loggers/logger.rb
49
+ - lib/loggers/modes.rb
50
+ - lib/project.rb
51
+ - lib/reviser.rb
52
+ - res/css/component.css
53
+ - res/css/normalize.css
54
+ - res/js/jquery.stickyheader.js
55
+ - type/CProject.yml
56
+ - type/HelloWorldRuby.yml
57
+ - type/HtmlASRALL.yml
58
+ - type/Labyrinthe.yml
59
+ homepage: http://rubygems.org/gems/reviser
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">"
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.1
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.5
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Reviser
83
+ test_files: []