Permalink
Browse files

Clean up code a bit

This should fix #117
  • Loading branch information...
1 parent 5dcf0f9 commit dad9fbfbfbfcfe743563348f2c17aedecfabe803 @flori committed Feb 11, 2012
Showing with 93 additions and 24,896 deletions.
  1. +1 −0 .gitignore
  2. +4 −0 CHANGES
  3. +4 −0 Gemfile
  4. +48 −58 Rakefile
  5. +1 −1 VERSION
  6. 0 benchmarks/data-p4-3GHz-ruby18/.keep
  7. +0 −52 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log
  8. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat
  9. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat
  10. +0 −900 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat
  11. +0 −901 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat
  12. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat
  13. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat
  14. +0 −261 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log
  15. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat
  16. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat
  17. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat
  18. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat
  19. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat
  20. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat
  21. +0 −262 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log
  22. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat
  23. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat
  24. +0 −82 benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log
  25. +0 −34 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log
  26. +0 −900 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat
  27. +0 −901 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat
  28. +0 −81 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log
  29. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat
  30. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat
  31. +0 −82 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log
  32. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat
  33. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat
  34. +0 −82 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log
  35. +0 −1,000 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat
  36. +0 −1,001 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat
  37. +0 −82 benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log
  38. 0 benchmarks/data/.keep
  39. +0 −222 benchmarks/generator2_benchmark.rb
  40. +0 −224 benchmarks/generator_benchmark.rb
  41. +0 −1,216 benchmarks/ohai.json
  42. +0 −1 benchmarks/ohai.ruby
  43. +0 −251 benchmarks/parser2_benchmark.rb
  44. +0 −259 benchmarks/parser_benchmark.rb
  45. +7 −3 install.rb
  46. +3 −6 json.gemspec
  47. +3 −6 json_pure.gemspec
  48. +1 −1 lib/json/version.rb
  49. +3 −3 tests/test_json.rb
  50. +18 −16 tests/test_json_generate.rb
