jeka 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +55 -2
  3. data/README.rdoc +6 -14
  4. data/VERSION +1 -1
  5. data/bin/jeka +64 -94
  6. data/jeka.gemspec +56 -28
  7. data/lib/jeka.rb +6 -4
  8. data/lib/jeka/algorithm.rb +106 -24
  9. data/lib/jeka/analysis.rb +15 -0
  10. data/lib/jeka/analysis/algorithm.rb +13 -0
  11. data/lib/jeka/analysis/compiler.rb +14 -0
  12. data/lib/jeka/analysis/compiler_option.rb +24 -0
  13. data/lib/jeka/analysis/database.rb +11 -0
  14. data/lib/jeka/analysis/implementation.rb +15 -0
  15. data/lib/jeka/analysis/implementation_information.rb +24 -0
  16. data/lib/jeka/analysis/result.rb +20 -0
  17. data/lib/jeka/analysis/source_file.rb +24 -0
  18. data/lib/jeka/analysis/test.rb +15 -0
  19. data/lib/jeka/analysis/test_case.rb +13 -0
  20. data/lib/jeka/compilers.rb +3 -0
  21. data/lib/jeka/compilers/compiler.rb +48 -0
  22. data/lib/jeka/compilers/gpp.rb +29 -0
  23. data/lib/jeka/compilers/ruby.rb +21 -0
  24. data/lib/jeka/console.rb +55 -0
  25. data/lib/jeka/implementation.rb +22 -97
  26. data/lib/jeka/test.rb +15 -31
  27. data/lib/jeka/test_case.rb +41 -0
  28. data/test/bubble_sort/_tests/_test_01.rb +13 -0
  29. data/test/bubble_sort/algorithm_bubble_sort.rb +15 -0
  30. data/test/bubble_sort/cpp/_implementation.yaml +3 -0
  31. data/test/{example/01_bubble_sort/cpp/bubble.cpp → bubble_sort/cpp/bubble_sort.cpp} +9 -10
  32. data/test/bubble_sort/ruby/_implementation.yaml +3 -0
  33. data/test/{example/01_bubble_sort/ruby/bubble.rb → bubble_sort/ruby/bubble_sort.rb} +2 -5
  34. data/test/double/_tests/_test_01.rb +13 -0
  35. data/test/double/algorithm_double.rb +15 -0
  36. data/test/double/cpp/double.cpp +10 -0
  37. data/test/double/ruby/double.rb +2 -0
  38. data/test/test_algorithm.rb +25 -11
  39. data/test/test_gpp.rb +29 -0
  40. data/test/test_implementation.rb +25 -10
  41. data/test/test_test_case.rb +21 -0
  42. metadata +94 -52
  43. data/lib/jeka/jeka_helper.rb +0 -16
  44. data/lib/jeka/make.rb +0 -103
  45. data/test/example/01_bubble_sort/_algorithm.yaml +0 -12
  46. data/test/example/01_bubble_sort/_description.textile +0 -1
  47. data/test/example/01_bubble_sort/_references.textile +0 -1
  48. data/test/example/01_bubble_sort/_tests/test_01.yaml +0 -3
  49. data/test/example/01_bubble_sort/_tests/test_02.yaml +0 -3
  50. data/test/example/01_bubble_sort/cpp/_implementation.yaml +0 -9
  51. data/test/example/01_bubble_sort/ruby/_implementation.yaml +0 -6
  52. data/test/site/algorithm.textile +0 -27
  53. data/test/site/cpp.textile +0 -46
  54. data/test/site/ruby.textile +0 -28
  55. data/test/test_make.rb +0 -34
  56. data/test/test_test.rb +0 -16
data/Gemfile CHANGED
@@ -2,6 +2,8 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
+ gem "dm-sqlite-adapter", ">= 0"
6
+ gem "data_mapper", ">= 0"
5
7
 
6
8
  # Add dependencies to develop your gem here.
7
9
  # Include everything needed to run rake, tests, features, etc.
@@ -10,4 +12,6 @@ group :development do
10
12
  gem "bundler", "~> 1.0.0"
11
13
  gem "jeweler", "~> 1.5.2"
12
14
  gem "rcov", ">= 0"
15
+ gem "dm-sqlite-adapter", ">= 0"
16
+ gem "data_mapper", ">= 0"
13
17
  end
