lewt 0.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +22 -0
  3. data/README.md +238 -0
  4. data/bin/lewt +10 -0
  5. data/lib/config/customers.yml +33 -0
  6. data/lib/config/enterprise.yml +54 -0
  7. data/lib/config/settings.yml +10 -0
  8. data/lib/config/templates/invoice.html.liquid +63 -0
  9. data/lib/config/templates/invoice.text.liquid +40 -0
  10. data/lib/config/templates/meta.html.liquid +0 -0
  11. data/lib/config/templates/meta.text.liquid +1 -0
  12. data/lib/config/templates/metastat.html.liquid +2 -0
  13. data/lib/config/templates/metastat.text.liquid +8 -0
  14. data/lib/config/templates/report.html.liquid +29 -0
  15. data/lib/config/templates/report.text.liquid +15 -0
  16. data/lib/config/templates/style.css +461 -0
  17. data/lib/extension.rb +158 -0
  18. data/lib/extensions/calendar-timekeeping/apple_extractor.rb +63 -0
  19. data/lib/extensions/calendar-timekeeping/calendar-timekeeping.rb +65 -0
  20. data/lib/extensions/calendar-timekeeping/extractor.rb +62 -0
  21. data/lib/extensions/calendar-timekeeping/gcal_extractor.rb +61 -0
  22. data/lib/extensions/calendar-timekeeping/ical_extractor.rb +52 -0
  23. data/lib/extensions/liquid-renderer.rb +106 -0
  24. data/lib/extensions/metastat/metamath.rb +108 -0
  25. data/lib/extensions/metastat/metastat.rb +161 -0
  26. data/lib/extensions/simple-expenses.rb +112 -0
  27. data/lib/extensions/simple-invoices.rb +93 -0
  28. data/lib/extensions/simple-milestones.rb +102 -0
  29. data/lib/extensions/simple-reports.rb +81 -0
  30. data/lib/extensions/store.rb +81 -0
  31. data/lib/lewt.rb +233 -0
  32. data/lib/lewt_book.rb +29 -0
  33. data/lib/lewt_ledger.rb +149 -0
  34. data/lib/lewtopts.rb +170 -0
  35. data/tests/LEWT Schedule.ics +614 -0
  36. data/tests/expenses.csv +1 -0
  37. data/tests/milestones.csv +1 -0
  38. data/tests/run_tests.rb +14 -0
  39. data/tests/tc_Billing.rb +29 -0
  40. data/tests/tc_CalExt.rb +44 -0
  41. data/tests/tc_Lewt.rb +37 -0
  42. data/tests/tc_LewtExtension.rb +31 -0
  43. data/tests/tc_LewtLedger.rb +38 -0
  44. data/tests/tc_LewtOpts.rb +26 -0
  45. metadata +158 -0
