xray-rails 0.1.6 → 0.1.7

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.
@@ -37,7 +37,7 @@
37
37
  <label for="xray-editor-input">Editor</label>
38
38
  <input id="xray-editor-input" type="text" value="<%= Xray.config.editor %>">
39
39
  <button type="submit">Save</button>
40
- <p>Settings are saved to ~/.xrayconfig</p>
40
+ <p>Settings are saved to <%= Xray.config.config_file %></p>
41
41
  </form>
42
42
  </div>
43
43
  <%= stylesheet_link_tag :xray %>
data/lib/xray/config.rb CHANGED
@@ -7,7 +7,7 @@ module Xray
7
7
  class Config
8
8
  attr_accessor :editor
9
9
 
10
- CONFIG_FILE = "#{Dir.home}/.xrayconfig"
10
+ CONFIG_FILE = ".xrayconfig"
11
11
  DEFAULT_EDITOR = '/usr/local/bin/subl'
12
12
 
13
13
  def editor
@@ -27,11 +27,19 @@ module Xray
27
27
  {editor: editor}.to_yaml
28
28
  end
29
29
 
30
+ def config_file
31
+ if File.exists?("#{Dir.pwd}/#{CONFIG_FILE}")
32
+ "#{Dir.pwd}/#{CONFIG_FILE}"
33
+ else
34
+ "#{Dir.home}/#{CONFIG_FILE}"
35
+ end
36
+ end
37
+
30
38
  private
31
39
 
32
40
  def write_config(new_config)
33
41
  config = load_config.merge(new_config)
34
- File.open(CONFIG_FILE, 'w') { |f| f.write(config.to_yaml) }
42
+ File.open(config_file, 'w') { |f| f.write(config.to_yaml) }
35
43
  end
36
44
 
37
45
  def load_config
@@ -39,7 +47,7 @@ module Xray
39
47
  end
40
48
 
41
49
  def local_config
42
- YAML.load_file(CONFIG_FILE)
50
+ YAML.load_file(config_file)
43
51
  rescue
44
52
  {}
45
53
  end
@@ -61,11 +61,14 @@ module Xray
61
61
  # <script src="/assets/jquery-min.js"></script>
62
62
  # <script src="/assets/jquery.min.1.9.1.js"></script>
63
63
  html.sub!(/<script[^>]+\/#{after_script_name}([-.]{1}[\d\.]+)?([-.]{1}min)?\.js[^>]+><\/script>/) do
64
- h = ActionController::Base.helpers
65
- "#{$~}\n" + h.javascript_include_tag(script_name)
64
+ "#{$~}\n" + view_context.javascript_include_tag(script_name)
66
65
  end
67
66
  end
68
67
 
68
+ def view_context
69
+ @view_context ||= Rails.application.assets.context_class.new nil, nil, nil
70
+ end
71
+
69
72
  def should_inject_xray?(status, headers, response)
70
73
  status == 200 &&
71
74
  !empty?(response) &&
data/lib/xray/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xray
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xray-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-14 00:00:00.000000000 Z
12
+ date: 2013-11-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails