Add support for Bower
This commit is contained in:
parent
b2b0d98dfa
commit
973d5d1a8f
6 changed files with 61 additions and 0 deletions
13
docs/bower.md
Normal file
13
docs/bower.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# [Bower](http://bower.io/)
|
||||
|
||||
Compatible with probably any type of linux guest distro, will cache guests'
|
||||
`$HOME/.cache/bower` if bower is detected.
|
||||
|
||||
To manually enable it:
|
||||
|
||||
```ruby
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = 'some-box-with-bower-installed'
|
||||
config.cache.enable :bower
|
||||
end
|
||||
```
|
|
@ -88,6 +88,7 @@
|
|||
<li><a tabindex="-1" href="buckets/apt-cacher">apt-cacher</a></li>
|
||||
<li><a tabindex="-1" href="buckets/chef">Chef</a></li>
|
||||
<li><a tabindex="-1" href="buckets/composer">Composer</a></li>
|
||||
<li><a tabindex="-1" href="buckets/composer">Bower</a></li>
|
||||
<li><a tabindex="-1" href="buckets/pacman">Pacman</a></li>
|
||||
<li><a tabindex="-1" href="buckets/npm">npm</a></li>
|
||||
<li><a tabindex="-1" href="buckets/rubygems">RubyGems</a></li>
|
||||
|
|
|
@ -96,6 +96,7 @@ require_relative "bucket/rvm"
|
|||
require_relative "bucket/apt_cacher"
|
||||
require_relative "bucket/apt_lists"
|
||||
require_relative "bucket/composer"
|
||||
require_relative "bucket/bower"
|
||||
require_relative "bucket/npm"
|
||||
require_relative "bucket/zypper"
|
||||
require_relative "bucket/generic"
|
||||
|
|
21
lib/vagrant-cachier/bucket/bower.rb
Normal file
21
lib/vagrant-cachier/bucket/bower.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
module VagrantPlugins
|
||||
module Cachier
|
||||
class Bucket
|
||||
class Bower < Bucket
|
||||
def self.capability
|
||||
:bower_path
|
||||
end
|
||||
|
||||
def install
|
||||
if guest.capability?(:bower_path)
|
||||
if bower_path = guest.capability(:bower_path)
|
||||
user_symlink(bower_path)
|
||||
end
|
||||
else
|
||||
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'Bower')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
20
lib/vagrant-cachier/cap/linux/bower_path.rb
Normal file
20
lib/vagrant-cachier/cap/linux/bower_path.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
module VagrantPlugins
|
||||
module Cachier
|
||||
module Cap
|
||||
module Linux
|
||||
module BowerPath
|
||||
def self.bower_path(machine)
|
||||
bower_path = nil
|
||||
machine.communicate.tap do |comm|
|
||||
return unless comm.test('which bower')
|
||||
comm.execute 'echo $HOME' do |buffer, output|
|
||||
bower_path = output.chomp if buffer == :stdout
|
||||
end
|
||||
end
|
||||
return "#{bower_path}/.cache/bower"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -16,6 +16,11 @@ module VagrantPlugins
|
|||
Cap::Linux::ComposerPath
|
||||
end
|
||||
|
||||
guest_capability 'linux', 'bower_path' do
|
||||
require_relative 'cap/linux/bower_path'
|
||||
Cap::Linux::BowerPath
|
||||
end
|
||||
|
||||
guest_capability 'linux', 'chef_file_cache_path' do
|
||||
require_relative 'cap/linux/chef_file_cache_path'
|
||||
Cap::Linux::ChefFileCachePath
|
||||
|
|
Loading…
Reference in a new issue