jeka 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- = Jeka v0.2.2
1
+ = Jeka v0.2.3
2
2
 
3
3
  Jeka is an awesome build/test/benchmarking tool.
4
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "jeka"
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Igor Bonadio"]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/jeka/algorithm.rb",
34
34
  "lib/jeka/analysis.rb",
35
35
  "lib/jeka/analysis/algorithm.rb",
36
+ "lib/jeka/analysis/algorithm_information.rb",
36
37
  "lib/jeka/analysis/compiler.rb",
37
38
  "lib/jeka/analysis/compiler_option.rb",
38
39
  "lib/jeka/analysis/database.rb",
@@ -17,6 +17,16 @@ module Jeka
17
17
  end
18
18
  end
19
19
 
20
+ @@information = Hash.new
21
+ def self.add_information(info)
22
+ if info.kind_of? Hash
23
+ @@information = info
24
+ else
25
+ yaml = YAML::load(File.open(info))
26
+ yaml.each_key {|key| @@information[key.to_sym] = yaml[key]}
27
+ end
28
+ end
29
+
20
30
  def self.add_tests(test_dir)
21
31
  Jeka::TestCase.reset
22
32
  Dir.glob(test_dir).each do |d|
@@ -31,10 +41,11 @@ module Jeka
31
41
  end
32
42
 
33
43
  def jekafy
