clinvoice 1.1.0 → 2.2.2

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
  SHA256:
3
- metadata.gz: 1b15d22bdc4eac1154f8ff91961d2ad3675f3046b17792a418310b02242478a5
4
- data.tar.gz: 0ec6a774d8e43916edf4d408aef4ac883195dd232262016f7fbe939721c2c70a
3
+ metadata.gz: 0613efe19493bd8ab74fd529496463b68d52cc8feff37fa279d21044dc271f16
4
+ data.tar.gz: 949fbc2f22382af6c0fb52844ebd0a0ebbff29e625d7f86ed395aff94bb834df
5
5
  SHA512:
6
- metadata.gz: 9828213ba2f5e4fa094bdbcb538811f8bd592a0f3f014a67142889630e591b2da66be54d9b4d1567a053635fa0d494255ff9e98d520f1faea1ae2bc235c6e969
7
- data.tar.gz: 9048ed41925013e8ee3326dd77daa039c79e2fd8c4155e98fb0b31c7330e23170039fe1717cf89bf65db0c72984ad5690b054e43f4e047f4d4921481ab2d1504
6
+ metadata.gz: 6a8b43a3e3a229804442b895715d8712876937e9c50ff18680ce49fb2200b5960565c1dac29224b2374578a035b86b09a45fb4a2fe8090fc84081d1163194475
7
+ data.tar.gz: ceaa6f32db5fc09e4e16477493f07f4bb44fc03416710af7a5801b9c41c6bd517c8d8247c01354d189345a839b4d09928409e7b5942cacdc9c7da4e0090f5952
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.5.5
data/Gemfile.lock CHANGED
@@ -1,29 +1,29 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clinvoice (1.0.0)
4
+ clinvoice (2.1.1)
5
5
  prawn (~> 2.2)
6
6
  prawn-table (~> 0.2.2)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- pdf-core (0.7.0)
12
- prawn (2.2.2)
13
- pdf-core (~> 0.7.0)
14
- ttfunk (~> 1.5)
11
+ pdf-core (0.9.0)
12
+ prawn (2.4.0)
13
+ pdf-core (~> 0.9.0)
14
+ ttfunk (~> 1.7)
15
15
  prawn-table (0.2.2)
16
16
  prawn (>= 1.3.0, < 3.0.0)
17
17
  rake (10.5.0)
18
- ttfunk (1.5.1)
18
+ ttfunk (1.7.0)
19
19
 
20
20
  PLATFORMS
21
21
  ruby
22
22
 
23
23
  DEPENDENCIES
24
- bundler (~> 1.16)
24
+ bundler (~> 2.2.10)
25
25
  clinvoice!
26
26
  rake (~> 10.0)
27
27
 
28
28
  BUNDLED WITH
29
- 1.16.4
29
+ 2.2.25
data/clinvoice.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
- spec.add_development_dependency 'bundler', '~> 1.16'
28
+ spec.add_development_dependency 'bundler', '~> 2.2.10'
29
29
  spec.add_development_dependency 'rake', '~> 10.0'
30
30
  spec.add_dependency 'prawn', '~> 2.2'
31
31
  spec.add_dependency 'prawn-table', '~> 0.2.2'
data/generate-gem ADDED
@@ -0,0 +1,4 @@
1
+
2
+ rm *.gem
3
+ gem build clinvoice.gemspec
4
+ gem push *.gem
@@ -5,6 +5,8 @@ require 'yaml'
5
5
  module Clinvoice
6
6
  class Data
7
7
  attr_reader :invoice_id,
8
+ :issue_date,
9
+ :due_date,
8
10
  :currency,
9
11
  :contractor,
10
12
  :client,
@@ -14,13 +16,17 @@ module Clinvoice
14
16
  :file
15
17
 
16
18
  def initialize(file)
17
- data = YAML.load_file("#{file}.yml")['data']
19
+ filename = file.end_with?('.yml') ? file : "#{file}.yml"
20
+
21
+ data = YAML.load_file(filename)['data']
18
22
 
19
23
  @file = file
20
24
  @invoice_id = data['id']
21
25
  @currency = data['currency']
22
26
  @issue_date = data['issue_date']
23
27
  @contractor = data['contractor']
28
+ @issue_date = data['issue_date']
29
+ @due_date = data['due_date']
24
30
  @client = data['client']
25
31
  @items = data['items'].map do |item|
