itamae-plugin-recipe-nodenv 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 +11 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +125 -0
- data/Rakefile +1 -0
- data/itamae-plugin-recipe-nodenv.gemspec +25 -0
- data/lib/itamae/plugin/recipe/nodenv.rb +11 -0
- data/lib/itamae/plugin/recipe/nodenv/install.rb +42 -0
- data/lib/itamae/plugin/recipe/nodenv/system.rb +9 -0
- data/lib/itamae/plugin/recipe/nodenv/user.rb +10 -0
- data/lib/itamae/plugin/recipe/nodenv/version.rb +9 -0
- data/mrblib +1 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 55db78b35197739046257cebc33f3de101155c6dc93bd9c7f55d060802fc4893
|
4
|
+
data.tar.gz: bbf8847880bc4f463748893eac0d8dd89a406b6567d06118962e933907eab703
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 287cf7e8c9ce65481fbec32f73c7403676912ccc40a2683ef39deec38e007c9711ac23a4a23121fd572de9d23159ae1383e234817943badde84aef48840efd3d
|
7
|
+
data.tar.gz: 8df6f6ffe8d55bf2bbe930820d72cc5a380fe54c2bccee722843509a93b7d254a38beb21726c5dcffa08e5bff9ebee79adb86b181132d3859879823c036fc9f1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Masayoshi Wada
|
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,125 @@
|
|
1
|
+
# Itamae::Plugin::Recipe::Nodenv
|
2
|
+
|
3
|
+
[itamae](https://github.com/itamae-kitchen/itamae) plugin to install node with nodenv
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'itamae-plugin-recipe-nodenv'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install itamae-plugin-recipe-nodenv
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### System wide installation
|
24
|
+
|
25
|
+
Install nodenv into /usr/local/nodenv
|
26
|
+
|
27
|
+
#### Recipe
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
include_recipe "nodenv::system"
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Configuration
|
34
|
+
|
35
|
+
Write a yaml file:
|
36
|
+
|
37
|
+
```yaml
|
38
|
+
# node.yaml
|
39
|
+
nodenv:
|
40
|
+
global:
|
41
|
+
10.15.0
|
42
|
+
versions:
|
43
|
+
- 11.6.0
|
44
|
+
- 10.15.0
|
45
|
+
|
46
|
+
# used in git clone (default: git)
|
47
|
+
scheme: https
|
48
|
+
|
49
|
+
# nodenv root dir (default: /usr/local/nodenv)
|
50
|
+
nodenv_root: /path/to/nodenv_root
|
51
|
+
```
|
52
|
+
|
53
|
+
and execute:
|
54
|
+
|
55
|
+
```console
|
56
|
+
$ itamae -y node.yml
|
57
|
+
```
|
58
|
+
|
59
|
+
### User local installation
|
60
|
+
|
61
|
+
#### Recipe
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
include_recipe "nodenv::user"
|
65
|
+
```
|
66
|
+
|
67
|
+
#### Configuration
|
68
|
+
|
69
|
+
```yaml
|
70
|
+
# node.yaml
|
71
|
+
nodenv:
|
72
|
+
user: masawada
|
73
|
+
global:
|
74
|
+
10.15.0
|
75
|
+
versions:
|
76
|
+
- 11.6.0
|
77
|
+
- 10.15.0
|
78
|
+
|
79
|
+
# used in git clone (default: git)
|
80
|
+
scheme: https
|
81
|
+
|
82
|
+
# nodenv root dir (default: $HOME/.nodenv)
|
83
|
+
nodenv_root: /path/to/nodenv_root
|
84
|
+
```
|
85
|
+
|
86
|
+
and execute:
|
87
|
+
|
88
|
+
```console
|
89
|
+
$ itamae -y node.yml
|
90
|
+
```
|
91
|
+
|
92
|
+
## mitamae support
|
93
|
+
|
94
|
+
It can be used as [mitamae](https://github.com/itamae-kitchen/mitamae) plugin.
|
95
|
+
|
96
|
+
Put this repository under `./plugins` as a git submodule:
|
97
|
+
|
98
|
+
```console
|
99
|
+
$ git submodule add https://github.com/masawada/itamae-plugin-recipe-nodenv.git plugins/itamae-plugin-recipe-nodenv
|
100
|
+
```
|
101
|
+
|
102
|
+
and write a recipe:
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
node.reverse_merge!(
|
106
|
+
nodenv: {
|
107
|
+
user: 'masawada',
|
108
|
+
global: '10.15.0',
|
109
|
+
versions: %w[
|
110
|
+
11.6.0
|
111
|
+
10.15.0
|
112
|
+
],
|
113
|
+
},
|
114
|
+
)
|
115
|
+
|
116
|
+
include_recipe "nodenv::user"
|
117
|
+
```
|
118
|
+
|
119
|
+
## Contributing
|
120
|
+
|
121
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/masawada/itamae-plugin-recipe-nodenv.
|
122
|
+
|
123
|
+
## License
|
124
|
+
|
125
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "itamae/plugin/recipe/nodenv/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "itamae-plugin-recipe-nodenv"
|
8
|
+
spec.version = Itamae::Plugin::Recipe::Nodenv::VERSION
|
9
|
+
spec.authors = ["Masayoshi Wada"]
|
10
|
+
spec.email = ["developer@andantesoftware.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Itamae plugin to install node with nodenv}
|
13
|
+
spec.description = %q{Itamae plugin to install node with nodenv}
|
14
|
+
spec.homepage = "https://github.com/masawada/itamae-plugin-recipe-nodenv"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
package 'git'
|
2
|
+
|
3
|
+
scheme = node[:nodenv][:scheme]
|
4
|
+
nodenv_root = node[:nodenv][:nodenv_root]
|
5
|
+
|
6
|
+
git nodenv_root do
|
7
|
+
repository "#{scheme}://github.com/nodenv/nodenv.git"
|
8
|
+
user node[:nodenv][:user] if node[:nodenv][:user]
|
9
|
+
end
|
10
|
+
|
11
|
+
directory File.join(nodenv_root, 'plugins') do
|
12
|
+
user node[:nodenv][:user] if node[:nodenv][:user]
|
13
|
+
end
|
14
|
+
|
15
|
+
git "#{nodenv_root}/plugins/node-build" do
|
16
|
+
repository "#{scheme}://github.com/nodenv/node-build.git"
|
17
|
+
user node[:nodenv][:user] if node[:nodenv][:user]
|
18
|
+
end
|
19
|
+
|
20
|
+
nodenv_init = <<-EOS
|
21
|
+
export NODENV_ROOT=#{nodenv_root}
|
22
|
+
export PATH="#{nodenv_root}/bin:${PATH}"
|
23
|
+
eval "$(nodenv init -)"
|
24
|
+
EOS
|
25
|
+
|
26
|
+
node[:nodenv][:versions].each do |version|
|
27
|
+
execute "nodenv install #{version}" do
|
28
|
+
command "#{nodenv_init} nodenv install #{version}"
|
29
|
+
not_if "#{nodenv_init} nodenv versions | grep #{version}"
|
30
|
+
user node[:nodenv][:user] if node[:nodenv][:user]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
if node[:nodenv][:global]
|
35
|
+
node[:nodenv][:global].tap do |version|
|
36
|
+
execute "nodenv global #{version}" do
|
37
|
+
command "#{nodenv_init} nodenv global #{version}"
|
38
|
+
not_if "#{nodenv_init} nodenv version | grep #{version}"
|
39
|
+
user node[:nodenv][:user] if node[:nodenv][:user]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/mrblib
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
./lib
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: itamae-plugin-recipe-nodenv
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masayoshi Wada
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-02 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.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
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: Itamae plugin to install node with nodenv
|
42
|
+
email:
|
43
|
+
- developer@andantesoftware.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- itamae-plugin-recipe-nodenv.gemspec
|
54
|
+
- lib/itamae/plugin/recipe/nodenv.rb
|
55
|
+
- lib/itamae/plugin/recipe/nodenv/install.rb
|
56
|
+
- lib/itamae/plugin/recipe/nodenv/system.rb
|
57
|
+
- lib/itamae/plugin/recipe/nodenv/user.rb
|
58
|
+
- lib/itamae/plugin/recipe/nodenv/version.rb
|
59
|
+
- mrblib
|
60
|
+
homepage: https://github.com/masawada/itamae-plugin-recipe-nodenv
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.7.6
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Itamae plugin to install node with nodenv
|
84
|
+
test_files: []
|