Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/scalebar.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require "scalebar/version"
require "scalebar/scalebar"
require 'trollop'
require 'dimensions'
require 'optimist'
require 'dimensions'
6 changes: 3 additions & 3 deletions lib/scalebar/scalebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def initialize(output, argv = ARGV)
end

def cmd_options(argv=ARGV)
Trollop::options(argv) do
Optimist::options(argv) do
# banner " Usage: scalebar imagefile"
banner <<"EOS"
NAME
Expand Down Expand Up @@ -244,7 +244,7 @@ def y_range
end

def parse_option
Trollop::die "invalid args" if argv.size < 1
Optimist::die "invalid args" if argv.size < 1
@image_path = argv.shift
@dirname = File.dirname(@image_path)
@basename = File.basename(@image_path, ".*")
Expand Down Expand Up @@ -276,7 +276,7 @@ def parse_option

def run
parse_option
if File.exists?(output_path)
if File.exist?(output_path)
STDERR.puts "|#{output_path}| already exists."
else
generate_tex(params[:grid])
Expand Down
2 changes: 1 addition & 1 deletion scalebar.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec", "~> 3.1"

spec.add_dependency "trollop", "~> 2.1"
spec.add_dependency "optimist", "~> 3.0"
spec.add_dependency "dimensions", "~> 1.3"
end
8 changes: 4 additions & 4 deletions spec/scalebar/scalebar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ module Scalebar

it "generate tex" do
cui.run
expect(File.exists?(tex_path)).to be_truthy
expect(File.exist?(tex_path)).to be_truthy
end


Expand All @@ -211,7 +211,7 @@ module Scalebar

it "generate tex with grid" do
cui.run
expect(File.exists?(tex_path)).to be_truthy
expect(File.exist?(tex_path)).to be_truthy
expect(File.open(tex_path).read).to match(/Grids of \|\S+\| micro meter pitch are drawn\./)
expect(File.open(tex_path).read).to match(/multiput/)
end
Expand All @@ -236,11 +236,11 @@ module Scalebar

it "generate tex without grid" do
cui.run
expect(File.exists?(tex_path)).to be_truthy
expect(File.exist?(tex_path)).to be_truthy
expect(File.open(tex_path).read).not_to match(/Grids of \|\S+\| micro meter pitch are drawn\./)
expect(File.open(tex_path).read).not_to match(/multiput/)
end
end

end
end
end
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'fileutils'

#require 'scalebar'
class Output
def messages
Expand Down
Loading