diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..3ef8ff9 --- /dev/null +++ b/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in ruby_gnuplot.gemspec +gemspec diff --git a/Rakefile b/Rakefile index d8ae9ee..bc3514b 100644 --- a/Rakefile +++ b/Rakefile @@ -1,21 +1,23 @@ -require 'jeweler2' -Jeweler::Tasks.new do |s| - s.name = 'gnuplot' - s.description = s.summary = "Utility library to aid in interacting with gnuplot from ruby" - s.version = "2.6.1" - s.authors='roger pack' - s.email = "rogerpack2005@gmail.com" - s.homepage = "http://github.com/rdp/ruby_gnuplot/tree/master" -end +require "bundler/gem_tasks" +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require 'rubygems/package_task' -task :default => :test +require_relative 'lib/ruby_gnuplot/version' desc 'run unit tests' -task :test do - Dir.chdir 'test' - for file in Dir['*'] - system("ruby #{file}") - end +task :default => :test + +Rake::TestTask.new do |t| + t.libs << "lib" << 'spec/support' + t.test_files = FileList['test/**/*.rb'] + t.verbose = false + t.warning = false +end + +def gemspec + @clean_gemspec ||= eval(File.read(File.expand_path('../ruby_gnuplot.gemspec', __FILE__))) end -Jeweler::RubygemsDotOrgTasks.new \ No newline at end of file +Gem::PackageTask.new(gemspec) { |pkg| } diff --git a/lib/ruby_gnuplot/version.rb b/lib/ruby_gnuplot/version.rb new file mode 100644 index 0000000..ba6c60b --- /dev/null +++ b/lib/ruby_gnuplot/version.rb @@ -0,0 +1,3 @@ +module RubyGnuplot + VERSION = "2.6.1" +end diff --git a/ruby_gnuplot.gemspec b/ruby_gnuplot.gemspec new file mode 100644 index 0000000..c9cf609 --- /dev/null +++ b/ruby_gnuplot.gemspec @@ -0,0 +1,21 @@ +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'ruby_gnuplot/version' + +Gem::Specification.new do |s| + s.name = 'gnuplot' + s.description = s.summary = "Utility library to aid in interacting with gnuplot from ruby" + s.version = RubyGnuplot::VERSION + s.authors='roger pack' + s.email = "rogerpack2005@gmail.com" + s.homepage = "http://github.com/rdp/ruby_gnuplot/tree/master" + s.license = "BSD" + + s.files = `git ls-files`.split($/) + s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) } + s.test_files = s.files.grep(%r{^(test|spec|features)/}) + s.require_paths = ["lib"] + + s.add_development_dependency 'minitest' +end diff --git a/test/arrtest.rb b/test/arrtest.rb index 208072c..00a95a3 100644 --- a/test/arrtest.rb +++ b/test/arrtest.rb @@ -1,12 +1,12 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.title "Array Plot Example" plot.ylabel "x" plot.xlabel "x^2" - + x = (0..50).collect { |v| v.to_f } y = x.collect { |v| v ** 2 } @@ -14,8 +14,8 @@ ds.with = "linespoints" ds.notitle end - + end - + end - + diff --git a/test/histtest.rb b/test/histtest.rb index dd09e24..d90bc0d 100644 --- a/test/histtest.rb +++ b/test/histtest.rb @@ -1,4 +1,4 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| gp << "bin(x, s) = s*int(x/s)\n" @@ -10,7 +10,7 @@ x = (0..500).collect { |v| (rand()-0.5)**3 } plot.data << Gnuplot::DataSet.new( [x] ) do |ds| - ds.title = "smooth frequency" + ds.title = "smooth frequency" ds.using = "(bin($1,.01)):(1.)" ds.smooth = "freq" ds.with = "boxes" diff --git a/test/multtest.rb b/test/multtest.rb index 1aeb1d5..3bf4983 100644 --- a/test/multtest.rb +++ b/test/multtest.rb @@ -1,14 +1,14 @@ -require '../lib/gnuplot' +require 'gnuplot' # File.open( "gnuplot.dat", "w") do |gp| Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.xrange "[-10:10]" plot.title "Sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" - + x = (0..50).collect { |v| v.to_f } y = x.collect { |v| v ** 2 } @@ -18,7 +18,7 @@ ds.title = "String function" ds.linewidth = 4 }, - + Gnuplot::DataSet.new( [x, y] ) { |ds| ds.with = "linespoints" ds.title = "Array data" @@ -26,6 +26,6 @@ ] end - + end - + diff --git a/test/sinwave.rb b/test/sinwave.rb index f7e7131..78db32e 100644 --- a/test/sinwave.rb +++ b/test/sinwave.rb @@ -1,19 +1,19 @@ -require '../lib/gnuplot' +require 'gnuplot' Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| - + plot.xrange "[-10:10]" plot.title "Sin Wave Example" plot.ylabel "x" plot.xlabel "sin(x)" - + plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds| ds.with = "lines" ds.linewidth = 4 end - + end - + end - + diff --git a/test/test_gnuplot.rb b/test/test_gnuplot.rb index 18d8e34..19b7625 100644 --- a/test/test_gnuplot.rb +++ b/test/test_gnuplot.rb @@ -1,9 +1,9 @@ # -*- ruby -*- -require '../lib/gnuplot' -require 'test/unit' +require 'gnuplot' +require 'minitest/autorun' -class StdDataTest < Test::Unit::TestCase +class StdDataTest < MiniTest::Test def test_array_1d data = (0..5).to_a @@ -38,7 +38,7 @@ def test_array_nd end -class DataSetTest < Test::Unit::TestCase +class DataSetTest < MiniTest::Test def test_yield_ctor ds = Gnuplot::DataSet.new do |ds| @@ -58,7 +58,7 @@ def test_yield_ctor end -class PlotTest < Test::Unit::TestCase +class PlotTest < MiniTest::Test def test_no_data plot = Gnuplot::Plot.new do |p| @@ -130,7 +130,7 @@ def test_style require 'rbconfig' -CONFIG = Config::MAKEFILE_CONFIG +CONFIG = RbConfig::MAKEFILE_CONFIG # This attempts to test the functions that comprise the gnuplot package. Most # of the bug reports that I get for this package have to do with finding the