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 CHANGED
@@ -1 +1 @@
1
- 2.0.2
1
+ 2.0.3
data/config/dot-grepmate CHANGED
@@ -2,6 +2,7 @@
2
2
  ---
3
3
  # valid outputs are: text, html, textmate, file_and_line
4
4
  default_output: html
5
+ temp_directory: <%= ENV['TMPDIR'] %>
5
6
  search_rails_source: false
6
7
  search_gems: false
7
8
  # if you only want to search a specific rails version, uncomment and set this:
data/grepmate.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{grepmate}
5
- s.version = "2.0.2"
5
+ s.version = "2.0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Steven Soroka", "Zach Holt"]
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(TEMP_FILE)
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 #{TEMP_FILE}. The grepmate gem expects to have write access to this 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 #{TEMP_FILE}
125
+ sudo chmod 0666 #{@temp_file}
126
126
 
127
127
  )
128
128
  raise e
129
129
  end
130
- File.open(TEMP_FILE, 'w') { |f| f.write(html) }
130
+ File.open(@temp_file, 'w') { |f| f.write(html) }
131
131
 
132
- system("open #{TEMP_FILE}")
132
+ system("open #{@temp_file}")
133
133
 
134
134
  end
135
135
  end
@@ -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 #{Output::HTML::TEMP_FILE}")
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssoroka-grepmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Soroka