itamae-plugin-recipe-goenv 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 31a823cb4b234f53e4990c412faa84e4c4d30a2f
4
+ data.tar.gz: 6b33b9ee5722b630e8abfa2dc6be883bc21dbd0f
5
+ SHA512:
6
+ metadata.gz: b66d95c6ea799db37bdba73fc0b9138efc246e029106428675a0977430d0ef3199d3d34102d918eeb2c8729297ace48c65bd0e913e2d2c85df08cb7b5d1366db
7
+ data.tar.gz: 4817eaac0923d4d4fbaf41804e3a6ba68a21a8440e7f26186b23431941e3bf0a3cd039915fb623abda519fdeac9285409b00b6bcc415bf549b49e4ec3c464ac9
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ /vendor/
16
+ example/.vagrant
@@ -0,0 +1,3 @@
1
+ ## v0.0.1 (2017-03-01)
2
+
3
+ - first release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-rbenv.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Civitaspo
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.
@@ -0,0 +1,132 @@
1
+ # Itamae::Plugin::Recipe::Goenv
2
+
3
+ [Itamae](https://github.com/ryotarai/itamae) plugin to install golang with [goenv](https://github.com/syndbg/goenv)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'itamae-plugin-recipe-goenv'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install itamae-plugin-recipe-goenv
20
+
21
+ # Usage
22
+ ## System wide installation
23
+
24
+ Install goenv to /usr/local/goenv or some shared path
25
+
26
+ ### Recipe
27
+
28
+ ```ruby
29
+ # your recipe
30
+ include_recipe "goenv::system"
31
+ ```
32
+
33
+ ### Node
34
+
35
+ Use this with `itamae -y node.yml`
36
+
37
+ ```yaml
38
+ # node.yml
39
+ goenv:
40
+ global:
41
+ 1.7.4
42
+ versions:
43
+ - 1.7.4
44
+ - 1.6.3
45
+ - 1.5.4
46
+
47
+ # goenv install dir, optional (default: /usr/local/goenv)
48
+ goenv_root: "/path/to/goenv"
49
+
50
+ # specify scheme to use in git clone, optional (default: git)
51
+ scheme: https
52
+
53
+ # Create /usr/local/goenv/cache, optional (default: false)
54
+ # See: https://github.com/syndbg/goenv/tree/bae243f3771731897aafb152126976653cb8213c/plugins/go-build#package-download-caching
55
+ cache: true
56
+ ```
57
+
58
+ ### .bashrc
59
+
60
+ Recommend to append this to .bashrc in your server.
61
+
62
+ ```bash
63
+ export GOENV_ROOT=/usr/local/goenv
64
+ export PATH="${GOENV_ROOT}/bin:${PATH}"
65
+ eval "$(goenv init -)"
66
+ ```
67
+
68
+ ## Installation for a user
69
+
70
+ Install goenv to `~#{node[:goenv][:user]}/.goenv`
71
+
72
+ ### Recipe
73
+
74
+ ```ruby
75
+ # your recipe
76
+ include_recipe "goenv::user"
77
+ ```
78
+
79
+ ### Node
80
+
81
+ Use this with `itamae -y node.yml`
82
+
83
+ ```yaml
84
+ # node.yml
85
+ goenv:
86
+ user: civitaspo
87
+ global:
88
+ 1.7.4
89
+ versions:
90
+ - 1.7.4
91
+ - 1.6.3
92
+ - 1.5.4
93
+
94
+ # specify scheme to use in git clone, optional (default: git)
95
+ scheme: https
96
+
97
+ # Create ~/.goenv/cache, optional (default: false)
98
+ # See: https://github.com/syndbg/goenv/tree/bae243f3771731897aafb152126976653cb8213c/plugins/go-build#package-download-caching
99
+ cache: true
100
+ ```
101
+
102
+ ## Example
103
+
104
+ ```
105
+ $ cd example
106
+ $ vagrant up
107
+ $ bundle exec itamae ssh --vagrant -y node.yml recipe.rb
108
+ ```
109
+
110
+ ## MItamae
111
+
112
+ This plugin can be used for MItamae too. Put this repository under `./plugins` as git submodule.
113
+
114
+ ```rb
115
+ node.reverse_merge!(
116
+ goenv: {
117
+ user: 'civitaspo',
118
+ global: '1.7.4',
119
+ versions: %w[
120
+ 1.7.4
121
+ 1.6.3
122
+ 1.5.4
123
+ ],
124
+ }
125
+ )
126
+
127
+ include_recipe "goenv::user"
128
+ ```
129
+
130
+ ## License
131
+
132
+ MIT License
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,71 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # All Vagrant configuration is done below. The "2" in Vagrant.configure
5
+ # configures the configuration version (we support older styles for
6
+ # backwards compatibility). Please don't change it unless you know what
7
+ # you're doing.
8
+ Vagrant.configure(2) do |config|
9
+ # The most common configuration options are documented and commented below.
10
+ # For a complete reference, please see the online documentation at
11
+ # https://docs.vagrantup.com.
12
+
13
+ # Every Vagrant development environment requires a box. You can search for
14
+ # boxes at https://atlas.hashicorp.com/search.
15
+ config.vm.box = "ubuntu/trusty64"
16
+
17
+ # Disable automatic box update checking. If you disable this, then
18
+ # boxes will only be checked for updates when the user runs
19
+ # `vagrant box outdated`. This is not recommended.
20
+ # config.vm.box_check_update = false
21
+
22
+ # Create a forwarded port mapping which allows access to a specific port
23
+ # within the machine from a port on the host machine. In the example below,
24
+ # accessing "localhost:8080" will access port 80 on the guest machine.
25
+ # config.vm.network "forwarded_port", guest: 80, host: 8080
26
+
27
+ # Create a private network, which allows host-only access to the machine
28
+ # using a specific IP.
29
+ # config.vm.network "private_network", ip: "192.168.33.10"
30
+
31
+ # Create a public network, which generally matched to bridged network.
32
+ # Bridged networks make the machine appear as another physical device on
33
+ # your network.
34
+ # config.vm.network "public_network"
35
+
36
+ # Share an additional folder to the guest VM. The first argument is
37
+ # the path on the host to the actual folder. The second argument is
38
+ # the path on the guest to mount the folder. And the optional third
39
+ # argument is a set of non-required options.
40
+ # config.vm.synced_folder "../data", "/vagrant_data"
41
+
42
+ # Provider-specific configuration so you can fine-tune various
43
+ # backing providers for Vagrant. These expose provider-specific options.
44
+ # Example for VirtualBox:
45
+ #
46
+ # config.vm.provider "virtualbox" do |vb|
47
+ # # Display the VirtualBox GUI when booting the machine
48
+ # vb.gui = true
49
+ #
50
+ # # Customize the amount of memory on the VM:
51
+ # vb.memory = "1024"
52
+ # end
53
+ #
54
+ # View the documentation for the provider you are using for more
55
+ # information on available options.
56
+
57
+ # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
58
+ # such as FTP and Heroku are also available. See the documentation at
59
+ # https://docs.vagrantup.com/v2/push/atlas.html for more information.
60
+ # config.push.define "atlas" do |push|
61
+ # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
62
+ # end
63
+
64
+ # Enable provisioning with a shell script. Additional provisioners such as
65
+ # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
66
+ # documentation for more information about their specific syntax and use.
67
+ # config.vm.provision "shell", inline: <<-SHELL
68
+ # sudo apt-get update
69
+ # sudo apt-get install -y apache2
70
+ # SHELL
71
+ end
@@ -0,0 +1,6 @@
1
+ goenv:
2
+ user: vagrant
3
+ global:
4
+ 1.7.4
5
+ versions:
6
+ - 1.7.4
@@ -0,0 +1 @@
1
+ include_recipe "goenv::user"
@@ -0,0 +1,25 @@
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/goenv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-goenv"
8
+ spec.version = Itamae::Plugin::Recipe::Goenv::VERSION
9
+ spec.authors = ["Civitaspo"]
10
+ spec.email = ["civitaspo@gmail.com"]
11
+ spec.summary = %q{Itamae plugin to install golang with goenv}
12
+ spec.description = %q{Itamae plugin to install golang with goenv}
13
+ spec.homepage = "https://github.com/civitaspo/itamae-plugin-recipe-goenv"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "itamae", ">= 1.2"
22
+
23
+ spec.add_development_dependency "bundler", ">= 1.7"
24
+ spec.add_development_dependency "rake", ">= 10.0"
25
+ end
@@ -0,0 +1 @@
1
+ require "itamae/plugin/recipe/goenv"
@@ -0,0 +1 @@
1
+ require "itamae/plugin/recipe/goenv/version"
@@ -0,0 +1,12 @@
1
+ # TODO: add dependencies by issue-driven.
2
+ case node[:platform]
3
+ when 'debian', 'ubuntu', 'mint'
4
+ when 'redhat', 'fedora', 'amazon'
5
+ # redhat is including CentOS
6
+ when 'osx', 'darwin'
7
+ when 'arch'
8
+ when 'opensuse'
9
+ else
10
+ end
11
+
12
+ package 'git'
@@ -0,0 +1,69 @@
1
+ # This recipe requires `goenv_root` is defined.
2
+
3
+ include_recipe 'goenv::dependency'
4
+
5
+ # TODO: configure the goenv repo url?
6
+ # repo_host = nodo[:goenv][:goenv_repo_host] || 'github.com'
7
+ # repo_org = node[:goenv][:goenv_repo_org] || 'syndbg'
8
+ scheme = node[:goenv][:scheme]
9
+ goenv_root = node[:goenv][:goenv_root]
10
+
11
+ git goenv_root do
12
+ repository "#{scheme}://github.com/syndbg/goenv.git"
13
+ revision node[:goenv][:revision] if node[:goenv][:revision]
14
+ user node[:goenv][:user] if node[:goenv][:user]
15
+ end
16
+
17
+ directory File.join(goenv_root, 'plugins') do
18
+ user node[:goenv][:user] if node[:goenv][:user]
19
+ end
20
+ if node[:goenv][:cache]
21
+ directory File.join(goenv_root, 'cache') do
22
+ user node[:goenv][:user] if node[:goenv][:user]
23
+ end
24
+ end
25
+
26
+ # TODO: if some goenv plugins are released, pubilsh this.
27
+ # ex)
28
+ # goenv_plugin:
29
+ # - github.com/civitaspo/goenv-default-packages
30
+ #
31
+ # define :goenv_plugin do
32
+ # repo_url = "#{scheme}://#{params[:name]}.git"
33
+ # pkg = params[:name].split('/').last
34
+ #
35
+ # git "#{goenv_root}/plugins/#{pkg}" do
36
+ # repository repo_url
37
+ # revision node[name][:rdevision] if node[name][:revision]
38
+ # user node[:goenv][:user] if node[:goenv][:user]
39
+ # end
40
+ # end
41
+
42
+ goenv_init = <<-EOS
43
+ export GOENV_ROOT=#{goenv_root}
44
+ export PATH="#{goenv_root}/bin:${PATH}"
45
+ eval "$(goenv init -)"
46
+ EOS
47
+
48
+ # nodoc
49
+ build_envs = node[:'go-build'][:build_envs].map do |key, value|
50
+ %Q[export #{key}="#{value}"\n]
51
+ end.join
52
+
53
+ node[:goenv][:versions].each do |version|
54
+ execute "goenv install #{version}" do
55
+ command "#{goenv_init} #{build_envs} goenv install #{version}"
56
+ not_if "#{goenv_init} goenv versions | grep #{version}"
57
+ user node[:goenv][:user] if node[:goenv][:user]
58
+ end
59
+ end
60
+
61
+ if node[:goenv][:global]
62
+ node[:goenv][:global].tap do |version|
63
+ execute "goenv global #{version}" do
64
+ command "#{goenv_init} goenv global #{version}"
65
+ not_if "#{goenv_init} goenv version | grep #{version}"
66
+ user node[:goenv][:user] if node[:goenv][:user]
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,12 @@
1
+ node.reverse_merge!(
2
+ goenv: {
3
+ goenv_root: '/usr/local/goenv',
4
+ scheme: 'git',
5
+ versions: [],
6
+ },
7
+ :'go-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ include_recipe 'goenv::install'
@@ -0,0 +1,22 @@
1
+ node.reverse_merge!(
2
+ goenv: {
3
+ scheme: 'git',
4
+ user: ENV['USER'],
5
+ versions: [],
6
+ },
7
+ :'go-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ unless node[:goenv][:goenv_root]
13
+ case node[:platform]
14
+ when 'osx', 'darwin'
15
+ user_dir = '/Users'
16
+ else
17
+ user_dir = '/home'
18
+ end
19
+ node[:goenv][:goenv_root] = File.join(user_dir, node[:goenv][:user], '.goenv')
20
+ end
21
+
22
+ include_recipe 'goenv::install'
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Goenv
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
8
+ end
9
+ end
data/mrblib ADDED
@@ -0,0 +1 @@
1
+ lib
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-goenv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Civitaspo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-28 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'
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'
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.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
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.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Itamae plugin to install golang with goenv
56
+ email:
57
+ - civitaspo@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - CHANGELOG.md
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - example/Vagrantfile
69
+ - example/node.yml
70
+ - example/recipe.rb
71
+ - itamae-plugin-recipe-goenv.gemspec
72
+ - lib/itamae-plugin-recipe-goenv.rb
73
+ - lib/itamae/plugin/recipe/goenv.rb
74
+ - lib/itamae/plugin/recipe/goenv/dependency.rb
75
+ - lib/itamae/plugin/recipe/goenv/install.rb
76
+ - lib/itamae/plugin/recipe/goenv/system.rb
77
+ - lib/itamae/plugin/recipe/goenv/user.rb
78
+ - lib/itamae/plugin/recipe/goenv/version.rb
79
+ - mrblib
80
+ homepage: https://github.com/civitaspo/itamae-plugin-recipe-goenv
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
85
+ rdoc_options: []
86
+ require_paths:
87
+ - lib
88
+ required_ruby_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ requirements: []
99
+ rubyforge_project:
100
+ rubygems_version: 2.5.1
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Itamae plugin to install golang with goenv
104
+ test_files: []