Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add a version number

  • Loading branch information...
commit 4334358b89f25ba964df20ab93c5942544b2fc00 1 parent 11f1afa
@jamis authored
Showing with 25 additions and 2 deletions.
  1. +3 −1 Rakefile
  2. +12 −1 bin/theseus
  3. +10 −0 lib/theseus/version.rb
View
4 Rakefile
@@ -3,6 +3,8 @@ require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/testtask'
+require './lib/theseus/version'
+
task :default => :test
Rake::TestTask.new do |t|
@@ -14,7 +16,7 @@ spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "Maze generator for Ruby"
s.name = 'theseus'
- s.version = "1.0.0"
+ s.version = Theseus::Version::STRING
s.files = FileList["README.markdown", "Rakefile", "lib/**/*.rb", "bin/*"].to_a
s.executables << "theseus"
s.add_dependency "chunky_png", "~> 0.12.0"
View
13 bin/theseus
@@ -57,7 +57,7 @@ OptionParser.new do |opts|
format = f.to_sym
end
- opts.on("-v", "--solve [METHOD]", "whether to display the solution of the maze.", "METHOD is either `backtracker' (the default) or `astar'") do |s|
+ opts.on("-V", "--solve [METHOD]", "whether to display the solution of the maze.", "METHOD is either `backtracker' (the default) or `astar'") do |s|
png_opts[:solution] = (s || :backtracker).to_sym
end
@@ -146,6 +146,17 @@ OptionParser.new do |opts|
opts.separator ""
opts.separator "Other options:"
+ opts.on_tail("-v", "--version", "display the Theseus version and exit") do
+ maze = Theseus::OrthogonalMaze.generate(width: 20, height: 4)
+ s = maze.to_s(mode: :lines).strip
+ print s.gsub(/^/, " ").sub(/^\s*/, "theseus --")
+
+ require 'theseus/version'
+ puts "--> v#{Theseus::Version::STRING}"
+ puts "a maze generator, renderer, and solver by Jamis Buck <jamis@jamisbuck.org>"
+ exit
+ end
+
opts.on_tail("-h", "--help", "this helpful list of options") do
puts opts
exit
View
10 lib/theseus/version.rb
@@ -0,0 +1,10 @@
+module Theseus
+ # The current version of the Theseus library.
+ module Version
+ MAJOR = 1
+ MINOR = 0
+ TINY = 0
+
+ STRING = [MAJOR, MINOR, TINY].join(".")
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.