bundle-try 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +4 -1
- data/bundle-try.gemspec +1 -1
- data/exe/bundler-try +29 -14
- 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: 3ddba0208467125097d2c03bf5fb1d1f7d0c117a
|
4
|
+
data.tar.gz: 45e1e60cb993da1a050f47ad4cf76cdbdd7d13a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ff813082c3b868597ebd40bc9257705b146559f896f19bec082317e2772e0d9e3ad02cdd0e4f99d4b72ff22e5bc9322413663d6fb9098cf474ba34e7a0e7722
|
7
|
+
data.tar.gz: 1ed47577d12ceac509e77c2b820956faec9ec2dbb0ae8658946b9a8a3ba4f915fa904b1ae97c8c786e588a2442f9f098a507f12a57656b2598c3f28f8ef58f4f
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -5,7 +5,10 @@ Quick weekend-hack inspired by [lein-try](https://github.com/rkneufeld/lein-try)
|
|
5
5
|
|
6
6
|
## Usage
|
7
7
|
|
8
|
-
|
8
|
+
By default `bundle try some_gem` will start a Ruby REPL.
|
9
|
+
To open a shell (i.e. to use gem executables) do: `bundle try --shell some_gem`.
|
10
|
+
|
11
|
+
Some examples:
|
9
12
|
|
10
13
|
```
|
11
14
|
$ bundle try redis
|
data/bundle-try.gemspec
CHANGED
data/exe/bundler-try
CHANGED
@@ -3,7 +3,11 @@ require 'bundle-try'
|
|
3
3
|
|
4
4
|
if ARGV.empty? || %w(-h --help help try).include?(ARGV.first)
|
5
5
|
puts(<<-EOH)
|
6
|
-
|
6
|
+
OPTIONS
|
7
|
+
--shell
|
8
|
+
Opens a shell instead of a Ruby REPL. This will let you try executables etc.
|
9
|
+
|
10
|
+
EXAMPLES
|
7
11
|
|
8
12
|
Pick a gem, any gem:
|
9
13
|
|
@@ -60,20 +64,31 @@ $ bundle try bundle-try
|
|
60
64
|
|
61
65
|
EOH
|
62
66
|
exit
|
63
|
-
|
64
|
-
|
65
|
-
require '
|
66
|
-
|
67
|
-
gemfile_content = BundleTry::Gemfile.render({:gemlines => BundleTry.argv_to_gemlines(ARGV.dup) })
|
68
|
-
File.write(gemfile.path, gemfile_content)
|
67
|
+
else
|
68
|
+
require 'tmpdir'
|
69
|
+
require 'fileutils'
|
70
|
+
require 'bundler/cli'
|
69
71
|
|
70
|
-
|
72
|
+
bundle_try_folder = File.join(Dir.tmpdir, 'bundle-try')
|
73
|
+
gemfile_path = File.join(bundle_try_folder, 'Gemfile')
|
74
|
+
FileUtils.rm_r(bundle_try_folder, secure: true) if Dir.exist?(bundle_try_folder)
|
75
|
+
FileUtils.mkdir(bundle_try_folder)
|
71
76
|
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
argv = ARGV.dup.tap {|a| a.delete('--shell') }
|
78
|
+
gemfile_content = BundleTry::Gemfile.render({:gemlines => BundleTry.argv_to_gemlines(argv) })
|
79
|
+
File.write(gemfile_path, gemfile_content)
|
80
|
+
Dir.chdir bundle_try_folder
|
75
81
|
Bundler::CLI.start(%W(install), :debug => true)
|
76
|
-
|
77
|
-
|
78
|
-
|
82
|
+
|
83
|
+
if ARGV.include?('--shell')
|
84
|
+
puts "Entering folder '#{bundle_try_folder}'. Happy hacking!"
|
85
|
+
`#{ENV['SHELL']} 1>&2`
|
86
|
+
else
|
87
|
+
if STDOUT.tty?
|
88
|
+
puts "Want to capture the generated Gemfile? Use `bundle try rake > Gemfile`."
|
89
|
+
Bundler::CLI.start(%W(console), :debug => true)
|
90
|
+
else
|
91
|
+
puts gemfile_content
|
92
|
+
end
|
93
|
+
end
|
79
94
|
end
|