rbinvoice 0.2.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,54 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ .DS_Store
31
+
32
+ # For TextMate
33
+ #*.tmproj
34
+ #tmtags
35
+
36
+ # For emacs:
37
+ *~
38
+ \#*
39
+ .\#*
40
+
41
+ # For vim:
42
+ .*.swp
43
+ .*.swo
44
+
45
+ # For redcar:
46
+ #.redcar
47
+
48
+ # For rubinius:
49
+ #*.rbc
50
+
51
+ tmp
52
+ README.html
53
+
54
+ rbinvoice*.gem
data/Rakefile CHANGED
@@ -9,24 +9,6 @@ rescue Bundler::BundlerError => e
9
9
  $stderr.puts "Run `bundle install` to install missing gems"
10
10
  exit e.status_code
11
11
  end
12
- require 'rake'
13
-
14
- require 'jeweler'
15
- Jeweler::Tasks.new do |gem|
16
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
- gem.name = "rbinvoice"
18
- gem.homepage = "http://github.com/pjungwir/rbinvoice"
19
- gem.license = "MIT"
20
- gem.summary = 'Used to invoice my clients'
21
- gem.description = <<-EOT
22
- Reads hours from a Google Spreadsheet and generates a PDF invoice.
23
- EOT
24
- gem.email = "pj@illuminatedcomputing.com"
25
- gem.authors = ["Paul A. Jungwirth"]
26
- gem.executables << 'rbinvoice'
27
- # dependencies defined in Gemfile
28
- end
29
- Jeweler::RubygemsDotOrgTasks.new
30
12
 
31
13
  require 'rspec/core'
32
14
  require 'rspec/core/rake_task'
@@ -34,24 +16,10 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
34
16
  spec.pattern = FileList['spec/**/*_spec.rb']
35
17
  end
36
18
 
37
- =begin
38
- RSpec::Core::RakeTask.new(:rcov) do |spec|
39
- spec.pattern = 'spec/**/*_spec.rb'
40
- spec.rcov = true
41
- end
42
- =end
43
-
44
19
  task :default => :spec
45
20
 
46
- require 'rdoc/task'
47
- Rake::RDocTask.new do |rdoc|
48
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
49
21
 
50
- rdoc.rdoc_dir = 'rdoc'
51
- rdoc.title = "rbinvoice #{version}"
52
- rdoc.rdoc_files.include('README*')
53
- rdoc.rdoc_files.include('lib/**/*.rb')
54
- end
22
+ Bundler::GemHelper.install_tasks
55
23
 
56
24
  task :run, [] => [] do |t, args|
57
25
  require 'rbinvoice'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.4.0
data/lib/rbinvoice.rb CHANGED
@@ -48,6 +48,8 @@ module RbInvoice
48
48
  parse_date(earliest_task_date(hours))
49
49
  end
50
50
  start_date, end_date = RbInvoice::Options::find_invoice_bounds(earliest_date, freq)
51
+ opts[:start_date] = start_date
52
+ opts[:end_date] = end_date
51
53
  tasks = hourly_breakdown(client, start_date, end_date, opts)
52
54
  while tasks.size > 0
53
55
  filename = RbInvoice::Options::default_out_filename(opts)
@@ -100,6 +102,7 @@ module RbInvoice
100
102
  total_duration: decimal_to_interval(items.inject(0) {|t, item| t + item['duration_decimal']}),
101
103
  total_price: "%0.02f" % items.inject(0) {|t, item| t + item['price_decimal']},
102
104
  dba: escape_for_latex(opts[:dba]),
105
+ payment_due: opts[:payment_due],
103
106
  client_full_name: escape_for_latex(full_name),
104
107
  client_address: escape_for_latex(address),
105
108
  client_description: escape_for_latex(description),
@@ -1,6 +1,7 @@
1
1
  require 'yaml'
2
2
  require 'trollop'
3
3
  require 'rbinvoice/util'
4
+ require 'rbinvoice/version'
4
5
 
5
6
  module RbInvoice
6
7
  module Options
@@ -199,6 +200,10 @@ module RbInvoice
199
200
  key_for_client(data, client, :dba) || opts[:dba] || 'Illuminated Computing Inc.'
200
201
  end
201
202
 
203
+ def self.payment_due_for_client(data, opts, client)
204
+ key_for_client(data, client, :payment_due) || opts[:payment_due] || 'upon receipt'
205
+ end
206
+
202
207
  def self.full_name_for_client(data, opts, client)
203
208
  key_for_client(data, client, :full_name)
204
209
  end
@@ -208,12 +213,13 @@ module RbInvoice
208
213
  end
209
214
 
210
215
  def self.description_for_client(data, opts, client)
211
- key_for_client(data, client, :description)
216
+ desc = key_for_client(data, client, :description)
217
+ "#{desc} from #{opts[:start_date].strftime("%B %-d")} to #{opts[:end_date].strftime("%B %-d, %Y")}."
212
218
  end
