ssoroka-grepmate 1.0.1 → 2.0.0

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.
@@ -0,0 +1,11 @@
1
+ module Output
2
+ class Text
3
+ def initialize(grepmate)
4
+ @grepmate = grepmate
5
+ end
6
+
7
+ def process
8
+ puts @grepmate.results
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,22 @@
1
+ module Output
2
+ class Textmate
3
+ def initialize(grepmate)
4
+ @grepmate = grepmate
5
+ end
6
+
7
+ def process
8
+ print "Found #{@grepmate.results.size} matches. "
9
+ if @grepmate.results.size > 20
10
+ puts "Display? [Y/n]..."
11
+ exit if $stdin.gets.chomp.downcase == 'n'
12
+ else
13
+ puts ''
14
+ end
15
+
16
+ @grepmate.results.each { |f|
17
+ file, line = f.split(':')
18
+ system("mate #{'-w ' if @grepmate.params['wait'].value}-l #{line} #{file}")
19
+ }
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,117 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Grepmate" do
4
+ before(:each) do
5
+ @orig_pwd = Dir.pwd
6
+ Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '..')))
7
+ end
8
+
9
+ after(:each) do
10
+ # change back
11
+ Dir.chdir @orig_pwd
12
+ end
13
+
14
+ describe 'bin/grepmate' do
15
+ it "should search project" do
16
+ output = `bin/grepmate -c "module Output"`.split("\n").compact.last
17
+ output.should =~ /Matches\: (\d+)/
18
+ output.scan(/Matches\: (\d+)/).flatten.first.to_i.should >= 6
19
+ end
20
+
21
+ it "should behave when piped STDIN files" do
22
+ `echo LICENSE | bin/grepmate -c "Steven Soroka"`.chomp.should == 'Matches: 1'
23
+ end
24
+ #
25
+ # it "should search gems" do
26
+ # # dev most likely has "main" gem installed, since it's a requirement, search for the words "gem install main" in the readme.
27
+ # `bin/grepmate -G -f "gem install main" 2> /dev/null`.grep(/main-[\d\.]+\/README/).should_not be_nil
28
+ # end
29
+ #
30
+ # it "should search rails" do
31
+ # # changelog is unlikely to change or go missing, since it's historical.
32
+ # `bin/grepmate -R -f "Fixed that validate_length_of lost :on option when :within was specified" 2> /dev/null`.grep(/CHANGELOG/).should_not be_nil
33
+ # end
34
+
35
+ it "should support regular expressions" do
36
+ # from LICENSE: this will match: Steven Soroka
37
+ `echo LICENSE | bin/grepmate -c -e "even .oro.a"`.chomp.should == 'Matches: 1'
38
+ end
39
+
40
+ describe 'output' do
41
+ it "should output text" do
42
+ result = `bin/grepmate --text 'Steven Soroka'`
43
+ # spec/grepmate_spec.rb:22: `echo LICENSE | bin/grepmate -c "Steven Soroka"`.chomp.should == 'Matches: 1'
44
+ # spec/grepmate_spec.rb:36: # from LICENSE: this will match: Steven Soroka
45
+ # spec/grepmate_spec.rb:42: puts `bin/grepmate --text 'Steven Soroka'`
46
+ # spec/grepmate_spec.rb:46: # `bin/grepmate --html 'Steven Soroka'`
47
+ # spec/grepmate_spec.rb:61: params.(blah blah blah blah blah blah blah blah blah blah)s => ["Steven Soroka"]))
48
+ result.should =~ /grepmate_spec/
49
+ end
50
+
51
+ it "should output html" do
52
+ # `bin/grepmate --html 'Steven Soroka'`
53
+ params = mock(:params)
54
+ params.should_receive(:[]).with('html').any_number_of_times.and_return(mock(:html, :value => true))
55
+ params.should_receive(:[]).with('text').any_number_of_times.and_return(mock(:text, :value => false))
56
+ params.should_receive(:[]).with('textmate').any_number_of_times.and_return(mock(:textmate, :value => false))
57
+ params.should_receive(:[]).with('file_and_line').any_number_of_times.and_return(mock(:file_and_line, :value => false))
58
+ params.should_receive(:[]).with('dir').any_number_of_times.and_return(mock(:dir, :values => ['bin', 'config', 'lib', 'spec'], :values= => nil))
59
+ params.should_receive(:[]).with('rails').any_number_of_times.and_return(mock(:rails, :given? => nil, :value => nil))
60
+ params.should_receive(:[]).with('gems').any_number_of_times.and_return(mock(:gems, :given? => nil, :value => nil))
61
+ params.should_receive(:[]).with('only_rails').any_number_of_times.and_return(mock(:only_rails, :value => nil))
62
+ params.should_receive(:[]).with('only_gems').any_number_of_times.and_return(mock(:only_gems, :value => nil))
63
+ params.should_receive(:[]).with('regex').any_number_of_times.and_return(mock(:regex, :value => nil))
64
+ params.should_receive(:[]).with('case').any_number_of_times.and_return(mock(:case, :value => nil))
65
+ params.should_receive(:[]).with('count').any_number_of_times.and_return(mock(:count, :value => nil))
66
+ params.should_receive(:[]).with('verbose').any_number_of_times.and_return(mock(:verbose, :value => nil))
67
+ params.should_receive(:[]).with('what_to_search_for').any_number_of_times.and_return(mock(:what_to_search_for, :values => ["Steven Soroka"]))
68
+
69
+ grepmate = Grepmate.new(params)
70
+ # hijack the output class so that it doesn't send the system() call.
71
+ output_class = Output::HTML.new(grepmate)
72
+ output_class.should_receive(:system).with("open #{Output::HTML::TEMP_FILE}")
73
+
74
+ Output::HTML.stub!(:new).and_return(output_class)
75
+
76
+ grepmate.find
77
+ grepmate.display
78
+ end
79
+
80
+ it "should output textmate commands" do
81
+ # `bin/grepmate --textmate 'Steven Soroka'`
82
+ params = mock(:params)
83
+ params.should_receive(:[]).with('html').any_number_of_times.and_return(mock(:html, :value => false))
84
+ params.should_receive(:[]).with('text').any_number_of_times.and_return(mock(:text, :value => false))
85
+ params.should_receive(:[]).with('textmate').any_number_of_times.and_return(mock(:textmate, :value => true))
86
+ params.should_receive(:[]).with('file_and_line').any_number_of_times.and_return(mock(:file_and_line, :value => false))
87
+ params.should_receive(:[]).with('dir').any_number_of_times.and_return(mock(:dir, :values => ['bin', 'config', 'lib', 'spec'], :values= => nil))
88
+ params.should_receive(:[]).with('rails').any_number_of_times.and_return(mock(:rails, :given? => nil, :value => nil))
89
+ params.should_receive(:[]).with('gems').any_number_of_times.and_return(mock(:gems, :given? => nil, :value => nil))
90
+ params.should_receive(:[]).with('only_rails').any_number_of_times.and_return(mock(:only_rails, :value => nil))
91
+ params.should_receive(:[]).with('only_gems').any_number_of_times.and_return(mock(:only_gems, :value => nil))
92
+ params.should_receive(:[]).with('regex').any_number_of_times.and_return(mock(:regex, :value => nil))
93
+ params.should_receive(:[]).with('case').any_number_of_times.and_return(mock(:case, :value => nil))
94
+ params.should_receive(:[]).with('count').any_number_of_times.and_return(mock(:count, :value => nil))
95
+ params.should_receive(:[]).with('verbose').any_number_of_times.and_return(mock(:verbose, :value => nil))
96
+ params.should_receive(:[]).with('wait').any_number_of_times.and_return(mock(:wait, :value => true))
97
+ params.should_receive(:[]).with('what_to_search_for').any_number_of_times.and_return(mock(:what_to_search_for, :values => ["Steven Soroka"]))
98
+
99
+ grepmate = Grepmate.new(params)
100
+ # hijack the output class so that it doesn't send the system() call.
101
+ output_class = Output::Textmate.new(grepmate)
102
+ output_class.should_receive(:system).any_number_of_times # .with("mate -w blah blah"). I'm not going to try to guess all the finds.
103
+ output_class.stub!(:print) # I don't want to see the output.
104
+ output_class.stub!(:puts) # I don't want to see the output.
105
+
106
+ Output::Textmate.stub!(:new).and_return(output_class)
107
+
108
+ grepmate.find
109
+ grepmate.display
110
+ end
111
+
112
+ it "should output file and line number commands" do
113
+ `bin/grepmate -f "module Output"`.split("\n").first.should =~ %r(lib/output/file_and_line\.rb:1)
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,11 @@
1
+ # require 'rubygems'
2
+ # gem 'rspec'
3
+ require 'spec'
4
+
5
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
6
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
+ require 'grepmate'
8
+
9
+ Spec::Runner.configure do |config|
10
+
11
+ end
data/tmp/grepmate.html ADDED
@@ -0,0 +1,83 @@
1
+ <html><head> <style type="text/css">body { background-color: #EEEEEE; } pre {
2
+ display: inline; } .ruby { font-family: Monaco; font-size: 10pt;
3
+ background-color: white } .ruby .normal {} .ruby .comment { color:
4
+ #005; font-style: italic; } .ruby .keyword { color: #A00; font-weight:
5
+ bold; } .ruby .method { color: #077; } .ruby .class { color: #074; }
6
+ .ruby .module { color: #050; } .ruby .punct { color: #447; font-weight:
7
+ bold; } .ruby .symbol { color: #099; } .ruby .string { color: #944;
8
+ background: #FFE; } .ruby .char { color: #F07; } .ruby .ident { color:
9
+ #004; } .ruby .constant { color: #07F; } .ruby .regex { color: #B66;
10
+ background: #FEF; } .ruby .number { color: #F99; } .ruby .attribute {
11
+ color: #7BB; } .ruby .global { color: #7FB; } .ruby .expr { color:
12
+ #227; } .ruby .escape { color: #277; } .ruby .highlight {
13
+ background-color: yellow; font-weight: 900; } td.lineno { text-align:
14
+ right; font-family: Monaco; font-size: 9pt; padding-right: 10px; }
15
+ td.filename { padding-top: 35px; font-family: Monaco; font-size: 14pt;
16
+ }</style>
17
+
18
+ <script type="text/javascript">
19
+ // http://www.nsftools.com/misc/SearchAndHighlight.htm
20
+
21
+ function doHighlight(bodyText,searchTerm,highlightStartTag,highlightEndTag)
22
+ {if((!highlightStartTag)||(!highlightEndTag)){highlightStartTag="<font style='color:blue; background-color:yellow;'>";highlightEndTag="</font>";}
23
+ var newText="";var i=-1;var lcSearchTerm=searchTerm.toLowerCase();var lcBodyText=bodyText.toLowerCase();while(bodyText.length>0){i=lcBodyText.indexOf(lcSearchTerm,i+1);if(i<0){newText+=bodyText;bodyText="";}else{if(bodyText.lastIndexOf(">",i)>=bodyText.lastIndexOf("<",i)){if(lcBodyText.lastIndexOf("/script>",i)>=lcBodyText.lastIndexOf("<script",i)){newText+=bodyText.substring(0,i)+highlightStartTag+bodyText.substr(i,searchTerm.length)+highlightEndTag;bodyText=bodyText.substr(i+searchTerm.length);lcBodyText=bodyText.toLowerCase();i=-1;}}}}
24
+ return newText;}
25
+ function highlightSearchTerms(searchText,treatAsPhrase,warnOnFailure,highlightStartTag,highlightEndTag)
26
+ {if(treatAsPhrase){searchArray=[searchText];}else{searchArray=searchText.split(" ");}
27
+ if(!document.body||typeof(document.body.innerHTML)=="undefined"){if(warnOnFailure){alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");}
28
+ return false;}
29
+ var bodyText=document.body.innerHTML;for(var i=0;i<searchArray.length;i++){bodyText=doHighlight(bodyText,searchArray[i],highlightStartTag,highlightEndTag);}
30
+ document.body.innerHTML=bodyText;return true;}</script></script>
31
+ </head><body onLoad="highlightSearchTerms('Steven Soroka', false)"><table cellspacing="0" cellpadding="2"><tr><td colspan="2" class="filename"><a href="file://spec">spec</a>/<a href="txmt://open?url=file://spec/grepmate_spec.rb">grepmate_spec.rb</a></td></tr>
32
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=19">19</a></td><td class="ruby"><pre> <span class="keyword">end</span></pre></td></tr>
33
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=20">20</a></td><td class="ruby"><pre> </pre></td></tr>
34
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=21">21</a></td><td class="ruby"><pre> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should behave when piped STDIN files</span><span class="punct">&quot;</span> <span class="keyword">do</span></pre></td></tr>
35
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=22">22</a></td><td class="ruby"><pre> `<span class="ident">echo</span> <span class="constant">LICENSE</span> <span class="punct">|</span> <span class="ident">bin</span><span class="punct">/</span><span class="ident">grepmate</span> <span class="punct">-</span><span class="ident">c</span> <span class="punct">&quot;</span><span class="string">Steven Soroka</span><span class="punct">&quot;`.</span><span class="ident">chomp</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">==</span> <span class="punct">'</span><span class="string">Matches: 1</span><span class="punct">'</span></pre></td></tr>
36
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=23">23</a></td><td class="ruby"><pre> <span class="keyword">end</span></pre></td></tr>
37
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=24">24</a></td><td class="ruby"><pre> <span class="comment">#</span></pre></td></tr>
38
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=25">25</a></td><td class="ruby"><pre> <span class="comment"># it &quot;should search gems&quot; do</span></pre></td></tr>
39
+ <tr><td class="lineno">...</td><td></td></tr><tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=33">33</a></td><td class="ruby"><pre> <span class="comment"># end</span></pre></td></tr>
40
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=34">34</a></td><td class="ruby"><pre> </pre></td></tr>
41
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=35">35</a></td><td class="ruby"><pre> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should support regular expressions</span><span class="punct">&quot;</span> <span class="keyword">do</span></pre></td></tr>
42
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=36">36</a></td><td class="ruby"><pre> <span class="comment"># from LICENSE: this will match: Steven Soroka</span></pre></td></tr>
43
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=37">37</a></td><td class="ruby"><pre> `<span class="ident">echo</span> <span class="constant">LICENSE</span> <span class="punct">|</span> <span class="ident">bin</span><span class="punct">/</span><span class="ident">grepmate</span> <span class="punct">-</span><span class="ident">c</span> <span class="punct">-</span><span class="ident">e</span> <span class="punct">&quot;</span><span class="string">even .oro.a</span><span class="punct">&quot;`.</span><span class="ident">chomp</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">==</span> <span class="punct">'</span><span class="string">Matches: 1</span><span class="punct">'</span></pre></td></tr>
44
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=38">38</a></td><td class="ruby"><pre> <span class="keyword">end</span></pre></td></tr>
45
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=39">39</a></td><td class="ruby"><pre> </pre></td></tr>
46
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=40">40</a></td><td class="ruby"><pre> <span class="ident">describe</span> <span class="punct">'</span><span class="string">output</span><span class="punct">'</span> <span class="keyword">do</span></pre></td></tr>
47
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=41">41</a></td><td class="ruby"><pre> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should output text</span><span class="punct">&quot;</span> <span class="keyword">do</span></pre></td></tr>
48
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=42">42</a></td><td class="ruby"><pre> <span class="ident">result</span> <span class="punct">=</span> `<span class="ident">bin</span><span class="punct">/</span><span class="ident">grepmate</span> <span class="punct">--</span><span class="ident">text</span> <span class="punct">'</span><span class="string">Steven Soroka</span><span class="punct">'`</span></pre></td></tr>
49
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=43">43</a></td><td class="ruby"><pre> <span class="comment"># spec/grepmate_spec.rb:22: `echo LICENSE | bin/grepmate -c &quot;Steven Soroka&quot;`.chomp.should == 'Matches: 1'</span></pre></td></tr>
50
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=44">44</a></td><td class="ruby"><pre> <span class="comment"># spec/grepmate_spec.rb:36: # from LICENSE: this will match: Steven Soroka</span></pre></td></tr>
51
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=45">45</a></td><td class="ruby"><pre> <span class="comment"># spec/grepmate_spec.rb:42: puts `bin/grepmate --text 'Steven Soroka'`</span></pre></td></tr>
52
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=46">46</a></td><td class="ruby"><pre> <span class="comment"># spec/grepmate_spec.rb:46: # `bin/grepmate --html 'Steven Soroka'`</span></pre></td></tr>
53
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=47">47</a></td><td class="ruby"><pre> <span class="comment"># spec/grepmate_spec.rb:61: params.(blah blah blah blah blah blah blah blah blah blah)s =&gt; [&quot;Steven Soroka&quot;]))</span></pre></td></tr>
54
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=48">48</a></td><td class="ruby"><pre> <span class="ident">result</span><span class="punct">.</span><span class="ident">should</span> <span class="punct">=~</span> <span class="punct">/</span><span class="regex">grepmate_spec</span><span class="punct">/</span></pre></td></tr>
55
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=49">49</a></td><td class="ruby"><pre> <span class="keyword">end</span></pre></td></tr>
56
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=50">50</a></td><td class="ruby"><pre> </pre></td></tr>
57
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=51">51</a></td><td class="ruby"><pre> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should output html</span><span class="punct">&quot;</span> <span class="keyword">do</span></pre></td></tr>
58
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=52">52</a></td><td class="ruby"><pre> <span class="comment"># `bin/grepmate --html 'Steven Soroka'`</span></pre></td></tr>
59
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=53">53</a></td><td class="ruby"><pre> <span class="ident">params</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(</span><span class="symbol">:params</span><span class="punct">)</span></pre></td></tr>
60
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=54">54</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">html</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:html</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">true</span><span class="punct">))</span></pre></td></tr>
61
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=55">55</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">text</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:text</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">false</span><span class="punct">))</span></pre></td></tr>
62
+ <tr><td class="lineno">...</td><td></td></tr><tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=64">64</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">case</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:case</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">nil</span><span class="punct">))</span></pre></td></tr>
63
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=65">65</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">count</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:count</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">nil</span><span class="punct">))</span></pre></td></tr>
64
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=66">66</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">verbose</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:verbose</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">nil</span><span class="punct">))</span></pre></td></tr>
65
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=67">67</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">what_to_search_for</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:what_to_search_for</span><span class="punct">,</span> <span class="symbol">:values</span> <span class="punct">=&gt;</span> <span class="punct">[&quot;</span><span class="string">Steven Soroka</span><span class="punct">&quot;]))</span></pre></td></tr>
66
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=68">68</a></td><td class="ruby"><pre> </pre></td></tr>
67
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=69">69</a></td><td class="ruby"><pre> <span class="ident">grepmate</span> <span class="punct">=</span> <span class="constant">Grepmate</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">params</span><span class="punct">)</span></pre></td></tr>
68
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=70">70</a></td><td class="ruby"><pre> <span class="comment"># hijack the output class so that it doesn't send the system() call.</span></pre></td></tr>
69
+ <tr><td class="lineno">...</td><td></td></tr><tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=78">78</a></td><td class="ruby"><pre> <span class="keyword">end</span></pre></td></tr>
70
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=79">79</a></td><td class="ruby"><pre> </pre></td></tr>
71
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=80">80</a></td><td class="ruby"><pre> <span class="ident">it</span> <span class="punct">&quot;</span><span class="string">should output textmate commands</span><span class="punct">&quot;</span> <span class="keyword">do</span></pre></td></tr>
72
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=81">81</a></td><td class="ruby"><pre> <span class="comment"># `bin/grepmate --textmate 'Steven Soroka'`</span></pre></td></tr>
73
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=82">82</a></td><td class="ruby"><pre> <span class="ident">params</span> <span class="punct">=</span> <span class="ident">mock</span><span class="punct">(</span><span class="symbol">:params</span><span class="punct">)</span></pre></td></tr>
74
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=83">83</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">html</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:html</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">false</span><span class="punct">))</span></pre></td></tr>
75
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=84">84</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">text</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:text</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">false</span><span class="punct">))</span></pre></td></tr>
76
+ <tr><td class="lineno">...</td><td></td></tr><tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=94">94</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">count</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:count</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">nil</span><span class="punct">))</span></pre></td></tr>
77
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=95">95</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">verbose</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:verbose</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">nil</span><span class="punct">))</span></pre></td></tr>
78
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=96">96</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">wait</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:wait</span><span class="punct">,</span> <span class="symbol">:value</span> <span class="punct">=&gt;</span> <span class="constant">true</span><span class="punct">))</span></pre></td></tr>
79
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=97">97</a></td><td class="ruby"><pre> <span class="ident">params</span><span class="punct">.</span><span class="ident">should_receive</span><span class="punct">(:[]).</span><span class="ident">with</span><span class="punct">('</span><span class="string">what_to_search_for</span><span class="punct">').</span><span class="ident">any_number_of_times</span><span class="punct">.</span><span class="ident">and_return</span><span class="punct">(</span><span class="ident">mock</span><span class="punct">(</span><span class="symbol">:what_to_search_for</span><span class="punct">,</span> <span class="symbol">:values</span> <span class="punct">=&gt;</span> <span class="punct">[&quot;</span><span class="string">Steven Soroka</span><span class="punct">&quot;]))</span></pre></td></tr>
80
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=98">98</a></td><td class="ruby"><pre> </pre></td></tr>
81
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=99">99</a></td><td class="ruby"><pre> <span class="ident">grepmate</span> <span class="punct">=</span> <span class="constant">Grepmate</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">params</span><span class="punct">)</span></pre></td></tr>
82
+ <tr><td class="lineno"><a href="txmt://open?url=file://spec/grepmate_spec.rb&line=100">100</a></td><td class="ruby"><pre> <span class="comment"># hijack the output class so that it doesn't send the system() call.</span></pre></td></tr>
83
+ </table></body></html>
metadata CHANGED
@@ -1,25 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssoroka-grepmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Soroka
8
+ - Zach Holt
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2008-12-06 00:00:00 -08:00
13
+ date: 2009-07-23 00:00:00 -07:00
13
14
  default_executable: grepmate
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: main
18
+ type: :runtime
17
19
  version_requirement:
