djinni 1.2.0 → 1.3.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: 88936cae4a96cccca6820c6f830a3f5e28f79b9b
4
- data.tar.gz: 90159372fe2bd970e47af1525f271bbc531f0c58
3
+ metadata.gz: 1ea5e8f1cef093a7500f760b453448830ad92b0b
4
+ data.tar.gz: a85a0322e73454913e284b02181e35bd0171fc93
5
5
  SHA512:
6
- metadata.gz: 7626993bc93def45acd243b738854f2b308d7f3268f94adea3e1edcc2d3a6c9b719ca2062f5db7df3f696312163344d6d8f6e1a79e672c0e0645575af9adfcbd
7
- data.tar.gz: 41144d92295dd23b38c9b22fcdc92e6fb7fa29f8e723af59eeb6ab22f8d81756ef68cda2299db2a51063d0d70c9e1d7f6f7d688b5d94972bdb422f9620676f42
6
+ metadata.gz: ad6db4b68eb697e3132cf9e558a367c30cd4155816282ab591921be7fcd98079ddb7277ae42904bd1cc5481c0758994cd2af70221daaca2d04e18890b92b049e
7
+ data.tar.gz: 71bd1a4c5d022f289d36ca805544ffe553f12f79180c2dd2cd72cd7b6bd9712b4fb72c4d6df6761576a3161e7e5feb64541b7ab0970d33086b94da7eaa5d3dd6
data/lib/djinni.rb CHANGED
@@ -1,5 +1,5 @@
1
+ require "fagin"
1
2
  require "io/console"
2
- require "pathname"
3
3
  require "terminfo"
4
4
 
5
5
  class Djinni
@@ -123,39 +123,13 @@ class Djinni
123
123
  load_wishes("#{File.dirname(__FILE__)}/djinni/wish")
124
124
  end
125
125
 
126
- def load_wish(clas)
127
- return if (clas.nil?)
128
- clas.strip!
129
- return if (clas.empty?)
130
-
131
- wish = nil
132
- begin
133
- wish = Object::const_get(clas).new
134
- rescue NameError => e
135
- raise Error::UnknownWishError.new(clas)
136
- end
137
-
138
- return if (wish.nil?)
139
-
140
- wish.aliases.each do |aliaz|
141
- @wishes[aliaz] = wish
142
- end
143
- end
144
- private :load_wish
145
-
146
126
  def load_wishes(dir)
147
127
  return if @loaded_from.include?(dir)
148
128
 
149
- path = Pathname.new(dir).expand_path
150
-
151
- Dir["#{path}/*.rb"].each do |file|
152
- require_relative file
153
-
154
- %x(
155
- \grep -E "^ *class .+ \< Djinni::Wish" #{file} | \
156
- awk '{print $2}'
157
- ).each_line do |clas|
158
- load_wish(clas)
129
+ classes = Fagin.find_children("Djinni::Wish", dir)
130
+ classes.each do |clas, wish|
131
+ wish.aliases.each do |aliaz|
132
+ @wishes[aliaz] = wish
159
133
  end
160
134
  end
161
135
 
data/lib/djinni/wish.rb CHANGED
@@ -31,6 +31,6 @@ class Djinni::Wish
31
31
  end
32
32
  end
33
33
 
34
- require "djinni/wish/djinni_help_wish"
35
- require "djinni/wish/djinni_history_wish"
36
- require "djinni/wish/djinni_quit_wish"
34
+ require "djinni/wish/help"
35
+ require "djinni/wish/history"
36
+ require "djinni/wish/quit"
@@ -1,6 +1,6 @@
1
1
  require "djinni"
2
2
 
3
- class DjinniHelpWish < Djinni::Wish
3
+ class Djinni::Wish::Help < 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 < Djinni::Wish
3
+ class Djinni::Wish::History < 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 < Djinni::Wish
3
+ class Djinni::Wish::Quit < Djinni::Wish
4
4
  def aliases
5
5
  return [ "bye", "exit", "q", "quit" ]
6
6
  end
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: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
@@ -50,6 +50,26 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 10.4.2
53
+ - !ruby/object:Gem::Dependency
54
+ name: fagin
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '0.1'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.1.0
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '0.1'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.1.0
53
73
  - !ruby/object:Gem::Dependency
54
74
  name: ruby-terminfo
55
75
  requirement: !ruby/object:Gem::Requirement
@@ -82,9 +102,9 @@ files:
82
102
  - lib/djinni/error.rb
83
103
  - lib/djinni/error/unknown_wish_error.rb
84
104
  - lib/djinni/wish.rb
85
- - lib/djinni/wish/djinni_help_wish.rb
86
- - lib/djinni/wish/djinni_history_wish.rb
87
- - lib/djinni/wish/djinni_quit_wish.rb
105
+ - lib/djinni/wish/help.rb
106
+ - lib/djinni/wish/history.rb
107
+ - lib/djinni/wish/quit.rb
88
108
  homepage: http://mjwhitta.github.io/djinni
89
109
  licenses:
90
110
  - GPL-3.0