freshtrack 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/bin/freshtrack +11 -0
- data/lib/freshbooks/extensions/base_object.rb +6 -0
- data/lib/freshbooks/extensions/time_entry.rb +2 -2
- data/lib/freshtrack/version.rb +1 -1
- data/lib/freshtrack.rb +11 -0
- data/spec/freshbooks/base_object_spec.rb +20 -0
- data/spec/freshbooks/time_entry_spec.rb +8 -0
- data/spec/freshtrack_command_spec.rb +40 -0
- data/spec/freshtrack_spec.rb +69 -0
- metadata +38 -66
- data/Manifest.txt +0 -46
- data/Rakefile +0 -51
- data/VERSION +0 -1
- data/config/hoe.rb +0 -79
- data/config/requirements.rb +0 -17
- data/log/debug.log +0 -0
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/setup.rb +0 -1585
- data/spec/.bacon +0 -0
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/rspec.rake +0 -21
- data/tasks/website.rake +0 -9
data/History.txt
CHANGED
data/bin/freshtrack
CHANGED
@@ -14,6 +14,7 @@ require 'optparse'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
aging = false
|
17
|
+
unbilled = nil
|
17
18
|
OPTIONS = {}
|
18
19
|
MANDATORY_OPTIONS = %w[]
|
19
20
|
|
@@ -34,6 +35,8 @@ BANNER
|
|
34
35
|
"Show this help message.") { puts opts; exit }
|
35
36
|
opts.on('--aging',
|
36
37
|
"Show invoice aging info.") { aging = true }
|
38
|
+
opts.on('--unbilled [PROJECT]', String,
|
39
|
+
"Show unbilled time info.") { |project| unbilled = project }
|
37
40
|
|
38
41
|
opts.parse!(ARGV)
|
39
42
|
|
@@ -55,6 +58,14 @@ if aging
|
|
55
58
|
exit
|
56
59
|
end
|
57
60
|
|
61
|
+
if unbilled
|
62
|
+
project = unbilled
|
63
|
+
Freshtrack.init(project)
|
64
|
+
time = Freshtrack.unbilled_time(project)
|
65
|
+
puts time
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
58
69
|
unless project
|
59
70
|
puts "Usage: #{File.basename($0)} [project] [options]"
|
60
71
|
exit
|
@@ -3,6 +3,12 @@ require 'date'
|
|
3
3
|
module FreshBooks
|
4
4
|
class BaseObject
|
5
5
|
MAPPING_FNS[Date] = lambda { |xml_val| Date.parse(xml_val.text) }
|
6
|
+
MAPPING_FNS[:boolean] = lambda do |xml_val|
|
7
|
+
case xml_val.text
|
8
|
+
when '0' : false
|
9
|
+
when '1' : true
|
10
|
+
end
|
11
|
+
end
|
6
12
|
|
7
13
|
def to_xml
|
8
14
|
# The root element is the elem name
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module FreshBooks
|
2
|
-
TimeEntry = BaseObject.new(:time_entry_id, :project_id, :task_id, :hours, :date, :notes)
|
2
|
+
TimeEntry = BaseObject.new(:time_entry_id, :project_id, :task_id, :hours, :date, :notes, :billed)
|
3
3
|
|
4
4
|
class TimeEntry
|
5
5
|
TYPE_MAPPINGS = {
|
6
6
|
'time_entry_id' => Fixnum, 'project_id' => Fixnum, 'task_id' => Fixnum,
|
7
|
-
'hours' => Float, 'date' => Date
|
7
|
+
'hours' => Float, 'date' => Date, 'billed' => :boolean
|
8
8
|
}
|
9
9
|
|
10
10
|
class << self
|
data/lib/freshtrack/version.rb
CHANGED
data/lib/freshtrack.rb
CHANGED
@@ -102,5 +102,16 @@ module Freshtrack
|
|
102
102
|
}
|
103
103
|
end
|
104
104
|
end
|
105
|
+
|
106
|
+
def unbilled_time(project_name)
|
107
|
+
time_entries = get_unbilled_time_entries(project_name)
|
108
|
+
time_entries.collect(&:hours).inject(&:+)
|
109
|
+
end
|
110
|
+
|
111
|
+
def get_unbilled_time_entries(project_name)
|
112
|
+
get_project_data(project_name)
|
113
|
+
time_entries = FreshBooks::TimeEntry.list('project_id' => @project.project_id, 'per_page' => 100)
|
114
|
+
time_entries.reject(&:billed)
|
115
|
+
end
|
105
116
|
end
|
106
117
|
end
|
@@ -22,6 +22,26 @@ describe FreshBooks::BaseObject do
|
|
22
22
|
@func.call(@date).to_s.should == @date.text
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
it 'should have a mapping function for boolean' do
|
27
|
+
FreshBooks::BaseObject::MAPPING_FNS[:boolean].should.respond_to(:call)
|
28
|
+
end
|
29
|
+
|
30
|
+
describe 'boolean mapping function' do
|
31
|
+
before do
|
32
|
+
@func = FreshBooks::BaseObject::MAPPING_FNS[:boolean]
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should convert '0' to false" do
|
36
|
+
@val = mock('boolean arg', :text => '0')
|
37
|
+
@func.call(@val).should == false
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should convert '1' to true" do
|
41
|
+
@val = mock('boolean arg', :text => '1')
|
42
|
+
@func.call(@val).should == true
|
43
|
+
end
|
44
|
+
end
|
25
45
|
|
26
46
|
describe 'converting an instance to XML' do
|
27
47
|
before do
|
@@ -29,6 +29,10 @@ describe FreshBooks::TimeEntry do
|
|
29
29
|
it 'should have notes' do
|
30
30
|
@time_entry.should.respond_to(:notes)
|
31
31
|
end
|
32
|
+
|
33
|
+
it 'should have billed' do
|
34
|
+
@time_entry.should.respond_to(:billed)
|
35
|
+
end
|
32
36
|
end
|
33
37
|
|
34
38
|
describe 'type mappings' do
|
@@ -55,6 +59,10 @@ describe FreshBooks::TimeEntry do
|
|
55
59
|
it 'should map date to Date' do
|
56
60
|
@mapping['date'].should == Date
|
57
61
|
end
|
62
|
+
|
63
|
+
it 'should map billed to boolean' do
|
64
|
+
@mapping['billed'].should == :boolean
|
65
|
+
end
|
58
66
|
end
|
59
67
|
|
60
68
|
describe 'creating an instance' do
|
@@ -192,4 +192,44 @@ describe 'freshtrack command' do
|
|
192
192
|
aging_run(@project)
|
193
193
|
end
|
194
194
|
end
|
195
|
+
|
196
|
+
describe 'when --unbilled specified' do
|
197
|
+
before do
|
198
|
+
@time_info = 37.5
|
199
|
+
Freshtrack.stub!(:unbilled_time).and_return(@time_info)
|
200
|
+
self.stub!(:puts)
|
201
|
+
end
|
202
|
+
|
203
|
+
def unbilled_run(project = nil)
|
204
|
+
args = ['--unbilled', project].compact
|
205
|
+
run_command(*args)
|
206
|
+
end
|
207
|
+
|
208
|
+
it 'should require a project value for the option' do
|
209
|
+
self.should.receive(:puts) { |text| text.to_s.match(/project.+required/i) }
|
210
|
+
unbilled_run(@project)
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should init Freshtrack with the given project' do
|
214
|
+
Freshtrack.should.receive(:init) do |arg|
|
215
|
+
arg.should == @project
|
216
|
+
end
|
217
|
+
unbilled_run(@project)
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'should get the unbilled time info for the given project' do
|
221
|
+
Freshtrack.should.receive(:unbilled_time).with(@project)
|
222
|
+
unbilled_run(@project)
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'should output the unbilled time' do
|
226
|
+
self.should.receive(:puts) { |text| text.to_s.match(Regexp.new(Regexp.escape(@time_info.to_s))) }
|
227
|
+
unbilled_run(@project)
|
228
|
+
end
|
229
|
+
|
230
|
+
it 'should not track time' do
|
231
|
+
Freshtrack.should.receive(:track).never
|
232
|
+
unbilled_run
|
233
|
+
end
|
234
|
+
end
|
195
235
|
end
|
data/spec/freshtrack_spec.rb
CHANGED
@@ -601,4 +601,73 @@ describe Freshtrack do
|
|
601
601
|
Freshtrack.invoice_aging.should == []
|
602
602
|
end
|
603
603
|
end
|
604
|
+
|
605
|
+
it 'should get unbilled time on a project' do
|
606
|
+
Freshtrack.should.respond_to(:unbilled_time)
|
607
|
+
end
|
608
|
+
|
609
|
+
describe 'getting unbilled time on a project' do
|
610
|
+
before do
|
611
|
+
@project_name = :proj
|
612
|
+
@time_entries = Array.new(3) { mock('time_entry', :hours => rand(10)) }
|
613
|
+
Freshtrack.stub!(:get_unbilled_time_entries).and_return(@time_entries)
|
614
|
+
end
|
615
|
+
|
616
|
+
it 'should require a project name' do
|
617
|
+
lambda { Freshtrack.unbilled_time }.should.raise(ArgumentError)
|
618
|
+
end
|
619
|
+
|
620
|
+
it 'should accept a project name' do
|
621
|
+
lambda { Freshtrack.unbilled_time(@project_name) }.should.not.raise(ArgumentError)
|
622
|
+
end
|
623
|
+
|
624
|
+
it 'should get time entries for the given project' do
|
625
|
+
Freshtrack.should.receive(:get_unbilled_time_entries).with(@project_name).and_return(@time_entries)
|
626
|
+
Freshtrack.unbilled_time(@project_name)
|
627
|
+
end
|
628
|
+
|
629
|
+
it 'should return the sum total hours of the time entries' do
|
630
|
+
total = @time_entries.collect(&:hours).inject(&:+)
|
631
|
+
Freshtrack.unbilled_time(@project_name).should == total
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
it 'should get unbilled time entries for a project' do
|
636
|
+
Freshtrack.should.respond_to(:get_unbilled_time_entries)
|
637
|
+
end
|
638
|
+
|
639
|
+
describe 'getting unbilled time entries for a project' do
|
640
|
+
before do
|
641
|
+
@project_name = :proj
|
642
|
+
Freshtrack.stub!(:get_project_data)
|
643
|
+
@project_id = 7
|
644
|
+
@project = mock('project', :project_id => @project_id)
|
645
|
+
Freshtrack.instance_variable_set('@project', @project)
|
646
|
+
@time_entries = Array.new(7) { mock('time entry', :billed => rand(2).zero?) }
|
647
|
+
FreshBooks::TimeEntry.stub!(:list).and_return(@time_entries)
|
648
|
+
end
|
649
|
+
|
650
|
+
it 'should require a project name' do
|
651
|
+
lambda { Freshtrack.get_unbilled_time_entries }.should.raise(ArgumentError)
|
652
|
+
end
|
653
|
+
|
654
|
+
it 'should accept a project name' do
|
655
|
+
lambda { Freshtrack.get_unbilled_time_entries(@project_name) }.should.not.raise(ArgumentError)
|
656
|
+
end
|
657
|
+
|
658
|
+
it 'should get project data for the given project name' do
|
659
|
+
Freshtrack.should.receive(:get_project_data).with(@project_name)
|
660
|
+
Freshtrack.get_unbilled_time_entries(@project_name)
|
661
|
+
end
|
662
|
+
|
663
|
+
it 'should get time entries for the project (based on ID)' do
|
664
|
+
FreshBooks::TimeEntry.should.receive(:list).with('project_id' => @project_id, 'per_page' => 100).and_return(@time_entries)
|
665
|
+
Freshtrack.get_unbilled_time_entries(@project_name)
|
666
|
+
end
|
667
|
+
|
668
|
+
it 'should return the unbilled time entries' do
|
669
|
+
expected = @time_entries.reject(&:billed)
|
670
|
+
Freshtrack.get_unbilled_time_entries(@project_name).should == expected
|
671
|
+
end
|
672
|
+
end
|
604
673
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freshtrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 6
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Yossef Mendelssohn
|
@@ -15,94 +15,83 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable: freshtrack
|
18
|
+
date: 2012-03-30 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
21
|
+
name: bacon
|
23
22
|
prerelease: false
|
24
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
25
|
requirements:
|
27
|
-
- - "
|
26
|
+
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
28
|
+
hash: 19
|
30
29
|
segments:
|
31
|
-
- 2
|
32
30
|
- 1
|
33
|
-
|
34
|
-
|
31
|
+
- 1
|
32
|
+
- 0
|
33
|
+
version: 1.1.0
|
34
|
+
type: :development
|
35
35
|
version_requirements: *id001
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
37
|
+
name: facon
|
38
38
|
prerelease: false
|
39
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ">="
|
43
43
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
44
|
+
hash: 11
|
45
45
|
segments:
|
46
|
-
- 1
|
47
|
-
- 1
|
48
46
|
- 0
|
49
|
-
|
47
|
+
- 5
|
48
|
+
- 0
|
49
|
+
version: 0.5.0
|
50
50
|
type: :development
|
51
51
|
version_requirements: *id002
|
52
52
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
53
|
+
name: freshbooks
|
54
54
|
prerelease: false
|
55
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
56
|
none: false
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
60
|
+
hash: 1
|
61
61
|
segments:
|
62
|
-
-
|
63
|
-
- 4
|
62
|
+
- 2
|
64
63
|
- 1
|
65
|
-
version:
|
66
|
-
type: :
|
64
|
+
version: "2.1"
|
65
|
+
type: :runtime
|
67
66
|
version_requirements: *id003
|
68
|
-
description:
|
69
|
-
email:
|
67
|
+
description: A simple tool to take your locally-tracked time and put it up on FreshBooks.
|
68
|
+
email:
|
69
|
+
- ymendel@pobox.com
|
70
70
|
executables:
|
71
71
|
- freshtrack
|
72
72
|
extensions: []
|
73
73
|
|
74
|
-
extra_rdoc_files:
|
75
|
-
|
74
|
+
extra_rdoc_files: []
|
75
|
+
|
76
76
|
files:
|
77
|
-
- History.txt
|
78
77
|
- License.txt
|
79
|
-
-
|
78
|
+
- History.txt
|
80
79
|
- README.txt
|
81
|
-
- Rakefile
|
82
|
-
- VERSION
|
83
|
-
- bin/freshtrack
|
84
|
-
- config/hoe.rb
|
85
|
-
- config/requirements.rb
|
86
|
-
- lib/freshbooks/extensions.rb
|
87
80
|
- lib/freshbooks/extensions/base_object.rb
|
88
81
|
- lib/freshbooks/extensions/invoice.rb
|
89
82
|
- lib/freshbooks/extensions/project.rb
|
90
83
|
- lib/freshbooks/extensions/task.rb
|
91
84
|
- lib/freshbooks/extensions/time_entry.rb
|
92
|
-
- lib/
|
93
|
-
- lib/freshtrack/core_ext.rb
|
85
|
+
- lib/freshbooks/extensions.rb
|
94
86
|
- lib/freshtrack/core_ext/array.rb
|
95
87
|
- lib/freshtrack/core_ext/numeric.rb
|
96
88
|
- lib/freshtrack/core_ext/time.rb
|
89
|
+
- lib/freshtrack/core_ext.rb
|
97
90
|
- lib/freshtrack/time_collectors/one_inch_punch.rb
|
98
91
|
- lib/freshtrack/time_collectors/punch.rb
|
99
92
|
- lib/freshtrack/time_collectors/punchy_template.rb
|
100
93
|
- lib/freshtrack/version.rb
|
101
|
-
-
|
102
|
-
- script/destroy
|
103
|
-
- script/generate
|
104
|
-
- setup.rb
|
105
|
-
- spec/.bacon
|
94
|
+
- lib/freshtrack.rb
|
106
95
|
- spec/core_ext/array_spec.rb
|
107
96
|
- spec/core_ext/numeric_spec.rb
|
108
97
|
- spec/core_ext/time_spec.rb
|
@@ -117,14 +106,10 @@ files:
|
|
117
106
|
- spec/spec_helper.rb
|
118
107
|
- spec/time_collectors/one_inch_punch_spec.rb
|
119
108
|
- spec/time_collectors/punch_spec.rb
|
120
|
-
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
has_rdoc: true
|
125
|
-
homepage: http://github.com/flogic/freshtrack
|
126
|
-
licenses:
|
127
|
-
- MIT
|
109
|
+
- bin/freshtrack
|
110
|
+
homepage: http://github.com/flogic/freshtrack/
|
111
|
+
licenses: []
|
112
|
+
|
128
113
|
post_install_message:
|
129
114
|
rdoc_options: []
|
130
115
|
|
@@ -151,22 +136,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
136
|
requirements: []
|
152
137
|
|
153
138
|
rubyforge_project:
|
154
|
-
rubygems_version: 1.
|
139
|
+
rubygems_version: 1.8.10
|
155
140
|
signing_key:
|
156
141
|
specification_version: 3
|
157
142
|
summary: Track your time on FreshBooks
|
158
|
-
test_files:
|
159
|
-
|
160
|
-
- spec/core_ext/numeric_spec.rb
|
161
|
-
- spec/core_ext/time_spec.rb
|
162
|
-
- spec/freshbooks/base_object_spec.rb
|
163
|
-
- spec/freshbooks/invoice_spec.rb
|
164
|
-
- spec/freshbooks/payment_spec.rb
|
165
|
-
- spec/freshbooks/project_spec.rb
|
166
|
-
- spec/freshbooks/task_spec.rb
|
167
|
-
- spec/freshbooks/time_entry_spec.rb
|
168
|
-
- spec/freshtrack_command_spec.rb
|
169
|
-
- spec/freshtrack_spec.rb
|
170
|
-
- spec/spec_helper.rb
|
171
|
-
- spec/time_collectors/one_inch_punch_spec.rb
|
172
|
-
- spec/time_collectors/punch_spec.rb
|
143
|
+
test_files: []
|
144
|
+
|
data/Manifest.txt
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
History.txt
|
2
|
-
License.txt
|
3
|
-
Manifest.txt
|
4
|
-
README.txt
|
5
|
-
Rakefile
|
6
|
-
bin/freshtrack
|
7
|
-
config/hoe.rb
|
8
|
-
config/requirements.rb
|
9
|
-
lib/freshtrack.rb
|
10
|
-
lib/freshtrack/version.rb
|
11
|
-
lib/freshtrack/core_ext.rb
|
12
|
-
lib/freshtrack/core_ext/array.rb
|
13
|
-
lib/freshtrack/core_ext/numeric.rb
|
14
|
-
lib/freshtrack/core_ext/time.rb
|
15
|
-
lib/freshtrack/time_collectors/one_inch_punch.rb
|
16
|
-
lib/freshtrack/time_collectors/punch.rb
|
17
|
-
lib/freshtrack/time_collectors/punchy_template.rb
|
18
|
-
lib/freshbooks/extensions.rb
|
19
|
-
lib/freshbooks/extensions/base_object.rb
|
20
|
-
lib/freshbooks/extensions/invoice.rb
|
21
|
-
lib/freshbooks/extensions/project.rb
|
22
|
-
lib/freshbooks/extensions/task.rb
|
23
|
-
lib/freshbooks/extensions/time_entry.rb
|
24
|
-
log/debug.log
|
25
|
-
script/destroy
|
26
|
-
script/generate
|
27
|
-
setup.rb
|
28
|
-
spec/core_ext/array_spec.rb
|
29
|
-
spec/core_ext/numeric_spec.rb
|
30
|
-
spec/core_ext/time_spec.rb
|
31
|
-
spec/time_collectors/one_inch_punch_spec.rb
|
32
|
-
spec/time_collectors/punch_spec.rb
|
33
|
-
spec/freshbooks/base_object_spec.rb
|
34
|
-
spec/freshbooks/invoice_spec.rb
|
35
|
-
spec/freshbooks/payment_spec.rb
|
36
|
-
spec/freshbooks/project_spec.rb
|
37
|
-
spec/freshbooks/task_spec.rb
|
38
|
-
spec/freshbooks/time_entry_spec.rb
|
39
|
-
spec/freshtrack_command_spec.rb
|
40
|
-
spec/freshtrack_spec.rb
|
41
|
-
spec/spec.opts
|
42
|
-
spec/spec_helper.rb
|
43
|
-
tasks/deployment.rake
|
44
|
-
tasks/environment.rake
|
45
|
-
tasks/rspec.rake
|
46
|
-
tasks/website.rake
|
data/Rakefile
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
#require 'bundler'
|
3
|
-
#begin
|
4
|
-
# Bundler.setup(:default, :development)
|
5
|
-
#rescue Bundler::BundlerError => e
|
6
|
-
# $stderr.puts e.message
|
7
|
-
# $stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
# exit e.status_code
|
9
|
-
#end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "freshtrack"
|
16
|
-
gem.homepage = "http://github.com/flogic/freshtrack"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{Track your time on FreshBooks}
|
19
|
-
gem.email = "ymendel@pobox.com"
|
20
|
-
gem.authors = ["Yossef Mendelssohn"]
|
21
|
-
gem.add_runtime_dependency 'freshbooks', '= 2.1'
|
22
|
-
gem.add_development_dependency 'bacon', '>= 1.1.0'
|
23
|
-
gem.add_development_dependency 'facon', '>= 0.4.1'
|
24
|
-
end
|
25
|
-
Jeweler::RubygemsDotOrgTasks.new
|
26
|
-
|
27
|
-
require 'rake/testtask'
|
28
|
-
Rake::TestTask.new(:test) do |test|
|
29
|
-
test.libs << 'lib' << 'test'
|
30
|
-
test.pattern = 'test/**/test_*.rb'
|
31
|
-
test.verbose = true
|
32
|
-
end
|
33
|
-
|
34
|
-
#require 'rcov/rcovtask'
|
35
|
-
#Rcov::RcovTask.new do |test|
|
36
|
-
# test.libs << 'test'
|
37
|
-
# test.pattern = 'test/**/test_*.rb'
|
38
|
-
# test.verbose = true
|
39
|
-
#end
|
40
|
-
|
41
|
-
task :default => :test
|
42
|
-
|
43
|
-
require 'rake/rdoctask'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
-
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
48
|
-
rdoc.title = "freshtrack #{version}"
|
49
|
-
rdoc.rdoc_files.include('README*')
|
50
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.5.0
|
data/config/hoe.rb
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
require 'freshtrack/version'
|
2
|
-
|
3
|
-
AUTHOR = 'Yossef Mendelssohn' # can also be an array of Authors
|
4
|
-
EMAIL = 'ymendel@pobox.com'
|
5
|
-
DESCRIPTION = "Track your time on FreshBooks"
|
6
|
-
GEM_NAME = 'freshtrack' # what ppl will type to install your gem
|
7
|
-
RUBYFORGE_PROJECT = 'yomendel' # The unix name for your project
|
8
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
9
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
10
|
-
EXTRA_DEPENDENCIES = [
|
11
|
-
['freshbooks', '= 2.1']
|
12
|
-
] # An array of rubygem dependencies [name, version]
|
13
|
-
EXTRA_DEV_DEPENDENCIES = [
|
14
|
-
['bacon', '>= 1.1.0'],
|
15
|
-
['facon', '>= 0.4.1']
|
16
|
-
] # An array of rubygem dependencies [name, version]
|
17
|
-
|
18
|
-
@config_file = "~/.rubyforge/user-config.yml"
|
19
|
-
@config = nil
|
20
|
-
RUBYFORGE_USERNAME = "unknown"
|
21
|
-
def rubyforge_username
|
22
|
-
unless @config
|
23
|
-
begin
|
24
|
-
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
25
|
-
rescue
|
26
|
-
puts <<-EOS
|
27
|
-
ERROR: No rubyforge config file found: #{@config_file}
|
28
|
-
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
29
|
-
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
30
|
-
EOS
|
31
|
-
exit
|
32
|
-
end
|
33
|
-
end
|
34
|
-
RUBYFORGE_USERNAME.replace @config["username"]
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
REV = nil
|
39
|
-
# UNCOMMENT IF REQUIRED:
|
40
|
-
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
41
|
-
VERS = Freshtrack::VERSION::STRING + (REV ? ".#{REV}" : "")
|
42
|
-
RDOC_OPTS = ['--quiet', '--title', 'freshtrack documentation',
|
43
|
-
"--opname", "index.html",
|
44
|
-
"--line-numbers",
|
45
|
-
"--main", "README",
|
46
|
-
"--inline-source"]
|
47
|
-
|
48
|
-
class Hoe
|
49
|
-
def extra_deps
|
50
|
-
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
51
|
-
@extra_deps
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# Generate all the Rake tasks
|
56
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
57
|
-
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
58
|
-
p.author = AUTHOR
|
59
|
-
p.description = DESCRIPTION
|
60
|
-
p.email = EMAIL
|
61
|
-
p.summary = DESCRIPTION
|
62
|
-
p.url = HOMEPATH
|
63
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
64
|
-
p.test_globs = ["test/**/test_*.rb"]
|
65
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
66
|
-
|
67
|
-
# == Optional
|
68
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
69
|
-
p.extra_deps = EXTRA_DEPENDENCIES
|
70
|
-
p.extra_dev_deps = EXTRA_DEV_DEPENDENCIES
|
71
|
-
|
72
|
-
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
77
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
78
|
-
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
79
|
-
hoe.rsync_args = '-av --delete --ignore-errors'
|
data/config/requirements.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
include FileUtils
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
-
begin
|
7
|
-
require req_gem
|
8
|
-
rescue LoadError
|
9
|
-
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
-
puts "Installation: gem install #{req_gem} -y"
|
11
|
-
exit
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
16
|
-
|
17
|
-
require 'freshtrack'
|
data/log/debug.log
DELETED
File without changes
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.join(File.dirname(__FILE__), '..')
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.join(File.dirname(__FILE__), '..')
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|