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/generate_next_template.rb,
lib/clinvoice/render_name_and_address.rb
Defined Under Namespace
Modules: GenerateNextTemplate, GeneratePDF, Helper, InitializeTemplate, RenderBasicInfo, RenderItems, RenderNameAndAddress, RenderNotes, RenderTitle, RenderTotal
Classes: Data
Constant Summary
collapse
- VERSION =
'1.1.0'
Class Method Summary
collapse
Class Method Details
.execute(args) ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/clinvoice.rb', line 9
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)
when 'next'
Clinvoice::GenerateNextTemplate.call(file)
else
show_usage_and_exit!
end
end
|
.show_usage_and_exit! ⇒ Object
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
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/clinvoice.rb', line 27
def self.show_usage_and_exit!
puts " Usage:\n\n clinvoice init <datafile> # starts a new template with id 1 and empty entries.\n clinvoice new <filename> # generates a pdf invoice based on a data file `yml`.\n clinvoice next <datafile> # generates the next data file `yml`.\n\n Args:\n\n - datafile: the yaml template without number and extention, example 'doge' ('doge-*.yml' templates)\n - filename: the yaml template with number but without extention, example 'doge-3' ('doge-3.yml' templates)\n\n Examples / Flow:\n\n 1 - First lets create a new client template:\n\n `$ clinvoice init doge-client`\n\n This will create a `doge-client-1.yml` data file, lets edit it and generate our pdf invoice.\n\n 2 - Edit the data file:\n\n `$ vim doge-client-1.yml`\n\n 3 - Now we can generate our pdf invoice based on the data file\n\n `$ clinvoice new doge-client-1`\n\n This will create a `doge-client-1.pdf` file based on the data file `doge-client-1.yml`.\n\n 4 - Generate a next datafile\n\n `$ clinvoice next doge-client`\n\n This will create a `doge-client-2.yml` data file, based on the last data file id + 1.\n\n USAGE\n\n exit\nend\n"
|