rbinvoice 0.2.0 → 0.2.1

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/TODO CHANGED
@@ -6,5 +6,5 @@
6
6
  - .rbinvoicerc
7
7
  - LaTeX+liquid template
8
8
  - more tests
9
- - print the pdflatex results to std{out,err}
9
+ - print the pdflatex results to std{out,err} only if the user gives a --verbose flag.
10
10
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -27,7 +27,7 @@ module RbInvoice
27
27
 
28
28
  def self.write_data_file(opts)
29
29
  # Add the new invoice to the list of client invoices.
30
- File.open(opts[:data_file], 'w') { |f| f.puts YAML::dump(opts[:data]) }
30
+ File.open(opts[:data_file], 'w') { |f| f.puts YAML::dump(RbInvoice::Util::stringify_hash(opts[:data])) }
31
31
  end
32
32
 
33
33
  def self.read_data_file(opts)
@@ -152,8 +152,8 @@ module RbInvoice
152
152
  client = data_for_client(data, opts[:client]) || add_new_client_data(opts[:client], data)
153
153
  (client[:invoices] ||= []) << {
154
154
  'id' => opts[:invoice_number],
155
- 'start_date' => start_date.strftime("%Y-%m-%d"),
156
- 'end_date' => end_date.strftime("%Y-%m-%d"),
155
+ 'start_date' => start_date,
156
+ 'end_date' => end_date,
157
157
  'filename' => filename
158
158
  }
159
159
  if not data[:last_invoice] or opts[:invoice_number] > data[:last_invoice]
@@ -25,5 +25,25 @@ module RbInvoice
25
25
  symbolize_hash(YAML::load(text) || {})
26
26
  end
27
27
 
28
+ def self.stringify_array(arr)
29
+ arr.map{|x|
30
+ case x
31
+ when Hash; stringify_hash(x)
32
+ when Array; stringify_array(x)
33
+ else x
34
+ end
35
+ }
36
+ end
37
+
38
+ def self.stringify_hash(h)
39
+ h.each_with_object({}) {|(k,v), h|
40
+ h[k.to_s] = case v
41
+ when Hash; stringify_hash(v)
42
+ when Array; stringify_array(v)
43
+ else; v
44
+ end
45
+ }
46
+ end
47
+
28
48
  end
29
49
  end
data/lib/rbinvoice.rb CHANGED
@@ -59,7 +59,7 @@ module RbInvoice
59
59
 
60
60
  def self.make_pdf(tasks, start_date, end_date, filename, opts)
61
61
  write_latex(tasks, end_date, filename, opts)
62
- `cd "#{File.dirname(filename)}" && pdflatex "#{File.basename(filename, '.pdf')}"`
62
+ system("cd \"#{File.dirname(filename)}\" && pdflatex \"#{File.basename(filename, '.pdf')}\"")
63
63
  RbInvoice::Options::add_invoice_to_data(tasks, start_date, end_date, filename, opts) unless opts[:no_data_file]
64
64
  end
65
65
 
data/rbinvoice.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rbinvoice"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul A. Jungwirth"]
12
- s.date = "2012-08-07"
12
+ s.date = "2012-08-08"
13
13
  s.description = " Reads hours from a Google Spreadsheet and generates a PDF invoice.\n"
14
14
  s.email = "pj@illuminatedcomputing.com"
15
15
  s.executables = ["rbinvoice", "rbinvoice"]
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "NOTES",
26
26
  "README.md",
27
27
  "Rakefile",
28
+ "TODO",
28
29
  "VERSION",
29
30
  "bin/rbinvoice",
30
31
  "lib/rbinvoice.rb",
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.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-07 00:00:00.000000000 Z
12
+ date: 2012-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop
@@ -157,6 +157,7 @@ files:
157
157
  - NOTES
158
158
  - README.md
159
159
  - Rakefile
160
+ - TODO
160
161
  - VERSION
161
162
  - bin/rbinvoice
162
163
  - lib/rbinvoice.rb
@@ -165,7 +166,6 @@ files:
165
166
  - rbinvoice.gemspec
166
167
  - spec/options_spec.rb
167
168
  - templates/invoice.tex.liquid
168
- - TODO
169
169
  homepage: http://github.com/pjungwir/rbinvoice
170
170
  licenses:
171
171
  - MIT
@@ -181,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  segments:
183
183
  - 0
184
- hash: -1042798753782564714
184
+ hash: 1533939018656104171
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  none: false
187
187
  requirements: