bookie_accounting 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Rakefile +4 -7
- data/TODO +1 -0
- data/bin/bookie-create-tables +1 -1
- data/bin/bookie-send +10 -1
- data/bookie_accounting.gemspec +6 -3
- data/lib/bookie/database.rb +241 -175
- data/lib/bookie/extensions.rb +72 -0
- data/lib/bookie/formatter.rb +15 -7
- data/lib/bookie/formatters/comma_dump.rb +9 -3
- data/lib/bookie/formatters/stdout.rb +1 -1
- data/lib/bookie/sender.rb +76 -16
- data/lib/bookie/senders/standalone.rb +2 -2
- data/lib/bookie/version.rb +1 -1
- data/rpm/bookie_accounting.spec.erb +2 -0
- data/spec/comma_dump_formatter_spec.rb +21 -12
- data/spec/database_spec.rb +199 -103
- data/spec/extensions_spec.rb +25 -0
- data/spec/formatter_spec.rb +37 -32
- data/spec/sender_spec.rb +127 -68
- data/spec/spec_helper.rb +15 -1
- data/spec/spreadsheet_formatter_spec.rb +16 -14
- data/spec/stdout_formatter_spec.rb +10 -8
- metadata +57 -11
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -11,12 +11,12 @@ RSpec::Core::RakeTask.new(:spec) do |task|
|
|
11
11
|
task.pattern = 'spec/*_spec.rb'
|
12
12
|
end
|
13
13
|
|
14
|
-
task :
|
14
|
+
task :rdoc do
|
15
15
|
system("rdoc rdoc lib")
|
16
16
|
end
|
17
17
|
|
18
|
-
desc "Build RPM and dependencies (intended for IBEST internal use)"
|
19
|
-
task :rpm_deps do
|
18
|
+
desc "Build RPM and dependencies (intended for University of Idaho IBEST internal use)"
|
19
|
+
task :rpm_deps => [:build] do
|
20
20
|
require 'erb'
|
21
21
|
require 'yaml'
|
22
22
|
|
@@ -27,9 +27,6 @@ task :rpm_deps do
|
|
27
27
|
:gem_file => "bookie_accounting-#{Bookie::VERSION}.gem",
|
28
28
|
:license => 'MIT',
|
29
29
|
:skip_deps => Set.new(['sqlite3']),
|
30
|
-
},
|
31
|
-
'bundler' => {
|
32
|
-
|
33
30
|
},
|
34
31
|
'spreadsheet' => {
|
35
32
|
:has_binaries => true,
|
@@ -136,7 +133,7 @@ def build_rpms(modules_to_build)
|
|
136
133
|
end
|
137
134
|
end
|
138
135
|
|
139
|
-
msg = `rpmbuild -
|
136
|
+
msg = `rpmbuild -ba #{spec_filename}`
|
140
137
|
unless $?.success?
|
141
138
|
puts msg
|
142
139
|
exit 1
|
data/bin/bookie-create-tables
CHANGED
@@ -33,7 +33,7 @@ config = Bookie::Config.new(config_file)
|
|
33
33
|
config.connect
|
34
34
|
|
35
35
|
if drop
|
36
|
-
STDOUT.write "Are you sure? This will destroy all tables in the database. "
|
36
|
+
STDOUT.write "Are you sure? This will destroy all tables in the database. (YES/NO): "
|
37
37
|
response = nil
|
38
38
|
until response
|
39
39
|
response = STDIN.gets.chomp
|
data/bin/bookie-send
CHANGED
@@ -18,6 +18,7 @@ require 'bookie/sender'
|
|
18
18
|
config_file = '/etc/bookie/config.json'
|
19
19
|
will_create = false
|
20
20
|
will_decommission = false
|
21
|
+
will_undo = false
|
21
22
|
system_start_time = nil
|
22
23
|
system_hostname = nil
|
23
24
|
system_end_time = nil
|
@@ -29,6 +30,10 @@ opts = OptionParser.new do |opts|
|
|
29
30
|
config_file = file
|
30
31
|
end
|
31
32
|
|
33
|
+
opts.on('-u', '--undo', String, "undo a previous send operation (file must be specified)") do
|
34
|
+
will_undo = true
|
35
|
+
end
|
36
|
+
|
32
37
|
opts.on("--create [TIME]",
|
33
38
|
"Create an entry for this system, recording the given time as its start time") do |time|
|
34
39
|
will_create = true
|
@@ -59,7 +64,11 @@ fail("No operation specified") unless filename || will_create || will_decommissi
|
|
59
64
|
|
60
65
|
if filename
|
61
66
|
sender = Bookie::Sender.new(config)
|
62
|
-
|
67
|
+
if will_undo
|
68
|
+
sender.undo_send(filename)
|
69
|
+
else
|
70
|
+
sender.send_data(filename)
|
71
|
+
end
|
63
72
|
end
|
64
73
|
|
65
74
|
if will_decommission
|
data/bookie_accounting.gemspec
CHANGED
@@ -17,11 +17,14 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.version = Bookie::VERSION
|
18
18
|
|
19
19
|
gem.add_dependency('activerecord')
|
20
|
-
|
21
|
-
#
|
22
|
-
#
|
20
|
+
gem.add_dependency('json')
|
21
|
+
#We need this because Bundler has no concept of optional dependencies
|
22
|
+
#and complains about using non-dependency gems.
|
23
|
+
#To do: figure out how to remove (file issue?)
|
24
|
+
gem.add_dependency('mysql2')
|
23
25
|
gem.add_dependency('pacct')
|
24
26
|
gem.add_dependency('spreadsheet')
|
27
|
+
gem.add_development_dependency('bundler')
|
25
28
|
gem.add_development_dependency('mocha')
|
26
29
|
gem.add_development_dependency('rspec')
|
27
30
|
gem.add_development_dependency('sqlite3')
|