diff options
| -rw-r--r-- | HACKING.markdown | 21 | ||||
| -rwxr-xr-x | bin/hcl | 1 | ||||
| -rw-r--r-- | hcl.gemspec | 6 | ||||
| -rw-r--r-- | lib/hcl/app.rb | 4 |
4 files changed, 27 insertions, 5 deletions
diff --git a/HACKING.markdown b/HACKING.markdown new file mode 100644 index 0000000..47e6ae1 --- /dev/null +++ b/HACKING.markdown @@ -0,0 +1,21 @@ +# Hacking HCl + +## Rubygems + +They're useful so we use them to install our gems. However there's no need to +explicitly include rubygems in the app. That's up the system to decide. Don't +require rubygems in the code. + +We require rubygems in the test as a developer convenience. + +## Running HCl in place + +This is common and supported: + + ruby -rubygems -Ilib bin/hcl + +Don't add dir(__FILE__)/lib to the load path in the binary. Bad manners. + +## That's it + +That's it. I mostly wrote this to explain why I rolled back certain changes. @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -$:.unshift(File.join(File.dirname(__FILE__), "../lib")) require 'hcl/app' HCl::App.command *ARGV diff --git a/hcl.gemspec b/hcl.gemspec index 773e7f2..93dcb62 100644 --- a/hcl.gemspec +++ b/hcl.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Zack Hobson"] - s.date = %q{2010-04-02} + s.date = %q{2010-09-26} s.default_executable = %q{hcl} s.description = %q{HCl is a command-line client for manipulating Harvest time sheets.} s.email = %q{zack@opensourcery.com} @@ -44,7 +44,7 @@ Gem::Specification.new do |s| s.homepage = %q{http://github.com/zenhob/hcl} s.rdoc_options = ["--charset=UTF-8"] s.require_paths = ["lib"] - s.rubygems_version = %q{1.3.6} + s.rubygems_version = %q{1.3.7} s.summary = %q{Harvest timesheets from the command-line} s.test_files = [ "test/app_test.rb", @@ -57,7 +57,7 @@ Gem::Specification.new do |s| current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION s.specification_version = 3 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then s.add_runtime_dependency(%q<termios>, [">= 0"]) s.add_runtime_dependency(%q<trollop>, [">= 1.10.2"]) s.add_runtime_dependency(%q<chronic>, [">= 0.2.3"]) diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb index b49c6c5..c1a6e9b 100644 --- a/lib/hcl/app.rb +++ b/lib/hcl/app.rb @@ -5,7 +5,6 @@ require 'net/http' require 'net/https' ## gem dependencies -require 'rubygems' require 'chronic' require 'trollop' require 'highline/import' @@ -79,6 +78,9 @@ module HCl else show end + rescue RuntimeError => e + puts "Error: #{e}" + exit 1 rescue TimesheetResource::Failure => e puts "Internal failure. #{e}" exit 1 |
