djinni 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/djinni.rb +6 -8
- data/lib/djinni_error.rb +10 -0
- metadata +2 -2
- data/lib/djinni_exit.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef936a21ffbf86d2e3066aa05597c6a5f968f357
|
4
|
+
data.tar.gz: 0c3a346b04c8e7413dcb8984ef0e26554f12ad94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b897ad86168a31364fdd9bf91810198798f3bc9200f488500dcd3f95c1530fd7ee271f7ce6ba0a77141501a1d7af4b40eea375f97d5d569b8651d2c1bcb1b1a
|
7
|
+
data.tar.gz: 8c091c11e1e68181d39cb188f58000b2322f5e216f19c00587ed6ad52f973a298b1a8027f8ecf2b50fc902369a732ab7eb575ecd5f64a7e9ad59084b68942fca
|
data/lib/djinni.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
+
require "djinni_error"
|
2
|
+
require "djinni_wish"
|
1
3
|
require "io/console"
|
2
4
|
require "pathname"
|
3
5
|
require "terminfo"
|
4
6
|
|
5
|
-
require_relative "djinni_exit"
|
6
|
-
require_relative "djinni_wish"
|
7
|
-
|
8
7
|
class Djinni
|
8
|
+
include DjinniError
|
9
|
+
|
9
10
|
def grant_wish(input, env = {})
|
10
11
|
return "" if (input.nil? || input.empty?)
|
11
12
|
|
@@ -122,8 +123,7 @@ class Djinni
|
|
122
123
|
begin
|
123
124
|
wish = Object::const_get(clas).new
|
124
125
|
rescue NameError => e
|
125
|
-
|
126
|
-
exit DjinniExit::UNKNOWN_WISH
|
126
|
+
raise DjinniError::UnknownWish.new(clas)
|
127
127
|
end
|
128
128
|
|
129
129
|
return if (wish.nil?)
|
@@ -138,13 +138,11 @@ class Djinni
|
|
138
138
|
|
139
139
|
path = Pathname.new(dir).expand_path
|
140
140
|
|
141
|
-
# puts "Loading wishes from #{path}"
|
142
141
|
Dir["#{path}/*.rb"].each do |file|
|
143
|
-
# puts "Loading #{clas}"
|
144
142
|
require_relative file
|
145
143
|
|
146
144
|
%x(
|
147
|
-
\grep -E "class
|
145
|
+
\grep -E "^ *class .+ \< DjinniWish" #{file} | \
|
148
146
|
awk '{print $2}'
|
149
147
|
).each_line do |clas|
|
150
148
|
load_wish(clas)
|
data/lib/djinni_error.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: djinni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Whittaker
|
@@ -62,7 +62,7 @@ files:
|
|
62
62
|
- lib/builtin/history.rb
|
63
63
|
- lib/builtin/quit.rb
|
64
64
|
- lib/djinni.rb
|
65
|
-
- lib/
|
65
|
+
- lib/djinni_error.rb
|
66
66
|
- lib/djinni_wish.rb
|
67
67
|
homepage: http://mjwhitta.github.io/djinni
|
68
68
|
licenses:
|
data/lib/djinni_exit.rb
DELETED