djinni 0.1.16 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03b1c387133f6e9dfd95e9962b6c86bf8b98621e
4
- data.tar.gz: 5a25d94354038b51f29eedcadbccc003c6a11dbb
3
+ metadata.gz: a53f002bb38f59690b1ed3e575b06e13f0b42a9b
4
+ data.tar.gz: 4a533cbd15ff289034611f7960600460af34d94e
5
5
  SHA512:
6
- metadata.gz: 1d72fed5eff6de074a270f8cfd628d25bfa37d17055b2f01f8931cc14de95174af1c7a004504806f99520b9fa260afd11bb2ec57cb74260041ab07f6a8056c61
7
- data.tar.gz: 6a8d0549883ee0a32c3fb1508886c75229e70cd8cf095ecd7619f0169fb854088b33e4737a7b173b42ab5c34963bd7f0898b615a066de733eb274c79b1be87d8
6
+ metadata.gz: 458243eef2e17c6f8fccfa41cf3ae550dc51147666f5c57964d1fd014ee9a6fdd945a97fe13d536e93ad07a242490716d040e496111418a1c69eb472817516d5
7
+ data.tar.gz: 1764fc8162dcc10e5fbd5fc42117c5376557b6343c1e4cac62e916e3e9f5a8b41fc3f7d0352cf488ac348428e7ee0879f9a85ae5a647a6d2b38cae5101860ed4
@@ -1,6 +1,6 @@
1
1
  require "djinni"
2
2
 
3
- class DjinniHelpWish < DjinniWish
3
+ class DjinniHelpWish < Djinni::Wish
4
4
  def aliases
5
5
  return [ "?", "help" ]
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "djinni"
2
2
 
3
- class DjinniHistoryWish < DjinniWish
3
+ class DjinniHistoryWish < Djinni::Wish
4
4
  def aliases
5
5
  return [ "hist", "history" ]
6
6
  end
@@ -1,6 +1,6 @@
1
1
  require "djinni"
2
2
 
3
- class DjinniQuitWish < DjinniWish
3
+ class DjinniQuitWish < Djinni::Wish
4
4
  def aliases
5
5
  return [ "bye", "exit", "q", "quit" ]
6
6
  end
@@ -0,0 +1,2 @@
1
+ class Djinni::Error < RuntimeError
2
+ end
@@ -0,0 +1,7 @@
1
+ require "djinni/error.rb"
2
+
3
+ class Djinni::UnknownWishError < Djinni::Error
4
+ def initialize(clas = "")
5
+ super("Unknown wish class #{clas}!")
6
+ end
7
+ end
@@ -1,4 +1,4 @@
1
- class DjinniWish
1
+ class Djinni::Wish
2
2
  class InterfaceNotImplementedError < NoMethodError
3
3
  end
4
4
 
data/lib/djinni.rb CHANGED
@@ -1,12 +1,8 @@
1
- require "djinni_error"
2
- require "djinni_wish"
3
1
  require "io/console"
4
2
  require "pathname"
5
3
  require "terminfo"
6
4
 
7
5
  class Djinni
8
- include DjinniError
9
-
10
6
  def grant_wish(input, djinni_env = {})
11
7
  return "" if (input.nil? || input.empty?)
12
8
 
@@ -136,7 +132,7 @@ class Djinni
136
132
  begin
137
133
  wish = Object::const_get(clas).new
138
134
  rescue NameError => e
139
- raise DjinniError::UnknownWish.new(clas)
135
+ raise Djinni::UnknownWishError.new(clas)
140
136
  end
141
137
 
142
138
  return if (wish.nil?)
@@ -156,7 +152,7 @@ class Djinni
156
152
  require_relative file
157
153
 
158
154
  %x(
159
- \grep -E "^ *class .+ \< DjinniWish" #{file} | \
155
+ \grep -E "^ *class .+ \< Djinni::Wish" #{file} | \
160
156
  awk '{print $2}'
161
157
  ).each_line do |clas|
162
158
  load_wish(clas)
@@ -211,3 +207,6 @@ class Djinni
211
207
  end
212
208
  private :store_history
213
209
  end
210
+
211
+ require "djinni/error"
212
+ require "djinni/wish"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: djinni
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-07 00:00:00.000000000 Z
11
+ date: 2015-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -62,8 +62,9 @@ files:
62
62
  - lib/builtin/djinni_history_wish.rb
63
63
  - lib/builtin/djinni_quit_wish.rb
64
64
  - lib/djinni.rb
65
- - lib/djinni_error.rb
66
- - lib/djinni_wish.rb
65
+ - lib/djinni/error.rb
66
+ - lib/djinni/unknwon_wish_error.rb
67
+ - lib/djinni/wish.rb
67
68
  homepage: http://mjwhitta.github.io/djinni
68
69
  licenses:
69
70
  - GPL-3.0
data/lib/djinni_error.rb DELETED
@@ -1,10 +0,0 @@
1
- module DjinniError
2
- class Error < RuntimeError
3
- end
4
-
5
- class UnknownWish < Error
6
- def initialize(clas = "")
7
- super("Unknown wish class #{clas}!")
8
- end
9
- end
10
- end