ascii_invoicer 2.5.15 → 2.5.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 323c8259870f7d7523277ae5879c95d89ff79f05
4
- data.tar.gz: 2d2efe808b97b0be6ab729226803dd25c2b58135
3
+ metadata.gz: eb682f58e7ae42b47e5d84e88de21f953df524ec
4
+ data.tar.gz: d6240cbc5f434f6ab8efef3ee8915cf63a5aefa0
5
5
  SHA512:
6
- metadata.gz: e22a536968bd6074270dac96e6e754e14125aec22cbb2b2b90e60cfacb49a232b5dbd707ec199cfd1162c0a736969f5e2a5d5900095887b5d5df45050d085986
7
- data.tar.gz: 45d36ca573aaacb0b0e2930a91b02bce846ad4f65a0750fa108b3b467e39bcdeac7939f08c5c370e8bdb1b2b16135427a755c22c2e50317245585dacbeb304b4
6
+ metadata.gz: d173a22fa136e4d20de1921c993a8ff7d33a4abb56978d8ed23fd3571ef0f9976adc458ecf87a52ca1b4afc4c6225098b1ba294295ce2c12e78683441247c249
7
+ data.tar.gz: 47796e28941946ab71ddeb4244a59632f43f4f6537670fa3859e331bd1483cf730677f1fe2ec27dc4a519099bd488cfb3bdc5ecc0d9345bc066bf44ee6ee6330
data/bin/ascii CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # warn_indent: true
3
+ # frozen_string_literal: true
2
4
 
3
5
  require 'pp'
4
6
  require 'csv'
@@ -187,30 +189,30 @@ class Commander < Thor
187
189
  projects = open_projects names, options
188
190
  paths= projects.map{ |project| project.path }
189
191
 
