vagrant-faster 0.0.3.pre.alpha.pre.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDlkZTk3ODU2ZGZhZjNjOGNjMzY0ZDE4OGFlMGM5NGUwZjhhMDQyYg==
5
+ data.tar.gz: !binary |-
6
+ NjMwNjkzNjM4MDRhZWM5Mzk1MzQzMzU4ZjMzN2Q5MmIxNzE2ODEwNA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MDRhYTFhMDU1ZDZiN2ZjZWQ0MzE0NDA0M2ZhNWYxYjUwMzJkNjNhMzMzNGJl
10
+ YTcxNzdiYWYzNTcwYTZiMDAzOGIzOWMwMGM4MDNlMTJhZGJmMTU0ZWRhMGUz
11
+ N2YwNWE5Y2NlNjRlOGQ5ZmFlYmI2YWMwMWM1OWI5ZmQwZmVkOTM=
12
+ data.tar.gz: !binary |-
13
+ YzgyYTdmZGU5YWIyYjFjZDdlYzY4NzU0Njg1NDRhN2Q3ZmMwZmRjMmViYzNh
14
+ N2FiZDA2MTZiYThlMzdiMDUzYzRlNmVhYTBkYzk4NDk5NGZiMjY5OGI4ZGNi
15
+ ODMwMmU3NmQ1YWVkZDVmMmU4ZjkzZDU4OWE4MzRhMjBhYTNmOTI=
data/.gitignore ADDED
@@ -0,0 +1,22 @@
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
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ ---
2
+ language: ruby
3
+ before_install:
4
+ - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
5
+ - "bundle config build.nokogiri --use-system-libraries"
6
+ script: echo
7
+ notifications:
8
+ email: false
9
+ deploy:
10
+ provider: rubygems
11
+ api_key:
12
+ secure: "ew0cfiSZSfkvEFpudCUtMc8hRi2uUxkWi7B6PFH/CNFKoa9V/3Mr1qtWwhG6pl2jV/NkiVCWooGzk7Cnth9RGUm2fMCYi85zi53mrIBJoROwgbem9jUlSCc0Ir4J5Xs2p783sV8fNLBaY/cnGFF8UW8d7OKLNkf/dlQmnI7YeOg="
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-faster.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
8
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 rdsubhas
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,29 @@
1
+ # Vagrant::Faster
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'vagrant-faster'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install vagrant-faster
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( https://github.com/[my-github-username]/vagrant-faster/fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ require 'vagrant/faster/plugin'
2
+
3
+ module Vagrant
4
+ module Faster
5
+ end
6
+ end
@@ -0,0 +1,47 @@
1
+ module Vagrant
2
+ module Faster
3
+ class Middleware
4
+ def initialize(app, env)
5
+ @app = app
6
+ @env = env
7
+ end
8
+
9
+ def call(env)
10
+ @env = env
11
+ vm = env[:vm] || env[:machine]
12
+
13
+ cpus, mem = optimal_settings
14
+ if cpus > 0 && mem > 0
15
+ puts "[vagrant-faster] Setting CPUs: #{cpus} and Memory: #{mem}"
16
+ vm.cpus = cpus
17
+ vm.memory = memory
18
+ else
19
+ puts "[vagrant-faster] was unable to detect optimal settings for your machine"
20
+ end
21
+ end
22
+
23
+ def optimal_settings
24
+ host = RbConfig::CONFIG['host_os']
25
+
26
+ cpus = -1
27
+ mem = -1
28
+
29
+ begin
30
+ if host =~ /darwin/
31
+ cpus = `sysctl -n hw.ncpu`.to_i
32
+ mem = `sysctl -n hw.memsize`.to_i / 1024 / 1024
33
+ elsif host =~ /linux/
34
+ cpus = `nproc`.to_i
35
+ mem = `grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'`.to_i / 1024
36
+ end
37
+
38
+ # Give VM 1/4 system memory & access to half of cpu cores on the host
39
+ cpus = cpus / 2 if cpus > 1
40
+ mem = mem / 4 if mem > 2048
41
+ rescue; end
42
+
43
+ cpus, mem
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,14 @@
1
+ module Vagrant
2
+ module Faster
3
+ class Plugin
4
+ name 'vagrant-faster'
5
+ description 'Make VMs faster by allocating more Memory/CPU based on your machine capacity'
6
+
7
+ action_hook 'faster' do |hook|
8
+ require_relative './middleware'
9
+ puts "[vagrant-faster] hook"
10
+ hook.before VagrantPlugins::ProviderVirtualBox::Action::Boot, Vagrant::Faster::Middleware
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "vagrant-faster"
7
+ spec.version = "0.0.3"
8
+ spec.version = "#{spec.version}-alpha-#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
9
+
10
+ spec.authors = ["rdsubhas"]
11
+ spec.email = ["rdsubhas@gmail.com"]
12
+ spec.description = %q{A Vagrant Plugin that makes your VirtualBox VMs faster by allocating more Memory/CPU based on your machine capacity}
13
+ spec.summary = spec.description
14
+ spec.homepage = "http://github.com/rdsubhas/vagrant-faster"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.6"
23
+ spec.add_development_dependency "rake"
24
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-faster
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3.pre.alpha.pre.4
5
+ platform: ruby
6
+ authors:
7
+ - rdsubhas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-08-13 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.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
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: A Vagrant Plugin that makes your VirtualBox VMs faster by allocating
42
+ more Memory/CPU based on your machine capacity
43
+ email:
44
+ - rdsubhas@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - .travis.yml
51
+ - Gemfile
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/vagrant/faster.rb
56
+ - lib/vagrant/faster/middleware.rb
57
+ - lib/vagrant/faster/plugin.rb
58
+ - vagrant-faster.gemspec
59
+ homepage: http://github.com/rdsubhas/vagrant-faster
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ! '>='
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ! '>'
75
+ - !ruby/object:Gem::Version
76
+ version: 1.3.1
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.3.0
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: A Vagrant Plugin that makes your VirtualBox VMs faster by allocating more
83
+ Memory/CPU based on your machine capacity
84
+ test_files: []