bundle-try 1.5.0 → 1.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c79e8cb51b88982e36eca082184a16bd7578e434
4
- data.tar.gz: 78faad3fa851535d8ae61a1dc139f94825a89d86
3
+ metadata.gz: 3ddba0208467125097d2c03bf5fb1d1f7d0c117a
4
+ data.tar.gz: 45e1e60cb993da1a050f47ad4cf76cdbdd7d13a7
5
5
  SHA512:
6
- metadata.gz: 368d1c89153a049dcc4ce5be15b522b7c665961ad1b815a66e7b3172be7e106c13aec3a89fc64a5d2692f56d9fd7a089cfa4b8e547be831fb40d3735208b369e
7
- data.tar.gz: 76aedae4fcff5374fffde380f6a893fee25427f46816e6a567e06eda8765e94ecb6368f996a6d6124e6eae6f2c17f4bbceb9a4f8ca417a9a9f8c8c27ffb59ca7
6
+ metadata.gz: 9ff813082c3b868597ebd40bc9257705b146559f896f19bec082317e2772e0d9e3ad02cdd0e4f99d4b72ff22e5bc9322413663d6fb9098cf474ba34e7a0e7722
7
+ data.tar.gz: 1ed47577d12ceac509e77c2b820956faec9ec2dbb0ae8658946b9a8a3ba4f915fa904b1ae97c8c786e588a2442f9f098a507f12a57656b2598c3f28f8ef58f4f
data/.travis.yml CHANGED
@@ -1,3 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
3
4
  - 2.1.5
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
- Pick a gem, any gem:
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
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "bundle-try"
7
- spec.version = '1.5.0'
7
+ spec.version = '1.6.0'
8
8
  spec.authors = ["Gert Goet"]
9
9
  spec.email = ["gert@thinkcreate.nl"]
10
10
 
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
- Examples:
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
- end
64
-
65
- require 'tempfile'
66
- gemfile = Tempfile.new('bundle-try')
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
- ENV['BUNDLE_GEMFILE'] = gemfile.path
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
- if STDOUT.tty?
73
- puts "Want to capture the generated Gemfile? Use `bundle try rake > Gemfile`."
74
- require 'bundler/cli'
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
- Bundler::CLI.start(%W(console), :debug => true)
77
- else
78
- puts gemfile_content
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundle-try
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gert Goet