scbi_plot 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.6 2011-06-14
2
+
3
+ Check for gnuplot_executable
4
+
1
5
  === 0.0.5 2011-06-03
2
6
 
3
7
  Added xrange and yrange support
data/lib/scbi_plot.rb CHANGED
@@ -7,5 +7,5 @@ require 'scbi_plot/lines'
7
7
 
8
8
 
9
9
  module ScbiPlot
10
- VERSION = '0.0.5'
10
+ VERSION = '0.0.6'
11
11
  end
@@ -32,7 +32,13 @@ module ScbiPlot
32
32
  def do_graph
33
33
  setup_data
34
34
  # $VERBOSE=false
35
-
35
+
36
+ if !gnu_plot_installed?
37
+ puts "GNUPLOT executable not installed"
38
+ return
39
+ end
40
+
41
+
36
42
  Gnuplot.open do |gp|
37
43
  # histogram
38
44
  Gnuplot::Plot.new( gp ) do |plot|
@@ -45,6 +45,10 @@ module ScbiPlot
45
45
  def do_graph
46
46
  setup_data
47
47
  # $VERBOSE=true
48
+ if !gnu_plot_installed?
49
+ puts "GNUPLOT executable not installed"
50
+ return
51
+ end
48
52
 
49
53
  Gnuplot.open do |gp|
50
54
  # histogram
@@ -23,6 +23,24 @@ module ScbiPlot
23
23
  class Plot
24
24
 
25
25
  attr_accessor :title,:file_name,:x_label,:y_label,:x_limit,:x, :y, :line_width, :x_range, :y_range
26
+
27
+ # Cross-platform way of finding an executable in the $PATH.
28
+ #
29
+ # which('ruby') #=> /usr/bin/ruby
30
+ def which(cmd)
31
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
32
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
33
+ exts.each { |ext|
34
+ exe = "#{path}/#{cmd}#{ext}"
35
+ return exe if File.executable? exe
36
+ }
37
+ end
38
+ return nil
39
+ end
40
+
41
+ def gnu_plot_installed?
42
+ return which('gnuplot')
43
+ end
26
44
 
27
45
  def initialize(file_name,title=nil)
28
46
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: scbi_plot
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Dario Guerrero Fernandez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-03 00:00:00 Z
13
+ date: 2011-06-14 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gnuplot