pry-de 0.0.3 → 0.0.4

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/README.md CHANGED
@@ -3,3 +3,20 @@
3
3
  Run-time Ruby Development Environment based on Pry. [Maturity: Infantile]
4
4
 
5
5
  See: https://github.com/pry/pry/wiki/pry-de
6
+
7
+ - `,,` (toggle ,-prefixes off/on commands, for terse input)
8
+ - `,-` (Remove last item from history, in preparation for a `play` command)
9
+ - `,b` (Alias for `break`)
10
+ - `,c` (Alias for `continue`)
11
+ - `,f` (Alias for `finish`)
12
+ - `,lib` (edit lib/)
13
+ - `,loc` (Show hash of local vars)
14
+ - `,m` (play method body only)
15
+ - `,n` (Alias for `next`)
16
+ - `,refactor` (No description.)
17
+ - `,s` (Alias for `step`)
18
+ - `,w` (Alias for `whereami`)
19
+ - `/[$?]?\s*(.*?)\s*,,e\s*(.*)/` (edit from anywhere on the line)
20
+ - `?$` (show-doc + show-source)
21
+ - `C$` (Hop to tag in the Ruby C source)
22
+ - `cat--EX` (show whole backtrace)
data/README.md.erb ADDED
@@ -0,0 +1,15 @@
1
+ # pry-de
2
+
3
+ Run-time Ruby Development Environment based on Pry. [Maturity: Infantile]
4
+
5
+ See: https://github.com/pry/pry/wiki/pry-de
6
+
7
+ <%
8
+ warn "(Running pry…)"
9
+ help_output = `pry -e 'Pry.config.pager = false' -e help -e quit`
10
+ help_output.match /pry-de.+?\n(.*?)\n\n/m
11
+ pry_de_commands = $1.split(/\n/)
12
+ pry_de_commands.each do |e|
13
+ /\s*(?<cmd>\S+)\s+(?<desc>.+)/ =~ e
14
+ %> - `<%= cmd %>` (<%= desc %>)
15
+ <% end %>
data/lib/pry-de.rb CHANGED
@@ -21,6 +21,9 @@ module PryDe
21
21
  psuedo_alias ',c', 'continue'
22
22
  psuedo_alias ',f', 'finish'
23
23
 
24
+ psuedo_alias ',w', 'whereami'
25
+
26
+ # (Trying to upstream. See: https://github.com/pry/pry/pull/722 )
24
27
  command ',loc', 'Show hash of local vars' do |*args|
25
28
  pry_vars = [
26
29
  :____, :___, :__, :_, :_dir_, :_file_, :_ex_, :_pry_, :_out_, :_in_ ]
@@ -45,6 +48,36 @@ module PryDe
45
48
  run_command 'play --lines 2..-2 -m'
46
49
  end
47
50
 
51
+ command ',refactor' do
52
+ raw = `git status --porcelain`
53
+ to_examine = raw.split(/\n/).map do |change|
54
+ change.sub! /./, '' # don't care about the cache status
55
+ status, filename = change.split(/ /, 2)
56
+ case status
57
+ when 'A', 'M', '?' then filename
58
+ when 'D' then nil
59
+ else
60
+ _pry_.output.puts "pry-de doesn't know about status %s for %s" % \
61
+ [ status, filename ]
62
+ filename
63
+ end
64
+ end.compact
65
+ to_examine.reject! do |filename|
66
+ dir = File.dirname filename
67
+ path = File.basename filename
68
+ vim_swapfile = dir + '/.' + path + '.swp'
69
+ if File.exists? vim_swapfile
70
+ _pry_.output.puts "Found vim swapfile for #{filename} (Skipping)"
71
+ true
72
+ end
73
+ end
74
+ if 0 < to_examine.size
75
+ system Pry.config.editor, *to_examine
76
+ else
77
+ _pry_.output.puts "Nothing found to refactor via \`git status\`"
78
+ end
79
+ end
80
+
48
81
  # Hopefully this will be of diminished employment, as more direct routes
49
82
  # to the desired file:line grow, but for now it's a good all-purpose "edit"
50
83
  command ',lib', 'edit lib/' do
@@ -55,6 +88,7 @@ module PryDe
55
88
  end
56
89
  end
57
90
 
91
+ # XXX needs to not recurse.
58
92
  # alias_command ',r', 'hist --replay -1'
59
93
 
60
94
  command '?$', 'show-doc + show-source' do
@@ -1,3 +1,3 @@
1
1
  module PryDe
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -1,15 +1,10 @@
1
- " Add this as ~/.vim/ftplugin/ruby_pry-de.vim (and make sure you've done:
2
- " filetype plugin on
3
- " in your vim startup files.
1
+ " Add the pry debug line with \bp (or <Space>bp, if you did: map <Space> <Leader> )
2
+ map <Leader>bp orequire'pry';binding.pry<esc>:w<cr>
3
+ " Alias for one-handed operation:
4
+ map <Leader><Leader>p <Leader>bp
5
+ " …also, Insert Mode as bpry<space>
6
+ iabbr bpry require'pry';binding.pry
4
7
 
5
- " Add the pry debug line with \\p (or <Space><Space>p, if you mapped it)
6
- map <Leader><Leader>p orequire 'pry';binding.pry<esc>:w<cr>
7
- " …also, allow bpry<space> (or bpry<C-]>) from Insert Mode:
8
- iabbr bpry require 'pry';binding.pry
9
-
10
- " Nab the last line from ~/.pry_history.
11
- map <leader>pry1 o<esc>:.!tail -1 ~/.pry_history<cr>==
12
-
13
- " Recommended: Play with tslime.vim, vimux, et. al.
14
- " I plan to really work out a good flow with the best parts of those, and put
15
- " it here. In the meantime, these paltry snippets will have to do. ☹
8
+ " Nab lines from ~/.pry_history (respects "count")
9
+ nmap <Leader>pry :<c-u>let pc = (v:count1 ? v:count1 : 1)<cr>:read !tail -<c-r>=pc<cr> ~/.pry_history<cr>:.-<c-r>=pc-1<cr>:norm <c-r>=pc<cr>==<cr>
10
+ " thanks to Houl, ZyX-i, and paradigm of #vim for all dogpiling on this one.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-de
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-17 00:00:00.000000000 Z
13
+ date: 2012-10-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry-full
@@ -66,7 +66,6 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
- - ! ',refactor'
70
69
  - ! ',retest'
71
70
  - .document
72
71
  - .gitignore
@@ -75,6 +74,7 @@ files:
75
74
  - Guardfile
76
75
  - LICENSE.txt
77
76
  - README.md
77
+ - README.md.erb
78
78
  - Rakefile
79
79
  - TODO-Pry
80
80
  - VERSION
data/,refactor DELETED
File without changes