reviser 0.0.4.2 → 0.0.4.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c6305159429bfb160ffd5a2d24ffe9cd652e896a
4
- data.tar.gz: 20d9a38a568bebb6828b130e5c4f7e50f51637a8
3
+ metadata.gz: fbf8045de0cc719744a2f7330246359db2cf9118
4
+ data.tar.gz: 2ea4deecb7572d9484c6c4506c02d19e928062e4
5
5
  SHA512:
6
- metadata.gz: 80b8a807a96f8027fe1108bdf4fa4e7fcb90e8cc11a57e776baa1c24e5ece1aee94f08b859fbcb7f2049868b55ca44fdb9537057db21173961ce5a9b57d43a23
7
- data.tar.gz: dfeee288363e89d12cf3e7aa36ea06982b4d4a9dd3d257f3773b80748f5fd326d43d02a25e35e580fd945fb1ad7c6b86850e2333341da6664c5f12900142d9c8
6
+ metadata.gz: 8789117a5c84196970ca0d2a26d657bbab41e4e5e1bfc956166edb7ba779a08a532769b275a668c4bff6acf636c7b45c75f8cec1084e259ab35186b44f3621d7
7
+ data.tar.gz: a86c7dab4e7470ef5fbf92963d6e6cce81320b01dc945205cde90ae46f782dc24d86644cf0e47412ea246b0a0edee62413c674f1f9ff4db94c0be8708d7eafd5
data/README.md CHANGED
@@ -59,11 +59,11 @@ Lives in *config.yml*.
59
59
 
60
60
  |Key |Description|Values|Required|
61
61
  |------|-----------|-----|:--------:|