data/tests/tc_Lewt.rb ADDED
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Test Cases for the Billing core extension.
4
+ # ./lib/extension.rb
5
+ #
6
+ # Written by: jdw <4 July 2014>
7
+ #
8
+ # ********************************************
9
+ require "test/unit"
10
+ require_relative "../lib/lewt.rb"
11
+
12
+ class TestLewt < Test::Unit::TestCase
13
+
14
+ def test_initialize
15
+ lewt = LEWT::Lewt.new( { :target => "ACME" } )
16
+ assert_kind_of( LEWT::Lewt, lewt, "Failed to initialize Lewt object.")
17
+ end
18
+
19
+ def test__methods
20
+ lewt = LEWT::Lewt.new( { :target => "ACME" } )
21
+ assert_kind_of( Hash, lewt.get_client("ACME"), "get_client method failing, make sure ACME is in your clients file when running tests")
22
+ end
23
+
24
+ def test_matching
25
+ # valid LEWT command line option delimiter are ',' '+' ':'
26
+ assert_not_equal( nil, "bcd+abc".match(LEWT::Lewt::OPTION_DELIMITER_REGEX) )
27
+ assert_not_equal( nil, "bcd,abc".match(LEWT::Lewt::OPTION_DELIMITER_REGEX) )
28
+ assert_not_equal( nil, "bcd:abc".match(LEWT::Lewt::OPTION_DELIMITER_REGEX) )
29
+ end
30
+
31
+ end
32
+
33
+
34
+
35
+
36
+
37
+
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Test Cases for the LewtExtension base class.
4
+ # ./lib/extension.rb
5
+ #
6
+ # Written by: jdw <4 July 2014>
7
+ #
8
+ # ********************************************
9
+
10
+ require "test/unit"
11
+ require_relative "../lib/extension.rb"
12
+
13
+
14
+ class TestLewtExtension < Test::Unit::TestCase
15
+
16
+ def test_initialize
17
+ lewt_object = LEWT::Extension.new({:cmd => "test_ext"})
18
+ assert_kind_of( String, lewt_object.lewt_stash, "lewt_stash not a *String*")
19
+ assert_kind_of( Hash, lewt_object.lewt_settings, "lewt_settings not a *Hash*")
20
+ assert_kind_of( Array, lewt_object.lewt_extensions, "@@lewt_extensions not an *Array*")
21
+ assert_kind_of( String, lewt_object.lewt_extensions[0].command_name, "LEWT extensions not registering proper 'cmd' string")
22
+ assert_kind_of( LEWT::Extension, lewt_object.lewt_extensions[0], "LEWT extension not being referenced properly")
23
+ end
24
+
25
+ end
26
+
27
+
28
+
29
+
30
+
31
+
@@ -0,0 +1,38 @@
1
+ require "test/unit"
2
+ require_relative "../lib/lewt_ledger.rb"
3
+
4
+ class TestLewtExtension < Test::Unit::TestCase
5
+
6
+ def test_lewt_ledger
7
+ row = create_row
8
+ assert_instance_of(Time, row[:date_start], "#{row.class.name} not storing start Time properly.")
9
+ assert_instance_of(Time, row[:date_end], "#{row.class.name} not storing end Time properly.")
10
+ assert_instance_of(String, row[:category], "#{row.class.name} not storing category properly.")
11
+ assert_instance_of(String, row[:entity], "#{row.class.name} not storing entity properly.")
12
+ assert_instance_of(String, row[:description], "#{row.class.name} not storing descriptions properly.")
13
+ assert_equal(1, row[:quantity], "#{row.class.name} not storing quanity properly.")
14
+ assert_equal(40.00, row[:unit_cost], "#{row.class.name} not storing unit_cost properly.")
15
+ assert_equal(40.00, row[:total], "#{row.class.name} not storing totals properly.")
16
+ end
17
+
18
+ def test_lewt_books
19
+ books = LEWT::LEWTBook.new
20
+ assert_raise( TypeError ) { books.push(1) }
21
+ row = create_row
22
+ books.push( row )
23
+ assert_instance_of( LEWT::LEWTLedger, books[0], "#{books.class.name} push method not working properly." )
24
+ end
25
+
26
+
27
+ def create_row
28
+ return LEWT::LEWTLedger.new({
29
+ :date_start => Time.now - 8,
30
+ :date_end => Time.now,
31
+ :category => "Expenses",
32
+ :entity => "ACME",
33
+ :description => "Paid for softwware license",
34
+ :quantity => 1,
35
+ :unit_cost => 40.00})
36
+ end
37
+
38
+ end
@@ -0,0 +1,26 @@
1
+ require "test/unit"
2
+
3
+ require_relative "../lib/lewtopts.rb"
4
+ require_relative "../lib/extensions/simple-invoices.rb"
5
+
6
+ class TestLewtOpts < Test::Unit::TestCase
7
+
8
+ def test_initialize
9
+ extensions = [
10
+ LEWT::SimpleInvoices.new
11
+ ]
12
+
13
+ simulated_options = {
14
+ :start => DateTime.now - 20,
15
+ :target => "ACME"
16
+ }
17
+
18
+ options = LEWT::LewtOpts.new( extensions, simulated_options )
19
+ assert_instance_of(LEWT::LewtOpts, options, "LewtOpts not inheriting hash properties properly in libmode.")
20
+
21
+ assert_instance_of(String, options[:target], "LewtOpts not setting supplied values properly in libmode.")
22
+ assert_equal("ACME", options[:target], "Expected 'ACME' (String) but got #{options[:target]} in libmode.")
23
+ end
24
+
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lewt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.12
5
+ platform: ruby
6
+ authors:
7
+ - Jason Wijegooneratne
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: safe_yaml
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: icalendar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 2.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 2.0.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: google_calendar
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.3.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.3.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: liquid
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.5.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.5.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: pdfkit
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.6.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.6.2
83
+ description: A dead simple command line tool and library for enterprise management.
84
+ It can currently handle invoicing, expenses, reporting, and is very extensible.
85
+ email: code@jwije.com
86
+ executables:
87
+ - lewt
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - LICENSE.md
92
+ - README.md
93
+ - bin/lewt
94
+ - lib/config/customers.yml
95
+ - lib/config/enterprise.yml
96
+ - lib/config/settings.yml
97
+ - lib/config/templates/invoice.html.liquid
98
+ - lib/config/templates/invoice.text.liquid
99
+ - lib/config/templates/meta.html.liquid
100
+ - lib/config/templates/meta.text.liquid
101
+ - lib/config/templates/metastat.html.liquid
102
+ - lib/config/templates/metastat.text.liquid
103
+ - lib/config/templates/report.html.liquid
104
+ - lib/config/templates/report.text.liquid
105
+ - lib/config/templates/style.css
106
+ - lib/extension.rb
107
+ - lib/extensions/calendar-timekeeping/apple_extractor.rb
108
+ - lib/extensions/calendar-timekeeping/calendar-timekeeping.rb
109
+ - lib/extensions/calendar-timekeeping/extractor.rb
110
+ - lib/extensions/calendar-timekeeping/gcal_extractor.rb
111
+ - lib/extensions/calendar-timekeeping/ical_extractor.rb
112
+ - lib/extensions/liquid-renderer.rb
113
+ - lib/extensions/metastat/metamath.rb
114
+ - lib/extensions/metastat/metastat.rb
115
+ - lib/extensions/simple-expenses.rb
116
+ - lib/extensions/simple-invoices.rb
117
+ - lib/extensions/simple-milestones.rb
118
+ - lib/extensions/simple-reports.rb
119
+ - lib/extensions/store.rb
120
+ - lib/lewt.rb
121
+ - lib/lewt_book.rb
122
+ - lib/lewt_ledger.rb
123
+ - lib/lewtopts.rb
124
+ - tests/LEWT Schedule.ics
125
+ - tests/expenses.csv
126
+ - tests/milestones.csv
127
+ - tests/run_tests.rb
128
+ - tests/tc_Billing.rb
129
+ - tests/tc_CalExt.rb
130
+ - tests/tc_Lewt.rb
131
+ - tests/tc_LewtExtension.rb
132
+ - tests/tc_LewtLedger.rb
133
+ - tests/tc_LewtOpts.rb
134
+ homepage: http://jwije.com/lewt
135
+ licenses:
136
+ - MIT
137
+ metadata: {}
138
+ post_install_message:
139
+ rdoc_options: []
140
+ require_paths:
141
+ - lib
142
+ required_ruby_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
152
+ requirements: []
153
+ rubyforge_project:
154
+ rubygems_version: 2.2.2
155
+ signing_key:
156
+ specification_version: 4
157
+ summary: Lazy Enterprise for hackers Without Time
158
+ test_files: []