34
- @database = Jeka::Analysis::Algorithm.create(
44
+ @database = Jeka::Analysis::Algorithm.create!(
35
45
  name: self.class.to_s,
36
46
  implementations: implementations.collect {|imp| imp.jekafy},
37
- test_cases: test_suites.collect {|tc| tc.jekafy}
47
+ test_cases: test_suites.collect {|tc| tc.jekafy},
48
+ algorithm_information: Jeka::Analysis::AlgorithmInformation.convert(@@information)
38
49
  )
39
50
  end
40
51
 
@@ -60,7 +71,7 @@ module Jeka
60
71
  block.call(0, :test, "#{txt}...failures")
61
72
  end
62
73
  end
63
- Jeka::Analysis::Result.create(
74
+ Jeka::Analysis::Result.create!(
64
75
  stdout: test_result[0].join,
65
76
  stderr: test_result[1].join,
66
77
  exit_status: test_result[2],
@@ -5,6 +5,7 @@ require 'dm-migrations'
5
5
 
6
6
  require File.join(ROOT_PATH, 'jeka/analysis/database')
7
7
  require File.join(ROOT_PATH, 'jeka/analysis/algorithm')
8
+ require File.join(ROOT_PATH, 'jeka/analysis/algorithm_information')
8
9
  require File.join(ROOT_PATH, 'jeka/analysis/implementation')
9
10
  require File.join(ROOT_PATH, 'jeka/analysis/implementation_information')
10
11
  require File.join(ROOT_PATH, 'jeka/analysis/compiler')
@@ -8,6 +8,7 @@ module Jeka
8
8
 
9
9
  has n, :implementations
10
10
  has n, :test_cases
11
+ has n, :algorithm_information
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,24 @@
1
+ module Jeka
2
+ module Analysis
3
+ class AlgorithmInformation
4
+ include DataMapper::Resource
5
+
6
+ property :id, Serial
7
+ property :name, String
8
+ property :value, String
9
+
10
+ belongs_to :algorithm
11
+
12
+ def self.convert(hash)
13
+ info = []
14
+ hash.each do |key, value|
15
+ info << AlgorithmInformation.new(
16
+ name: key,
17
+ value: value
18
+ )
19
+ end
20
+ info
21
+ end
22
+ end
23
+ end
24
+ end
@@ -37,7 +37,7 @@ module Jeka
37
37
  end
38
38
 
39
39
  def jekafy
40
- @database = Jeka::Analysis::Compiler.create(
40
+ @database = Jeka::Analysis::Compiler.create!(
41
41
  name: self.class.to_s,
42
42
  compiler_options: Jeka::Analysis::CompilerOption.convert(@options),
43
43
  source_files: Jeka::Analysis::SourceFile.convert(@files)
@@ -25,7 +25,7 @@ module Jeka
25
25
  end
26
26
 
27
27
  def jekafy
28
- @database = Jeka::Analysis::Implementation.create(
28
+ @database = Jeka::Analysis::Implementation.create!(
29
29
  name: @name,
30
30
  compiler: @compiler.jekafy,
31
31
  implementation_information: Jeka::Analysis::ImplementationInformation.convert(@information)
@@ -10,7 +10,7 @@ module Jeka
10
10
  end
11
11
 
12
12
  def jekafy
13
- @database = Jeka::Analysis::Test.create(
13
+ @database = Jeka::Analysis::Test.create!(
14
14
  name: @name,
15
15
  output: @output,
16
16
  input: @input
@@ -30,7 +30,7 @@ module Jeka
30
30
  end
31
31
 
32
32
  def jekafy
33
- @database = Jeka::Analysis::TestCase.create(
33
+ @database = Jeka::Analysis::TestCase.create!(
34
34
  name: self.class.to_s,
35
35
  tests: tests.collect {|t| t.jekafy}
36
36
  )
@@ -2,6 +2,10 @@ require 'helper'
2
2
 
3
3
  class TestConsole < Test::Unit::TestCase
4
4
 
5
+ def TestConsole.version
6
+ File.open(File.join(File.dirname(__FILE__), '..', 'VERSION'), "r").readlines.join
7
+ end
8
+
5
9
  def TestConsole.command(cmd)
6
10
  stdout_ = nil
7
11
  stderr_ = nil
@@ -20,14 +24,14 @@ class TestConsole < Test::Unit::TestCase
20
24
 
21
25
  should "shows help" do
22
26
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka run --help")
23
- assert_equal "jeka v0.2.1\nUsage: jeka run [options] file ...\n -n, --n-repetitions N Number of repetions\n -b, --build Number of repetions\n -o, --output O Number of repetions\n",
27
+ assert_equal "jeka v#{TestConsole.version}\nUsage: jeka run [options] file ...\n -n, --n-repetitions N Number of repetions\n -b, --build Number of repetions\n -o, --output O Number of repetions\n",
24
28
  stdout.join
25
29
  assert_equal 0, exit_status
26
30
  end
27
31
 
28
32
  should "show help" do
29
33
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka run -h")
30
- assert_equal "jeka v0.2.1\nUsage: jeka run [options] file ...\n -n, --n-repetitions N Number of repetions\n -b, --build Number of repetions\n -o, --output O Number of repetions\n",
34
+ assert_equal "jeka v#{TestConsole.version}\nUsage: jeka run [options] file ...\n -n, --n-repetitions N Number of repetions\n -b, --build Number of repetions\n -o, --output O Number of repetions\n",
31
35
  stdout.join
32
36
  assert_equal 0, exit_status
33
37
  end
@@ -35,7 +39,7 @@ class TestConsole < Test::Unit::TestCase
35
39
  should "run algorithms" do
36
40
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka build 'test/**/algorithm_*.rb'")
37
41
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka run 'test/**/algorithm_*.rb'")
38
- assert_equal "jeka v0.2.1\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
42
+ assert_equal "jeka v#{TestConsole.version}\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
39
43
  stdout.join
40
44
  assert_equal 0, exit_status
41
45
  end
@@ -43,14 +47,14 @@ class TestConsole < Test::Unit::TestCase
43
47
  should "run algorithms 3 times" do
44
48
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka build 'test/**/algorithm_*.rb'")
45
49
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka run -n 3 'test/**/algorithm_*.rb'")
46
- assert_equal "jeka v0.2.1\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
50
+ assert_equal "jeka v#{TestConsole.version}\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
47
51
  stdout.join
48
52
  assert_equal 0, exit_status
49
53
  end
50
54
 
51
55
  should "run and build algorithms" do
52
56
  stdout, stderr, exit_status = TestConsole.command("ruby bin/jeka run -b 'test/**/algorithm_*.rb'")
53
- assert_equal "jeka v0.2.1\n[ 0%] Building algorithms...\n[ 33%] Building AlgorithmBubbleSort\n[ 66%] Building AlgorithmDouble\n[100%] Done!\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
57
+ assert_equal "jeka v#{TestConsole.version}\n[ 0%] Building algorithms...\n[ 33%] Building AlgorithmBubbleSort\n[ 66%] Building AlgorithmDouble\n[100%] Done!\n[ 0%] Running algorithms...\n[ 33%] Running AlgorithmBubbleSort...\n[ 66%] Running AlgorithmDouble...\n[100%] Done!\n",
54
58
  stdout.join
55
59
  assert_equal 0, exit_status
56
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jeka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dm-sqlite-adapter
16
- requirement: &70192081814220 !ruby/object:Gem::Requirement
16
+ requirement: &70160603852100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70192081814220
24
+ version_requirements: *70160603852100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: data_mapper
27
- requirement: &70192081813120 !ruby/object:Gem::Requirement
27
+ requirement: &70160603851260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70192081813120
35
+ version_requirements: *70160603851260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &70192081811400 !ruby/object:Gem::Requirement
38
+ requirement: &70160603850560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70192081811400
46
+ version_requirements: *70160603850560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70192081810220 !ruby/object:Gem::Requirement
49
+ requirement: &70160603849820 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70192081810220
57
+ version_requirements: *70160603849820
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70192081809380 !ruby/object:Gem::Requirement
60
+ requirement: &70160603848960 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.5.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70192081809380
68
+ version_requirements: *70160603848960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70192081807700 !ruby/object:Gem::Requirement
71
+ requirement: &70160603848040 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70192081807700
79
+ version_requirements: *70160603848040
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: dm-sqlite-adapter
82
- requirement: &70192081806460 !ruby/object:Gem::Requirement
82
+ requirement: &70160603846860 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70192081806460
90
+ version_requirements: *70160603846860
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: data_mapper
93
- requirement: &70192081805780 !ruby/object:Gem::Requirement
93
+ requirement: &70160603845660 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70192081805780
101
+ version_requirements: *70160603845660
102
102
  description: Jeka is an awesome build/test/benchmarking tool
103
103
  email: igorbonadio@gmail.com
104
104
  executables:
@@ -123,6 +123,7 @@ files:
123
123
  - lib/jeka/algorithm.rb
124
124
  - lib/jeka/analysis.rb
125
125
  - lib/jeka/analysis/algorithm.rb
126
+ - lib/jeka/analysis/algorithm_information.rb
126
127
  - lib/jeka/analysis/compiler.rb
127
128
  - lib/jeka/analysis/compiler_option.rb
128
129
  - lib/jeka/analysis/database.rb
@@ -176,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
176
177
  version: '0'
177
178
  segments:
178
179
  - 0
179
- hash: -4567337074381682559
180
+ hash: -1046946649744668863
180
181
  required_rubygems_version: !ruby/object:Gem::Requirement
181
182
  none: false
182
183
  requirements: