hw_checker 1.4.4 → 1.4.10

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzhkMzI5YTgzNjBhNDc1ZWRhMTljMjQ2NTJlMDRlMjUxZTI3NWY1ZA==
4
+ Njc4NjBkNjg1YjA0NTVlMWFlN2MzOWNhZDU4NTA1NmU1ZGY0NDI3YQ==
5
5
  data.tar.gz: !binary |-
6
- YjdhOTc1MjE5ZjBiZjkzMTRkZTUzODA4MGQ2NjQzNDljYmFkY2E1Yg==
6
+ MjBhMzVmOGRkNDJhMmU1MTNmMjA1YTQwMGUyMzE3Mzc0MzI2NmNkNw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGIxODQ0OWE4YjYyM2IxYzU1MjIxNzE3MTViNTQ5NTllN2E4MTIyYTIzOTQ5
10
- MjMxZmI0NTFlMDU0ZjdmNGFiOWFiNjQ5ZGE3MmMzNjAxOTJkZmU0NTM0N2My
11
- MzA0MjZiOWQ2YjJhOWNmM2RkZDNlZjFhODExMTA0ZmZkOTZiYjM=
9
+ MjhmOTU5MzMxZmE2NDBkYjRmYjZiNTFjZWYzODc5YTFhYzU2YzhjMDlkZTM5
10
+ MDNiNWZlYzlmNzM4YTFmYTkwOGM4MzU0MzQ4NjhjZGM4NTI4ZDhkNDQ2Zjdh
11
+ YjNjYTYwMGNkYTNmNzg0YjA0MDRmYTkxYTU5N2ZmNGJlZjgzZjk=
12
12
  data.tar.gz: !binary |-
13
- OWRlN2UwNmJjM2YxMmIxZjRkMmFhYjFjYjE3N2RlOWViYTc1MjY5Nzg3N2Q4
14
- M2RhODFjOGFkYjJmMDEwZDNhYjc1OTgxM2EzYmMwMTVjMWY2OGJiOGIwNmJl
15
- YTg2ZWNkMjE4ZTEyZGM2NmRjYjNmYjM0NGU1NmJmYzEyODAyOWE=
13
+ YjM2M2Q1MGJlNTNlZTJiMGZmMDk4NWI1ZjQxODIyNzI0YTBmMWQ0OThlNWQ2
14
+ MjFlYWMxZGJjMjAwMGI3ZjY4Mjc0ZGRmYTU2YjZlNWU4ZjA1YjIzYzllZDdi
15
+ MDQwN2Y0NmFhMzIzZGE4N2M4MDQ4ZmE5MDQ2OWYwOGM1ZDFkMTI=
data/bin/hw_checker CHANGED
@@ -6,6 +6,6 @@ begin
6
6
  HomeWorkChecker::FileScan.new(ARGV[0], ARGV[1]).each do |name, type|
7
7
  HomeWorkChecker::Base.start(ARGV[0], ARGV[1], name, type)
8
8
  end
9
- rescue HomeWorkChecker::DirectoryExistError, HomeWorkChecker::DirectoryFormatError => error
9
+ rescue HomeWorkChecker::DirectoryExistError, HomeWorkChecker::DirectoryFormatError, RuntimeError => error
10
10
  puts error.message, error.backtrace
11
11
  end
File without changes
data/lib/hw_checker.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'nokogiri'
2
2
  require 'yaml'
3
+
3
4
  require 'hw_checker/directory_exist_error'
4
5
  require 'hw_checker/directory_format_error'
5
6
  require 'hw_checker/string'
@@ -8,6 +9,8 @@ require 'hw_checker/file_scan'
8
9
  require 'hw_checker/unarchive'
9
10
  require 'hw_checker/zip'
10
11
  require 'hw_checker/archive_result'
12
+ require 'hw_checker/code_quality'
13
+ require 'hw_checker/test_run'
11
14
  require 'hw_checker/python_code_quality'
12
15
  require 'hw_checker/python_test_run'
13
16
  require 'hw_checker/ruby_code_quality'
@@ -16,8 +19,9 @@ require 'hw_checker/ruby_test_run'
16
19
 
17
20
  module HomeWorkChecker
18
21
  def self.configurate