26
32
  [
@@ -34,5 +40,9 @@ module Clinvoice
34
40
  @notes = data['notes']
35
41
  @total = @items.map(&:last).sum
36
42
  end
43
+
44
+ def pdf_file
45
+ "#{file.gsub('.yml', '')}.pdf"
46
+ end
37
47
  end
38
48
  end
@@ -16,7 +16,7 @@ module Clinvoice
16
16
  def self.call(file)
17
17
  data = Clinvoice::Data.new(file)
18
18
 
19
- Prawn::Document.generate("#{data.file}.pdf") do |pdf|
19
+ Prawn::Document.generate(data.pdf_file) do |pdf|
20
20
  Prawn::Font::AFM.hide_m17n_warning = true
21
21
 
22
22
  pdf.font 'Helvetica'
@@ -12,6 +12,20 @@ module Clinvoice
12
12
  Clinvoice::Helper.new_line(pdf, data.currency)
13
13
 
14
14
  pdf.move_down 10
15
+
16
+ if data.issue_date
17
+ Clinvoice::Helper.new_bold_line(pdf, "Issue Date")
18
+ Clinvoice::Helper.new_line(pdf, data.issue_date)
19
+
20
+ pdf.move_down 10
21
+ end
22
+
23
+ if data.issue_date
24
+ Clinvoice::Helper.new_bold_line(pdf, "Due Date")
25
+ Clinvoice::Helper.new_line(pdf, data.due_date)
26
+
27
+ pdf.move_down 10
28
+ end
15
29
  end
16
30
  end
17
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clinvoice
4
- VERSION = '1.1.0'
4
+ VERSION = '2.2.2'
5
5
  end
data/lib/clinvoice.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'clinvoice/initialize_template'
4
- require 'clinvoice/generate_next_template'
5
4
  require 'clinvoice/generate_pdf'
6
5
  require 'clinvoice/version'
7
6
 
@@ -17,8 +16,6 @@ module Clinvoice
17
16
  Clinvoice::InitializeTemplate.call(file)
18
17
  when 'new'
19
18
  Clinvoice::GeneratePDF.call(file)
20
- when 'next'
21
- Clinvoice::GenerateNextTemplate.call(file)
22
19
  else
23
20
  show_usage_and_exit!
24
21
  end
@@ -30,7 +27,6 @@ module Clinvoice
30
27
 
31
28
  clinvoice init <datafile> # starts a new template with id 1 and empty entries.
32
29
  clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.
33
- clinvoice next <datafile> # generates the next data file `yml`.
34
30
 
35
31
  Args:
36
32
 
@@ -55,12 +51,6 @@ module Clinvoice
55
51
 
56
52
  This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.
57
53
 
58
- 4 - Generate a next datafile
59
-
60
- `$ clinvoice next doge-client`
61
-
62
- This will create a `doge-client-2.yml` data file, based on the last data file id + 1.
63
-
64
54
  USAGE
65
55
 
66
56
  exit
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clinvoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew S Aguiar
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-20 00:00:00.000000000 Z
11
+ date: 2021-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: 2.2.10
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: 2.2.10
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ extra_rdoc_files: []
77
77
  files:
78
78
  - ".gitignore"
79
79
  - ".rspec"
80
+ - ".tool-versions"
80
81
  - ".travis.yml"
81
82
  - CODE_OF_CONDUCT.md
82
83
  - Gemfile
@@ -87,9 +88,9 @@ files:
87
88
  - bin/clinvoice
88
89
  - bin/setup
89
90
  - clinvoice.gemspec
91
+ - generate-gem
90
92
  - lib/clinvoice.rb
91
93
  - lib/clinvoice/data.rb
92
- - lib/clinvoice/generate_next_template.rb
93
94
  - lib/clinvoice/generate_pdf.rb
94
95
  - lib/clinvoice/helper.rb
95
96
  - lib/clinvoice/initialize_template.rb
@@ -104,7 +105,7 @@ homepage: https://github.com/andrewaguiar/clinvoice
104
105
  licenses:
105
106
  - MIT
106
107
  metadata: {}
107
- post_install_message:
108
+ post_install_message:
108
109
  rdoc_options: []
109
110
  require_paths:
110
111
  - lib
@@ -119,9 +120,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
120
  - !ruby/object:Gem::Version
120
121
  version: '0'
121
122
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.7.3
124
- signing_key:
123
+ rubyforge_project:
124
+ rubygems_version: 2.7.6.2
125
+ signing_key:
125
126
  specification_version: 4
126
127
  summary: Generates invoices using command line
127
128
  test_files: []
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Clinvoice
4
- module GenerateNextTemplate
5
- def self.call(file)
6
- last_data_file = Dir["#{file}-*.yml"].max
7
- template_content = File.read(last_data_file)
8
-
9
- next_id = template_content.scan(/id: (\d*)/).first.first.to_i + 1
10
-
11
- next_template_content = template_content.sub(/id: (\d*)/, "id: #{next_id}")
12
-
13
- File.write("#{file}-#{next_id}.yml", next_template_content)
14
- end
15
- end
16
- end