213
219
 
214
220
  def self.parse_command_line(argv)
215
221
  opts = Trollop::options(argv) do
216
- version "rbinvoice 0.1.0 (c) 2012 Paul A. Jungwirth"
222
+ version "rbinvoice #{::RbInvoice::VERSION} (c) 2012 Paul A. Jungwirth"
217
223
  banner <<-EOH
218
224
  USAGE: rbinvoice [options] <client> [filename]
219
225
  EOH
@@ -260,6 +266,7 @@ module RbInvoice
260
266
  opts[:end_date] = Date.strptime(opts[:end_date], "%Y-%m-%d") if opts[:end_date]
261
267
 
262
268
  opts[:dba] = dba_for_client(opts[:data], opts, opts[:client])
269
+ opts[:payment_due] = payment_due_for_client(opts[:data], opts, opts[:client])
263
270
  # Read the list of past invoices.
264
271
  # If there are none, assume there is only one invoice to do.
265
272
 
@@ -0,0 +1,3 @@
1
+ module RbInvoice
2
+ VERSION = '0.4.0'
3
+ end
data/rbinvoice.gemspec CHANGED
@@ -1,78 +1,33 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ $:.push File.dirname(__FILE__) + "/lib"
2
+ require 'rbinvoice/version'
5
3
 
6
4
  Gem::Specification.new do |s|
7
5
  s.name = "rbinvoice"
8
- s.version = "0.2.4"
6
+ s.version = RbInvoice::VERSION
9
7
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Paul A. Jungwirth"]
12
- s.date = "2013-03-15"
8
+ s.summary = "Used to invoice my clients"
13
9
  s.description = " Reads hours from a Google Spreadsheet and generates a PDF invoice.\n"
14
- s.email = "pj@illuminatedcomputing.com"
15
- s.executables = ["rbinvoice", "rbinvoice"]
16
- s.extra_rdoc_files = [
17
- "LICENSE.txt",
18
- "README.html",
19
- "README.md",
20
- "TODO"
21
- ]
22
- s.files = [
23
- "Gemfile",
24
- "Gemfile.lock",
25
- "LICENSE.txt",
26
- "NOTES",
27
- "README.md",
28
- "Rakefile",
29
- "TODO",
30
- "VERSION",
31
- "bin/rbinvoice",
32
- "lib/rbinvoice.rb",
33
- "lib/rbinvoice/options.rb",
34
- "lib/rbinvoice/util.rb",
35
- "rbinvoice.gemspec",
36
- "spec/options_spec.rb",
37
- "templates/invoice.tex.liquid"
38
- ]
39
10
  s.homepage = "http://github.com/pjungwir/rbinvoice"
11
+ s.date = "2013-03-15"
12
+ s.authors = ["Paul A. Jungwirth"]
13
+ s.email = "pj@illuminatedcomputing.com"
14
+
40
15
  s.licenses = ["MIT"]
16
+
41
17
  s.require_paths = ["lib"]
18
+ s.executables = ["rbinvoice", "rbinvoice"]
42
19
  s.rubygems_version = "1.8.24"
43
- s.summary = "Used to invoice my clients"
44
20
 
45
- if s.respond_to? :specification_version then
46
- s.specification_version = 3
21
+ s.files = `git ls-files`.split("\n")
22
+ s.test_files = `git ls-files -- {test,spec,fixtures}/*`.split("\n")
23
+
24
+ s.add_runtime_dependency 'trollop', '>= 0'
25
+ s.add_runtime_dependency 'roo', '>= 0'
26
+ s.add_runtime_dependency 'prawn', '>= 0'
27
+ s.add_runtime_dependency 'liquid', '>= 0'
28
+
29
+ s.add_development_dependency 'rspec', '~> 2.4.0'
30
+ s.add_development_dependency 'bundler', '>= 0'
47
31
 
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_runtime_dependency(%q<trollop>, [">= 0"])
50
- s.add_runtime_dependency(%q<roo>, [">= 0"])
51
- s.add_runtime_dependency(%q<prawn>, [">= 0"])
52
- s.add_runtime_dependency(%q<liquid>, [">= 0"])
53
- s.add_development_dependency(%q<rspec>, [">= 0"])
54
- s.add_development_dependency(%q<bundler>, [">= 0"])
55
- s.add_development_dependency(%q<jeweler>, [">= 0"])
56
- s.add_development_dependency(%q<simplecov>, [">= 0"])
57
- else
58
- s.add_dependency(%q<trollop>, [">= 0"])
59
- s.add_dependency(%q<roo>, [">= 0"])
60
- s.add_dependency(%q<prawn>, [">= 0"])
61
- s.add_dependency(%q<liquid>, [">= 0"])
62
- s.add_dependency(%q<rspec>, [">= 0"])
63
- s.add_dependency(%q<bundler>, [">= 0"])
64
- s.add_dependency(%q<jeweler>, [">= 0"])
65
- s.add_dependency(%q<simplecov>, [">= 0"])
66
- end
67
- else
68
- s.add_dependency(%q<trollop>, [">= 0"])
69
- s.add_dependency(%q<roo>, [">= 0"])
70
- s.add_dependency(%q<prawn>, [">= 0"])
71
- s.add_dependency(%q<liquid>, [">= 0"])
72
- s.add_dependency(%q<rspec>, [">= 0"])
73
- s.add_dependency(%q<bundler>, [">= 0"])
74
- s.add_dependency(%q<jeweler>, [">= 0"])
75
- s.add_dependency(%q<simplecov>, [">= 0"])
76
- end
77
32
  end