18
20
  version_requirements: !ruby/object:Gem::Requirement
19
21
  requirements:
20
22
  - - ">="
21
23
  - !ruby/object:Gem::Version
22
- version: "0"
24
+ version: 2.8.3
25
+ version:
26
+ - !ruby/object:Gem::Dependency
27
+ name: syntax
28
+ type: :runtime
29
+ version_requirement:
30
+ version_requirements: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.0
23
35
  version:
24
36
  description: Extremely fast search of rails projects or rails source for code, open in textmate or browser with html output
25
37
  email: ssoroka78@gmail.com
@@ -28,24 +40,32 @@ executables:
28
40
  extensions: []
29
41
 
30
42
  extra_rdoc_files:
31
- - bin/grepmate
32
- - README
43
+ - LICENSE
44
+ - README.rdoc
33
45
  files:
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
34
51
  - bin/grepmate
52
+ - config/dot-grepmate
35
53
  - grepmate.gemspec
36
- - Manifest
37
- - Rakefile
38
- - README
39
- has_rdoc: true
54
+ - lib/.empty
55
+ - lib/.git-empty
56
+ - lib/grepmate.rb
57
+ - lib/output/file_and_line.rb
58
+ - lib/output/html.rb
59
+ - lib/output/text.rb
60
+ - lib/output/textmate.rb
61
+ - spec/grepmate_spec.rb
62
+ - spec/spec_helper.rb
63
+ - tmp/grepmate.html
64
+ has_rdoc: false
40
65
  homepage: http://github.com/ssoroka/grepmate