data/Gemfile.lock CHANGED
@@ -1,20 +1,73 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ addressable (2.2.6)
5
+ bcrypt-ruby (2.1.4)
6
+ data_mapper (1.1.0)
7
+ dm-aggregates (= 1.1.0)
8
+ dm-constraints (= 1.1.0)
9
+ dm-core (= 1.1.0)
10
+ dm-migrations (= 1.1.0)
11
+ dm-serializer (= 1.1.0)
12
+ dm-timestamps (= 1.1.0)
13
+ dm-transactions (= 1.1.0)
14
+ dm-types (= 1.1.0)
15
+ dm-validations (= 1.1.0)
16
+ data_objects (0.10.6)
17
+ addressable (~> 2.1)
18
+ dm-aggregates (1.1.0)
19
+ dm-core (~> 1.1.0)
20
+ dm-constraints (1.1.0)
21
+ dm-core (~> 1.1.0)
22
+ dm-core (1.1.0)
23
+ addressable (~> 2.2.4)
24
+ dm-do-adapter (1.1.0)
25
+ data_objects (~> 0.10.2)
26
+ dm-core (~> 1.1.0)
27
+ dm-migrations (1.1.0)
28
+ dm-core (~> 1.1.0)
29
+ dm-serializer (1.1.0)
30
+ dm-core (~> 1.1.0)
31
+ fastercsv (~> 1.5.4)
32
+ json (~> 1.4.6)
33
+ dm-sqlite-adapter (1.1.0)
34
+ dm-do-adapter (~> 1.1.0)
35
+ do_sqlite3 (~> 0.10.2)
36
+ dm-timestamps (1.1.0)
37
+ dm-core (~> 1.1.0)
38
+ dm-transactions (1.1.0)
39
+ dm-core (~> 1.1.0)
40
+ dm-types (1.1.0)
41
+ bcrypt-ruby (~> 2.1.4)
42
+ dm-core (~> 1.1.0)
43
+ fastercsv (~> 1.5.4)
44
+ json (~> 1.4.6)
45
+ stringex (~> 1.2.0)
46
+ uuidtools (~> 2.1.2)
47
+ dm-validations (1.1.0)
48
+ dm-core (~> 1.1.0)
49
+ do_sqlite3 (0.10.6)
50
+ data_objects (= 0.10.6)
51
+ fastercsv (1.5.4)
4
52
  git (1.2.5)
5
53
  jeweler (1.5.2)
6
54
  bundler (~> 1.0.0)
7
55
  git (>= 1.2.5)
8
56
  rake
9
- rake (0.8.7)
10
- rcov (0.9.9)
57
+ json (1.4.6)
58
+ rake (0.9.2)
59
+ rcov (0.9.10)
11
60
  shoulda (2.11.3)
61
+ stringex (1.2.2)
62
+ uuidtools (2.1.2)
12
63
 
13
64
  PLATFORMS
14
65
  ruby
15
66
 
16
67
  DEPENDENCIES
17
68
  bundler (~> 1.0.0)
69
+ data_mapper
70
+ dm-sqlite-adapter
18
71
  jeweler (~> 1.5.2)
19
72
  rcov
20
73
  shoulda
data/README.rdoc CHANGED
@@ -1,8 +1,8 @@
1
- = Jeka v0.1.0
1
+ = Jeka v0.2.0
2
2
 
3
3
  Jeka is an awesome build/test/benchmarking tool.
4
4
 