62
- |*src*|Path to the archive containing projects||![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
63
- |*dest*|Path to a directory where projects will be extracted||![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
64
- |*projects_names*|Naming convention for projects|`^GROUP_NAME_NAME` `^GROUP_NAME(_NAME)*` `^TP_NAME_FIRSTN`|![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
65
- |*type*|The type of the project|`my_project` (*type/my_project.yml* must exist)|![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
66
- |*criteria*|The criteria you want for analysis|`all_files` `src_files` `lines_count` `comments_count` `compile` `execute`|![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
62
+ |*src*|Path to the archive containing projects||![checkbox.png](http://i.imgur.com/QicGTBr.png)|
63
+ |*dest*|Path to a directory where projects will be extracted||![checkbox.png](http://i.imgur.com/QicGTBr.png)|
64
+ |*projects_names*|Naming convention for projects|`^GROUP_NAME_NAME` `^GROUP_NAME(_NAME)*` `^TP_NAME_FIRSTN`|![checkbox.png](http://i.imgur.com/QicGTBr.png)|
65
+ |*type*|The type of the project|`my_project` (*type/my_project.yml* must exist)|![checkbox.png](http://i.imgur.com/QicGTBr.png)|
66
+ |*criteria*|The criteria you want for analysis|`all_files` `src_files` `lines_count` `comments_count` `compile` `execute`|![checkbox.png](http://i.imgur.com/QicGTBr.png)|
67
67
  |*extensions*|The list of extensions you want for analysis|See below||
68
68
  |*create_git_repo*|Whether to create a git repository for each project or not (requires *git* gem)|Default `false`||
69
69
  |*out*|The name of the analysis output file|Default *results*||
@@ -75,7 +75,7 @@ Lives in *type/my_project.yml*.
75
75
 
76
76
  |Key |Description|Values|Required|
77
77
  |------|-----------|-----|:--------:|
78
- |*language*|The target language|`C` `Java` `HTML` `Ruby`|![checkbox.png](https://bitbucket.org/repo/AyGgAx/images/3281147034-checkbox.png)|
78
+ |*language*|The target language|`C` `Java` `HTML` `Ruby`|![checkbox.png](http://i.imgur.com/QicGTBr.png)|
79
79
  |*timeout*|In seconds. Compilation and execution will halt if not completed within the defined timeout|Default *4*||
80
80
  |*required_files*|A list of required files|Tip: you can use regular expressions||
81
81
  |*preferred_build_command*|The command to build the program with|`make`||
data/ext/valgrind.rb CHANGED
@@ -37,7 +37,7 @@ module Reviser
37
37
  # Yann, execution_count shall be taken in count imo
38
38
  #
39
39
  def memleaks
40
- executable = find_executable
40
+ executable = find_first_executable
41
41
  program = "#{Cfg[:program_prefix]}#{executable}"
42
42
  param = Cfg.has_key?(:execution_value) ? Cfg[:execution_value].first : ''
43
43
  cmd = "valgrind --leak-check=full --track-origins=yes --show-reachable=yes #{program} #{param}"
data/lib/reviser.rb CHANGED
@@ -31,16 +31,15 @@ require_relative 'reviser/helpers/system'
31
31
 
32
32
  class String
33
33
  #
34
- # We need this method from Rails to
34
+ # We need the 'underscore' method from Rails API to
35
35
  # convert CamelCaseNames to underscore_names
36
36
  #
37
- def underscore
38
- self.gsub(/::/, '/').
39
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
40
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
41
- tr("-", "_").
42
- downcase
43
- end
37
+ def underscore
38
+ self.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
39
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
40
+ tr("-", "_").
41
+ downcase
42
+ end
44
43
  end
45
44
 
46
45
  #
@@ -117,17 +117,17 @@ module Reviser
117
117
  #
118
118
  # Default values for optional keys
119
119
  #
120
- Cfg[:options] ||= { verbose: true, log_dir:'logs', log_mode: 'org' }
121
- Cfg[:timeout] ||= 4
122
- Cfg[:out] ||= 'results'
123
- Cfg[:out_format] ||= ['csv', 'html']
124
- Cfg[:required_files] ||= []
120
+ @@mem[:options] ||= { verbose: true, log_dir:'logs', log_mode: 'org' }
121
+ @@mem[:timeout] ||= 4
122
+ @@mem[:out] ||= 'results'
123
+ @@mem[:out_format] ||= ['csv', 'html']
124
+ @@mem[:required_files] ||= []
125
125
 
126
- Cfg[:program_prefix] ||= ''
127
- Cfg[:execution_command] ||= ''
128
- Cfg[:execution_count] ||= 1
126
+ @@mem[:program_prefix] ||= ''
127
+ @@mem[:execution_command] ||= ''
128
+ @@mem[:execution_count] ||= 1
129
129
 
130
- Cfg[:create_git_repo] ||= false
130
+ @@mem[:create_git_repo] ||= false
131
131
  end
132
132
 
133
133
  private
@@ -37,6 +37,7 @@ module Reviser
37
37
  # Only here for compiled language,
38
38
  #
39
39
  def compile
40
+ raise Exception, "#{Cfg[:language]} is not a compiled language" unless Cfg[:compiled]
40
41
  #
41
42
  # For now, we compile only if there's
42
43
  # no missing file
@@ -33,6 +33,7 @@ module Reviser
33
33
  # languages
34
34
  #
35
35
  module Execution
36
+ include Helpers::System
36
37
  #
37
38
  # Determines how to execute the program
38
39
  # thanks to Cfg, then returns its exec
@@ -46,12 +47,7 @@ module Reviser
46
47
  outputs << make_exec(v)
47
48
  end
48
49
  else
49
- if Cfg.has_key? :execution_count
50
- outputs[Cfg[:execution_value]] = []
51
- Cfg[:execution_count].times do
52
- outputs << make_exec(Cfg[:execution_value])
53
- end
54
- else
50
+ Cfg[:execution_count].times do
55
51
  outputs << make_exec(Cfg[:execution_value])
56
52
  end
57
53
  end
@@ -83,7 +79,7 @@ module Reviser
83
79
  # security
84
80
  #
85
81
  def make_exec param = ''
86
- program = (Cfg.has_key? :program_name) && Cfg[:program_name] || find_executable
82
+ program = (Cfg.has_key? :program_name) && Cfg[:program_name] || find_first_executable
87
83
 
88
84
  return 'Program not found' unless program != nil
89
85
 
data/lib/reviser/exec.rb CHANGED
@@ -36,7 +36,7 @@ module Reviser
36
36
  #
37
37
  class Exec < Thor
38
38
 
39
- VERSION = '0.0.4.2'
39
+ VERSION = '0.0.4.3'
40
40
 
41
41
  map '--version' => :version
42
42
  map '-v' => :version
@@ -172,8 +172,10 @@ module Reviser
172
172
 
173
173
  # Then the config file
174
174
  ['config.yml', 'labels.yml'].each do |tpl|
175
- FileUtils.cp File.join(Cfg::ROOT, tpl), dir
176
- message('Create', dir == '.' && tpl || File.join(dir, tpl))
175
+ unless File.exists? File.join(dir, tpl)
176
+ FileUtils.cp(File.join(Cfg::ROOT, tpl), dir)
177
+ message('Create', dir == '.' && tpl || File.join(dir, tpl))
178
+ end
177
179
  end
178
180
  end
179
181
 
@@ -33,7 +33,7 @@ module Reviser
33
33
  #
34
34
  # @return the first executable found
35
35
  #
36
- def find_executable
36
+ def find_first_executable
37
37
  Dir['*'].select { |f| File.executable?(f) && !File.directory?(f) }.first
38
38
  end
39
39
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reviser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.2
4
+ version: 0.0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renan Strauss