Skip to content

Commit

Permalink
Specify all dependiencies in gemspec and upgrade some gems
Browse files Browse the repository at this point in the history
* Fix compatibility with sequel 4.0.0
* Upgrade rspec and fix deprecation warnings
* Manage all dependencies through gemspec
  • Loading branch information
Sam Goldstein committed Jul 15, 2013
1 parent 4ce8c4d commit 47802b5
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 147 deletions.
18 changes: 1 addition & 17 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
source 'http://rubygems.org'

gem 'sequel', ">= 3.9.0"
gem 'sqlite3', "~> 1.3.3"
gem 'chronic', ">= 0.6.4"
gem 'json', ">= 1.4.6"
gem 'icalendar', "~>1.1.5"
gem 'rake'
gem 'rdoc'

group :test do
gem "rspec", "~>2"
gem 'fakefs'
end

group :development do
gem 'jeweler'
end
gemspec
23 changes: 0 additions & 23 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,4 @@ Rake::RDocTask.new do |rd|
rd.rdoc_files.include("README", "**/*.rb")
end

begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = %q{timetrap}

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Sam Goldstein"]
s.description = %q{Command line time tracker}
s.email = %q{[email protected]}
s.has_rdoc = true
s.homepage = "http://github.com/samg/timetrap/tree/master"
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.bindir = "bin"
s.executables = ['t']
s.summary = %q{Command line time tracker}
s.add_dependency("sequel", ">= 3.9.0")
s.add_dependency("sqlite3", "~> 1.3.3")
s.add_dependency("chronic", ">= 0.6.4")
end
rescue LoadError
puts "Jeweler not available."
end

4 changes: 2 additions & 2 deletions lib/timetrap/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def sheet_name_from_string string
when /^\W*full\W*$/ then "full"
when /^$/ then Timer.current_sheet
else
entry = DB[:entries].filter(:sheet.like("#{string}")).first ||
DB[:entries].filter(:sheet.like("#{string}%")).first
entry = DB[:entries].filter(Sequel.like(:sheet,string)).first ||
DB[:entries].filter(Sequel.like(:sheet, "#{string}%")).first
if entry
entry[:sheet]
else
Expand Down
3 changes: 3 additions & 0 deletions lib/timetrap/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Timetrap
VERSION = '1.8.8'
end
24 changes: 12 additions & 12 deletions spec/timetrap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def invoke command
:note => 'entry 4', :start => '2008-10-05 18:00:00'
)

Time.stub!(:now).and_return local_time('2008-10-05 20:00:00')
Time.stub(:now).and_return local_time('2008-10-05 20:00:00')
@desired_output = <<-OUTPUT
Timesheet: SpecSheet
Day Start End Duration Notes
Expand Down Expand Up @@ -513,13 +513,13 @@ def output

it "should set the start when starting a new entry" do
@time = Time.now
Time.stub!(:now).and_return @time
Time.stub(:now).and_return @time
invoke 'in working on something'
Timetrap::Entry.order_by(:id).last.start.to_i.should == @time.to_i
end

it "should not start the time if the timetrap is running" do
Timetrap::Timer.stub!(:running?).and_return true
Timetrap::Timer.stub(:running?).and_return true
lambda do
invoke 'in'
end.should_not change(Timetrap::Entry, :count)
Expand All @@ -532,15 +532,15 @@ def output

it "should fail with a warning for misformatted cli options it can't parse" do
now = Time.now
Time.stub!(:now).and_return now
Time.stub(:now).and_return now
invoke 'in work --at="18 minutes ago"'
Timetrap::Entry.order_by(:id).last.should be_nil
$stderr.string.should =~ /\w+/
end

it "should fail with a time argurment of total garbage" do
now = Time.now
Time.stub!(:now).and_return now
Time.stub(:now).and_return now
invoke 'in work --at "total garbage"'
Timetrap::Entry.order_by(:id).last.should be_nil
$stderr.string.should =~ /\w+/
Expand Down Expand Up @@ -700,7 +700,7 @@ def output

describe "with a numeric sheet name" do
before do
Time.stub!(:now).and_return local_time("2008-10-05 18:00:00")
Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
create_entry( :sheet => 1234, :start => local_time_cli('2008-10-03 12:00:00'),
:end => local_time_cli('2008-10-03 14:00:00'))
end
Expand All @@ -723,7 +723,7 @@ def output

describe "with a numeric sheet name" do
before do
Time.stub!(:now).and_return local_time("2008-10-05 18:00:00")
Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
create_entry( :sheet => '1234', :start => local_time_cli('2008-10-03 12:00:00'),
:end => local_time_cli('2008-10-03 14:00:00'))
end
Expand All @@ -747,7 +747,7 @@ def output

