pry-try 0.3.0 → 0.3.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.
- checksums.yaml +4 -4
- data/exe/pry-try +11 -5
- data/lib/pry-try/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11b72dd28ab9834e8076c2599a077ac5bf860086
|
|
4
|
+
data.tar.gz: 40aff3a89220c2f5e62d7ad29c818db246c8f244
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e85d21006089b7fb273a00ed00ef3e6e632800147dfbefdd45e8e1334f966c08597ae4645a4f7cab3fc1e68d426cbc5a0ff7ee9c8bc96cb2d88e1350baf5f874
|
|
7
|
+
data.tar.gz: cd00c3bb86175b6b38986a335ccc96fbc47b21a5f8f07791ca3b67f7bb6b2fce140d9d5c5c8708aa7146a1dc25fbd9cf6109b02f317886f30740181d9975283c
|
data/exe/pry-try
CHANGED
|
@@ -25,17 +25,23 @@ def parse_gems(args)
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
def template_for_gems(gems)
|
|
28
|
+
def template_for_gems(gems, options = {})
|
|
29
29
|
require 'erb'
|
|
30
30
|
@gems = gems
|
|
31
|
+
@inline = options[:inline]
|
|
31
32
|
ERB.new(<<-GEMFILE, 1, "-").result
|
|
33
|
+
<% if @inline -%>
|
|
34
|
+
#!/usr/bin/env ruby
|
|
35
|
+
|
|
32
36
|
begin
|
|
33
37
|
require "bundler/inline"
|
|
34
38
|
rescue LoadError => e
|
|
35
39
|
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
|
|
36
40
|
raise e
|
|
37
41
|
end
|
|
38
|
-
|
|
42
|
+
<% else -%>
|
|
43
|
+
require "bundler/inline"
|
|
44
|
+
<% end -%>
|
|
39
45
|
gemfile(true) do
|
|
40
46
|
source 'https://rubygems.org'
|
|
41
47
|
gem 'pry'
|
|
@@ -48,7 +54,7 @@ end
|
|
|
48
54
|
GEMFILE
|
|
49
55
|
end
|
|
50
56
|
|
|
51
|
-
if ARGV.empty? || %w(-h --help).include?(ARGV.first)
|
|
57
|
+
if ($stdin.tty? && ARGV.empty?) || %w(-h --help).include?(ARGV.first)
|
|
52
58
|
puts(<<-EOH)
|
|
53
59
|
Usage:
|
|
54
60
|
pry-try activesupport
|
|
@@ -83,7 +89,7 @@ elsif %w(-v --version).include?(ARGV.first)
|
|
|
83
89
|
exit
|
|
84
90
|
elsif %w(--inline).include?(ARGV.first)
|
|
85
91
|
ARGV.shift
|
|
86
|
-
puts template_for_gems(parse_gems(ARGV))
|
|
92
|
+
puts template_for_gems(parse_gems(ARGV), :inline => true)
|
|
87
93
|
exit
|
|
88
94
|
end
|
|
89
95
|
|
|
@@ -95,5 +101,5 @@ if @gems.any?
|
|
|
95
101
|
@script = Tempfile.new('pry-try').tap do |f|
|
|
96
102
|
File.write(f, template_for_gems(@gems).gsub(/\n+ *(?=\S)/, ';'))
|
|
97
103
|
end
|
|
98
|
-
exec %{unset BUNDLE_BIN;script=$(cat #{@script ? @script.path : ''} #{$stdin.tty? ? '' : '-'}; echo;echo '$stdin = $stdin.reopen "/dev/tty";'); printf "${script}" | pry}
|
|
99
104
|
end
|
|
105
|
+
exec %{unset BUNDLE_BIN;script=$(cat #{@script ? @script.path : ''} #{$stdin.tty? ? '' : '-'}; echo;echo '$stdin = $stdin.reopen "/dev/tty";'); printf "${script}" | pry}
|
data/lib/pry-try/version.rb
CHANGED