From a2a09bc65fc8930a2ad776eca7d662e263ec5b56 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Fri, 24 Jul 2009 19:32:22 -0700 Subject: Mention gem in README, read version from file. --- lib/hcl.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/hcl.rb b/lib/hcl.rb index d14fa8e..9a18920 100644 --- a/lib/hcl.rb +++ b/lib/hcl.rb @@ -3,7 +3,6 @@ require 'rexml/document' require 'net/http' require 'net/https' -require 'rubygems' require 'chronic' require 'trollop' require 'highline/import' @@ -26,7 +25,7 @@ class Net::HTTP end class HCl - VERSION = "0.1.0" + VERSION_FILE = File.dirname(__FILE__) + '/../VERSION.yml' SETTINGS_FILE = "#{ENV['HOME']}/.hcl_settings" CONFIG_FILE = "#{ENV['HOME']}/.hcl_config" @@ -49,13 +48,19 @@ class HCl end def initialize + @version = YAML::load(File.read(VERSION_FILE)) read_config read_settings end + def version + [:major, :minor, :patch].map { |v| @version[v] }.join('.') + end + def process_args *args + version_string = version Trollop::options(args) do - version "HCl #{VERSION}" + version "HCl #{version_string}" stop_on %w[ show tasks set unset note add rm start stop ] banner <<-EOM HCl is a command-line client for manipulating Harvest time sheets. -- cgit v1.2.3