itamae-plugin-recipe-pyenv 0.2.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 48b93dfc01c04777d24b4a436e83504d4fc7db45
4
- data.tar.gz: 7bd7adaf152d572aefc52e04001de9da54fa1d7a
3
+ metadata.gz: 76d1d81cbc2c903c0313c0940680375daf50699a
4
+ data.tar.gz: ce3a03fd75d13a90d12c3af4d82e8d5b7f47b32b
5
5
  SHA512:
6
- metadata.gz: a758634c88e2e30e606821a481aa078e1775e875725428aa635b65b132f89d4f8108104e80f3fb25d856a50705f6b09b76acd11577423be547ca533bbb04c7fe
7
- data.tar.gz: 62e0f028f70e17a5762c8284a5222146cc5a042b10e2d2d980aeef33d5b3bd4c456825f91022f36cec028ed3326794858fcdc47861db57ac52ab641fde5e98a0
6
+ metadata.gz: 4170e4bd1fd1bb7c29435e750d0efc488b2b573656d93f57f009707e0b1f0c0ef03c42ecf6b71233a65bbb5f6859c998d2ae9f99b8f3ebc38dfd2acb09c7186a
7
+ data.tar.gz: 0c26bf63059f6309d2d96733d52884feed45c7898bbd23ddececec0a2d0875d0b8bc3f90718032de09ceb8b9f3aa4f169eba711399d7c2bab378ee9147a5595e
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2015-2017 MATSUMOTO, Katsuyoshi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -22,6 +22,8 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
+ ### Installation for system
26
+
25
27
  You write config file:
26
28
 
27
29
  ```json
@@ -44,6 +46,46 @@ Exec script:
44
46
  $ bundle exec itamae local recipe.rb -j pyenv.json
45
47
  ```
46
48
 
49
+ Define environment variable: (exp: .bashrc)
50
+ ```console
51
+ export PYENV_ROOT="/usr/local/pyenv"
52
+ export PATH="$PYENV_ROOT/bin:$PATH"
53
+ eval "$(pyenv init -)"
54
+ ```
55
+
56
+ ### Installation for a user
57
+
58
+ You write config file:
59
+
60
+ ```json
61
+ {
62
+ "pyenv" : {
63
+ "scheme" : "git", // set scheme your using git clone protocol, git or https
64
+ "user": "ec2-user",
65
+ "versions" : ["2.7.5", "3.4.3"],
66
+ "global" : "3.4.3"
67
+ }
68
+ }
69
+ ```
70
+
71
+ Add your itamae recipe:
72
+ ```ruby
73
+ include_recipe 'pyenv::user'
74
+ ```
75
+
76
+ Exec script:
77
+ ```console
78
+ $ bundle exec itamae local recipe.rb -j pyenv.json
79
+ ```
80
+
81
+ Define environment variable: (exp: .bashrc)
82
+ ```console
83
+ export PYENV_ROOT="$HOME/.pyenv"
84
+ export PATH="$PYENV_ROOT/bin:$PATH"
85
+ eval "$(pyenv init -)"
86
+ ```
87
+
88
+
47
89
  ## Development
48
90
 
