clinvoice 1.1.0 → 2.1.0

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: 0f14251c2e76af986045d3ca172d0863711562b01b212691be36c2d61021b7ea
4
+ data.tar.gz: 3347c2a65da53a16050980236dc84a68483b689c02dda0cae527895134e766ea
5
5
  SHA512:
6
- metadata.gz: 9828213ba2f5e4fa094bdbcb538811f8bd592a0f3f014a67142889630e591b2da66be54d9b4d1567a053635fa0d494255ff9e98d520f1faea1ae2bc235c6e969
7
- data.tar.gz: 9048ed41925013e8ee3326dd77daa039c79e2fd8c4155e98fb0b31c7330e23170039fe1717cf89bf65db0c72984ad5690b054e43f4e047f4d4921481ab2d1504
6
+ metadata.gz: 6d7ff3cd3eac02ed2ab4c3bfdf770b15d8fcb0ff935a222c306f37133311ae34cb4e2a574de54e118a24a8907e479d6edd233ca2113e8f3db5a021c913264670
7
+ data.tar.gz: 74db98d5b3b4b5f275b9c29f768c2d2d93e974d0d8df26f46ca7429850dbd8b4488eed6cba0cd62664561271418aee546f9c130692969dcf186ff1bd15fd0e67
data/lib/clinvoice.rb CHANGED
@@ -17,8 +17,6 @@ module Clinvoice
17
17
  Clinvoice::InitializeTemplate.call(file)
18
18
  when 'new'
19
19
  Clinvoice::GeneratePDF.call(file)
20
- when 'next'
21
- Clinvoice::GenerateNextTemplate.call(file)
22
20
  else
23
21
  show_usage_and_exit!
24
22
  end
@@ -30,7 +28,6 @@ module Clinvoice
30
28
 
31
29
  clinvoice init <datafile> # starts a new template with id 1 and empty entries.
32
30
  clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.
33
- clinvoice next <datafile> # generates the next data file `yml`.
34
31
 
35
32
  Args:
36
33
 
@@ -55,12 +52,6 @@ module Clinvoice
55
52
 
56
53
  This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.
57
54
 
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
55
  USAGE
65
56
 
66
57
  exit
@@ -14,7 +14,9 @@ module Clinvoice
14
14
  :file
15
15
 
16
16
  def initialize(file)
17
- data = YAML.load_file("#{file}.yml")['data']
17
+ filename = file.end_with?('.yml') ? file : "#{file}.yml"
18
+
19
+ data = YAML.load_file(filename)['data']
18
20
 
19
21
  @file = file
20
22
  @invoice_id = data['id']
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clinvoice
4
- VERSION = '1.1.0'
4
+ VERSION = '2.1.0'
5
5
  end
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.1.0
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-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,7 +89,6 @@ files:
89
89
  - clinvoice.gemspec
90
90
  - lib/clinvoice.rb
91
91
  - lib/clinvoice/data.rb
92
- - lib/clinvoice/generate_next_template.rb
93
92
  - lib/clinvoice/generate_pdf.rb
94
93
  - lib/clinvoice/helper.rb
95
94
  - lib/clinvoice/initialize_template.rb
@@ -104,7 +103,7 @@ homepage: https://github.com/andrewaguiar/clinvoice
104
103
  licenses:
105
104
  - MIT
106
105
  metadata: {}
107
- post_install_message:
106
+ post_install_message:
108
107
  rdoc_options: []
109
108
  require_paths:
110
109
  - lib
@@ -119,9 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
118
  - !ruby/object:Gem::Version
120
119
  version: '0'
121
120
  requirements: []
122
- rubyforge_project:
123
- rubygems_version: 2.7.3
124
- signing_key:
121
+ rubygems_version: 3.1.4
122
+ signing_key:
125
123
  specification_version: 4
126
124
  summary: Generates invoices using command line
127
125
  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