5
- It uses Jekyll (https://github.com/mojombo/jekyll) to create a website with informations about algorithms.
5
+ This new version changed a lot! Now, Jeka generates a database containing information about your algorithms and in the future, you will be able to do any kind of analysis you want with the help of plugins.
6
6
 
7
7
  == Applications
8
8
 
@@ -12,25 +12,17 @@ It uses Jekyll (https://github.com/mojombo/jekyll) to create a website with info
12
12
 
13
13
  == Creating a Jeka Repository
14
14
 
15
- See an example here[link:https://github.com/igorbonadio/jeka/tree/master/test/example]
15
+ See an example here[link:https://github.com/igorbonadio/jeka/tree/master/test/bubble_sort]
16
16
 
17
17
  == Using
18
18
 
19
19
  Building a Jeka repository:
20
20
 
21
- $ jeka build <dir>
21
+ $ jeka build "your_repository_folder/**/algorithm_*.rb"
22
22
 
23
- Testing implementations:
23
+ Running implementations:
24
24
 
25
- $ jeka test <dir>
26
-
27
- Benchmarking implementations:
28
-
29
- $ jeka benchmark <dir>
30
-
31
- Creating a Jekyll site:
32
-
33
- $ jeka site <dir>
25
+ $ jeka run "your_repository_folder/**/algorithm_*.rb" # it will generate a sqlite3 database named 'analysis.jeka'
34
26
 
35
27
  == For the future
36
28
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
data/bin/jeka CHANGED
@@ -1,117 +1,87 @@
1
1
  #!/usr/bin/env ruby
2
- # encoding: utf-8
3
2
 
4
- require File.join(File.expand_path(File.dirname(__FILE__)), '/../lib/jeka')
5
- require 'uri'
3
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ require 'jeka'
6
6
 
7
- def help
8
- puts "Usage: p-lang [option] folder"
9
- puts " options:"
10
- puts " build"
11
- puts " test"
12
- puts " benchmark"
13
- puts " site"
14
- puts " Example:"
15
- puts " jeka build test/example/01_bubble_sort/"
16
- end
17
-
18
- def init(folder)
19
- jeka_dir = Dir.new(folder)
20
- jeka_dir.each do |d|
21
- dir = File.join(folder, d)
22
- if (File.directory?(dir) and d != "." and d != "..")
23
- yield dir
24
- end
7
+ def build(files)
8
+ Dir.glob(files).each do |d|
9
+ require File.join(File.join(Dir.getwd, d))
25
10
  end
26
- end
27
-
28
- def build(folder)
29
- init(folder) do |dir|
30
- begin
31
- make = Jeka::Make.new(dir)
32
- puts "[build] #{dir}"
33
- make.build
34
- rescue
11
+
12
+ error = false
13
+ Jeka::Algorithm.build_all do |p, t, o|
14
+ case t
15
+ when :step
16
+ p = p.to_s
17
+ while p.length < 3
18
+ p = " " + p
19
+ end
20
+ puts "[#{p}%] #{o}"
21
+ when :output
22
+ o = o.join
23
+ if o.length > 0
24
+ puts o
25
+ end
26
+ when :error
27
+ o = o.join
28
+ if o.length > 0
29
+ puts o
30
+ end
31
+ error = true
32
+ when :done
33
+ if error
34
+ puts "[100%] Some error occurs..."
35
+ else
36
+ puts "[100%] Done!"
37
+ end
35
38
  end
36
- build(dir)
37
39
  end
38
40
  end
39
41
 
40
- def test(folder)
41
- init(folder) do |dir|
42
- begin
43
- make = Jeka::Make.new(dir)
44
- make.test do |i, t, r|
45
- ok = "error"
46
- ok = "ok" if r
47
- puts "[test] #{i.algorithm.name} - #{i.language} - #{t.name}: #{ok}"
48
- end
49
- rescue
50
- end
51
- test(dir)
42
+ def run(files)
43
+ Dir.glob(files).each do |d|
44
+ require File.join(File.join(Dir.getwd, d))
52
45
  end
53
- end
54
-
55
- def benchmark(folder)
56
- init(folder) do |dir|
57
- begin
58
- ok = false
59
- make = Jeka::Make.new(dir)
60
- print "[benchmark] #{dir}... "
61
- ok = true
62
- make.benchmark(10)
63
- puts "ok"
64
- rescue
65
- puts "error" if ok
46
+
47
+ error = false
48
+ Jeka::Algorithm.run_all do |p, t, o|
49
+ case t
50
+ when :step
51
+ p = p.to_s
52
+ while p.length < 3
53
+ p = " " + p
54
+ end
55
+ puts "[#{p}%] #{o}"
56
+ when :error
57
+ o = o.join
58
+ if o.length > 0
59
+ puts o
60
+ end
61
+ error = true
62
+ when :done
63
+ if error
64
+ puts "[100%] Some error occurs..."
65
+ else
66
+ puts "[100%] Done!"
67
+ end
66
68
  end
67
- benchmark(dir)
68
69
  end
69
70
  end
70
71
 
71
- def site(folder)
72
- build(folder)
73
- benchmark(folder)
74
-
75
- Dir.mkdir("_jeka") unless Dir.exists?("_jeka")
76
- Dir.mkdir("_jeka/algorithms") unless Dir.exists?("_jeka/algorithms")
77
- Dir.mkdir("_jeka/algorithms/_posts") unless Dir.exists?("_jeka/algorithms/_posts")
78
- Dir.mkdir("_jeka/implementations/") unless Dir.exists?("_jeka/implementations/")
79
- Dir.mkdir("_jeka/implementations/_posts") unless Dir.exists?("_jeka/implementations/_posts")
80
-
81
- _site(folder)
82
- end
83
-
84
- def _site(folder)
85
- init(folder) do |dir|
86
- begin
87
- make = Jeka::Make.new(dir)
88
- puts "[site] #{dir}"
89
- algorithm, implementations = make.generate_site
90
- falgorithm = File.new(File.join("_jeka/algorithms/_posts", "2011-01-01-#{algorithm[0].name.gsub(" ", "_")}.textile"), "w")
91
- falgorithm.write(algorithm[1])
92
- implementations.each do |imp|
93
- fimplementation = File.new(File.join("_jeka/implementations/_posts", "2011-01-01-#{imp[0].comment.gsub(" ", "_")}.textile"), "w")
94
- fimplementation.write(imp[1])
95
- end
96
- rescue
97
- end
98
- _site(dir)
99
- end
72
+ def help
73
+ puts "usage: jeka [build|run] [regexp|file|dir]"
100
74
  end
101
75
 
102
76
  if ARGV.length == 2
103
77
  case ARGV[0]
104
78
  when "build"
105
79
  build(ARGV[1])
106
- when "test"
107
- test(ARGV[1])
108
- when "benchmark"
109
- benchmark(ARGV[1])
110
- when "site"
111
- site(ARGV[1])
80
+ when "run"
81
+ run(ARGV[1])
112
82
  else
113
- help
83
+ help()
114
84
  end
115
85
  else
116
- help
86
+ help()
117
87
  end
data/jeka.gemspec CHANGED
@@ -5,15 +5,14 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jeka}
8
- s.version = "0.1.1"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Igor Bonadio"]
12
- s.date = %q{2011-07-16}
13
- s.default_executable = %q{jeka}
11
+ s.authors = [%q{Igor Bonadio}]
12
+ s.date = %q{2011-09-18}
14
13
  s.description = %q{Jeka is an awesome build/test/benchmarking tool}
15
14
  s.email = %q{igorbonadio@gmail.com}
16
- s.executables = ["jeka"]
15
+ s.executables = [%q{jeka}]
17
16
  s.extra_rdoc_files = [
18
17
  "LICENSE.txt",
19
18
  "README.rdoc"
@@ -30,62 +29,91 @@ Gem::Specification.new do |s|
30
29
  "jeka.gemspec",
31
30
  "lib/jeka.rb",
32
31
  "lib/jeka/algorithm.rb",
32
+ "lib/jeka/analysis.rb",
33
+ "lib/jeka/analysis/algorithm.rb",
34
+ "lib/jeka/analysis/compiler.rb",
35
+ "lib/jeka/analysis/compiler_option.rb",
36
+ "lib/jeka/analysis/database.rb",
37
+ "lib/jeka/analysis/implementation.rb",
38
+ "lib/jeka/analysis/implementation_information.rb",
39
+ "lib/jeka/analysis/result.rb",
40
+ "lib/jeka/analysis/source_file.rb",
41
+ "lib/jeka/analysis/test.rb",
42
+ "lib/jeka/analysis/test_case.rb",
43
+ "lib/jeka/compilers.rb",
44
+ "lib/jeka/compilers/compiler.rb",
45
+ "lib/jeka/compilers/gpp.rb",
46
+ "lib/jeka/compilers/ruby.rb",
47
+ "lib/jeka/console.rb",
33
48
  "lib/jeka/implementation.rb",
34
- "lib/jeka/jeka_helper.rb",
35
- "lib/jeka/make.rb",
36
49
  "lib/jeka/test.rb",
37
- "test/example/01_bubble_sort/_algorithm.yaml",
38
- "test/example/01_bubble_sort/_description.textile",
39
- "test/example/01_bubble_sort/_references.textile",
40
- "test/example/01_bubble_sort/_tests/test_01.yaml",
41
- "test/example/01_bubble_sort/_tests/test_02.yaml",
42
- "test/example/01_bubble_sort/cpp/_implementation.yaml",
43
- "test/example/01_bubble_sort/cpp/bubble.cpp",
44
- "test/example/01_bubble_sort/ruby/_implementation.yaml",
45
- "test/example/01_bubble_sort/ruby/bubble.rb",
50
+ "lib/jeka/test_case.rb",
51
+ "test/bubble_sort/_tests/_test_01.rb",
52
+ "test/bubble_sort/algorithm_bubble_sort.rb",
53
+ "test/bubble_sort/cpp/_implementation.yaml",
54
+ "test/bubble_sort/cpp/bubble_sort.cpp",
55
+ "test/bubble_sort/ruby/_implementation.yaml",
56
+ "test/bubble_sort/ruby/bubble_sort.rb",
57
+ "test/double/_tests/_test_01.rb",
58
+ "test/double/algorithm_double.rb",
59
+ "test/double/cpp/double.cpp",
60
+ "test/double/ruby/double.rb",
46
61
  "test/helper.rb",
47
- "test/site/algorithm.textile",
48
- "test/site/cpp.textile",
49
- "test/site/ruby.textile",
50
62
  "test/test_algorithm.rb",
63
+ "test/test_gpp.rb",
51
64
  "test/test_implementation.rb",
52
- "test/test_make.rb",
53
- "test/test_test.rb"
65
+ "test/test_test_case.rb"
54
66
  ]
55
67
  s.homepage = %q{http://github.com/igorbonadio/jeka}
56
- s.licenses = ["MIT"]
57
- s.require_paths = ["lib"]
58
- s.rubygems_version = %q{1.3.7}
68
+ s.licenses = [%q{MIT}]
69
+ s.require_paths = [%q{lib}]
70
+ s.rubygems_version = %q{1.8.9}
59
71
  s.summary = %q{Jeka is an awesome build/test/benchmarking tool}
60
72
  s.test_files = [
61
- "test/example/01_bubble_sort/ruby/bubble.rb",
73
+ "test/bubble_sort/_tests/_test_01.rb",
74
+ "test/bubble_sort/algorithm_bubble_sort.rb",
75
+ "test/bubble_sort/ruby/bubble_sort.rb",
76
+ "test/double/_tests/_test_01.rb",
77
+ "test/double/algorithm_double.rb",
78
+ "test/double/ruby/double.rb",
62
79
  "test/helper.rb",
63
80
  "test/test_algorithm.rb",
81
+ "test/test_gpp.rb",
64
82
  "test/test_implementation.rb",
65
- "test/test_make.rb",
66
- "test/test_test.rb"
83
+ "test/test_test_case.rb"
67
84
  ]
68
85
 
69
86
  if s.respond_to? :specification_version then
70
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
71
87
  s.specification_version = 3
72
88
 
73
89
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
90
+ s.add_runtime_dependency(%q<dm-sqlite-adapter>, [">= 0"])
91
+ s.add_runtime_dependency(%q<data_mapper>, [">= 0"])
74
92
  s.add_development_dependency(%q<shoulda>, [">= 0"])
75
93
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
76
94
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
77
95
  s.add_development_dependency(%q<rcov>, [">= 0"])
96
+ s.add_development_dependency(%q<dm-sqlite-adapter>, [">= 0"])
97
+ s.add_development_dependency(%q<data_mapper>, [">= 0"])
78
98
  else
99
+ s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
100
+ s.add_dependency(%q<data_mapper>, [">= 0"])
79
101
  s.add_dependency(%q<shoulda>, [">= 0"])
80
102
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
81
103
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
82
104
  s.add_dependency(%q<rcov>, [">= 0"])
105
+ s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
106
+ s.add_dependency(%q<data_mapper>, [">= 0"])
83
107
  end
84
108
  else
109
+ s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
110
+ s.add_dependency(%q<data_mapper>, [">= 0"])
85
111
  s.add_dependency(%q<shoulda>, [">= 0"])
86
112
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
87
113
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
88
114
  s.add_dependency(%q<rcov>, [">= 0"])
115
+ s.add_dependency(%q<dm-sqlite-adapter>, [">= 0"])
116
+ s.add_dependency(%q<data_mapper>, [">= 0"])
89
117
  end
90
118
  end
91
119