49
91
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -0,0 +1,37 @@
1
+ case node[:platform]
2
+ when 'debian', 'ubuntu'
3
+ package 'build-essential'
4
+ when 'redhat', 'fedora', 'amazon'
5
+ package 'gcc'
6
+ package 'zlib-devel'
7
+ package 'openssl-devel'
8
+ end
9
+
10
+ package 'git'
11
+
12
+ git node[:pyenv][:pyenv_root] do
13
+ repository "#{node[:pyenv][:scheme]}://github.com/pyenv/pyenv.git"
14
+ user node[:pyenv][:user] if node[:pyenv][:user]
15
+ end
16
+
17
+ pyenv_init = <<-EOS
18
+ export PYENV_ROOT=#{node[:pyenv][:pyenv_root]}
19
+ export PATH="#{node[:pyenv][:pyenv_root]}/bin:$PATH"
20
+ eval "$(pyenv init -)"
21
+ EOS
22
+
23
+ node[:pyenv][:versions].each do |version|
24
+ execute "pyenv install #{version}" do
25
+ command "#{pyenv_init} pyenv install #{version}"
26
+ not_if "#{pyenv_init} pyenv versions | grep #{version}"
27
+ user node[:pyenv][:user] if node[:pyenv][:user]
28
+ end
29
+ end
30
+
31
+ node[:pyenv][:global].tap do |version|
32
+ execute "pyenv global #{version}" do
33
+ command "#{pyenv_init} pyenv global #{version}"
34
+ not_if "#{pyenv_init} pyenv version | grep #{version}"
35
+ user node[:pyenv][:user] if node[:pyenv][:user]
36
+ end
37
+ end
@@ -1,29 +1,9 @@
1
- case node[:platform]
2
- when "debian", "ubuntu"
3
- package "build-essential"
4
- end
5
-
6
- package "git"
7
-
8
- require "itamae/plugin/recipe/pyenv"
9
-
10
- scheme = "git"
11
- scheme = node[:pyenv][:scheme] if node[:pyenv][:scheme]
12
-
13
- git pyenv_root do
14
- repository "#{scheme}://github.com/yyuu/pyenv.git"
15
- end
16
-
17
- node[:pyenv][:versions].each do |version|
18
- execute "pyenv install #{version}" do
19
- command "#{pyenv_init} pyenv install #{version}"
20
- not_if "#{pyenv_init} pyenv versions | grep #{version}"
21
- end
22
- end
23
-
24
- node[:pyenv][:global].tap do |version|
25
- execute "pyenv global #{version}" do
26
- command "#{pyenv_init} pyenv global #{version}"
27
- not_if "#{pyenv_init} pyenv version | grep #{version}"
28
- end
29
- end
1
+ node.reverse_merge!(
2
+ pyenv: {
3
+ pyenv_root: '/usr/local/pyenv',
4
+ scheme: 'git',
5
+ versions: [],
6
+ },
7
+ )
8
+
9
+ include_recipe 'pyenv::install'
@@ -0,0 +1,18 @@
1
+ node.reverse_merge!(
2
+ pyenv: {
3
+ scheme: 'git',
4
+ versions: []
5
+ }
6
+ )
7
+
8
+ if node[:pyenv][:pyenv_root].nil?
9
+ user_dir = case node[:platform]
10
+ when 'osx', 'darwin'
11
+ '/Users'
12
+ else
13
+ '/home'
14
+ end
15
+ node[:pyenv][:pyenv_root] = File.join(user_dir, node[:pyenv][:user], '.pyenv')
16
+ end
17
+
18
+ include_recipe 'pyenv::install'
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module Pyenv
5
- VERSION = "0.2.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
8
8
  end
@@ -1,17 +1 @@
1
- DEFAULT_PYENV_ROOT = "/usr/local/pyenv"
2
-
3
- def pyenv_root
4
- if node[:pyenv] && node[:pyenv][:pyenv_root]
5
- node[:pyenv][:pyenv_root]
6
- else
7
- DEFAULT_PYENV_ROOT
8
- end
9
- end
10
-
11
- def pyenv_init
12
- <<-EOS
13
- export PYENV_ROOT=#{pyenv_root}
14
- export PATH="#{pyenv_root}/bin:$PATH"
15
- eval "$(pyenv init -)"
16
- EOS
17
- end
1
+ require "itamae/plugin/recipe/pyenv/version"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-recipe-pyenv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MATSUMOTO, Katsuyoshi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae
@@ -62,12 +62,15 @@ files:
62
62
  - ".gitignore"
63
63
  - CODE_OF_CONDUCT.md
64
64
  - Gemfile
65
+ - LICENSE
65
66
  - README.md
66
67
  - Rakefile
67
68
  - itamae-plugin-recipe-pyenv.gemspec
68
69
  - lib/itamae-plugin-recipe-pyenv.rb
69
70
  - lib/itamae/plugin/recipe/pyenv.rb
71
+ - lib/itamae/plugin/recipe/pyenv/install.rb
70
72
  - lib/itamae/plugin/recipe/pyenv/system.rb
73
+ - lib/itamae/plugin/recipe/pyenv/user.rb
71
74
  - lib/itamae/plugin/recipe/pyenv/version.rb
72
75
  homepage: https://github.com/katsyoshi/itamae-plugin-recipe-pyenv
73
76
  licenses:
@@ -89,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
92
  version: '0'
90
93
  requirements: []
91
94
  rubyforge_project:
92
- rubygems_version: 2.5.2
95
+ rubygems_version: 2.6.11
93
96
  signing_key:
94
97
  specification_version: 4
95
98
  summary: itamae plugin recipe pyenv