ruby_do_plugin_filesearch 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,6 +4,7 @@ source "http://rubygems.org"
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
 
6
6
  gem "ruby_do", ">= 0.0.0"
7
+ gem "knjrbfw"
7
8
 
8
9
  # Add dependencies to develop your gem here.
9
10
  # Include everything needed to run rake, tests, features, etc.
data/Gemfile.lock CHANGED
@@ -56,6 +56,7 @@ PLATFORMS
56
56
  DEPENDENCIES
57
57
  bundler (>= 1.0.0)
58
58
  jeweler (~> 1.8.4)
59
+ knjrbfw
59
60
  rcov
60
61
  rdoc (~> 3.12)
61
62
  rspec (~> 2.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.0
1
+ 0.0.1
@@ -34,11 +34,9 @@ class Ruby_do_plugin_filesearch < Ruby_do::Plugin::Base
34
34
 
35
35
  def on_search(args)
36
36
  return Enumerator.new do |yielder|
37
- words = args[:text].split(/\s+/).map{|ele| ele.downcase}
38
-
39
- if !words.empty?
37
+ if !args[:words].empty?
40
38
  @ob.list(:Plugin_filesearch_folder) do |folder|
41
- files = self.scan_dir(folder[:path], :words => words, :depth => 0, :max_depth => folder[:search_depth].to_i) do |file|
39
+ files = self.scan_dir(folder[:path], :words => args[:words], :depth => 0, :max_depth => folder[:search_depth].to_i) do |file|
42
40
  title = sprintf(_("Open '%s'."), file[:name])
43
41
 
44
42
  yielder << Ruby_do::Plugin::Result.new(
@@ -54,8 +52,8 @@ class Ruby_do_plugin_filesearch < Ruby_do::Plugin::Base
54
52
  end
55
53
  end
56
54
 
57
- def execute_result(res)
58
- Knj::Os.subproc("xdg-open \"#{res.args[:path]}\"")
55
+ def execute_result(args)
56
+ Knj::Os.subproc("xdg-open \"#{args[:res].args[:path]}\"")
59
57
  return :close_win_main
60
58
  end
61
59
 
@@ -63,26 +61,26 @@ class Ruby_do_plugin_filesearch < Ruby_do::Plugin::Base
63
61
  depth = args[:depth] + 1
64
62
 
65
63
  Dir.foreach(path) do |file|
66
- next if file[0, 1] == "."
67
- fp = "#{path}/#{file}"
68
- filel = file.downcase
69
-
70
- if File.directory?(fp)
71
- begin
64
+ begin
65
+ next if file[0, 1] == "."
66
+ fp = "#{path}/#{file}"
67
+ filel = file.downcase
68
+
69
+ if File.directory?(fp)
72
70
  self.scan_dir(fp, args.merge(:depth => depth), &block) if depth < args[:max_depth]
73
- rescue => e
74
- $stderr.puts "Error while searching folder: '#{e.message}' for '#{fp}'."
75
- end
76
- else
77
- all_found = true
78
- args[:words].each do |word|
79
- if file.index(word) == nil
80
- all_found = false
81
- break
71
+ else
72
+ all_found = true
73
+ args[:words].each do |word|
74
+ if filel.index(word) == nil
75
+ all_found = false
76
+ break
77
+ end
82
78
  end
79
+
80
+ block.call(:name => file, :path => fp) if all_found
83
81
  end
84
-
85
- block.call(:name => file, :path => fp) if all_found
82
+ rescue => e
83
+ $stderr.puts "Error while searching item: '#{e.message}' for '#{fp}'."
86
84
  end
87
85
  end
88
86
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ruby_do_plugin_filesearch}
8
- s.version = "0.0.0"
8
+ s.version = "0.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
47
47
 
48
48
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
49
  s.add_runtime_dependency(%q<ruby_do>, [">= 0.0.0"])
50
+ s.add_runtime_dependency(%q<knjrbfw>, [">= 0"])
50
51
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
51
52
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
52
53
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
@@ -54,6 +55,7 @@ Gem::Specification.new do |s|
54
55
  s.add_development_dependency(%q<rcov>, [">= 0"])
55
56
  else
56
57
  s.add_dependency(%q<ruby_do>, [">= 0.0.0"])
58
+ s.add_dependency(%q<knjrbfw>, [">= 0"])
57
59
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
58
60
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
61
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
@@ -62,6 +64,7 @@ Gem::Specification.new do |s|
62
64
  end
63
65
  else
64
66
  s.add_dependency(%q<ruby_do>, [">= 0.0.0"])
67
+ s.add_dependency(%q<knjrbfw>, [">= 0"])
65
68
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
66
69
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
67
70
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ruby_do_plugin_filesearch
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.0
5
+ version: 0.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -25,8 +25,19 @@ dependencies:
25
25
  prerelease: false
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: knjrbfw
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: "0"
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ requirement: &id003 !ruby/object:Gem::Requirement
30
41
  none: false
31
42
  requirements:
32
43
  - - ~>
@@ -34,10 +45,10 @@ dependencies:
34
45
  version: 2.8.0
35
46
  type: :development
36
47
  prerelease: false
37
- version_requirements: *id002
48
+ version_requirements: *id003
38
49
  - !ruby/object:Gem::Dependency
39
50
  name: rdoc
40
- requirement: &id003 !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
41
52
  none: false
42
53
  requirements:
43
54
  - - ~>
@@ -45,10 +56,10 @@ dependencies:
45
56
  version: "3.12"
46
57
  type: :development
47
58
  prerelease: false
48
- version_requirements: *id003
59
+ version_requirements: *id004
49
60
  - !ruby/object:Gem::Dependency
50
61
  name: bundler
51
- requirement: &id004 !ruby/object:Gem::Requirement
62
+ requirement: &id005 !ruby/object:Gem::Requirement
52
63
  none: false
53
64
  requirements:
54
65
  - - ">="
@@ -56,10 +67,10 @@ dependencies:
56
67
  version: 1.0.0
57
68
  type: :development
58
69
  prerelease: false
59
- version_requirements: *id004
70
+ version_requirements: *id005
60
71
  - !ruby/object:Gem::Dependency
61
72
  name: jeweler
62
- requirement: &id005 !ruby/object:Gem::Requirement
73
+ requirement: &id006 !ruby/object:Gem::Requirement
63
74
  none: false
64
75
  requirements:
65
76
  - - ~>
@@ -67,10 +78,10 @@ dependencies:
67
78
  version: 1.8.4
68
79
  type: :development
69
80
  prerelease: false
70
- version_requirements: *id005
81
+ version_requirements: *id006
71
82
  - !ruby/object:Gem::Dependency
72
83
  name: rcov
73
- requirement: &id006 !ruby/object:Gem::Requirement
84
+ requirement: &id007 !ruby/object:Gem::Requirement
74
85
  none: false
75
86
  requirements:
76
87
  - - ">="
@@ -78,7 +89,7 @@ dependencies:
78
89
  version: "0"
79
90
  type: :development
80
91
  prerelease: false
81
- version_requirements: *id006
92
+ version_requirements: *id007
82
93
  description: A plugin for Ruby-Do that allows searching for and executing files.
83
94
  email: k@spernj.org
84
95
  executables: []
@@ -121,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
132
  requirements:
122
133
  - - ">="
123
134
  - !ruby/object:Gem::Version
124
- hash: -403522318111538229
135
+ hash: -1666545148604119211
125
136
  segments:
126
137
  - 0
127
138
  version: "0"