ripl-short_errors 0.1.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'rubygems' unless defined? Gem
3
+ require File.dirname(__FILE__) + "/lib/ripl/short_errors"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "ripl-short_errors"
7
+ s.version = Ripl::ShortErrors::VERSION
8
+ s.authors = ["Jan Lelis"]
9
+ s.email = "mail@janlelis.de"
10
+ s.homepage = "https://github.com/janlelis/ripl-misc/blob/master/lib/ripl/short_errors.rb"
11
+ s.summary = "Only show the first backtrace entry when errors are displayed."
12
+ s.description = "Only show the first backtrace entry when errors are displayed. The complete backtrace can be shown by the _! method."
13
+ s.required_rubygems_version = ">= 1.3.6"
14
+ s.add_dependency 'ripl', '>= 0.2.8'
15
+ s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
16
+ s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
17
+ s.license = 'MIT'
18
+ end
@@ -0,0 +1,2 @@
1
+ == 0.1.0
2
+ * Initial release.
@@ -0,0 +1,22 @@
1
+ The MIT LICENSE
2
+
3
+ Copyright (c) 2010 Jan Lelis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,10 @@
1
+ Gem: ripl-short_errors
2
+ By: Jan Lelis
3
+
4
+ Description:
5
+ Only show the first backtrace entry when errors are displayed. The complete backtrace can be shown by the _! method.
6
+
7
+ Please note:
8
+ Needs to be required before ripl-color_error
9
+
10
+ J-_-L
@@ -0,0 +1,35 @@
1
+ require 'rake'
2
+ require 'fileutils'
3
+
4
+ def gemspec
5
+ @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec')
6
+ end
7
+
8
+ desc "Build the gem"
9
+ task :gem=>:gemspec do
10
+ sh "gem build .gemspec"
11
+ FileUtils.mkdir_p 'pkg'
12
+ FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", 'pkg'
13
+ end
14
+
15
+ desc "Install the gem locally"
16
+ task :install => :gem do
17
+ sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
18
+ end
19
+
20
+ desc "Generate the gemspec"
21
+ task :generate do
22
+ puts gemspec.to_ruby
23
+ end
24
+
25
+ desc "Validate the gemspec"
26
+ task :gemspec do
27
+ gemspec.validate
28
+ end
29
+
30
+ desc 'Run tests'
31
+ task :test do |t|
32
+ sh 'bacon -q -Ilib -I. test/*_test.rb'
33
+ end
34
+
35
+ task :default => :test
@@ -0,0 +1 @@
1
+ ripl >=0.2.8
@@ -0,0 +1,37 @@
1
+ # Gem: ripl-short_errors
2
+ # By: Jan Lelis
3
+
4
+ # Description:
5
+ # Only show the first backtrace entry when errors are displayed. The complete backtrace can be shown by the _! method.
6
+
7
+ # Please note:
8
+ # Needs to be required before ripl-color_error
9
+
10
+ require 'ripl'
11
+
12
+ module Ripl::ShortErrors
13
+ VERSION = '0.1.0'
14
+
15
+ attr_reader :last_error
16
+
17
+ def format_error(err)
18
+ "#{err.class}: #{err.message.chomp}" +
19
+ ( err.backtrace.first =~ %r|/lib/ripl/shell.rb| ? '' : " [#{err.backtrace.first}]" )
20
+ end
21
+
22
+ def print_eval_error(err)
23
+ @last_error = err
24
+ super
25
+ end
26
+
27
+ module Commands
28
+ def _!
29
+ puts Ripl.shell.last_error.backtrace.join("\n ")
30
+ end
31
+ end
32
+ end
33
+
34
+ Ripl::Shell.send :include, Ripl::ShortErrors
35
+ Ripl::Commands.send :include, Ripl::ShortErrors::Commands
36
+
37
+ # J-_-L
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ripl-short_errors
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Jan Lelis
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-16 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: ripl
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 2
31
+ - 8
32
+ version: 0.2.8
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: Only show the first backtrace entry when errors are displayed. The complete backtrace can be shown by the _! method.
36
+ email: mail@janlelis.de
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - README.rdoc
43
+ - LICENSE.txt
44
+ files:
45
+ - lib/ripl/short_errors.rb
46
+ - LICENSE.txt
47
+ - README.rdoc
48
+ - CHANGELOG.rdoc
49
+ - deps.rip
50
+ - Rakefile
51
+ - .gemspec
52
+ has_rdoc: true
53
+ homepage: https://github.com/janlelis/ripl-misc/blob/master/lib/ripl/short_errors.rb
54
+ licenses:
55
+ - MIT
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ segments:
75
+ - 1
76
+ - 3
77
+ - 6
78
+ version: 1.3.6
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Only show the first backtrace entry when errors are displayed.
86
+ test_files: []
87
+