public
Description: An extremely simple way to create a RubyGem
Homepage: http://dojo.rubyforge.org/gemify
Clone URL: git://github.com/judofyr/gemify.git
Search Repo:
Optimizing the UI-system
judofyr (author)
Fri May 02 07:00:02 -0700 2008
commit  c895f045aa266272b0ba85c7e9a2f28e7ed28ffb
tree    5715fae4a070b41e35e465d7d6f4c850c949dd85
parent  251ef0fea0f5c5b33c6928b587c66be61c9d7c87
...
36
37
38
39
40
41
 
 
 
42
43
44
...
62
63
64
65
 
 
 
66
...
36
37
38
 
 
 
39
40
41
42
43
44
...
62
63
64
 
65
66
67
68
0
@@ -36,9 +36,9 @@ parser = OptionParser.new do |opts|
0
     "git, darcs, hg, bzr, svn or cvs") do |val|
0
     options[:manifest] = val.to_sym
0
   end
0
- #opts.on("-u", "--ui NAME", "Specifies user interface") do |name|
0
- # options[:ui] = name
0
- #end
0
+ opts.on("-u", "--ui NAME", "Specifies user interface") do |name|
0
+ options[:ui] = name
0
+ end
0
 end
0
 
0
 begin
0
@@ -62,5 +62,7 @@ begin
0
     end
0
   end
0
 rescue Gemify::UI::EmptyManifest
0
- puts "Can't find anything to make a gem out of..."
0
+ puts "Can't find anything to make a gem out of..."
0
+rescue Exception => e
0
+ puts e.message
0
 end
...
2
3
4
 
5
6
7
...
40
41
42
43
44
45
46
47
48
49
 
 
 
 
50
51
52
53
54
55
56
 
57
...
2
3
4
5
6
7
8
...
41
42
43
 
 
 
 
 
 
 
44
45
46
47
48
49
50
51
52
 
 
53
54
0
@@ -2,6 +2,7 @@ module Gemify
0
   class UI
0
     class EmptyManifest < StandardError; end
0
 
0
+ UIS = ["CLI"]
0
     SETTINGS = ".gemified"
0
     VCS = [:git, :darcs, :hg, :bzr, :svn, :cvs]
0
     MODE = [:auto, :file, :vcs, :basic]
0
@@ -40,17 +41,13 @@ module Gemify
0
     end
0
 
0
     def self.use(name)
0
- case name.to_s
0
- when "cli"
0
- require "gemify/ui/cli"
0
- return Gemify::UI::CLI
0
- #when "curses"
0
- # require "gemify/ui/curses"
0
- # return Gemify::UI::Curses
0
+ file = name.to_s.downcase
0
+ if klass = UIS.find{ |x| x.downcase == file }
0
+ require "gemify/ui/#{file}"
0
+ return Gemify::UI.const_get(klass)
0
       else
0
         raise ArgumentError, "There is no UI named '#{name}'"
0
       end
0
     end
0
   end
0
-
0
-end
0
+end
0
\ No newline at end of file

Comments

    No one has commented yet.