pbm 0.0.0 → 0.0.2
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.
- checksums.yaml +4 -4
- data/bin/pbm +23 -1
- data/lib/pbm/commands/exit.rb +9 -0
- data/lib/pbm.rb +23 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72395ba1ec7512460857a4f71404909a9602b316
|
|
4
|
+
data.tar.gz: c77ab99a57e6f8f26068fc2e291c5291d10f40e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9f26ef8d9fdb9c3f82dd3a52eaeaadbe1d792ea50a2e49b0be66848b7b0bb0bfb752d8f5588fc93355d669653e40ce41636693dc44a65dbcca7121a0e8974c5a
|
|
7
|
+
data.tar.gz: dbad43f52fd56108f03fbc120ee113f64555760ce30b5935cb4770a95adeec792bcd473e12085b5ef4c1f5800e353f318a1f19e27c22406e3654b64f28960bb6
|
data/bin/pbm
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require 'pbm'
|
|
4
|
+
|
|
5
|
+
pbm = PBM.new
|
|
6
|
+
|
|
7
|
+
puts '============================='
|
|
8
|
+
puts 'PBM - Personal Budget Manager'
|
|
9
|
+
puts '============================='
|
|
10
|
+
puts
|
|
11
|
+
puts 'Type \'help\' to display a list of commands.'
|
|
12
|
+
puts 'Type \'exit\' to quit.'
|
|
13
|
+
puts
|
|
14
|
+
|
|
15
|
+
while pbm.running?
|
|
16
|
+
command = gets.chomp
|
|
17
|
+
|
|
18
|
+
begin
|
|
19
|
+
pbm.exec(command)
|
|
20
|
+
rescue => e
|
|
21
|
+
puts e.message
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
puts 'Closing.'
|
data/lib/pbm.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'pbm/commands/exit'
|
|
2
|
+
|
|
3
|
+
class PBM
|
|
4
|
+
attr_writer :running
|
|
5
|
+
|
|
6
|
+
def initialize
|
|
7
|
+
@running = true
|
|
8
|
+
@commands = {
|
|
9
|
+
:exit => Exit.new(self)
|
|
10
|
+
}
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def exec command
|
|
14
|
+
command.to_sym.tap do |c|
|
|
15
|
+
raise "#{c}: invalid command." unless @commands.has_key?(c)
|
|
16
|
+
@commands[c].run
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def running?
|
|
21
|
+
!!@running
|
|
22
|
+
end
|
|
23
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pbm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tarso Aires
|
|
@@ -18,6 +18,8 @@ extensions: []
|
|
|
18
18
|
extra_rdoc_files: []
|
|
19
19
|
files:
|
|
20
20
|
- bin/pbm
|
|
21
|
+
- lib/pbm.rb
|
|
22
|
+
- lib/pbm/commands/exit.rb
|
|
21
23
|
homepage: http://rubygems.org/gems/pbm
|
|
22
24
|
licenses:
|
|
23
25
|
- MIT
|