wycats-textmate 0.9.0 → 0.9.1

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.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/bin/textmate +6 -3
  3. metadata +1 -2
  4. data/lib/class_cli.rb +0 -77
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
  require 'date'
4
4
 
5
5
  GEM = "textmate"
6
- GEM_VERSION = "0.9.0"
6
+ GEM_VERSION = "0.9.1"
7
7
  AUTHOR = "Yehuda Katz"
8
8
  EMAIL = "wycats@gmail.com"
9
9
  HOMEPAGE = "http://yehudakatz.com"
data/bin/textmate CHANGED
@@ -21,11 +21,14 @@ class TextmateInstaller < Thor
21
21
  end
22
22
  end
23
23
 
24
- desc "list", "lists all the bundles installed locally"
25
- def list()
24
+ desc "list [SEARCH]", "lists all the bundles installed locally"
25
+ def list(limit = "")
26
+ limit = Regexp.new(".*#{limit}.*", "i")
27
+
26
28
  local_bundle_paths.each do |name,bundles_path|
27
29
  puts "\n" << name.to_s << " Bundles\n" << name.to_s.gsub(/./,'-') << '--------'
28
- puts Dir["#{e_sh bundles_path}/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.join("\n")
30
+ puts Dir["#{e_sh bundles_path}/*.tmbundle"].map {|x| x.split("/").last.split(".").first}.
31
+ select {|x| x =~ limit}.join("\n")
29
32
  end
30
33
  end
31
34
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wycats-textmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yehuda Katz
@@ -35,7 +35,6 @@ files:
35
35
  - README.markdown
36
36
  - Rakefile
37
37
  - bin/textmate
38
- - lib/class_cli.rb
39
38
  has_rdoc: true
40
39
  homepage: http://yehudakatz.com
41
40
  post_install_message:
data/lib/class_cli.rb DELETED
@@ -1,77 +0,0 @@
1
- require "getopt/long"
2
-
3
- module Hermes
4
- def self.extended(klass)
5
- klass.class_eval <<-RUBY, "class_cli.rb", 6
6
-
7
- def self.method_added(meth)
8
- return if !public_instance_methods.include?(meth.to_s) || !@@usage
9
- @@descriptions = defined?(@@descriptions) ? @@descriptions : []
10
- @@usages = defined?(@@usages) ? @@usages : []
11
- @@opts = defined?(@@opts) ? @@opts : []
12
- @@descriptions << [meth.to_s, @@desc]
13
- @@usages << [meth.to_s, @@usage]
14
- if defined?(@@method_options) && @@method_options
15
- @@opts << [meth.to_s, @@method_options]
16
- end
17
- @@usage, @@desc, @@method_options = nil
18
- end
19
-
20
- def self.desc(usage, description)
21
- @@usage, @@desc = usage, description
22
- end
23
-
24
- def self.method_options(opts)
25
- @@method_options = opts
26
- end
27
-
28
- def self.start
29
- meth = ARGV.shift
30
- params = ARGV.inject([]) do |accum, arg|
31
- accum << ARGV.delete(arg) unless arg =~ /^\-/
32
- accum
33
- end
34
- if @@opts.assoc(meth)
35
- opts = @@opts.assoc(meth).last.map {|opt, val| [opt, val == true ? Getopt::BOOLEAN : Getopt.const_get(val)].flatten}
36
- options = Getopt::Long.getopts(*opts)
37
- params << options
38
- end
39
- new(meth, params)
40
- end
41
-
42
- def initialize(op, params)
43
- send(op.to_sym, *params) if public_methods.include?(op)
44
- end
45
-
46
- private
47
- def format_opts(opts)
48
- return "" unless opts
49
- opts.map do |opt, val|
50
- if val == true || val == "BOOLEAN"
51
- opt
52
- elsif val == "REQUIRED"
53
- opt + "=" + opt.gsub(/\-/, "").upcase
54
- elsif val == "OPTIONAL"
55
- "[" + opt + "=" + opt.gsub(/\-/, "").upcase + "]"
56
- end
57
- end.join(" ")
58
- end
59
-
60
- public
61
- desc "help", "show this screen"
62
- def help
63
- puts "Options"
64
- puts "-------"
65
- max_usage = @@usages.max {|x,y| x.last.to_s.size <=> y.last.to_s.size}.last.size
66
- max_opts = @@opts.empty? ? 0 : format_opts(@@opts.max {|x,y| x.last.to_s.size <=> y.last.to_s.size}.last).size
67
- max_desc = @@descriptions.max {|x,y| x.last.to_s.size <=> y.last.to_s.size}.last.size
68
- @@usages.each do |meth, usage|
69
- format = "%-" + (max_usage + max_opts + 4).to_s + "s"
70
- print format % (@@usages.assoc(meth)[1] + (@@opts.assoc(meth) ? " " + format_opts(@@opts.assoc(meth)[1]) : ""))
71
- # print format % (@@usages.assoc(meth)[1] + @@opts.assoc(meth) ? format_opts(@@opts.assoc(meth)[1]) : ""))
72
- puts @@descriptions.assoc(meth)[1]
73
- end
74
- end
75
- RUBY
76
- end
77
- end