Module: Clinvoice
- Defined in:
- lib/clinvoice.rb,
lib/clinvoice/data.rb,
lib/clinvoice/helper.rb,
lib/clinvoice/version.rb,
lib/clinvoice/generate_pdf.rb,
lib/clinvoice/render_items.rb,
lib/clinvoice/render_notes.rb,
lib/clinvoice/render_title.rb,
lib/clinvoice/render_total.rb,
lib/clinvoice/render_basic_info.rb,
lib/clinvoice/initialize_template.rb,
lib/clinvoice/render_name_and_address.rb
Defined Under Namespace
Modules: GeneratePDF, Helper, InitializeTemplate, RenderBasicInfo, RenderItems, RenderNameAndAddress, RenderNotes, RenderTitle, RenderTotal
Classes: Data
Constant Summary
collapse
- VERSION =
'2.3.0'
Class Method Summary
collapse
Class Method Details
.execute(args) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/clinvoice.rb', line 8
def self.execute(args)
show_usage_and_exit! if args.empty?
command = args[0]
file = args[1]
case command
when 'init'
Clinvoice::InitializeTemplate.call(file)
when 'new'
Clinvoice::GeneratePDF.call(file)
else
show_usage_and_exit!
end
end
|
.show_usage_and_exit! ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/clinvoice.rb', line 24
def self.show_usage_and_exit!
puts <<~USAGE
Usage:
clinvoice init <datafile> # starts a new template with id 1 and empty entries.
clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.
Args:
- datafile: the yaml template without number and extention, example 'doge' ('doge-*.yml' templates)
- filename: the yaml template with number but without extention, example 'doge-3' ('doge-3.yml' templates)
Examples / Flow:
1 - First lets create a new client template:
`$ clinvoice init doge-client`
This will create a `doge-client-1.yml` data file, lets edit it and generate our pdf invoice.
2 - Edit the data file:
`$ vim doge-client-1.yml`
3 - Now we can generate our pdf invoice based on the data file
`$ clinvoice new doge-client-1`
This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.
USAGE
exit
end
|