vagrant_workspace 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd3b2075002d793c75d7beddd350cf140675760d
4
+ data.tar.gz: 563bfc7c7811e30fb7f6a056f8ad3d65a0c25ae4
5
+ SHA512:
6
+ metadata.gz: 8d220df6a2b9b6b56dc460eedf7ac3872888112fec3c4335d36c23aac2c7cc7e0220e4ac1cb214d6ae2e72e4ee8b2c26531bbf165e74ffccf15574e779ca4833
7
+ data.tar.gz: 1e309d74fe77f9fefed14d36e502e2dbb24556a089b196f5a39d39ff0f2baf6ecaa48fd282003df9b1717313cde3be2814e1a2027693537c2aee95b1cada901d
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'vagrant', github: 'mitchellh/vagrant'
5
+ end
6
+
7
+ group :plugins do
8
+ gemspec
9
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 adjust
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,50 @@
1
+ # Vagrant Workspace Manager
2
+
3
+ This plugin allows you to load workspace configuration files. These configuration files simplify the workflow of switching git branches/updating them, when you work on multiple projects at once.
4
+
5
+ ## Installation
6
+
7
+ Install the plugin with a typical Vagrant procedure:
8
+
9
+ ```sh
10
+ $ vagrant plugin install vagrant-workspace
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ Example vagrant configuration:
16
+ ```ruby
17
+ Vagrant.configure("2") do |config|
18
+ config.workspace.absolute_path = '/adjust'
19
+ end
20
+ ```
21
+
22
+ Example workspace file:
23
+ ```yml
24
+ # workspaces/mega_feature.yml
25
+ project1:
26
+ run:
27
+ - git fetch origin
28
+ - git checkout mega_feature
29
+ - bundle install
30
+ project2:
31
+ run:
32
+ - git fetch origin
33
+ - git checkout mega_feature
34
+ - npm install
35
+ ```
36
+
37
+ Example command:
38
+ ```sh
39
+ $ vagrant workspace workspaces/mega_feature.yml
40
+ ```
41
+
42
+ ## Development
43
+
44
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45
+
46
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/vagrant-workspace.
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,39 @@
1
+ module VagrantWorkspace
2
+ module Action
3
+ class Run
4
+ attr_reader :app, :env, :machine, :workspace_file
5
+
6
+ def initialize(app, env)
7
+ @app = app
8
+ @env = env
9
+ @machine = env[:machine]
10
+ @workspace_file = env[:workspace_file]
11
+ end
12
+
13
+ def call(env)
14
+ projects.each do |project_name, project|
15
+ puts "Executing commands on #{project_name}:"
16
+ project['run'].each do |command|
17
+ puts "$ #{command}"
18
+ machine.communicate.execute "cd #{path(project_name)} && #{command}"
19
+ end
20
+ end
21
+ app.call(env)
22
+ end
23
+
24
+ private
25
+
26
+ def projects
27
+ YAML.load_file(workspace_file)
28
+ end
29
+
30
+ def path(project)
31
+ File.join(workspace_path, project)
32
+ end
33
+
34
+ def workspace_path
35
+ machine.config.workspace.absolute_path
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,13 @@
1
+ require 'vagrant_workspace/action/run'
2
+
3
+ module VagrantWorkspace
4
+ module Action
5
+ include Vagrant::Action::Builtin
6
+
7
+ def self.run
8
+ Vagrant::Action::Builder.new.tap do |builder|
9
+ builder.use Run
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,22 @@
1
+ require 'vagrant_workspace/action'
2
+
3
+ module VagrantWorkspace
4
+ class Command < Vagrant.plugin(2, :command)
5
+ # Show description when `vagrant list-commands` is triggered
6
+ def self.synopsis
7
+ 'plugin: vagrant_workspace: executes workspace files'
8
+ end
9
+
10
+ def execute
11
+ _, workspace_file = ARGV
12
+
13
+ with_target_vms do |machine|
14
+ @env.action_runner.run(Action.run, {
15
+ global_env: @env,
16
+ machine: machine,
17
+ workspace_file: workspace_file
18
+ })
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module VagrantWorkspace
2
+ class Config < Vagrant.plugin(2, :config)
3
+ attr_accessor :absolute_path
4
+
5
+ def initialize
6
+ @absolute_path = UNSET_VALUE
7
+ end
8
+
9
+ def finalize!
10
+ @absolute_path = '/home/vagrant' if @absolute_path == UNSET_VALUE
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,19 @@
1
+ module VagrantWorkspace
2
+ class Plugin < Vagrant.plugin('2')
3
+ name 'Vagrant Workspace'
4
+ description <<-DESC
5
+ This plugin allows you to load and execute workspace configuration files.
6
+ These configuration files simplify the workflow of working with multiple projects.
7
+ DESC
8
+
9
+ command 'workspace' do
10
+ require_relative 'command'
11
+ Command
12
+ end
13
+
14
+ config 'workspace' do
15
+ require_relative 'config'
16
+ Config
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module VagrantWorkspace
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'vagrant'
2
+
3
+ require 'vagrant_workspace/plugin'
4
+
5
+ module VagrantWorkspace
6
+ # Your code goes here...
7
+ end
@@ -0,0 +1,21 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant_workspace/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant_workspace"
8
+ spec.version = VagrantWorkspace::VERSION
9
+ spec.authors = ["Ali Ismayilov"]
10
+ spec.email = ["ali@ismailov.info"]
11
+
12
+ spec.summary = %q{Vagrant workspaces plugin}
13
+ spec.description = %q{Vagrant workspaces plugin}
14
+ spec.homepage = "https://github.com/adjust/vagrant_workspace"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.require_paths = ["lib"]
18
+
19
+ spec.add_development_dependency "bundler", "~> 1.10"
20
+ spec.add_development_dependency "rake", "~> 10.0"
21
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant_workspace
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ali Ismayilov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-25 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.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
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.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Vagrant workspaces plugin
42
+ email:
43
+ - ali@ismailov.info
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - LICENSE
53
+ - README.md
54
+ - Rakefile
55
+ - lib/vagrant_workspace.rb
56
+ - lib/vagrant_workspace/action.rb
57
+ - lib/vagrant_workspace/action/run.rb
58
+ - lib/vagrant_workspace/command.rb
59
+ - lib/vagrant_workspace/config.rb
60
+ - lib/vagrant_workspace/plugin.rb
61
+ - lib/vagrant_workspace/version.rb
62
+ - vagrant-workspace.gemspec
63
+ homepage: https://github.com/adjust/vagrant_workspace
64
+ licenses: []
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
83
+ signing_key:
84
+ specification_version: 4
85
+ summary: Vagrant workspaces plugin
86
+ test_files: []