41
66
  post_install_message:
42
67
  rdoc_options:
43
- - --line-numbers
44
- - --inline-source
45
- - --title
46
- - Grepmate
47
- - --main
48
- - README
68
+ - --charset=UTF-8
49
69
  require_paths:
50
70
  - lib
51
71
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -58,14 +78,15 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
78
  requirements:
59
79
  - - ">="
60
80
  - !ruby/object:Gem::Version
61
- version: "1.2"
81
+ version: "0"
62
82
  version:
63
83
  requirements: []
64
84
 
65
- rubyforge_project: grepmate
85
+ rubyforge_project:
66
86
  rubygems_version: 1.2.0
67
87
  signing_key:
68
- specification_version: 2
88
+ specification_version: 3
69
89
  summary: Extremely fast search of rails projects or rails source for code, open in textmate or browser with html output
70
- test_files: []
71
-
90
+ test_files:
91
+ - spec/grepmate_spec.rb
92
+ - spec/spec_helper.rb
data/Manifest DELETED
@@ -1,5 +0,0 @@
1
- bin/grepmate
2
- grepmate.gemspec
3
- Manifest
4
- Rakefile
5
- README
data/README DELETED
@@ -1,54 +0,0 @@
1
- = Grepmate
2
-
3
- Extremely fast search of rails projects or rails source for code, open in textmate or browser with html output
4
-
5
- == Usage
6
-
7
- grepmate [what_to_search_for*] [dir=dir] [exclude=exclude] [options]+
8
-
9
- or this works too...
10
-
11
- grepmate [options]+ [what_to_search_for*] [dir=dir] [exclude=exclude]
12
-
13
- == Parameters
14
-
15
- what_to_search_for (-1 ~> what_to_search_for)
16
- What to search for. Enclose in quotes to search for phrase.
17
- dir=dir (-1 ~>
18
- dir=app,config,db,lib,spec,public,vendor/plugins,test/selenium_fixtures,test/selenium)
19
- Directories to search. Defaults to project.
20
- exclude=exclude (-1 ~>
21
- exclude=\.sql$,\.log$,\.tmp$,\.gz$,\.bz2$,\.tar$,\.db$,\.sqlite$,\.sqlite3$,\.csv$,\.DS_Store$,\.svn,\.git,\.CSV$,grepmate\.html$)
22
- Exclude paths matching these patterns.
23
- --case
24
- Case sensitive search (exclude for case insensitive).
25
- --no_html, -H
26
- Turn off HTML output.
27
- --only_rails, -R
28
- Search Rails source, not the project. Takes precedence over dir=
29
- --rails, -r
30
- Search Rails source, in addition to whatever is named by dir= dir=
31
- etc.
32
- --gems, -g
33
- Search all gems, in addition to whatever is named by dir= dir= etc.
34
- --only_gems, -G
35
- Search only gems, not the project. Takes precedence over dir=
36
- --wait, -w
37
- Wait between finds until TextMate is closed. Only works with
38
- --no_html.
39
- --count, -c
40
- Display only the number of matches.
41
- --help, -h
42
-
43
- == Authors
44
-
45
- - Steven Soroka
46
- - Zach Holt
47
-
48
- == To Do
49
-
50
- - check ~/.grepmate for current rails repo to use instead of always using latest
51
- - change output file to write to /tmp or something
52
- - add include parameter to selectively include file extensions
53
- - Allow global and cwd .gmconfig files to determine things like exclusions and inclusions.
54
- - If we're not in a RAILS_ROOT, assume -r ./*