pry-pipeline 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 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-pipeline.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,140 @@
1
+ # pry-pipeline
2
+
3
+ Pipeline for pry. This adds `_pipe_` and `|` methods to String and Symbol.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ group :development do
11
+ gem 'pry-pipeline'
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-pipeline
25
+ ```
26
+
27
+ ## Simple usage
28
+
29
+ This usage is simple but unuseful.
30
+
31
+ ```
32
+ $ pry
33
+ [1] pry(main)> 'Pry.run_command' | '$'
34
+
35
+ From: /Users/toqoz/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_class.rb @ line 217:
36
+ Number of lines: 12
37
+ Owner: #<Class:Pry>
38
+ Visibility: public
39
+
40
+ def self.run_command(command_string, options={})
41
+ options = {
42
+ :context => TOPLEVEL_BINDING,
43
+ :show_output => true,
44
+ :output => Pry.output,
45
+ :commands => Pry.commands
46
+ }.merge!(options)
47
+
48
+ output = options[:show_output] ? options[:output] : StringIO.new
49
+
50
+ Pry.new(:output => output, :input => StringIO.new(command_string), :commands => options[:commands], :prompt => proc {""}, :hooks => Pry::Hooks.new).rep(options[:context])
51
+ end
52
+ => nil
53
+ ```
54
+
55
+ ## Useful usage(with [ruby-anything](https://github.com/ToQoz/ruby-anything))
56
+
57
+ *You can select method interactively and see its source!!!*
58
+
59
+ ```
60
+ $ pry
61
+ [1] pry(main)> 'Pry.' + _anything_(Pry.methods) | '$'
62
+ >>>>>>> select method with anything interface >>>>>>>
63
+ >>>>>>> select `run_command` >>>>>>>
64
+ From: /Users/toqoz/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_class.rb @ line 217:
65
+ Number of lines: 12
66
+ Owner: #<Class:Pry>
67
+ Visibility: public
68
+
69
+ def self.run_command(command_string, options={})
70
+ options = {
71
+ :context => TOPLEVEL_BINDING,
72
+ :show_output => true,
73
+ :output => Pry.output,
74
+ :commands => Pry.commands
75
+ }.merge!(options)
76
+
77
+ output = options[:show_output] ? options[:output] : StringIO.new
78
+
79
+ Pry.new(:output => output, :input => StringIO.new(command_string), :commands => options[:commands], :prompt => proc {""}, :hooks => Pry::Hooks.new).rep(options[:context])
80
+ end
81
+ => nil
82
+ ```
83
+
84
+ ## Tips
85
+
86
+ In your ~/.pryrc.(if you use [ruby-anything](https://github.com/ToQoz/ruby-anything))
87
+
88
+ ```ruby
89
+ begin
90
+ require 'ruby-anything'
91
+ require 'pry-pipeline'
92
+ rescue LoadError => err
93
+ puts "Failed to require. in #{__FILE__}"
94
+ end
95
+
96
+ def method_source(obj)
97
+ "#{obj.inspect}." + _anything_(obj.methods) | '$'
98
+ end
99
+
100
+ def instance_method_source(cls)
101
+ "#{cls.inspect}#" + _anything_(cls.instance_methods) | '$'
102
+ end
103
+ ```
104
+
105
+ Start pry.
106
+
107
+ ```
108
+ $ pry
109
+ [1] pry(main)> ams Pry
110
+ >>>>>>> select method with anything interface >>>>>>>
111
+ >>>>>>> select `run_command` >>>>>>>
112
+ From: /Users/toqoz/.rbenv/versions/1.9.3-p327-perf/lib/ruby/gems/1.9.1/gems/pry-0.9.10/lib/pry/pry_class.rb @ line 217:
113
+ Number of lines: 12
114
+ Owner: #<Class:Pry>
115
+ Visibility: public
116
+
117
+ def self.run_command(command_string, options={})
118
+ options = {
119
+ :context => TOPLEVEL_BINDING,
120
+ :show_output => true,
121
+ :output => Pry.output,
122
+ :commands => Pry.commands
123
+ }.merge!(options)
124
+
125
+ output = options[:show_output] ? options[:output] : StringIO.new
126
+
127
+ Pry.new(:output => output, :input => StringIO.new(command_string), :commands => options[:commands], :prompt => proc {""}, :hooks => Pry::Hooks.new).rep(options[:context])
128
+ end
129
+ => nil
130
+ ```
131
+
132
+ :)
133
+
134
+ ## Contributing
135
+
136
+ 1. Fork it
137
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
138
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
139
+ 4. Push to the branch (`git push origin my-new-feature`)
140
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,11 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ class String
4
+ def _pipe_(cmd); Pry.run_command("#{cmd} #{self}") end
5
+ alias_method :|, :_pipe_
6
+ end
7
+
8
+ class Symbol
9
+ def _pipe_(*args); to_s._pipe_(*args) end
10
+ alias_method :|, :_pipe_
11
+ end
@@ -0,0 +1,3 @@
1
+ module PryPipeline
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "pry-pipeline/version"
2
+
3
+ module PryPipeline
4
+ if defined? Pry
5
+ require 'pry-pipeline/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-pipeline/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "pry-pipeline"
8
+ gem.version = PryPipeline::VERSION
9
+ gem.authors = ["Takatoshi Matsumoto"]
10
+ gem.email = ["toqoz403@gmail.com"]
11
+ gem.description = %q{Pipeline for pry}
12
+ gem.summary = %q{Pipeline for pry. This adds `_pipe_` and `|` methods to String and Symbol}
13
+ gem.homepage = ""
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,71 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pry-pipeline
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-16 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: Pipeline for pry
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-pipeline.rb
43
+ - lib/pry-pipeline/ext.rb
44
+ - lib/pry-pipeline/version.rb
45
+ - pry-pipeline.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:
66
+ rubygems_version: 1.8.24
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Pipeline for pry. This adds `_pipe_` and `|` methods to String and Symbol
70
+ test_files: []
71
+ has_rdoc: