vagrant-bundler-tools 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.mdown +2 -38
- metadata +15 -58
- data/lib/vagrant_bundler_tools.rb +0 -21
- data/lib/vagrant_bundler_tools/command/base.rb +0 -37
- data/lib/vagrant_bundler_tools/command/bundle.rb +0 -53
- data/lib/vagrant_bundler_tools/command/bundle_list.rb +0 -11
- data/lib/vagrant_bundler_tools/command/bundle_open.rb +0 -33
- data/lib/vagrant_bundler_tools/command/bundle_show.rb +0 -24
- data/lib/vagrant_bundler_tools/errors.rb +0 -20
- data/lib/vagrant_init.rb +0 -3
- data/templates/locales/en.yml +0 -11
data/README.mdown
CHANGED
@@ -1,43 +1,7 @@
|
|
1
1
|
# Vagrant-bundler-tools
|
2
2
|
|
3
|
-
This gem
|
4
|
-
|
5
|
-
|
6
|
-
For example you can open a gem bundled on your linux guest in your OSX host's
|
7
|
-
editor.
|
8
|
-
|
9
|
-
## Installation
|
10
|
-
|
11
|
-
gem install vagrant-bundler-tools
|
12
|
-
|
13
|
-
## Usage
|
14
|
-
|
15
|
-
To open a gem bundled on your guest in your host's editor use
|
16
|
-
|
17
|
-
vagrant bundle open <gem_name>
|
18
|
-
|
19
|
-
from the host.
|
20
|
-
|
21
|
-
## Other commands
|
22
|
-
|
23
|
-
You can also use
|
24
|
-
|
25
|
-
- List bundled gems on the host
|
26
|
-
|
27
|
-
vagrant bundle list
|
28
|
-
|
29
|
-
- Show path (on the host) to the named gem bundled on the guest
|
30
|
-
|
31
|
-
vagrant bundle show <gem_name>
|
32
|
-
|
33
|
-
## Caveats
|
34
|
-
|
35
|
-
You will need to set the bundle path on the guest to be a subdirectory of the
|
36
|
-
project so that the host can access it, for example with
|
37
|
-
|
38
|
-
bundle config path .bundled_gems
|
39
|
-
|
40
|
-
in the project directory on the guest.
|
3
|
+
This gem has been renamed vagrant-bundler, please install vagrant-bundler
|
4
|
+
instead.
|
41
5
|
|
42
6
|
## MIT License
|
43
7
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-bundler-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,33 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-05-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: vagrant
|
16
|
-
requirement: &
|
15
|
+
name: vagrant-bundler
|
16
|
+
requirement: &70287023329640 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - =
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 0.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: i18n
|
27
|
-
requirement: &70244479667700 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 0.5.0
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70244479667700
|
24
|
+
version_requirements: *70287023329640
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: rake
|
38
|
-
requirement: &
|
27
|
+
requirement: &70287023329240 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
30
|
- - ! '>='
|
@@ -43,32 +32,11 @@ dependencies:
|
|
43
32
|
version: '0'
|
44
33
|
type: :development
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
47
|
-
-
|
48
|
-
|
49
|
-
requirement: &70244479665980 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :development
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *70244479665980
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: minitest
|
60
|
-
requirement: &70244479665080 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - ! '>='
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: '0'
|
66
|
-
type: :development
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: *70244479665080
|
69
|
-
description: ! 'vagrant-bundler-tools is a vagrant plugin to make it possible to interact
|
35
|
+
version_requirements: *70287023329240
|
36
|
+
description: ! 'vagrant-bundler-tools has been renamed vagrant-bundler, please install
|
37
|
+
this
|
70
38
|
|
71
|
-
|
39
|
+
instead.
|
72
40
|
|
73
41
|
'
|
74
42
|
email: joel@joelchippindale.com
|
@@ -78,21 +46,10 @@ extra_rdoc_files:
|
|
78
46
|
- README.mdown
|
79
47
|
files:
|
80
48
|
- README.mdown
|
81
|
-
|
82
|
-
- lib/vagrant_bundler_tools/command/base.rb
|
83
|
-
- lib/vagrant_bundler_tools/command/bundle.rb
|
84
|
-
- lib/vagrant_bundler_tools/command/bundle_list.rb
|
85
|
-
- lib/vagrant_bundler_tools/command/bundle_open.rb
|
86
|
-
- lib/vagrant_bundler_tools/command/bundle_show.rb
|
87
|
-
- lib/vagrant_bundler_tools/errors.rb
|
88
|
-
- lib/vagrant_init.rb
|
89
|
-
- templates/locales/en.yml
|
90
|
-
homepage: http://github.com/mocoso/vagrant-bundler-tools
|
49
|
+
homepage: http://github.com/mocoso/vagrant-bundler
|
91
50
|
licenses: []
|
92
51
|
post_install_message:
|
93
|
-
rdoc_options:
|
94
|
-
- --main
|
95
|
-
- README.mdown
|
52
|
+
rdoc_options: []
|
96
53
|
require_paths:
|
97
54
|
- lib
|
98
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -103,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
60
|
version: '0'
|
104
61
|
segments:
|
105
62
|
- 0
|
106
|
-
hash:
|
63
|
+
hash: -3174316831503469718
|
107
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
65
|
none: false
|
109
66
|
requirements:
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'vagrant'
|
2
|
-
require 'vagrant_bundler_tools/command/base'
|
3
|
-
require 'vagrant_bundler_tools/command/bundle'
|
4
|
-
require 'vagrant_bundler_tools/command/bundle_list'
|
5
|
-
require 'vagrant_bundler_tools/command/bundle_open'
|
6
|
-
require 'vagrant_bundler_tools/command/bundle_show'
|
7
|
-
require 'vagrant_bundler_tools/errors'
|
8
|
-
|
9
|
-
module VagrantBundlerTools
|
10
|
-
|
11
|
-
# The source root is the path to the root directory of
|
12
|
-
# the VagrantBundlerTools gem.
|
13
|
-
def self.source_root
|
14
|
-
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Vagrant.commands.register(:bundle) { VagrantBundlerTools::Command::Bundle }
|
19
|
-
|
20
|
-
# # Default I18n to load the en locale
|
21
|
-
I18n.load_path << File.expand_path("templates/locales/en.yml", VagrantBundlerTools.source_root)
|
@@ -1,37 +0,0 @@
|
|
1
|
-
module VagrantBundlerTools
|
2
|
-
module Command
|
3
|
-
class Base < Vagrant::Command::Base
|
4
|
-
protected
|
5
|
-
def locate_gem(gem_name)
|
6
|
-
bundle_show = ssh_execute("cd /vagrant && bundle show #{gem_name}").strip
|
7
|
-
|
8
|
-
if bundle_show.include?('Could not find gem')
|
9
|
-
raise Errors::GemNotFound.new(bundle_show)
|
10
|
-
end
|
11
|
-
|
12
|
-
unless bundle_show.start_with?('/vagrant/')
|
13
|
-
raise Errors::BundlePathOutsideVagrantDirectory.new
|
14
|
-
end
|
15
|
-
|
16
|
-
host_path = bundle_show.gsub(%r{^/vagrant/}, '')
|
17
|
-
File.expand_path(host_path)
|
18
|
-
end
|
19
|
-
|
20
|
-
def ssh_execute(command)
|
21
|
-
output = ''
|
22
|
-
with_target_vms(nil, :single_target => true) do |vm|
|
23
|
-
# Basic checks that are required for proper SSH
|
24
|
-
raise Errors::VMNotCreatedError if !vm.created?
|
25
|
-
raise Errors::VMInaccessible if !vm.state == :inaccessible
|
26
|
-
raise Errors::VMNotRunningError if vm.state != :running
|
27
|
-
|
28
|
-
vm.channel.execute(command, :error_check => false) do |type, data|
|
29
|
-
output << data.to_s
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
output
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
module VagrantBundlerTools
|
4
|
-
module Command
|
5
|
-
class Bundle < Base
|
6
|
-
def initialize(argv, env)
|
7
|
-
super
|
8
|
-
|
9
|
-
@main_args, @sub_command, @sub_args = split_main_and_subcommand(argv)
|
10
|
-
|
11
|
-
@subcommands = Vagrant::Registry.new
|
12
|
-
@subcommands.register(:list) { VagrantBundlerTools::Command::BundleList }
|
13
|
-
@subcommands.register(:open) { VagrantBundlerTools::Command::BundleOpen }
|
14
|
-
@subcommands.register(:show) { VagrantBundlerTools::Command::BundleShow }
|
15
|
-
end
|
16
|
-
|
17
|
-
def execute
|
18
|
-
if @main_args.include?("-h") || @main_args.include?("--help")
|
19
|
-
# Print the help for all the box commands.
|
20
|
-
return help
|
21
|
-
end
|
22
|
-
|
23
|
-
# If we reached this far then we must have a subcommand. If not,
|
24
|
-
# then we also just print the help and exit.
|
25
|
-
command_class = @subcommands.get(@sub_command.to_sym) if @sub_command
|
26
|
-
return help if !command_class || !@sub_command
|
27
|
-
|
28
|
-
# Initialize and execute the command class
|
29
|
-
command_class.new(@sub_args, @env).execute
|
30
|
-
end
|
31
|
-
|
32
|
-
# Prints the help out for this command
|
33
|
-
def help
|
34
|
-
opts = OptionParser.new do |opts|
|
35
|
-
opts.banner = "Usage: vagrant bundle <command> [<args>]"
|
36
|
-
opts.separator ""
|
37
|
-
opts.separator "Available subcommands:"
|
38
|
-
|
39
|
-
# Add the available subcommands as separators in order to print them
|
40
|
-
# out as well.
|
41
|
-
keys = []
|
42
|
-
@subcommands.each { |key, value| keys << key }
|
43
|
-
|
44
|
-
keys.each do |key|
|
45
|
-
opts.separator " #{key}"
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
@env.ui.info(opts.help, :prefix => false)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module VagrantBundlerTools
|
2
|
-
module Command
|
3
|
-
class BundleOpen < Base
|
4
|
-
def execute
|
5
|
-
opts = OptionParser.new do |opts|
|
6
|
-
opts.banner = "Show the path to a bundle gem on the vagrant box"
|
7
|
-
opts.separator ""
|
8
|
-
opts.separator "Usage: vagrant bundle show <gem_name>"
|
9
|
-
end
|
10
|
-
|
11
|
-
# Parse the options
|
12
|
-
argv = parse_options(opts)
|
13
|
-
|
14
|
-
return if !argv
|
15
|
-
|
16
|
-
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
17
|
-
|
18
|
-
# Method largely copied and pasted from from Bundler::CLI#open
|
19
|
-
editor = [ENV['BUNDLER_EDITOR'], ENV['VISUAL'], ENV['EDITOR']].find{|e| !e.nil? && !e.empty? }
|
20
|
-
if editor
|
21
|
-
gem_path = locate_gem(argv[0])
|
22
|
-
Dir.chdir(gem_path) do
|
23
|
-
command = "#{editor} #{gem_path}"
|
24
|
-
success = system(command)
|
25
|
-
@env.ui.info "Could not run '#{command}'" unless success
|
26
|
-
end
|
27
|
-
else
|
28
|
-
@env.ui.info("To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
module VagrantBundlerTools
|
4
|
-
module Command
|
5
|
-
class BundleShow < Base
|
6
|
-
def execute
|
7
|
-
opts = OptionParser.new do |opts|
|
8
|
-
opts.banner = "Show the path to a bundle gem on the vagrant box"
|
9
|
-
opts.separator ""
|
10
|
-
opts.separator "Usage: vagrant bundle show <gem_name>"
|
11
|
-
end
|
12
|
-
|
13
|
-
# Parse the options
|
14
|
-
argv = parse_options(opts)
|
15
|
-
|
16
|
-
return if !argv
|
17
|
-
|
18
|
-
raise Vagrant::Errors::CLIInvalidUsage, :help => opts.help.chomp if argv.length < 1
|
19
|
-
|
20
|
-
@env.ui.info locate_gem(argv[0])
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module VagrantBundlerTools
|
2
|
-
module Errors
|
3
|
-
class BundlePathOutsideVagrantDirectory < Vagrant::Errors::VagrantError
|
4
|
-
error_key(:bundle_path_outside_vagrant_directory, "vagrant_bundler_tools.errors")
|
5
|
-
end
|
6
|
-
|
7
|
-
class GemNotFound < Vagrant::Errors::VagrantError
|
8
|
-
def initialize(message)
|
9
|
-
# We inherit from Vagrant::Errors::VagrantError so that Vagrant
|
10
|
-
# handles this error like other VagrantErrors but we want to skip
|
11
|
-
# VagrantError#initialize to avoid i18n translations, because we are
|
12
|
-
# just passing on the message 'bundle show' returns
|
13
|
-
#
|
14
|
-
# This call effectively calls initialize on VagrantError's superclass
|
15
|
-
# StandardError
|
16
|
-
StandardError.instance_method(:initialize).bind(self).call(message)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/lib/vagrant_init.rb
DELETED
data/templates/locales/en.yml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
en:
|
2
|
-
vagrant_bundler_tools:
|
3
|
-
errors:
|
4
|
-
bundle_path_outside_vagrant_directory: |-
|
5
|
-
The guest's bundle path must be a subdirectory of /vagrant to be accessible to the host
|
6
|
-
|
7
|
-
Run
|
8
|
-
|
9
|
-
bundle config path .bundled_gems && bundle install
|
10
|
-
|
11
|
-
On the guest to move the bundle to a location the host can access
|