19
- fname = File.expand_path('./config/config.yml')
20
- hash_conf = YAML.load_file fname
22
+ hwc_home = File.realpath(File.join(File.dirname(__FILE__), '..') )
23
+ config_file = File.join(hwc_home, 'config', 'default.yml')
24
+ hash_conf = YAML.load_file config_file
21
25
  archive_types, language_types, module_types = hash_conf['archives'].split(' '), {}, {}
22
26
  hash_conf['languages'].each do |key, value|
23
27
  language_types[key] = value
@@ -0,0 +1,9 @@
1
+ module HomeWorkChecker
2
+ module ArchiveResult
3
+ class CodeQuality
4
+ def perform
5
+ raise RuntimeError, 'Should be redefined in hereditary classes'
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,6 +1,6 @@
1
1
  module HomeWorkChecker
2
2
  module ArchiveResult
3
- class PythonCodeQuality
3
+ class PythonCodeQuality < CodeQuality
4
4
  def initialize(tmp_path, dirname)
5
5
  @work_path = "#{tmp_path}/#{dirname}/tests/statistic"
6
6
  raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
@@ -18,17 +18,14 @@ module HomeWorkChecker
18
18
  end
19
19
 
20
20
  def calc_percent_quality(filename)
21
- =begin
22
- rake = ((`tail -n 75 #{filename}`).scan(/\d{1,2}\.\d{1,2}\\/).shift.to_f)
23
- if rake > 10
24
- (rake / 10).round(2)
25
- else
26
- (rake * 10).round(2)
27
- end
28
- =end
29
21
  File.open(filename).each_line do |line|
30
22
  next unless line.match(/^Your\scode\shas\sbeen\srated\sat/)
31
- return ( line.scan(/[\d\.]+/).shift.to_f * 10 )
23
+ rake = line.scan(/[\d\.]+/).shift.to_f
24
+ if rake > 10
25
+ return (rake / 10).round(2)
26
+ else
27
+ return (rake * 10).round(2)
28
+ end
32
29
  end
33
30
  end
34
31
  end
@@ -1,6 +1,6 @@
1
1
  module HomeWorkChecker
2
2
  module ArchiveResult
3
- class PythonTestRun
3
+ class PythonTestRun < TestRun
4
4
  def initialize(tmp_path, dirname)
5
5
  @work_path = "#{tmp_path}/#{dirname}/tests/application"
6
6
  raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
@@ -1,6 +1,6 @@
1
1
  module HomeWorkChecker
2
2
  module ArchiveResult
3
- class RubyCodeQuality
3
+ class RubyCodeQuality < CodeQuality
4
4
  def initialize(tmp_path, dirname)
5
5
  @work_path = "#{tmp_path}/#{dirname}"
6
6
  raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
@@ -1,6 +1,6 @@
1
1
  module HomeWorkChecker
2
2
  module ArchiveResult
3
- class RubyTestRun
3
+ class RubyTestRun < TestRun
4
4
  def initialize(tmp_path, dirname)
5
5
  @work_path = "#{tmp_path}/#{dirname}/test"
6
6
  raise DirectoryExistError, "Archive '#{dirname}' is invalid" unless Dir::exist?(@work_path)
@@ -0,0 +1,9 @@
1
+ module HomeWorkChecker
2
+ module ArchiveResult
3
+ class TestRun
4
+ def perform
5
+ raise RuntimeError, 'Should be redefined in hereditary classes'
6
+ end
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hw_checker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.4
4
+ version: 1.4.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lv-LAMP-085
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-20 00:00:00.000000000 Z
11
+ date: 2013-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 0.7.2
33
+ version: 0.8.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 0.7.2
40
+ version: 0.8.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,6 +58,8 @@ executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
60
  files:
61
+ - lib/hw_checker/test_run.rb
62
+ - lib/hw_checker/code_quality.rb
61
63
  - lib/hw_checker/python_test_run.rb
62
64
  - lib/hw_checker/ruby_test_run.rb
63
65
  - lib/hw_checker/string.rb
@@ -73,7 +75,7 @@ files:
73
75
  - lib/hw_checker.rb
74
76
  - bin/hw_checker
75
77
  - spec/spec_helper.rb
76
- - config/config.yml
78
+ - config/default.yml
77
79
  homepage:
78
80
  licenses: []
79
81
  metadata: {}