pry-command_result 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pry-command_result.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Takatoshi Matsumoto
2
+
3
+ MIT License
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.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # PryCommandResult
2
+
3
+ This return pry's command result and don't output it. You can assign it to variables and process it with ruby.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'pry-command_result'
12
+ end
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ ```
18
+ $ bundle
19
+ ```
20
+
21
+ Or install it yourself as:
22
+
23
+ ```sh
24
+ $ gem install pry-command_result
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ```
30
+ [1] pry(main)> result = command_result '$ Pry.method'
31
+ => "\n\e[1mFrom:\e[0m proc.c (C Method):\n\e[1mNumber of lines:\e[0m 5\n\e[1mOwner:\e[0m Kernel\n\e[1mVisibility:\e[0m public\n\nVALUE\nrb_obj_method(VALUE obj, VALUE vid)\n{\n \e[1;31mreturn\e[0m mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, FALSE);\n}\n"
32
+ [2] pry(main)> puts result
33
+
34
+ From: proc.c (C Method):
35
+ Number of lines: 5
36
+ Owner: Kernel
37
+ Visibility: public
38
+
39
+ VALUE
40
+ rb_obj_method(VALUE obj, VALUE vid)
41
+ {
42
+ return mnew(CLASS_OF(obj), obj, rb_to_id(vid), rb_cMethod, FALSE);
43
+ }
44
+ => nil
45
+ [3] pry(main)> puts result.split("\n").grep(/From/)
46
+ From: proc.c (C Method):
47
+ => nil
48
+ ```
49
+
50
+
51
+ ## Contributing
52
+
53
+ 1. Fork it
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,14 @@
1
+ require 'stringio'
2
+
3
+ module Kernel
4
+ def command_result(command)
5
+ output = StringIO.new
6
+ pager = Pry.config.pager
7
+ Pry.config.pager = false
8
+ Pry.run_command(command, output: output, show_output: true)
9
+ output.string
10
+ ensure
11
+ Pry.config.pager = pager
12
+ output.close
13
+ end
14
+ end
@@ -0,0 +1,3 @@
1
+ module PryCommandResult
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "pry-command_result/version"
2
+
3
+ module PryCommandResult
4
+ if defined? Pry
5
+ require "pry-command_result/kernel_ext"
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pry-command_result/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "pry-command_result"
8
+ gem.version = PryCommandResult::VERSION
9
+ gem.authors = ["Takatoshi Matsumoto"]
10
+ gem.email = ["toqoz403@gmail.com"]
11
+ gem.description = %q{This return pry's command result and don't output it}
12
+ gem.summary = %q{This return pry's command result and don't output it. You can assign it to variables and process it with ruby.}
13
+ gem.homepage = "https://github.com/ToQoz/pry-command_result"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency 'pry'
21
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pry-command_result
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Takatoshi Matsumoto
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-01-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ prerelease: false
16
+ type: :runtime
17
+ version_requirements: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ name: pry
24
+ requirement: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: This return pry's command result and don't output it
31
+ email:
32
+ - toqoz403@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE.txt
40
+ - README.md
41
+ - Rakefile
42
+ - lib/pry-command_result.rb
43
+ - lib/pry-command_result/kernel_ext.rb
44
+ - lib/pry-command_result/version.rb
45
+ - pry-command_result.gemspec
46
+ homepage: https://github.com/ToQoz/pry-command_result
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:
66
+ rubygems_version: 1.8.24
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: This return pry's command result and don't output it. You can assign it to
70
+ variables and process it with ruby.
71
+ test_files: []
72
+ has_rdoc: