vagrant-commands 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +56 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +124 -0
- data/LICENSE +21 -0
- data/README.md +7 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/vagrant-commands/commands/commands.rb +24 -0
- data/lib/vagrant-commands/commands/custom.rb +56 -0
- data/lib/vagrant-commands/config.rb +16 -0
- data/lib/vagrant-commands/plugin.rb +26 -0
- data/lib/vagrant-commands/util.rb +10 -0
- data/lib/vagrant-commands/version.rb +3 -0
- data/lib/vagrant-commands.rb +5 -0
- data/vagrant-commands.gemspec +26 -0
- data/vagrant-commands.sublime-project +8 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1ff12e9edc886c0bbf5f9b00de66e72cf7148d6b8da86bb8e080c024052850f8
|
4
|
+
data.tar.gz: 4761720d59916ea65d932364f2b8d980d9b92f80c34c16977ac566ef8a6ac9f7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c61ab325ae426ed219d143ad1e44d1de9fac0e1c437cb68d3fbec89c999332ce620c48a6ad7fc9b1eabd5866de63786b657e3879d5dacb34db52049eea04616a
|
7
|
+
data.tar.gz: e668353505885a2abd22fe024aabe5219935ac9281a342b6c4bd80225b3eb0267f133d61ab8e7222a6be1343f31ec81ff71170aa188becda6880c4dfd5011de8
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Ignore vagrant files
|
2
|
+
/.vagrant
|
3
|
+
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
14
|
+
/tmp/
|
15
|
+
|
16
|
+
# Used by dotenv library to load environment variables.
|
17
|
+
# .env
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Text editors, etc.
|
56
|
+
*.sublime-workspace
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/hashicorp/vagrant.git
|
3
|
+
revision: 25e11650c3c6b1a2d461ef055aabacb8562b265b
|
4
|
+
tag: v2.2.4
|
5
|
+
specs:
|
6
|
+
vagrant (2.2.4)
|
7
|
+
bcrypt_pbkdf (~> 1.0.0)
|
8
|
+
childprocess (~> 0.6.0)
|
9
|
+
ed25519 (~> 1.2.4)
|
10
|
+
erubis (~> 2.7.0)
|
11
|
+
hashicorp-checkpoint (~> 0.1.5)
|
12
|
+
i18n (~> 1.1.1)
|
13
|
+
listen (~> 3.1.5)
|
14
|
+
log4r (~> 1.1.9, < 1.1.11)
|
15
|
+
net-scp (~> 1.2.0)
|
16
|
+
net-sftp (~> 2.1)
|
17
|
+
net-ssh (~> 5.1.0)
|
18
|
+
rb-kqueue (~> 0.2.0)
|
19
|
+
rest-client (>= 1.6.0, < 3.0)
|
20
|
+
ruby_dep (<= 1.3.1)
|
21
|
+
rubyzip (~> 1.2.2)
|
22
|
+
vagrant_cloud (~> 2.0.2)
|
23
|
+
wdm (~> 0.1.0)
|
24
|
+
winrm (~> 2.1)
|
25
|
+
winrm-elevated (~> 1.1)
|
26
|
+
winrm-fs (~> 1.0)
|
27
|
+
|
28
|
+
PATH
|
29
|
+
remote: .
|
30
|
+
specs:
|
31
|
+
vagrant-commands (0.1.0)
|
32
|
+
|
33
|
+
GEM
|
34
|
+
remote: https://rubygems.org/
|
35
|
+
specs:
|
36
|
+
bcrypt_pbkdf (1.0.1-x64-mingw32)
|
37
|
+
builder (3.2.3)
|
38
|
+
childprocess (0.6.3)
|
39
|
+
ffi (~> 1.0, >= 1.0.11)
|
40
|
+
concurrent-ruby (1.1.5)
|
41
|
+
domain_name (0.5.20190701)
|
42
|
+
unf (>= 0.0.5, < 1.0.0)
|
43
|
+
ed25519 (1.2.4)
|
44
|
+
erubis (2.7.0)
|
45
|
+
ffi (1.11.1-x64-mingw32)
|
46
|
+
gssapi (1.3.0)
|
47
|
+
ffi (>= 1.0.1)
|
48
|
+
gyoku (1.3.1)
|
49
|
+
builder (>= 2.1.2)
|
50
|
+
hashicorp-checkpoint (0.1.5)
|
51
|
+
http-cookie (1.0.3)
|
52
|
+
domain_name (~> 0.5)
|
53
|
+
httpclient (2.8.3)
|
54
|
+
i18n (1.1.1)
|
55
|
+
concurrent-ruby (~> 1.0)
|
56
|
+
listen (3.1.5)
|
57
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
58
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
59
|
+
ruby_dep (~> 1.2)
|
60
|
+
little-plugger (1.1.4)
|
61
|
+
log4r (1.1.10)
|
62
|
+
logging (2.2.2)
|
63
|
+
little-plugger (~> 1.1)
|
64
|
+
multi_json (~> 1.10)
|
65
|
+
mime-types (3.2.2)
|
66
|
+
mime-types-data (~> 3.2015)
|
67
|
+
mime-types-data (3.2019.0331)
|
68
|
+
multi_json (1.13.1)
|
69
|
+
net-scp (1.2.1)
|
70
|
+
net-ssh (>= 2.6.5)
|
71
|
+
net-sftp (2.1.2)
|
72
|
+
net-ssh (>= 2.6.5)
|
73
|
+
net-ssh (5.1.0)
|
74
|
+
netrc (0.11.0)
|
75
|
+
nori (2.6.0)
|
76
|
+
rake (10.5.0)
|
77
|
+
rb-fsevent (0.10.3)
|
78
|
+
rb-inotify (0.10.0)
|
79
|
+
ffi (~> 1.0)
|
80
|
+
rb-kqueue (0.2.5)
|
81
|
+
ffi (>= 0.5.0)
|
82
|
+
rest-client (2.0.2-x64-mingw32)
|
83
|
+
ffi (~> 1.9)
|
84
|
+
http-cookie (>= 1.0.2, < 2.0)
|
85
|
+
mime-types (>= 1.16, < 4.0)
|
86
|
+
netrc (~> 0.8)
|
87
|
+
ruby_dep (1.3.1)
|
88
|
+
rubyntlm (0.6.2)
|
89
|
+
rubyzip (1.2.3)
|
90
|
+
unf (0.1.4)
|
91
|
+
unf_ext
|
92
|
+
unf_ext (0.0.7.6)
|
93
|
+
vagrant_cloud (2.0.2)
|
94
|
+
rest-client (~> 2.0.2)
|
95
|
+
wdm (0.1.1)
|
96
|
+
winrm (2.3.2)
|
97
|
+
builder (>= 2.1.2)
|
98
|
+
erubis (~> 2.7)
|
99
|
+
gssapi (~> 1.2)
|
100
|
+
gyoku (~> 1.0)
|
101
|
+
httpclient (~> 2.2, >= 2.2.0.2)
|
102
|
+
logging (>= 1.6.1, < 3.0)
|
103
|
+
nori (~> 2.0)
|
104
|
+
rubyntlm (~> 0.6.0, >= 0.6.1)
|
105
|
+
winrm-elevated (1.1.1)
|
106
|
+
winrm (~> 2.0)
|
107
|
+
winrm-fs (~> 1.0)
|
108
|
+
winrm-fs (1.3.2)
|
109
|
+
erubis (~> 2.7)
|
110
|
+
logging (>= 1.6.1, < 3.0)
|
111
|
+
rubyzip (~> 1.1)
|
112
|
+
winrm (~> 2.0)
|
113
|
+
|
114
|
+
PLATFORMS
|
115
|
+
x64-mingw32
|
116
|
+
|
117
|
+
DEPENDENCIES
|
118
|
+
bundler (~> 1.17)
|
119
|
+
rake (~> 10)
|
120
|
+
vagrant!
|
121
|
+
vagrant-commands!
|
122
|
+
|
123
|
+
BUNDLED WITH
|
124
|
+
1.17.3
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 joe-damore
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Vagrant Commands
|
2
|
+
Vagrant plugin for custom console commands
|
3
|
+
|
4
|
+
## Overview
|
5
|
+
Vagrant Commands allows you to define arbitrary subcommands for your
|
6
|
+
Vagrant development environments, allowing you to execute scripts on
|
7
|
+
your Vagrant guests using custom interfaces defined in YAML.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "vagrant/commands"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Commands
|
2
|
+
class Commands < Vagrant.plugin('2', :command)
|
3
|
+
|
4
|
+
def initialize(machine, env)
|
5
|
+
super(machine, env)
|
6
|
+
|
7
|
+
#@config = VagrantCommands::Util::config(env)
|
8
|
+
#@machine = machine
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.synopsis
|
12
|
+
'list commands added by vagrant-commands'
|
13
|
+
end
|
14
|
+
|
15
|
+
def execute
|
16
|
+
with_target_vms(nil) do |machine|
|
17
|
+
puts "#{machine}"
|
18
|
+
puts "#{machine.name}"
|
19
|
+
end
|
20
|
+
0
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Commands
|
2
|
+
|
3
|
+
def self.custom_command(name, commandItem)
|
4
|
+
return Class.new(Vagrant.plugin('2', :command)) do
|
5
|
+
|
6
|
+
define_singleton_method :synopsis do
|
7
|
+
"#{commandItem['synopsis']}"
|
8
|
+
end
|
9
|
+
|
10
|
+
define_method :initialize do |machine, env|
|
11
|
+
super(machine, env)
|
12
|
+
end
|
13
|
+
|
14
|
+
define_method :execute do
|
15
|
+
with_target_vms(nil) do |machine|
|
16
|
+
# If 'machine' configuration not set, set to 'default' by default.
|
17
|
+
targetMachine = commandItem['machine']
|
18
|
+
if targetMachine == nil
|
19
|
+
targetMachine = 'default'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Only execute on the targeted machine
|
23
|
+
if (machine.name.to_s <=> targetMachine) == 0
|
24
|
+
if !machine.communicate.ready?
|
25
|
+
# TODO Proper error management
|
26
|
+
# See https://github.com/dustymabe/vagrant-sshfs/blob/master/lib/vagrant-sshfs/command.rb:ln38 for inspiration
|
27
|
+
puts "Machine is not up yet!"
|
28
|
+
next
|
29
|
+
end
|
30
|
+
|
31
|
+
if commandItem.has_key?('exec')
|
32
|
+
if commandItem['exec'] != nil and commandItem['exec'].has_key?('command')
|
33
|
+
options = {}
|
34
|
+
arguments = ""
|
35
|
+
|
36
|
+
|
37
|
+
if ARGV.length > 1
|
38
|
+
rangeEnd = ARGV.length - 1
|
39
|
+
argvArguments = ARGV[1..rangeEnd]
|
40
|
+
arguments = " "
|
41
|
+
argvArguments.each { |arg|
|
42
|
+
arguments = "#{arguments} #{arg}"
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
options[:extra_args] = ["-t", "#{commandItem['exec']['command']}#{arguments}"]
|
47
|
+
|
48
|
+
Vagrant::Util::SSH.exec(machine.ssh_info, options);
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
|
3
|
+
module VagrantCommands
|
4
|
+
class Config < Vagrant.plugin('2', :config)
|
5
|
+
attr_accessor :path
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@path = UNSET_VALUE
|
9
|
+
end
|
10
|
+
|
11
|
+
def finalize!
|
12
|
+
conf = './vagrant-commands.yaml'
|
13
|
+
@path = conf if @path == UNSET_VALUE
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'vagrant'
|
2
|
+
require 'vagrant-commands'
|
3
|
+
require 'vagrant-commands/version'
|
4
|
+
require 'vagrant-commands/commands/custom'
|
5
|
+
require 'vagrant-commands/commands/commands'
|
6
|
+
|
7
|
+
require 'yaml'
|
8
|
+
|
9
|
+
class VagrantCommands::Plugin < Vagrant.plugin("2")
|
10
|
+
name "Commands"
|
11
|
+
|
12
|
+
description <<-DESC
|
13
|
+
This plugin allows custom commands to be added
|
14
|
+
to Vagrant environments using YAML.
|
15
|
+
DESC
|
16
|
+
|
17
|
+
if File.exist?('vagrant-commands.yml')
|
18
|
+
vagrantCommands = YAML.load_file('vagrant-commands.yml');
|
19
|
+
vagrantCommands['commands'].each { |commandItem|
|
20
|
+
command commandItem['name'] do
|
21
|
+
# Commands::Commands
|
22
|
+
Commands::custom_command(commandItem['name'], commandItem)
|
23
|
+
end
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require "vagrant-commands/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "vagrant-commands"
|
9
|
+
spec.version = VagrantCommands::VERSION
|
10
|
+
spec.authors = ["Joe D'Amore"]
|
11
|
+
spec.email = ["joe@joedamore.me"]
|
12
|
+
|
13
|
+
spec.summary = "Custom commands for local development"
|
14
|
+
spec.description = "Custom commands for Vagrant local development environments"
|
15
|
+
spec.homepage = "https://github.com/joe-damore/vagrant-commands"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
|
21
|
+
spec.files = %x{git ls-files -z}.split("\0")
|
22
|
+
spec.require_path = "lib"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.17"
|
25
|
+
spec.add_development_dependency "rake", "~> 10"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-commands
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joe D'Amore
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.17'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.17'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10'
|
41
|
+
description: Custom commands for Vagrant local development environments
|
42
|
+
email:
|
43
|
+
- joe@joedamore.me
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/console
|
55
|
+
- bin/setup
|
56
|
+
- lib/vagrant-commands.rb
|
57
|
+
- lib/vagrant-commands/commands/commands.rb
|
58
|
+
- lib/vagrant-commands/commands/custom.rb
|
59
|
+
- lib/vagrant-commands/config.rb
|
60
|
+
- lib/vagrant-commands/plugin.rb
|
61
|
+
- lib/vagrant-commands/util.rb
|
62
|
+
- lib/vagrant-commands/version.rb
|
63
|
+
- vagrant-commands.gemspec
|
64
|
+
- vagrant-commands.sublime-project
|
65
|
+
homepage: https://github.com/joe-damore/vagrant-commands
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.0.4
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Custom commands for local development
|
88
|
+
test_files: []
|