View
@@ -8,3 +8,4 @@ Gemfile.lock
.rvmrc
*.rbc
.rbx
+.AppleDouble
View
@@ -1,3 +1,7 @@
+2012-02-11 (1.6.6)
+ * Propagate src encoding to values made from it (fixes 1.9 mode converting
+ everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo
+ <tom.enebo@gmail.com>)
2012-01-15 (1.6.5)
* Vit Ondruch <v.ondruch@tiscali.cz> reported a bug that shows up when using
optimisation under GCC 4.7. Thx to him, Bohuslav Kabrda
View
@@ -9,3 +9,7 @@ gemspec :name => 'json-java'
group :development do
gem 'simplecov', :platform => :mri_19
end
+
+group :test do
+ gem 'test-unit', '2.4.7', :platform => :mri_19
+end
View
106 Rakefile
@@ -4,21 +4,27 @@ rescue LoadError
end
require 'rbconfig'
-begin
- include RbConfig
-rescue NameError
- include Config
-end
-
+include\
+ begin
+ RbConfig
+ rescue NameError
+ Config
+ end
require 'rake/clean'
-CLOBBER.include Dir['benchmarks/data/*.{dat,log}'], 'doc', 'Gemfile.lock'
+CLOBBER.include 'doc', 'Gemfile.lock'
CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp',
FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'],
FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class,dSYM}"],
FileList['java/src/**/*.class']
-MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
+require 'rake/testtask'
+class UndocumentedTestTask < Rake::TestTask
+ def desc(*) end
+end
+
+MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') }
+BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') }
PKG_NAME = 'json'
PKG_TITLE = 'JSON Implementation for Ruby'
PKG_VERSION = File.read('VERSION').chomp
@@ -44,19 +50,9 @@ JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') }
RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') }
-def myruby(*args, &block)
- @myruby ||= File.join(CONFIG['bindir'], CONFIG['ruby_install_name'])
- options = (Hash === args.last) ? args.pop : {}
- if args.length > 1 then
- sh(*([@myruby] + args + [options]), &block)
- else
- sh("#{@myruby} #{args.first}", options, &block)
- end
-end
-
desc "Installing library (pure)"
task :install_pure => :version do
- myruby 'install.rb'
+ ruby 'install.rb'
end
task :install_ext_really do
@@ -75,11 +71,7 @@ desc "Installing library (extension)"
task :install_ext => [ :compile, :install_pure, :install_ext_really ]
desc "Installing library (extension)"
-if RUBY_PLATFORM =~ /java/
- task :install => :install_pure
-else
- task :install => :install_ext
-end
+task :install => :install_ext
if defined?(Gem) and defined?(Gem::PackageTask)
spec_pure = Gem::Specification.new do |s|
@@ -92,7 +84,6 @@ if defined?(Gem) and defined?(Gem::PackageTask)
s.require_path = 'lib'
s.add_development_dependency 'permutation'
- s.add_development_dependency 'bullshit'
s.add_development_dependency 'sdoc'
s.add_development_dependency 'rake', '~>0.9.2'
@@ -133,7 +124,6 @@ if defined?(Gem) and defined?(Gem::PackageTask)
s.require_paths << 'ext'
s.require_paths << 'lib'
s.add_development_dependency 'permutation'
- s.add_development_dependency 'bullshit'
s.add_development_dependency 'sdoc'
s.extra_rdoc_files << 'README.rdoc'
@@ -182,18 +172,26 @@ EOT
end
desc "Testing library (pure ruby)"
-task :test_pure => :clean do
- ENV['JSON'] = 'pure'
- ENV['RUBYOPT'] = "-Ilib #{ENV['RUBYOPT']}"
- myruby '-S', 'testrb', *Dir['./tests/test_*.rb']
+task :test_pure => [ :clean, :do_test_pure ]
+
+UndocumentedTestTask.new do |t|
+ t.name = 'do_test_pure'
+ t.libs << 'lib'
+ t.test_files = FileList['tests/test_*.rb']
+ t.verbose = true
+ t.options = '-v'
end
desc "Testing library (pure ruby and extension)"
-task :test => [ :test_pure, :test_ext ]
+task :test do
+ sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1
+ sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1
+end
namespace :gems do
+ desc 'Install all development gems'
task :install do
- sh 'bundle'
+ sh "#{BUNDLE}"
end
end
@@ -250,9 +248,14 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
end
desc "Testing library (jruby)"
- task :test_ext => :create_jar do
- ENV['JSON'] = 'ext'
- myruby '-S', 'testrb', '-Ilib', *Dir['./tests/test_*.rb']
+ task :test_ext => [ :create_jar, :do_test_ext ]
+
+ UndocumentedTestTask.new do |t|
+ t.name = 'do_test_ext'
+ t.libs << 'lib'
+ t.test_files = FileList['tests/test_*.rb']
+ t.verbose = true
+ t.options = '-v'
end
file JRUBY_PARSER_JAR => :compile do
@@ -304,44 +307,31 @@ else
file EXT_PARSER_DL => EXT_PARSER_SRC do
cd EXT_PARSER_DIR do
- myruby 'extconf.rb'
+ ruby 'extconf.rb'
sh MAKE
end
cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
end
file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do
cd EXT_GENERATOR_DIR do
- myruby 'extconf.rb'
+ ruby 'extconf.rb'
sh MAKE
end
cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR
end
desc "Testing library (extension)"
- task :test_ext => :compile do
- ENV['JSON'] = 'ext'
- ENV['RUBYOPT'] = "-Iext:lib #{ENV['RUBYOPT']}"
- myruby '-S', 'testrb', *Dir['./tests/test_*.rb']
+ task :test_ext => [ :compile, :do_test_ext ]
+
+ UndocumentedTestTask.new do |t|
+ t.name = 'do_test_ext'
+ t.libs << 'ext' << 'lib'
+ t.test_files = FileList['tests/test_*.rb']
+ t.verbose = true
+ t.options = '-v'
end
- desc "Benchmarking parser"
- task :benchmark_parser do
- ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
- myruby 'benchmarks/parser_benchmark.rb'
- myruby 'benchmarks/parser2_benchmark.rb'
- end
-
- desc "Benchmarking generator"
- task :benchmark_generator do
- ENV['RUBYOPT'] = "-Ilib:ext #{ENV['RUBYOPT']}"
- myruby 'benchmarks/generator_benchmark.rb'
- myruby 'benchmarks/generator2_benchmark.rb'
- end
-
- desc "Benchmarking library"
- task :benchmark => [ :benchmark_parser, :benchmark_generator ]
-
desc "Create RDOC documentation"
task :doc => [ :version, EXT_PARSER_SRC ] do
sh "sdoc -o doc -t '#{PKG_TITLE}' -m README.rdoc README.rdoc lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}"
View
@@ -1 +1 @@
-1.6.5
+1.6.6
No changes.
@@ -1,52 +0,0 @@
-========================== 2009-04-01T16:54:14 CEST ===========================
-
-Comparing times (call_time_mean):
- 1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
- 547.354332608 ( real) -> 15.090x
- 0.001826970
- 2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
- 443.968212317 ( real) -> 12.240x
- 0.002252414
- 3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
- 375.104545883 ( real) -> 10.341x
- 0.002665923
- 4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
- 49.978706968 ( real) -> 1.378x
- 0.020008521
- 5 GeneratorBenchmarkRails#generator 1000 repeats:
- 38.531868759 ( real) -> 1.062x
- 0.025952543
- 6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
- 36.927649925 ( real) -> 1.018x 7 (>=3859)
- 0.027079979
- 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
- 36.272134441 ( real) -> 1.000x 6 (>=3859)
- 0.027569373
- calls/sec ( time) -> speed covers
- secs/call
-
-Comparing times (call_time_median):
- 1 GeneratorBenchmarkExt#generator_fast 1000 repeats:
- 708.258020939 ( real) -> 16.547x
- 0.001411915
- 2 GeneratorBenchmarkExt#generator_safe 1000 repeats:
- 569.105020353 ( real) -> 13.296x
- 0.001757145
- 3 GeneratorBenchmarkExt#generator_pretty 900 repeats:
- 482.825371244 ( real) -> 11.280x
- 0.002071142
- 4 GeneratorBenchmarkPure#generator_fast 1000 repeats:
- 62.717626652 ( real) -> 1.465x
- 0.015944481
- 5 GeneratorBenchmarkRails#generator 1000 repeats:
- 43.965681162 ( real) -> 1.027x
- 0.022745013
- 6 GeneratorBenchmarkPure#generator_safe 1000 repeats:
- 43.929073409 ( real) -> 1.026x 7 (>=3859)
- 0.022763968
- 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats:
- 42.802514491 ( real) -> 1.000x 6 (>=3859)
- 0.023363113
- calls/sec ( time) -> speed covers
- secs/call
-===============================================================================
Oops, something went wrong.

0 comments on commit dad9fbf

Please sign in to comment.