itamae-plugin-recipe-nodebrew 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +66 -0
- data/Rakefile +28 -0
- data/Vagrantfile +29 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/itamae-plugin-recipe-nodebrew.gemspec +27 -0
- data/lib/itamae/plugin/recipe/nodebrew.rb +0 -0
- data/lib/itamae/plugin/recipe/nodebrew/common.rb +2 -0
- data/lib/itamae/plugin/recipe/nodebrew/resource.rb +39 -0
- data/lib/itamae/plugin/recipe/nodebrew/system.rb +41 -0
- data/lib/itamae/plugin/recipe/nodebrew/user.rb +46 -0
- data/lib/itamae/plugin/recipe/nodebrew/version.rb +9 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/system/node.json +16 -0
- data/spec/system/nodebrew_spec.rb +28 -0
- data/spec/system/role.rb +2 -0
- data/spec/user/node.json +17 -0
- data/spec/user/nodebrew_spec.rb +28 -0
- data/spec/user/role.rb +2 -0
- metadata +134 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b9b1523c56170fe4cef4f70d0599c9cc0f7ed4b
|
4
|
+
data.tar.gz: a5b310181f1447941a1bce422587430413f6b02d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a425fb86a7197249d8e8803faf897722764d713913e335e3d30612890f0620f8477601e5c92e9867eb54f306273d9e63e8564dc656a6f29cb60478cd831b1f73
|
7
|
+
data.tar.gz: d1c8600b56677092b0d36218c16e5d3e84dd7e0607f64a700f6d36942140382ffa8a1233ecee44137266c729d6452785745220e343b4cbf24c19e024a3664228
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 toihrk
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
# Itamae::Plugin::Recipe::Nodebrew
|
2
|
+
|
3
|
+
Installs nodebrew.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'itamae-plugin-recipe-nodebrew'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install itamae-plugin-recipe-nodebrew
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### install for single user
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
include_recipe 'nodebrew::user'
|
27
|
+
```
|
28
|
+
|
29
|
+
### install for system
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
include_recipe 'nodebrew::system'
|
33
|
+
```
|
34
|
+
|
35
|
+
### node.json
|
36
|
+
|
37
|
+
```json
|
38
|
+
{
|
39
|
+
"nodebrew": {
|
40
|
+
"versions": {
|
41
|
+
"io@v3.3.0": [
|
42
|
+
{
|
43
|
+
"name": "coffee-script",
|
44
|
+
"version": "1.9.3"
|
45
|
+
}
|
46
|
+
],
|
47
|
+
"v4.0.0": [
|
48
|
+
"gulp"
|
49
|
+
]
|
50
|
+
},
|
51
|
+
"use": "v4.0.0"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
1. Fork it ( https://github.com/toihrk/itamae-plugin-recipe-nodebrew/fork )
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
61
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
62
|
+
5. Create a new Pull Request
|
63
|
+
|
64
|
+
## Special Thanks
|
65
|
+
|
66
|
+
[rutan/itamae-plugin-recipe-rtn_rbenv](https://github.com/rutan/itamae-plugin-recipe-rtn_rbenv)
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require "bundler/gem_tasks"
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
task spec: 'spec:all'
|
6
|
+
task default: :spec
|
7
|
+
|
8
|
+
namespace :spec do
|
9
|
+
targets = []
|
10
|
+
Dir.glob('./spec/*').each do |dir|
|
11
|
+
next unless File.directory?(dir)
|
12
|
+
targets << File.basename(dir)
|
13
|
+
end
|
14
|
+
platforms = %w[sl6 ubuntu1404]
|
15
|
+
|
16
|
+
task all: targets
|
17
|
+
task default: :all
|
18
|
+
|
19
|
+
targets.each do |target|
|
20
|
+
platforms.each do |platform|
|
21
|
+
desc "Run serverspec tests to #{target} in #{platform}"
|
22
|
+
RSpec::Core::RakeTask.new(target.to_sym) do |t|
|
23
|
+
ENV['TARGET_HOST'] = "#{platform}_#{target}"
|
24
|
+
t.pattern = "spec/#{target}/*_spec.rb"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/Vagrantfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
VAGRANTFILE_API_VERSION = "2"
|
5
|
+
|
6
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
7
|
+
|
8
|
+
config.vm.define :sl6_user do |c|
|
9
|
+
c.vm.box = "sl6"
|
10
|
+
c.vm.box_url = 'http://files.rutan.info/box/scientific-6-5-x64-virtualbox.box'
|
11
|
+
c.vm.network :private_network, ip: '192.168.33.11'
|
12
|
+
end
|
13
|
+
config.vm.define :sl6_system do |c|
|
14
|
+
c.vm.box = "sl6"
|
15
|
+
c.vm.box_url = 'http://files.rutan.info/box/scientific-6-5-x64-virtualbox.box'
|
16
|
+
c.vm.network :private_network, ip: '192.168.33.12'
|
17
|
+
end
|
18
|
+
|
19
|
+
config.vm.define :ubuntu1404_user do |c|
|
20
|
+
c.vm.box = "ubuntu1404"
|
21
|
+
c.vm.box_url = 'https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box'
|
22
|
+
c.vm.network :private_network, ip: '192.168.33.21'
|
23
|
+
end
|
24
|
+
config.vm.define :ubuntu1404_system do |c|
|
25
|
+
c.vm.box = "ubuntu1404"
|
26
|
+
c.vm.box_url = 'https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box'
|
27
|
+
c.vm.network :private_network, ip: '192.168.33.22'
|
28
|
+
end
|
29
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "itamae/plugin/recipe/nodebrew"
|
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
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'itamae/plugin/recipe/nodebrew/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "itamae-plugin-recipe-nodebrew"
|
8
|
+
spec.version = Itamae::Plugin::Recipe::Nodebrew::VERSION
|
9
|
+
spec.authors = ["toihrk"]
|
10
|
+
spec.email = ["toihrk@me.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Itamae Recipe 'nodebrew'}
|
13
|
+
spec.description = %q{Itamae Recipe 'nodebrew'}
|
14
|
+
spec.homepage = "https://github.com/toihrk/itamae-plugin-recipe-nodebrew"
|
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_dependency "itamae", "~> 1.2.21"
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.10.5"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.4.2"
|
26
|
+
spec.add_development_dependency "serverspec", "~> 2.3.1"
|
27
|
+
end
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
NODEBREW_DEFAULT_PROFILE_PATH = '/etc/profile.d/nodebrew.sh'
|
2
|
+
|
3
|
+
define :nodebrew_install, user: nil, profile_path: NODEBREW_DEFAULT_PROFILE_PATH do
|
4
|
+
params = self.params
|
5
|
+
|
6
|
+
execute "#{params[:name]}" do
|
7
|
+
command "export NODEBREW_ROOT=#{params[:name]} && curl -L git.io/nodebrew | perl - setup"
|
8
|
+
user params[:user] if params[:user]
|
9
|
+
end
|
10
|
+
|
11
|
+
setting = <<-EOS
|
12
|
+
export NODEBREW_ROOT=#{params[:name]}
|
13
|
+
export PATH=$NODEBREW_ROOT/current/bin:$PATH
|
14
|
+
EOS
|
15
|
+
execute 'add nodebrew settings' do
|
16
|
+
command "echo '#{setting}' >> #{params[:profile_path]}"
|
17
|
+
user params[:user] if params[:user]
|
18
|
+
not_if "test `touch #{params[:profile_path]} && cat #{params[:profile_path]} | grep 'nodebrew' -c` != 0"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
define :node_install, user: nil, profile_path: NODEBREW_DEFAULT_PROFILE_PATH do
|
23
|
+
params = self.params
|
24
|
+
|
25
|
+
execute "node install #{params[:name]}" do
|
26
|
+
command ". #{params[:profile_path]} && nodebrew install-binary #{params[:name]}"
|
27
|
+
user params[:user] if params[:user]
|
28
|
+
not_if "test `. #{params[:profile_path]} && nodebrew ls | grep '#{params[:name]}' -c` != 0"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
define :npm_install, version: nil, node_version: nil, user: nil, profile_path: NODEBREW_DEFAULT_PROFILE_PATH do
|
33
|
+
params = self.params
|
34
|
+
|
35
|
+
execute "npm install #{params[:name]}" do
|
36
|
+
command ". #{params[:profile_path]} && nodebrew use #{params[:node_version]} && npm install -g #{params[:name]}#{params[:version] ? "@#{params[:version]}" : ''}"
|
37
|
+
user params[:user] if params[:user]
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
include_recipe './resource.rb'
|
2
|
+
include_recipe 'nodebrew::common'
|
3
|
+
|
4
|
+
# load setting
|
5
|
+
NODEBREW_ROOT = '/usr/local/nodebrew'
|
6
|
+
NODEBREW_PROFILE_PATH = '/etc/profile.d/nodebrew.sh'
|
7
|
+
|
8
|
+
# install nodebrew
|
9
|
+
nodebrew_install NODEBREW_ROOT do
|
10
|
+
profile_path NODEBREW_PROFILE_PATH
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
# install nodejs and npm
|
16
|
+
(node['nodebrew']['versions'] || {}).each do |node_version, npms|
|
17
|
+
node_install node_version do
|
18
|
+
profile_path NODEBREW_PROFILE_PATH
|
19
|
+
end
|
20
|
+
npms.each do |npm|
|
21
|
+
if npm.kind_of?(Hash)
|
22
|
+
npm_install npm['name'] do
|
23
|
+
self.node_version node_version
|
24
|
+
version npm['version'] if npm['version']
|
25
|
+
profile_path NODEBREW_PROFILE_PATH
|
26
|
+
end
|
27
|
+
else
|
28
|
+
npm_install npm do
|
29
|
+
self.node_version node_version
|
30
|
+
profile_path NODEBREW_PROFILE_PATH
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# set use version
|
37
|
+
if node['nodebrew']['use']
|
38
|
+
execute "nodebrew use #{node['nodebrew']['use']}" do
|
39
|
+
command ". #{NODEBREW_PROFILE_PATH} && nodebrew alias default #{node['nodebrew']['use']} && nodebrew use default"
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
include_recipe './resource.rb'
|
2
|
+
include_recipe 'nodebrew::common'
|
3
|
+
|
4
|
+
# load setting
|
5
|
+
NODEBREW_USER = (node['nodebrew']['user'] || 'vagrant')
|
6
|
+
NODEBREW_USER_HOME = "/home/#{NODEBREW_USER}"
|
7
|
+
NODEBREW_ROOT = "#{NODEBREW_USER_HOME}/.nodebrew"
|
8
|
+
NODEBREW_PROFILE_PATH = "#{NODEBREW_USER_HOME}/.bash_profile"
|
9
|
+
|
10
|
+
# install nodebrew
|
11
|
+
nodebrew_install NODEBREW_ROOT do
|
12
|
+
user NODEBREW_USER
|
13
|
+
profile_path NODEBREW_PROFILE_PATH
|
14
|
+
end
|
15
|
+
|
16
|
+
# install nodejs and npm
|
17
|
+
(node['nodebrew']['versions'] || {}).each do |node_version, npms|
|
18
|
+
node_install node_version do
|
19
|
+
user NODEBREW_USER
|
20
|
+
profile_path NODEBREW_PROFILE_PATH
|
21
|
+
end
|
22
|
+
npms.each do |npm|
|
23
|
+
if npm.kind_of?(Hash)
|
24
|
+
npm_install npm['name'] do
|
25
|
+
self.node_version node_version
|
26
|
+
version npm['version'] if npm['version']
|
27
|
+
user NODEBREW_USER
|
28
|
+
profile_path NODEBREW_PROFILE_PATH
|
29
|
+
end
|
30
|
+
else
|
31
|
+
npm_install npm do
|
32
|
+
self.node_version node_version
|
33
|
+
user NODEBREW_USER
|
34
|
+
profile_path NODEBREW_PROFILE_PATH
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# set use version
|
41
|
+
if node['nodebrew']['use']
|
42
|
+
execute "nodebrew use #{node['nodebrew']['use']}" do
|
43
|
+
command ". #{NODEBREW_PROFILE_PATH} && nodebrew alias default #{node['nodebrew']['use']} && nodebrew use default"
|
44
|
+
user NODEBREW_USER
|
45
|
+
end
|
46
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'serverspec'
|
2
|
+
require 'net/ssh'
|
3
|
+
require 'tempfile'
|
4
|
+
|
5
|
+
set :backend, :ssh
|
6
|
+
|
7
|
+
if ENV['ASK_SUDO_PASSWORD']
|
8
|
+
begin
|
9
|
+
require 'highline/import'
|
10
|
+
rescue LoadError
|
11
|
+
fail "highline is not available. Try installing it."
|
12
|
+
end
|
13
|
+
set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
|
14
|
+
else
|
15
|
+
set :sudo_password, ENV['SUDO_PASSWORD']
|
16
|
+
end
|
17
|
+
|
18
|
+
host = ENV['TARGET_HOST']
|
19
|
+
target = host.split('_')[1]
|
20
|
+
|
21
|
+
`vagrant up #{host}`
|
22
|
+
system("bundle exec itamae ssh -h #{host} --vagrant '#{File.expand_path("../#{target}/role.rb", __FILE__)}' -j '#{File.expand_path("../#{target}/node.json", __FILE__)}'")
|
23
|
+
config = Tempfile.new('', Dir.tmpdir)
|
24
|
+
`vagrant ssh-config #{host} > #{config.path}`
|
25
|
+
|
26
|
+
options = Net::SSH::Config.for(host, [config.path])
|
27
|
+
|
28
|
+
options[:user] ||= Etc.getlogin
|
29
|
+
|
30
|
+
set :host, options[:host_name] || host
|
31
|
+
set :ssh_options, options
|
32
|
+
|
33
|
+
# Disable sudo
|
34
|
+
# set :disable_sudo, true
|
35
|
+
|
36
|
+
|
37
|
+
# Set environment variables
|
38
|
+
# set :env, :LANG => 'C', :LC_MESSAGES => 'C'
|
39
|
+
|
40
|
+
# Set PATH
|
41
|
+
# set :path, '/sbin:/usr/local/sbin:$PATH'
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe command('. /etc/profile && which nodebrew') do
|
4
|
+
let(:disable_sudo) { true }
|
5
|
+
its(:stdout) { should match '/usr/local/nodebrew/current/bin/nodebrew' }
|
6
|
+
end
|
7
|
+
|
8
|
+
%w[io@v3.3.0 v4.0.0].each do |node_version|
|
9
|
+
describe command(". /etc/profile && nodebrew ls | grep '#{node_version}'") do
|
10
|
+
let(:disable_sudo) { true }
|
11
|
+
its(:stdout) { should match /#{Regexp.escape(node_version)}/ }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe command(". /etc/profile; sudo -i nodebrew use io@v3.3.0 && npm ls -g coffee-script") do
|
16
|
+
let(:disable_sudo) { true }
|
17
|
+
its(:stdout) { should match /1\.9\.3/ }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe command(". /etc/profile; sudo -i nodebrew use v4.0.0 && npm ls -g gulp") do
|
21
|
+
let(:disable_sudo) { true }
|
22
|
+
its(:stdout) { should match /gulp/ }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe command(". /etc/profile && node -v") do
|
26
|
+
let(:disable_sudo) { true }
|
27
|
+
its(:stdout) { should match /v4\.0\.0/ }
|
28
|
+
end
|
data/spec/system/role.rb
ADDED
data/spec/user/node.json
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe command('. /home/vagrant/.bash_profile; which nodebrew') do
|
4
|
+
let(:disable_sudo) { true }
|
5
|
+
its(:stdout) { should match '/home/vagrant/.nodebrew/current/bin/nodebrew' }
|
6
|
+
end
|
7
|
+
|
8
|
+
%w[io@v3.3.0 v4.0.0].each do |node_version|
|
9
|
+
describe command(". /home/vagrant/.bash_profile; nodebrew ls | grep '#{node_version}'") do
|
10
|
+
let(:disable_sudo) { true }
|
11
|
+
its(:stdout) { should match /#{Regexp.escape(node_version)}/ }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe command(". /home/vagrant/.bash_profile; nodebrew use io@v3.3.0 && npm ls -g coffee-script") do
|
16
|
+
let(:disable_sudo) { false }
|
17
|
+
its(:stdout) { should match /1\.9\.3/ }
|
18
|
+
end
|
19
|
+
|
20
|
+
describe command(". /home/vagrant/.bash_profile; nodebrew use v4.0.0 && npm ls -g gulp") do
|
21
|
+
let(:disable_sudo) { false }
|
22
|
+
its(:stdout) { should match /gulp/ }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe command(". /home/vagrant/.bash_profile; node -v") do
|
26
|
+
let(:disable_sudo) { true }
|
27
|
+
its(:stdout) { should match /v4\.0\.0/ }
|
28
|
+
end
|
data/spec/user/role.rb
ADDED
metadata
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-nodebrew
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- toihrk
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: itamae
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.21
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.21
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.10.5
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.10.5
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 10.4.2
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 10.4.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: serverspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.3.1
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.3.1
|
69
|
+
description: Itamae Recipe 'nodebrew'
|
70
|
+
email:
|
71
|
+
- toihrk@me.com
|
72
|
+
executables:
|
73
|
+
- console
|
74
|
+
- setup
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".travis.yml"
|
81
|
+
- CODE_OF_CONDUCT.md
|
82
|
+
- Gemfile
|
83
|
+
- LICENSE.txt
|
84
|
+
- README.md
|
85
|
+
- Rakefile
|
86
|
+
- Vagrantfile
|
87
|
+
- bin/console
|
88
|
+
- bin/setup
|
89
|
+
- itamae-plugin-recipe-nodebrew.gemspec
|
90
|
+
- lib/itamae/plugin/recipe/nodebrew.rb
|
91
|
+
- lib/itamae/plugin/recipe/nodebrew/common.rb
|
92
|
+
- lib/itamae/plugin/recipe/nodebrew/resource.rb
|
93
|
+
- lib/itamae/plugin/recipe/nodebrew/system.rb
|
94
|
+
- lib/itamae/plugin/recipe/nodebrew/user.rb
|
95
|
+
- lib/itamae/plugin/recipe/nodebrew/version.rb
|
96
|
+
- spec/spec_helper.rb
|
97
|
+
- spec/system/node.json
|
98
|
+
- spec/system/nodebrew_spec.rb
|
99
|
+
- spec/system/role.rb
|
100
|
+
- spec/user/node.json
|
101
|
+
- spec/user/nodebrew_spec.rb
|
102
|
+
- spec/user/role.rb
|
103
|
+
homepage: https://github.com/toihrk/itamae-plugin-recipe-nodebrew
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.4.5.1
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Itamae Recipe 'nodebrew'
|
127
|
+
test_files:
|
128
|
+
- spec/spec_helper.rb
|
129
|
+
- spec/system/node.json
|
130
|
+
- spec/system/nodebrew_spec.rb
|
131
|
+
- spec/system/role.rb
|
132
|
+
- spec/user/node.json
|
133
|
+
- spec/user/nodebrew_spec.rb
|
134
|
+
- spec/user/role.rb
|