78
33
 
@@ -46,7 +46,7 @@ Beaverton, OR 97005 \\
46
46
 
47
47
  \noindent
48
48
  Please make all checks payable to {{ dba }}. \\
49
- Payment due upon receipt. \\
49
+ Payment due {{ payment_due }}. \\
50
50
 
51
51
  \begin{center}
52
52
  \textbf{Thank you for your business!}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbinvoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -80,17 +80,17 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - ~>
84
84
  - !ruby/object:Gem::Version
85
- version: '0'
85
+ version: 2.4.0
86
86
  type: :development
87
87
  prerelease: false
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - ~>
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 2.4.0
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: bundler
96
96
  requirement: !ruby/object:Gem::Requirement
@@ -107,38 +107,6 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: jeweler
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
- - !ruby/object:Gem::Dependency
127
- name: simplecov
128
- requirement: !ruby/object:Gem::Requirement
129
- none: false
130
- requirements:
131
- - - ! '>='
132
- - !ruby/object:Gem::Version
133
- version: '0'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
- requirements:
139
- - - ! '>='
140
- - !ruby/object:Gem::Version
141
- version: '0'
142
110
  description: ! ' Reads hours from a Google Spreadsheet and generates a PDF invoice.
143
111
 
144
112
  '
@@ -146,12 +114,9 @@ email: pj@illuminatedcomputing.com
146
114
  executables:
147
115
  - rbinvoice
148
116
  extensions: []
149
- extra_rdoc_files:
150
- - LICENSE.txt
151
- - README.html
152
- - README.md
153
- - TODO
117
+ extra_rdoc_files: []
154
118
  files:
119
+ - .gitignore
155
120
  - Gemfile
156
121
  - Gemfile.lock
157
122
  - LICENSE.txt
@@ -164,10 +129,10 @@ files:
164
129
  - lib/rbinvoice.rb
165
130
  - lib/rbinvoice/options.rb
166
131
  - lib/rbinvoice/util.rb
132
+ - lib/rbinvoice/version.rb
167
133
  - rbinvoice.gemspec
168
134
  - spec/options_spec.rb
169
135
  - templates/invoice.tex.liquid
170
- - README.html
171
136
  homepage: http://github.com/pjungwir/rbinvoice
172
137
  licenses:
173
138
  - MIT
@@ -183,7 +148,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
148
  version: '0'
184
149
  segments:
185
150
  - 0
186
- hash: 2995707456041748597
151
+ hash: 3119729522843240763
187
152
  required_rubygems_version: !ruby/object:Gem::Requirement
188
153
  none: false
189
154
  requirements:
data/README.html DELETED
@@ -1,43 +0,0 @@
1
- <h1>rbinvoice</h1>
2
-
3
- <p>rbinvoice lets you generate PDF invoices from a Google Spreadsheet.
4
- It's pretty obscure; you probably haven't heard of it.</p>
5
-
6
- <h2>Input</h2>
7
-
8
- <p>RbInvoice reads your hours from a Google Spreadsheet, which should be formatted like this:</p>
9
-
10
- <table>
11
- <tr>
12
- <td colspan="7"><b style="font-size:120%">My Time Tracking</b></td>
13
- </tr>
14
- <tr>
15
- <td><b>Weekday</b></td>
16
- <td><b>Day</b></td>
17
- <td><b>Task</b></td>
18
- <td><b>Notes</b></td>
19
- <td><b>Start</b></td>
20
- <td><b>Stop</b></td>
21
- <td><b>Total</b></td>
22
- </tr>
23
- <tr>
24
- <td>T</td>
25
- <td>3/20/2012</td>
26
- <td>BigCorp</td>
27
- <td>API</td>
28
- <td>8:00</td>
29
- <td>12:15</td>
30
- <td>4:15</td>
31
- </tr>
32
- <tr>
33
- <td>T</td>
34
- <td>3/20/2012</td>
35
- <td>SmallCorp</td>
36
- <td>Shopping Cart</td>
37
- <td>13:00</td>
38
- <td>17:15</td>
39
- <td>4:00</td>
40
- </tr>
41
- </table>
42
-
43
- <p>Columns B, E, F, and G should have a Date format. </p>