instance_accountant 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/instance_accountant.gemspec +34 -16
- data/lib/instance_accountant/cli.rb +1 -1
- data/lib/instance_accountant.rb +1 -1
- metadata +16 -73
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4050e8562394fe0c8cbbbd33075f8fedbfeafe1
|
4
|
+
data.tar.gz: 78d22b9d8d3aabc24748fd0fbce92b9fd9d59388
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57b2fc72feadc5f1cfa05d37ba5892df8c2f6205499b9d8a114f51f1b3e2ee7ac021d3842da556c92a76d810d57bf40d255341c0d8f27b4d9110d0818e5bb03f
|
7
|
+
data.tar.gz: 395d3eae795f35c7a8e6f45a7d69b4fe630d9bca270dca83ea05f2c91b4542cab42b153cff1710bb17ec34d34589f1e1f32165f2f338c3d1fbcc815edd31d614
|
data/instance_accountant.gemspec
CHANGED
@@ -5,28 +5,46 @@ $LOAD_PATH.unshift 'lib'
|
|
5
5
|
require 'instance_accountant'
|
6
6
|
|
7
7
|
Gem::Specification.new do |gem|
|
8
|
-
gem.authors
|
8
|
+
gem.authors = [ 'Tom Mornini', 'John McKee' ]
|
9
9
|
|
10
|
-
gem.files
|
10
|
+
gem.files = Dir.glob( 'lib/**/*.rb' )
|
11
11
|
|
12
|
-
gem.files
|
13
|
-
gem.files
|
14
|
-
gem.files
|
15
|
-
gem.files
|
12
|
+
gem.files << 'instance_accountant.gemspec'
|
13
|
+
gem.files << 'LICENSE.txt'
|
14
|
+
gem.files << 'Rakefile'
|
15
|
+
gem.files << 'README.md'
|
16
16
|
|
17
|
-
gem.test_files
|
17
|
+
gem.test_files = Dir.glob( 'spec/**/*.rb' )
|
18
18
|
|
19
|
-
gem.name
|
20
|
-
gem.description = File.read 'README.md'
|
21
|
-
gem.summary = 'account for hourly instance usage using Subledger'
|
22
|
-
gem.version = InstanceAccountant::VERSION
|
23
|
-
gem.email = 'admin@subledger.com'
|
24
|
-
gem.licenses = ['BSD 3-Clause']
|
19
|
+
gem.name = 'instance_accountant'
|
25
20
|
|
26
|
-
gem.
|
21
|
+
gem.description = <<-'EOF'
|
22
|
+
The instance_accountant gem is designed to be used to account
|
23
|
+
for hourly resource consumption, such as EC2 instances, using
|
24
|
+
Subledger, the double-entry accounting API.
|
27
25
|
|
28
|
-
|
29
|
-
|
26
|
+
It can account for both cost (amount owed to AWS) as well as price
|
27
|
+
(amount owed to instance owner). If you run hourly-billed instances
|
28
|
+
for yourself, or for others, and want real-time usage information
|
29
|
+
for yourself, and for those paying you for the instance, then this
|
30
|
+
gem is for you. :-)
|
31
|
+
|
32
|
+
instance_accountant keeps state in an "hourfile" that contains the
|
33
|
+
timestamp of the last hour accounted for. It is intended to be run
|
34
|
+
in --daemon mode at startup. It makes no effort to account for
|
35
|
+
instance time when it is not running, so it's important to run it
|
36
|
+
immediately upon startup, and to make sure that it is always running.
|
37
|
+
EOF
|
38
|
+
|
39
|
+
gem.summary = 'account for hourly instance usage using Subledger'
|
40
|
+
gem.version = InstanceAccountant::VERSION
|
41
|
+
gem.email = 'admin@subledger.com'
|
42
|
+
gem.licenses = ['BSD 3-Clause']
|
43
|
+
|
44
|
+
gem.homepage = 'https://github.com/subledger/instance_accountant'
|
45
|
+
|
46
|
+
gem.bindir = 'bin'
|
47
|
+
gem.executables = 'instance_accountant'
|
30
48
|
|
31
49
|
gem.add_runtime_dependency 'subledger', '~> 0.7'
|
32
50
|
gem.add_runtime_dependency 'thor', '~> 0.19'
|
data/lib/instance_accountant.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instance_accountant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Mornini
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: subledger
|
@@ -165,79 +165,22 @@ dependencies:
|
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0.27'
|
168
|
-
description: |
|
169
|
-
|
168
|
+
description: |2
|
169
|
+
The instance_accountant gem is designed to be used to account
|
170
|
+
for hourly resource consumption, such as EC2 instances, using
|
171
|
+
Subledger, the double-entry accounting API.
|
170
172
|
|
171
|
-
|
173
|
+
It can account for both cost (amount owed to AWS) as well as price
|
174
|
+
(amount owed to instance owner). If you run hourly-billed instances
|
175
|
+
for yourself, or for others, and want real-time usage information
|
176
|
+
for yourself, and for those paying you for the instance, then this
|
177
|
+
gem is for you. :-)
|
172
178
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
The gem provides an executable that can be invoked two ways:
|
180
|
-
|
181
|
-
1) you want to account for the hourly cost of instances:
|
182
|
-
|
183
|
-
#!/bin/bash
|
184
|
-
|
185
|
-
instance_accountant account \
|
186
|
-
--cost 0.1 \
|
187
|
-
--cost_reference 'http://test.com/cost' \
|
188
|
-
--expense_acct subledger_account_id \
|
189
|
-
--payable_acct subledger_account_id \
|
190
|
-
--key_id subledger_key_id \
|
191
|
-
--secret subledger_secret \
|
192
|
-
--org_id subledger_org_id \
|
193
|
-
--book_id subledger_book_id \
|
194
|
-
--daemon 2>&1 >> instance_accountant.log
|
195
|
-
|
196
|
-
2) you want to account for both the hourly cost and income:
|
197
|
-
|
198
|
-
#!/bin/bash
|
199
|
-
|
200
|
-
instance_accountant account \
|
201
|
-
--cost 0.1 \
|
202
|
-
--expense_acct subledger_account_id \
|
203
|
-
--payable_acct subledger_account_id \
|
204
|
-
--price 0.2 \
|
205
|
-
--receivable_acct subledger_account_id \
|
206
|
-
--income_acct subledger_account_id \
|
207
|
-
--key_id subledger_key_id \
|
208
|
-
--secret subledger_secret \
|
209
|
-
--org_id subledger_org_id \
|
210
|
-
--book_id subledger_book_id \
|
211
|
-
--daemon 2>&1 >> instance_accountant.log
|
212
|
-
|
213
|
-
Here's a complete set of options:
|
214
|
-
|
215
|
-
Options:
|
216
|
-
f, [--filepath=FILEPATH]
|
217
|
-
# Default: ~/.instance_accountant
|
218
|
-
d, --description=DESCRIPTION
|
219
|
-
# Default: instance usage for: %
|
220
|
-
[--reference=REFERENCE]
|
221
|
-
c, --cost=COST
|
222
|
-
[--cost-description=COST_DESCRIPTION]
|
223
|
-
# Default: instance cost for: %
|
224
|
-
[--cost-reference=COST_REFERENCE]
|
225
|
-
e, --expense-acct=EXPENSE_ACCT
|
226
|
-
p, --payable-acct=PAYABLE_ACCT
|
227
|
-
p, [--price=PRICE]
|
228
|
-
[--price-description=PRICE_DESCRIPTION]
|
229
|
-
# Default: instance price for %
|
230
|
-
[--price-reference=PRICE_REFERENCE]
|
231
|
-
i, [--income-acct=INCOME_ACCT]
|
232
|
-
r, [--receivable-acct=RECEIVABLE_ACCT]
|
233
|
-
k, --key-id=KEY_ID
|
234
|
-
s, --secret=SECRET
|
235
|
-
o, --org-id=ORG_ID
|
236
|
-
b, --book-id=BOOK_ID
|
237
|
-
[--daemon], [--no-daemon]
|
238
|
-
|
239
|
-
Note: %s in descriptions will be replaced by the ISO 8601 of the hour in UTC
|
240
|
-
Note: instance_accountant captures errors and does its best to keep running
|
179
|
+
instance_accountant keeps state in an "hourfile" that contains the
|
180
|
+
timestamp of the last hour accounted for. It is intended to be run
|
181
|
+
in --daemon mode at startup. It makes no effort to account for
|
182
|
+
instance time when it is not running, so it's important to run it
|
183
|
+
immediately upon startup, and to make sure that it is always running.
|
241
184
|
email: admin@subledger.com
|
242
185
|
executables:
|
243
186
|
- instance_accountant
|