190
- if options[:archive]
191
- map = $PLUMBER.map_project_files_archive(options[:archive])
192
- else
193
- map = $PLUMBER.map_project_files_working()
194
- end
195
- map.each{|k,v|
196
- names.each{|name|
197
- if k.downcase.include? name.downcase
198
- paths += [v]
199
- end
192
+ if options[:archive]
193
+ map = $PLUMBER.map_project_files_archive(options[:archive])
194
+ else
195
+ map = $PLUMBER.map_project_files_working()
196
+ end
197
+ map.each{|k,v|
198
+ names.each{|name|
199
+ if k.downcase.include? name.downcase
200
+ paths += [v]
201
+ end
202
+ }
200
203
  }
201
- }
202
- paths.uniq!
204
+ paths.uniq!
203
205
 
204
- #pp paths
205
- $logger.info "opening #{paths}", :stdo
206
- end
206
+ #pp paths
207
+ $logger.info "opening #{paths}", :stdo
208
+ end
207
209
 
208
- if paths.size > 0
209
- edit_files paths, options[:editor]
210
- else
211
- puts "nothing found (#{names})"
210
+ if paths.size > 0
211
+ edit_files paths, options[:editor]
212
+ else
213
+ puts "nothing found (#{names})"
214
+ end
212
215
  end
213
- end
214
216
 
215
217
 
216
218
  desc "open NAMES", "Open created documents"
@@ -1,7 +1,7 @@
1
- require "ascii_invoicer/version"
2
- require "ascii_invoicer/settings_manager"
3
- require "ascii_invoicer/InvoiceProject"
4
- require "ascii_invoicer/hash_transformer"
5
- require "ascii_invoicer/tweaks"
6
- require "ascii_invoicer/mixins"
7
- require "ascii_invoicer/ascii_logger"
1
+ require "./lib/ascii_invoicer/version"
2
+ require "./lib/ascii_invoicer/settings_manager"
3
+ require "./lib/ascii_invoicer/InvoiceProject"
4
+ require "./lib/ascii_invoicer/hash_transformer"
5
+ require "./lib/ascii_invoicer/tweaks"
6
+ require "./lib/ascii_invoicer/mixins"
7
+ require "./lib/ascii_invoicer/ascii_logger"
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  require 'yaml'
2
3
  require 'csv'
3
4
  require 'date'
@@ -115,7 +116,13 @@ class InvoiceProject < LuigiProject
115
116
  end
116
117
 
117
118
  #load format and transform or not
118
- @data[:format] = @raw_data['format'] ? @raw_data['format'] : "1.0.0"
119
+ @data[:format] = if @raw_data['format']
120
+ @raw_data['format']
121
+ elsif @raw_data['meta']['format']
122
+ @raw_data['meta']['format']
123
+ else
124
+ "1.0.0"
125
+ end
119
126
  if @data[:format] < "2.4.0"
120
127
  begin
121
128
  @raw_data = import_100 @raw_data
@@ -199,7 +206,11 @@ class InvoiceProject < LuigiProject
199
206
  new_hash.set_path("event/dates/0/time/begin", new_hash.get_path("time")) if date[1].nil?
200
207
  new_hash.set_path("event/dates/0/time/end", new_hash.get_path("time_end")) if date[1].nil?
201
208
 
202
- new_hash['manager']= new_hash['manager'].lines.to_a[1] if new_hash['manager'].lines.to_a.length > 1
209
+ pp new_hash
210
+ manager_lines = new_hash['manager'].lines.to_a()
211
+ if manager_lines.length > 1
212
+ new_hash['manager'] = new_hash['manager'].lines[1]
213
+ end
203
214
 
204
215
  if new_hash.get_path("client/fullname").words.class == Array
205
216
  new_hash.set_path("client/title", new_hash.get_path("client/fullname").lines.to_a[0].strip)
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  #http://stackoverflow.com/questions/6407141/how-can-i-have-ruby-logger-log-output-to-stdout-as-well-as-file
2
3
  require 'logger'
3
4
  require 'fileutils'
@@ -1,3 +1,5 @@
1
+ # warn_indent: true
2
+ # frozen_string_literal: true
1
3
  require 'date'
2
4
  #require File.join __dir__ + '/rfc5322_regex.rb'
3
5
 
@@ -1,3 +1,5 @@
1
+ # warn_indent: true
2
+ # frozen_string_literal: true
1
3
  module Generators
2
4
  def generate_hours_total full_data
3
5
  hours = full_data[:hours]
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  require 'hash-graft'
2
3
 
3
4
  class HashTransformer
@@ -1,3 +1,5 @@
1
+ # warn_indent: true
2
+ # frozen_string_literal: true
1
3
  require 'icalendar'
2
4
  require 'fileutils'
3
5
  require 'money'
@@ -1,3 +1,5 @@
1
+ # warn_indent: true
2
+ # frozen_string_literal: true
1
3
  require 'paint'
2
4
 
3
5
  require File.join __dir__, 'tweaks.rb'
@@ -87,13 +89,13 @@ module ProjectFileReader
87
89
  @logger.info Paint[path, :yellow] if @settings.DEBUG
88
90
  return parser.call(value)
89
91
  end
90
- end
91
92
  rescue => error
92
93
  fail_at path
93
94
  puts Array.new($@).keep_if{|line| line.include? "filter_"}.map {|line| Paint[line, :red, :bold]}
94
95
  puts Array.new($@).keep_if{|line| line.include? "generate_"}.map {|line| Paint[line, :blue, :bold]}
95
96
  puts Paint[" #{error} (#{@project_path})", :yellow]
96
97
  end
98
+ end
97
99
 
98
100
  def fail_at(*criteria)
99
101
  @data[:valid] = false
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  # RFC 5322 Email Validation Regex in Ruby
2
3
 
3
4
  $RFC5322 = /
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  require 'fileutils'
2
3
 
3
4
  require 'hash-graft'
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  require 'logger'
2
3
 
3
4
  module TexWriter
@@ -93,11 +94,18 @@ module TexWriter
93
94
  templates[File.basename(file.split(?.)[0]).to_sym] = file
94
95
  }
95
96
  path = templates[type]
96
- if File.exists?(path)
97
- return File.open(path).read
98
- else
97
+
98
+ if path.nil?
99
+ @logger.error "No template found!\n Check #{$PLUMBER.dirs[:templates]} !"
100
+ return false
101
+
102
+ elsif not File.exists?(path)
99
103
  @logger.error "Template (#{path}) File not found!"
100
104
  return false
105
+
106
+ else
107
+ return File.open(path).read
108
+
101
109
  end
102
110
  end
103
111
 
@@ -1,3 +1,5 @@
1
+ # warn_indent: true
2
+ # frozen_string_literal: true
1
3
  $FB = "foobar"
2
4
  class TrueClass
3
5
  def print(symbol=?✓)
@@ -1,3 +1,4 @@
1
+ # warn_indent: true
1
2
  module AsciiInvoicer
2
- VERSION = '2.5.15'
3
+ VERSION = '2.5.17'
3
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ascii_invoicer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.15
4
+ version: 2.5.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hendrik Sollich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-22 00:00:00.000000000 Z
11
+ date: 2016-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec