rubymine_heaven 0.0.1
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.
- data/.gitignore +5 -0
- data/Gemfile +4 -0
- data/README.md +53 -0
- data/Rakefile +1 -0
- data/bin/mine-handler +23 -0
- data/lib/rubymine_heaven.rb +8 -0
- data/lib/rubymine_heaven/linkable_errors.rb +37 -0
- data/lib/rubymine_heaven/linkable_errors_railtie.rb +18 -0
- data/lib/rubymine_heaven/version.rb +3 -0
- data/rubymine_heaven.gemspec +26 -0
- metadata +70 -0
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# RubyMine Heaven
|
2
|
+
|
3
|
+
This gem does 2 things:
|
4
|
+
|
5
|
+
* points links on rails error pages to rubymine
|
6
|
+
* points links from footnotes (if present) to RubyMine (https://github.com/josevalim/rails-footnotes)
|
7
|
+
|
8
|
+
## Getting started
|
9
|
+
|
10
|
+
You need to perform some steps (one time) before first usage:
|
11
|
+
|
12
|
+
* Create command line launcher for RubyMine (Tools / Create Command-line launcher for RubyMine 4 EAP)
|
13
|
+
* Create protocol handler in AppleScript Editor
|
14
|
+
* start the AppleScript Editor
|
15
|
+
* paste this code into the editor:
|
16
|
+
<blockquote>
|
17
|
+
<p>on open location this_url</p>
|
18
|
+
<p> do shell script ("mine_handler '" & this_url & "'")</p>
|
19
|
+
<p>end open location</p>
|
20
|
+
</blockquote>
|
21
|
+
* save this file as an Application (for instance to /Applicaions folder)
|
22
|
+
* link protocol "x-mine" to application created in previous step (You can use MisFox, MoreInternet or RCDefaultApp for it)
|
23
|
+
* in MisFox select Protocol Helpers and add new protocol with name "x-mine" a chose application created in
|
24
|
+
AppleScript editor as it's handler.
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
In your Gemfile add:
|
32
|
+
|
33
|
+
<code>gem 'rubymine_heaven'<code>
|
34
|
+
|
35
|
+
that's all...
|
36
|
+
|
37
|
+
## Prerequisites
|
38
|
+
|
39
|
+
* Mac OS X
|
40
|
+
* IntelliJ RubyMine
|
41
|
+
|
42
|
+
## Bugs and Feedback
|
43
|
+
|
44
|
+
If you discover any bugs, please send an e-mail to petr@petrcervinka.cz. Positive feedback is fine too!
|
45
|
+
|
46
|
+
## How can you help?
|
47
|
+
|
48
|
+
If someone knows how to eliminate the need to create ApplScript handler (or how to create this handler programaticaly),
|
49
|
+
or how to register new protocol programitacly, please let me know.
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
MIT License.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/mine-handler
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
arg_line = ARGV[0]
|
3
|
+
|
4
|
+
if /x-mine:\/\/open\?(.*)/ =~ arg_line
|
5
|
+
parts = $1.split("&")
|
6
|
+
args = {}
|
7
|
+
parts.each do |part|
|
8
|
+
arg_pair = part.split("=", 2)
|
9
|
+
puts arg_pair.inspect
|
10
|
+
if arg_pair.size == 2
|
11
|
+
args[arg_pair[0]] = arg_pair[1]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
if args["file"]
|
15
|
+
command = "/usr/local/bin/mine"
|
16
|
+
command += " --line #{args['line']}" if args['line']
|
17
|
+
command += " #{args['file']}"
|
18
|
+
exec command
|
19
|
+
else
|
20
|
+
puts "no file given"
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module RubymineHeaven
|
2
|
+
module LinkableErrors
|
3
|
+
|
4
|
+
def self.included(base)
|
5
|
+
base.class_eval do
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def link_to_code(text)
|
10
|
+
# we must create new String, because SafeBuffer#gsub don't set $1, $2, ... variables !!
|
11
|
+
String.new(text).gsub(/(\/?[\w\/\.@-]+)\:(\d+)/) do |match|
|
12
|
+
file = $1 || "file??"
|
13
|
+
line = $2 || "line-no??"
|
14
|
+
file = Rails.root + file if file =~ Rails::BacktraceCleaner::APP_DIRS_PATTERN
|
15
|
+
"<a href='x-mine://open?file=#{file}&line=#{line}'>#{match}</a>"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def rescue_action_locally(request, exception)
|
20
|
+
template = ActionView::Base.new([RESCUES_TEMPLATE_PATH],
|
21
|
+
:request => request,
|
22
|
+
:exception => exception,
|
23
|
+
:application_trace => application_trace(exception),
|
24
|
+
:framework_trace => framework_trace(exception),
|
25
|
+
:full_trace => full_trace(exception)
|
26
|
+
)
|
27
|
+
file = "rescues/#{@@rescue_templates[exception.class.name]}.erb"
|
28
|
+
body = template.render(:file => file, :layout => 'rescues/layout.erb')
|
29
|
+
body = link_to_code(body)
|
30
|
+
render(status_code(exception), body)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RubymineHeaven
|
2
|
+
class LinkableErrorsRailtie < ::Rails::Railtie
|
3
|
+
initializer "linkable_errors_railtie.boot" do
|
4
|
+
if Rails.env.development?
|
5
|
+
Rails.backtrace_cleaner.remove_filters!
|
6
|
+
Rails.backtrace_cleaner.add_filter { |line| line.sub("#{Rails.root}/", '') }
|
7
|
+
|
8
|
+
# point links on rails error pages to rubymine
|
9
|
+
ActionDispatch::ShowExceptions.send(:include, LinkableErrors)
|
10
|
+
|
11
|
+
# point footnotes links to rubymine
|
12
|
+
if defined?(Footnotes)
|
13
|
+
Footnotes::Filter.prefix = 'x-mine://open?url=%s&line=%d'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "rubymine_heaven/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "rubymine_heaven"
|
7
|
+
s.version = RubymineHeaven::VERSION
|
8
|
+
s.authors = ["Petr Cervinka"]
|
9
|
+
s.email = ["petr@petrcervinka.cz"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Rails gem form pleasant development with InteliJ RubyMine}
|
12
|
+
s.description = %q{This gem integrates rails3-footnotes with RubyMine so footnetes's links are opened by Rubymine. It also connects stack trace lines
|
13
|
+
in development mode with RubyMine. You need some manual work to set handler for browser links (see README).'}
|
14
|
+
|
15
|
+
s.rubyforge_project = "rubymine_heaven"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "rails", ">= 3.0.0"
|
23
|
+
# specify any dependencies here; for example:
|
24
|
+
# s.add_development_dependency "rspec"
|
25
|
+
# s.add_runtime_dependency "rest-client"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubymine_heaven
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Petr Cervinka
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-23 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: &70192546061060 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70192546061060
|
25
|
+
description: ! "This gem integrates rails3-footnotes with RubyMine so footnetes's
|
26
|
+
links are opened by Rubymine. It also connects stack trace lines\n in development
|
27
|
+
mode with RubyMine. You need some manual work to set handler for browser links (see
|
28
|
+
README).'"
|
29
|
+
email:
|
30
|
+
- petr@petrcervinka.cz
|
31
|
+
executables:
|
32
|
+
- mine-handler
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- .gitignore
|
37
|
+
- Gemfile
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- bin/mine-handler
|
41
|
+
- lib/rubymine_heaven.rb
|
42
|
+
- lib/rubymine_heaven/linkable_errors.rb
|
43
|
+
- lib/rubymine_heaven/linkable_errors_railtie.rb
|
44
|
+
- lib/rubymine_heaven/version.rb
|
45
|
+
- rubymine_heaven.gemspec
|
46
|
+
homepage: ''
|
47
|
+
licenses: []
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project: rubymine_heaven
|
66
|
+
rubygems_version: 1.8.10
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Rails gem form pleasant development with InteliJ RubyMine
|
70
|
+
test_files: []
|