File tree 9 files changed +72
-42
lines changed 9 files changed +72
-42
lines changed Original file line number Diff line number Diff line change
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ruby_gnuplot.gemspec
4
+ gemspec
Original file line number Diff line number Diff line change 1
- require 'jeweler2'
2
- Jeweler ::Tasks . new do |s |
3
- s . name = 'gnuplot'
4
- s . description = s . summary = "Utility library to aid in interacting with gnuplot from ruby"
5
- s . version = "2.6.1"
6
- s . authors = 'roger pack'
7
-
8
- s . homepage = "http://github.com/rdp/ruby_gnuplot/tree/master"
9
- end
1
+ require "bundler/gem_tasks"
2
+ require 'rake'
3
+ require 'rake/clean'
4
+ require 'rake/testtask'
5
+ require 'rubygems/package_task'
10
6
11
- task :default => :test
7
+ require_relative 'lib/ruby_gnuplot/version'
12
8
13
9
desc 'run unit tests'
14
- task :test do
15
- Dir . chdir 'test'
16
- for file in Dir [ '*' ]
17
- system ( "ruby #{ file } " )
18
- end
10
+ task :default => :test
11
+
12
+ Rake ::TestTask . new do |t |
13
+ t . libs << "lib" << 'spec/support'
14
+ t . test_files = FileList [ 'test/**/*.rb' ]
15
+ t . verbose = false
16
+ t . warning = false
17
+ end
18
+
19
+ def gemspec
20
+ @clean_gemspec ||= eval ( File . read ( File . expand_path ( '../ruby_gnuplot.gemspec' , __FILE__ ) ) )
19
21
end
20
22
21
- Jeweler :: RubygemsDotOrgTasks . new
23
+ Gem :: PackageTask . new ( gemspec ) { | pkg | }
Original file line number Diff line number Diff line change
1
+ module RubyGnuplot
2
+ VERSION = "2.6.1"
3
+ end
Original file line number Diff line number Diff line change
1
+ # coding: utf-8
2
+ lib = File . expand_path ( '../lib' , __FILE__ )
3
+ $LOAD_PATH. unshift ( lib ) unless $LOAD_PATH. include? ( lib )
4
+ require 'ruby_gnuplot/version'
5
+
6
+ Gem ::Specification . new do |s |
7
+ s . name = 'gnuplot'
8
+ s . description = s . summary = "Utility library to aid in interacting with gnuplot from ruby"
9
+ s . version = RubyGnuplot ::VERSION
10
+ s . authors = 'roger pack'
11
+
12
+ s . homepage = "http://github.com/rdp/ruby_gnuplot/tree/master"
13
+ s . license = "BSD"
14
+
15
+ s . files = `git ls-files` . split ( $/)
16
+ s . executables = s . files . grep ( %r{^bin/} ) { |f | File . basename ( f ) }
17
+ s . test_files = s . files . grep ( %r{^(test|spec|features)/} )
18
+ s . require_paths = [ "lib" ]
19
+
20
+ s . add_development_dependency 'minitest'
21
+ end
Original file line number Diff line number Diff line change 1
- require '../lib/ gnuplot'
1
+ require 'gnuplot'
2
2
3
3
Gnuplot . open do |gp |
4
4
Gnuplot ::Plot . new ( gp ) do |plot |
5
-
5
+
6
6
plot . title "Array Plot Example"
7
7
plot . ylabel "x"
8
8
plot . xlabel "x^2"
9
-
9
+
10
10
x = ( 0 ..50 ) . collect { |v | v . to_f }
11
11
y = x . collect { |v | v ** 2 }
12
12
13
13
plot . data << Gnuplot ::DataSet . new ( [ x , y ] ) do |ds |
14
14
ds . with = "linespoints"
15
15
ds . notitle
16
16
end
17
-
17
+
18
18
end
19
-
19
+
20
20
end
21
-
21
+
Original file line number Diff line number Diff line change 1
- require '../lib/ gnuplot'
1
+ require 'gnuplot'
2
2
3
3
Gnuplot . open do |gp |
4
4
gp << "bin(x, s) = s*int(x/s)\n "
10
10
11
11
x = ( 0 ..500 ) . collect { |v | ( rand ( ) -0.5 ) **3 }
12
12
plot . data << Gnuplot ::DataSet . new ( [ x ] ) do |ds |
13
- ds . title = "smooth frequency"
13
+ ds . title = "smooth frequency"
14
14
ds . using = "(bin($1,.01)):(1.)"
15
15
ds . smooth = "freq"
16
16
ds . with = "boxes"
Original file line number Diff line number Diff line change 1
- require '../lib/ gnuplot'
1
+ require 'gnuplot'
2
2
3
3
# File.open( "gnuplot.dat", "w") do |gp|
4
4
Gnuplot . open do |gp |
5
5
Gnuplot ::Plot . new ( gp ) do |plot |
6
-
6
+
7
7
plot . xrange "[-10:10]"
8
8
plot . title "Sin Wave Example"
9
9
plot . ylabel "x"
10
10
plot . xlabel "sin(x)"
11
-
11
+
12
12
x = ( 0 ..50 ) . collect { |v | v . to_f }
13
13
y = x . collect { |v | v ** 2 }
14
14
18
18
ds . title = "String function"
19
19
ds . linewidth = 4
20
20
} ,
21
-
21
+
22
22
Gnuplot ::DataSet . new ( [ x , y ] ) { |ds |
23
23
ds . with = "linespoints"
24
24
ds . title = "Array data"
25
25
}
26
26
]
27
27
28
28
end
29
-
29
+
30
30
end
31
-
31
+
Original file line number Diff line number Diff line change 1
- require '../lib/ gnuplot'
1
+ require 'gnuplot'
2
2
3
3
Gnuplot . open do |gp |
4
4
Gnuplot ::Plot . new ( gp ) do |plot |
5
-
5
+
6
6
plot . xrange "[-10:10]"
7
7
plot . title "Sin Wave Example"
8
8
plot . ylabel "x"
9
9
plot . xlabel "sin(x)"
10
-
10
+
11
11
plot . data << Gnuplot ::DataSet . new ( "sin(x)" ) do |ds |
12
12
ds . with = "lines"
13
13
ds . linewidth = 4
14
14
end
15
-
15
+
16
16
end
17
-
17
+
18
18
end
19
-
19
+
Original file line number Diff line number Diff line change 1
1
# -*- ruby -*-
2
2
3
- require '../lib/ gnuplot'
4
- require 'test/unit '
3
+ require 'gnuplot'
4
+ require 'minitest/autorun '
5
5
6
- class StdDataTest < Test :: Unit :: TestCase
6
+ class StdDataTest < MiniTest :: Test
7
7
8
8
def test_array_1d
9
9
data = ( 0 ..5 ) . to_a
@@ -38,7 +38,7 @@ def test_array_nd
38
38
end
39
39
40
40
41
- class DataSetTest < Test :: Unit :: TestCase
41
+ class DataSetTest < MiniTest :: Test
42
42
43
43
def test_yield_ctor
44
44
ds = Gnuplot ::DataSet . new do |ds |
@@ -58,7 +58,7 @@ def test_yield_ctor
58
58
end
59
59
60
60
61
- class PlotTest < Test :: Unit :: TestCase
61
+ class PlotTest < MiniTest :: Test
62
62
63
63
def test_no_data
64
64
plot = Gnuplot ::Plot . new do |p |
@@ -130,7 +130,7 @@ def test_style
130
130
131
131
132
132
require 'rbconfig'
133
- CONFIG = Config ::MAKEFILE_CONFIG
133
+ CONFIG = RbConfig ::MAKEFILE_CONFIG
134
134
135
135
# This attempts to test the functions that comprise the gnuplot package. Most
136
136
# of the bug reports that I get for this package have to do with finding the
You can’t perform that action at this time.
0 commit comments