vagrant-tmuxme 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bd3d3dfaa8b6fd16b7e0866dd33bcfdb68e5108a
4
+ data.tar.gz: 107d279def728aa7db1b0b6e84fa0d727956ba93
5
+ SHA512:
6
+ metadata.gz: 68c341eec103f4d0ac9c2ec591e3f64d90ca0665b2aa33117e0c2751c6aa9d60ea57900d97c72a3f07e3673d33583452778b10096033b0c8fe7060093095e23b
7
+ data.tar.gz: d96893b2af243c6b5b8f3ed3da7bc3ed7419efbd97d34a5ed7965fec7d6e2dc72855e76ca1ba088ef830cb288004659d91e3a1015c1401ee61aa04ab32cc91ef
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-tmuxme.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Brian Miller
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ 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, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Brian Miller
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ # Vagrant-Tmuxme
2
+
3
+ Start tmuxme sessions in a running vagrant instance. The safe way to pair with
4
+ tmuxme.
5
+
6
+ ## Installation
7
+
8
+ Build the gem locally
9
+
10
+ rake build
11
+
12
+ Install the built gem in vagrant
13
+
14
+ vagrant plugin install pkg/vagrant-tmuxme-0.0.1.gem
15
+
16
+ ## Usage
17
+
18
+ A new tmuxme session can be started in a running vagrant instance by running
19
+ the following:
20
+
21
+ vagrant tmuxme [tmuxme user]
22
+
23
+ **Note** the directory that you start vagrant in is automatically shared with
24
+ the vm and will be accessible to any tmuxme guest.
25
+
26
+ ## Contributing
27
+
28
+ 1. Fork it
29
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
30
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
31
+ 4. Push to the branch (`git push origin my-new-feature`)
32
+ 5. Create new Pull Request
33
+ =======
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require "vagrant-tmuxme/version"
2
+ require "vagrant-tmuxme/plugin"
3
+
4
+ module VagrantPlugins
5
+ module Tmuxme
6
+ end
7
+ end
@@ -0,0 +1,44 @@
1
+ module VagrantPlugins
2
+ module Tmuxme
3
+ module Cap
4
+ class EnsureTmux
5
+
6
+ def self.ensure_tmux(machine, env)
7
+ return unless machine.communicate.ready?
8
+
9
+ if tmux_installed?(machine)
10
+ env.ui.info I18n.t('vagrant_tmuxme.tmux_installed')
11
+ else
12
+ env.ui.info I18n.t('vagrant_tmuxme.installing_tmux')
13
+ install_tmux!(machine)
14
+ end
15
+ end
16
+
17
+ def self.tmux_installed?(machine)
18
+ machine.communicate.execute("tmux -V") rescue false
19
+ end
20
+
21
+ def self.install_tmux!(machine)
22
+ machine.communicate.tap do |comm|
23
+ case machine.guest.name
24
+ when :debian, :ubuntu
25
+ comm.sudo "apt-get update"
26
+ comm.sudo "apt-get install tmux"
27
+ when :fedora, :centos, :redhat
28
+ comm.sudo "yum install tmux"
29
+ when :suse
30
+ comm.sudo "yast2 -i tmux"
31
+ when :gentoo
32
+ comm.sudo "emerge tmux"
33
+ when :arch
34
+ comm.sudo "pacman -s tmux"
35
+ else
36
+ raise Errors::TmuxNotAvailableError, guest: machine.guest.name
37
+ end
38
+ end
39
+ end
40
+
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,30 @@
1
+ module VagrantPlugins
2
+ module Tmuxme
3
+ module Cap
4
+ class EnsureTmuxme
5
+
6
+ def self.ensure_tmuxme(machine, env)
7
+ return unless machine.communicate.ready?
8
+
9
+ if tmuxme_installed?(machine)
10
+ env.ui.info I18n.t('vagrant_tmuxme.tmuxme_installed')
11
+ else
12
+ env.ui.info I18n.t('vagrant_tmuxme.installing_tmuxme')
13
+ install_tmuxme!(machine)
14
+ end
15
+ end
16
+
17
+ def self.tmuxme_installed?(machine)
18
+ machine.communicate.execute("tmuxme") rescue false
19
+ end
20
+
21
+ def self.install_tmuxme!(machine)
22
+ machine.communicate.tap do |comm|
23
+ comm.sudo "gem install tmuxme"
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ module VagrantPlugins
2
+ module Tmuxme
3
+ module Errors
4
+ class TmuxNotAvailableError < Vagrant::Errors::VagrantError
5
+ error_key(:tmux_not_available)
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,38 @@
1
+ begin
2
+ require "vagrant"
3
+ rescue LoadError
4
+ raise "The Vagrant Tmuxme plugin must be run within Vagrant."
5
+ end
6
+
7
+ # This is a sanity check to make sure no one is attempting to install
8
+ # this into an early Vagrant version.
9
+ if Vagrant::VERSION < "1.1.0"
10
+ raise "The Vagrant Tmuxme plugin is only compatible with Vagrant 1.1+"
11
+ end
12
+
13
+ # Add our custom translations to the load path
14
+ I18n.load_path << File.expand_path("../../../locales/en.yml", __FILE__)
15
+
16
+ module VagrantPlugins
17
+ module Tmuxme
18
+ class Plugin < Vagrant.plugin("2")
19
+ name "Vagrant Tmuxme"
20
+ description "Create a tmuxme session the safe way"
21
+
22
+ command "tmuxme" do
23
+ require_relative "tmuxme_command"
24
+ TmuxmeCommand
25
+ end
26
+
27
+ guest_capability("linux", "ensure_tmux") do
28
+ require_relative "cap/ensure_tmux"
29
+ Cap::EnsureTmux
30
+ end
31
+
32
+ guest_capability("linux", "ensure_tmuxme") do
33
+ require_relative "cap/ensure_tmuxme"
34
+ Cap::EnsureTmuxme
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,29 @@
1
+ require 'optparse'
2
+
3
+ module VagrantPlugins
4
+ module Tmuxme
5
+ class TmuxmeCommand < Vagrant.plugin("2", :command)
6
+ def execute
7
+ options = {}
8
+
9
+ opts = OptionParser.new do |opt|
10
+ opt.banner = "Usage: vagrant tmuxme [username]"
11
+ end
12
+
13
+ argv = parse_options(opts)
14
+
15
+ with_target_vms("default") do |vm|
16
+ raise Vagrant::Errors::VMNotCreatedError if vm.state.id == :not_created
17
+ raise Vagrant::Errors::VMInaccessible if vm.state.id == :inaccessible
18
+ end
19
+
20
+ with_target_vms("default") do |vm|
21
+ vm.guest.capability(:ensure_tmux, @env)
22
+ vm.guest.capability(:ensure_tmuxme, @env)
23
+ @env.ui.info "Starting pair session with #{argv.join(" ")}"
24
+ vm.action(:ssh, ssh_opts: { extra_args: ["-t", ". /etc/profile; . ~/.profile; tmuxme #{argv.join(" ")}"], subprocess: true })
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Tmuxme
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
data/locales/en.yml ADDED
@@ -0,0 +1,18 @@
1
+ en:
2
+ vagrant_tmuxme:
3
+ ensure_tmux: |-
4
+ Ensuring that tmux is installed on guest.
5
+ tmux_installed: |-
6
+ Tmux already installed.
7
+ installing_tmux: |-
8
+ Installing tmux...
9
+ ensure_tmuxme: |-
10
+ Ensuring that tmuxme is installed on guest.
11
+ tmuxme_installed: |-
12
+ Tmuxme already installed.
13
+ installing_tmuxme: |-
14
+ Installing tmuxme...
15
+ vagrant:
16
+ errors:
17
+ tmux_not_available: |-
18
+ Unable to install tmux on a machine of guest type '%{guest}'.
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-tmuxme/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-tmuxme"
8
+ spec.version = VagrantPlugins::Tmuxme::VERSION
9
+ spec.authors = ["Brian Miller"]
10
+ spec.email = ["brimil01@gmail.com"]
11
+ spec.description = %q{Tmuxme the safe way}
12
+ spec.summary = %q{Tmuxme the safe way}
13
+ spec.homepage = "http://www.tmux.me"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-tmuxme
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Brian Miller
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-04 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: Tmuxme the safe way
42
+ email:
43
+ - brimil01@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/vagrant-tmuxme.rb
55
+ - lib/vagrant-tmuxme/cap/ensure_tmux.rb
56
+ - lib/vagrant-tmuxme/cap/ensure_tmuxme.rb
57
+ - lib/vagrant-tmuxme/errors.rb
58
+ - lib/vagrant-tmuxme/plugin.rb
59
+ - lib/vagrant-tmuxme/tmuxme_command.rb
60
+ - lib/vagrant-tmuxme/version.rb
61
+ - locales/en.yml
62
+ - vagrant-tmuxme.gemspec
63
+ homepage: http://www.tmux.me
64
+ licenses:
65
+ - MIT
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 2.0.0
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Tmuxme the safe way
87
+ test_files: []