describe "with sheets defined" do
before :each do
Time.stub!(:now).and_return local_time("2008-10-05 18:00:00")
Time.stub(:now).and_return local_time("2008-10-05 18:00:00")
create_entry( :sheet => 'A Longly Named Sheet 2', :start => local_time_cli('2008-10-03 12:00:00'),
:end => local_time_cli('2008-10-03 14:00:00'))
create_entry( :sheet => 'A Longly Named Sheet 2', :start => local_time_cli('2008-10-03 12:00:00'),
Expand Down Expand Up @@ -826,7 +826,7 @@ def output
@entry = Timetrap::Timer.active_entry
@entry.start = Time.at(0)
@entry.save
Time.stub!(:now).and_return Time.at(60)
Time.stub(:now).and_return Time.at(60)
end

it "should show how long the current item is running for" do
Expand All @@ -843,7 +843,7 @@ def output
@entry = Timetrap::Timer.active_entry
@entry.start = Time.at(0)
@entry.save
Time.stub!(:now).and_return Time.at(60)
Time.stub(:now).and_return Time.at(60)
end

it "should show both entries" do
Expand All @@ -862,7 +862,7 @@ def output
invoke 'in'
@active = Timetrap::Timer.active_entry
@now = Time.now
Time.stub!(:now).and_return @now
Time.stub(:now).and_return @now
end
it "should set the stop for the running entry" do
@active.refresh.end.should == nil
Expand Down Expand Up @@ -896,7 +896,7 @@ def output
describe "resume" do
before :each do
@time = Time.now
Time.stub!(:now).and_return @time
Time.stub(:now).and_return @time

invoke 'in Some strange task'
@last_active = Timetrap::Timer.active_entry
Expand Down
119 changes: 26 additions & 93 deletions timetrap.gemspec
Original file line number Diff line number Diff line change
@@ -1,97 +1,30 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'timetrap/version'

Gem::Specification.new do |s|
s.name = "timetrap"
s.version = "1.8.7"
Gem::Specification.new do |spec|
spec.name = "timetrap"
spec.version = Timetrap::VERSION
spec.authors = ["Sam Goldstein"]
spec.email = ["[email protected]"]
spec.description = "Command line time tracker"
spec.summary = "Command line time tracker"
spec.homepage = "https://github.com/samg/timetrap"
spec.license = "MIT"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Sam Goldstein"]
s.date = "2013-05-18"
s.description = "Command line time tracker"
s.email = "[email protected]"
s.executables = ["t"]
s.extra_rdoc_files = [
"LICENSE.txt",
"README.md"
]
s.files = [
".rspec",
".travis.yml",
"CONTRIBUTORS",
"Gemfile",
"LICENSE.txt",
"README.md",
"Rakefile",
"VERSION.yml",
"bin/dev_t",
"bin/t",
"lib/Getopt/Declare.rb",
"lib/Getopt/DelimScanner.rb",
"lib/timetrap.rb",
"lib/timetrap/cli.rb",
"lib/timetrap/config.rb",
"lib/timetrap/formatters.rb",
"lib/timetrap/formatters/csv.rb",
"lib/timetrap/formatters/factor.rb",
"lib/timetrap/formatters/ical.rb",
"lib/timetrap/formatters/ids.rb",
"lib/timetrap/formatters/json.rb",
"lib/timetrap/formatters/text.rb",
"lib/timetrap/helpers.rb",
"lib/timetrap/models.rb",
"lib/timetrap/timer.rb",
"spec/timetrap_spec.rb",
"timetrap.gemspec"
]
s.homepage = "http://github.com/samg/timetrap/tree/master"
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = "2.0.0"
s.summary = "Command line time tracker"
spec.files = `git ls-files`.split($/)
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

if s.respond_to? :specification_version then
s.specification_version = 4

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<sequel>, [">= 3.9.0"])
s.add_runtime_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_runtime_dependency(%q<chronic>, [">= 0.6.4"])
s.add_runtime_dependency(%q<json>, [">= 1.4.6"])
s.add_runtime_dependency(%q<icalendar>, ["~> 1.1.5"])
s.add_runtime_dependency(%q<rake>, [">= 0"])
s.add_runtime_dependency(%q<rdoc>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 0"])
s.add_runtime_dependency(%q<sequel>, [">= 3.9.0"])
s.add_runtime_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_runtime_dependency(%q<chronic>, [">= 0.6.4"])
else
s.add_dependency(%q<sequel>, [">= 3.9.0"])
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_dependency(%q<chronic>, [">= 0.6.4"])
s.add_dependency(%q<json>, [">= 1.4.6"])
s.add_dependency(%q<icalendar>, ["~> 1.1.5"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<sequel>, [">= 3.9.0"])
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_dependency(%q<chronic>, [">= 0.6.4"])
end
else
s.add_dependency(%q<sequel>, [">= 3.9.0"])
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_dependency(%q<chronic>, [">= 0.6.4"])
s.add_dependency(%q<json>, [">= 1.4.6"])
s.add_dependency(%q<icalendar>, ["~> 1.1.5"])
s.add_dependency(%q<rake>, [">= 0"])
s.add_dependency(%q<rdoc>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 0"])
s.add_dependency(%q<sequel>, [">= 3.9.0"])
s.add_dependency(%q<sqlite3>, ["~> 1.3.3"])
s.add_dependency(%q<chronic>, [">= 0.6.4"])
end
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec", '~> 2.13'
spec.add_development_dependency "fakefs"
spec.add_development_dependency "icalendar"
spec.add_development_dependency "json"
spec.add_dependency "sequel", "~> 4.0.0"
spec.add_dependency "sqlite3", "~> 1.3.3"
spec.add_dependency "chronic", "~> 0.9.1"
end

0 comments on commit 47802b5

Please sign in to comment.