ssoroka-grepmate 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/config/dot-grepmate +1 -0
- data/grepmate.gemspec +1 -1
- data/lib/grepmate.rb +1 -1
- data/lib/output/html.rb +7 -7
- data/spec/grepmate_spec.rb +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.3
|
data/config/dot-grepmate
CHANGED
data/grepmate.gemspec
CHANGED
data/lib/grepmate.rb
CHANGED
@@ -11,7 +11,7 @@ require File.join(File.dirname(__FILE__), 'output', 'text')
|
|
11
11
|
require File.join(File.dirname(__FILE__), 'output', 'file_and_line')
|
12
12
|
|
13
13
|
class Grepmate
|
14
|
-
attr_reader :params, :dirs, :query, :results
|
14
|
+
attr_reader :params, :dirs, :query, :results, :config
|
15
15
|
CONFIG_FILE = File.expand_path("~/.grepmate")
|
16
16
|
|
17
17
|
def initialize(params)
|
data/lib/output/html.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Output
|
2
2
|
class HTML
|
3
|
-
TEMP_FILE = File.expand_path(File.join(ENV['TMPDIR'], %w(grepmate.html)))
|
4
|
-
|
5
3
|
def initialize(grepmate)
|
6
4
|
@grepmate = grepmate
|
5
|
+
temp_dir = grepmate.config['temp_directory'] || ENV['TMPDIR']
|
6
|
+
@temp_file = File.expand_path(File.join(temp_dir, %w(grepmate.html)))
|
7
7
|
end
|
8
8
|
|
9
9
|
def determine_javascript_highlight_text
|
@@ -115,21 +115,21 @@ module Output
|
|
115
115
|
html << '</table></body></html>'
|
116
116
|
|
117
117
|
begin
|
118
|
-
FileUtils.touch(
|
118
|
+
FileUtils.touch(@temp_file)
|
119
119
|
rescue Errno::EACCES => e
|
120
120
|
puts %(
|
121
121
|
|
122
|
-
Looks like there's a permission error for the file #{
|
122
|
+
Looks like there's a permission error for the file #{@temp_file}. The grepmate gem expects to have write access to this file.
|
123
123
|
|
124
124
|
To fix, please do:
|
125
|
-
sudo chmod 0666 #{
|
125
|
+
sudo chmod 0666 #{@temp_file}
|
126
126
|
|
127
127
|
)
|
128
128
|
raise e
|
129
129
|
end
|
130
|
-
File.open(
|
130
|
+
File.open(@temp_file, 'w') { |f| f.write(html) }
|
131
131
|
|
132
|
-
system("open #{
|
132
|
+
system("open #{@temp_file}")
|
133
133
|
|
134
134
|
end
|
135
135
|
end
|
data/spec/grepmate_spec.rb
CHANGED
@@ -69,7 +69,7 @@ describe "Grepmate" do
|
|
69
69
|
grepmate = Grepmate.new(params)
|
70
70
|
# hijack the output class so that it doesn't send the system() call.
|
71
71
|
output_class = Output::HTML.new(grepmate)
|
72
|
-
output_class.should_receive(:system).with("open #{
|
72
|
+
output_class.should_receive(:system).with("open #{output_class.instance_variable_get('@temp_file')}")
|
73
73
|
|
74
74
|
Output::HTML.stub!(:new).and_return(output_class)
|
75
75
|
|