itamae-plugin-recipe-scalaenv 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: 0e9220fa129254992eb60be8a3e3583a47196a21
4
+ data.tar.gz: 3b5abecf1421653426947d851b6285baa10d6b50
5
+ SHA512:
6
+ metadata.gz: 00d48ecba2ab131996dca0331a2f49da1426f3d78ce80c370496eaaed9db71f3593d60b511892fd9ea8f019d62f73ffa41e2360a14877349cc208a2e72969e4c
7
+ data.tar.gz: 927b3ffb50da1fed649354314249046609e0db746f57f8fe02b2793ba7ca9ef341adb6b1f25cd848297391daeb599ec01b1648267927115d6b684f7ea918043e
@@ -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-10-17)
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-scalaenv.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2017 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,120 @@
1
+ # Itamae::Plugin::Recipe::Scalaenv
2
+
3
+ [Itamae](https://github.com/ryotarai/itamae) plugin to install scala with [scalaenv](https://github.com/scalaenv/scalaenv)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'itamae-plugin-recipe-scalaenv'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install itamae-plugin-recipe-scalaenv
20
+
21
+ # Usage
22
+ ## System wide installation
23
+
24
+ Install scalaenv to /usr/local/scalaenv or some shared path
25
+
26
+ ### Recipe
27
+
28
+ ```ruby
29
+ # your recipe
30
+ include_recipe "scalaenv::system"
31
+ ```
32
+
33
+ ### Node
34
+
35
+ Use this with `itamae -y node.yml`
36
+
37
+ ```yaml
38
+ # node.yml
39
+ scalaenv:
40
+ global: scala-2.12.2
41
+ versions:
42
+ - scala-2.11.8
43
+ - scala-2.10.6
44
+
45
+ # scalaenv install dir, optional (default: /usr/local/scalaenv)
46
+ scalaenv_root: "/path/to/scalaenv"
47
+
48
+ # specify scheme to use in git clone, optional (default: git)
49
+ scheme: https
50
+ ```
51
+
52
+ ### .bashrc
53
+
54
+ Recommend to append this to .bashrc in your server.
55
+
56
+ ```bash
57
+ export SCALAENV_ROOT=/usr/local/scalaenv
58
+ export PATH="${SCALAENV_ROOT}/bin:${PATH}"
59
+ eval "$(scalaenv init -)"
60
+ ```
61
+
62
+ ## Installation for a user
63
+
64
+ Install scalaenv to `~#{node[:scalaenv][:user]}/.scalaenv`
65
+
66
+ ### Recipe
67
+
68
+ ```ruby
69
+ # your recipe
70
+ include_recipe "scalaenv::user"
71
+ ```
72
+
73
+ ### Node
74
+
75
+ Use this with `itamae -y node.yml`
76
+
77
+ ```yaml
78
+ # node.yml
79
+ scalaenv:
80
+ user: civitaspo
81
+ global: scala-2.12.2
82
+ versions:
83
+ - scala-2.11.8
84
+ - scala-2.10.6
85
+
86
+ # specify scheme to use in git clone, optional (default: git)
87
+ scheme: https
88
+
89
+ ```
90
+
91
+ ## Example
92
+
93
+ ```
94
+ $ cd example
95
+ $ vagrant up
96
+ $ bundle exec itamae ssh --vagrant -y node.yml recipe.rb
97
+ ```
98
+
99
+ ## MItamae
100
+
101
+ This plugin can be used for MItamae too. Put this repository under `./plugins` as git submodule.
102
+
103
+ ```rb
104
+ node.reverse_merge!(
105
+ scalaenv: {
106
+ user: 'civitaspo',
107
+ global: 'scala-2.12.2',
108
+ versions: %w[
109
+ scala-2.11.8
110
+ scala-2.10.6
111
+ ],
112
+ }
113
+ )
114
+
115
+ include_recipe "scalaenv::user"
116
+ ```
117
+
118
+ ## License
119
+
120
+ 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
+ scalaenv:
2
+ user: vagrant
3
+ global: scala-2.12.2
4
+ versions:
5
+ - scala-2.11.8
6
+ - scala-2.10.6
@@ -0,0 +1 @@
1
+ include_recipe "scalaenv::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/scalaenv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-scalaenv"
8
+ spec.version = Itamae::Plugin::Recipe::Scalaenv::VERSION
9
+ spec.authors = ["Civitaspo"]
10
+ spec.email = ["civitaspo@gmail.com"]
11
+ spec.summary = %q{Itamae plugin to install scala with scalaenv}
12
+ spec.description = %q{Itamae plugin to install scala with scalaenv}
13
+ spec.homepage = "https://github.com/civitaspo/itamae-plugin-recipe-scalaenv"
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/scalaenv"
@@ -0,0 +1 @@
1
+ require "itamae/plugin/recipe/scalaenv/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,64 @@
1
+ # This recipe requires `scalaenv_root` is defined.
2
+
3
+ include_recipe 'scalaenv::dependency'
4
+
5
+ # TODO: configure the scalaenv repo url?
6
+ # repo_host = nodo[:scalaenv][:scalaenv_repo_host] || 'github.com'
7
+ # repo_org = node[:scalaenv][:scalaenv_repo_org] || 'scalaenv'
8
+ scheme = node[:scalaenv][:scheme]
9
+ scalaenv_root = node[:scalaenv][:scalaenv_root]
10
+
11
+ git scalaenv_root do
12
+ repository "#{scheme}://github.com/scalaenv/scalaenv.git"
13
+ revision node[:scalaenv][:revision] if node[:scalaenv][:revision]
14
+ user node[:scalaenv][:user] if node[:scalaenv][:user]
15
+ end
16
+
17
+ directory File.join(scalaenv_root, 'plugins') do
18
+ user node[:scalaenv][:user] if node[:scalaenv][:user]
19
+ end
20
+
21
+ # TODO: if some scalaenv plugins are released, pubilsh this.
22
+ # ex)
23
+ # scalaenv_plugin:
24
+ # - github.com/civitaspo/scalaenv-default-packages
25
+ #
26
+ # define :scalaenv_plugin do
27
+ # repo_url = "#{scheme}://#{params[:name]}.git"
28
+ # pkg = params[:name].split('/').last
29
+ #
30
+ # git "#{scalaenv_root}/plugins/#{pkg}" do
31
+ # repository repo_url
32
+ # revision node[name][:rdevision] if node[name][:revision]
33
+ # user node[:scalaenv][:user] if node[:scalaenv][:user]
34
+ # end
35
+ # end
36
+
37
+ scalaenv_init = <<-EOS
38
+ export SCALAENV_ROOT=#{scalaenv_root}
39
+ export PATH="#{scalaenv_root}/bin:${PATH}"
40
+ eval "$(scalaenv init -)"
41
+ EOS
42
+
43
+ # nodoc
44
+ build_envs = node[:'scala-build'][:build_envs].map do |key, value|
45
+ %Q[export #{key}="#{value}"\n]
46
+ end.join
47
+
48
+ node[:scalaenv][:versions].each do |version|
49
+ execute "scalaenv install #{version}" do
50
+ command "#{scalaenv_init} #{build_envs} scalaenv install #{version}"
51
+ not_if "#{scalaenv_init} scalaenv versions | grep #{version}"
52
+ user node[:scalaenv][:user] if node[:scalaenv][:user]
53
+ end
54
+ end
55
+
56
+ if node[:scalaenv][:global]
57
+ node[:scalaenv][:global].tap do |version|
58
+ execute "scalaenv global #{version}" do
59
+ command "#{scalaenv_init} scalaenv global #{version}"
60
+ not_if "#{scalaenv_init} scalaenv version | grep #{version}"
61
+ user node[:scalaenv][:user] if node[:scalaenv][:user]
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,12 @@
1
+ node.reverse_merge!(
2
+ scalaenv: {
3
+ scalaenv_root: '/usr/local/scalaenv',
4
+ scheme: 'git',
5
+ versions: [],
6
+ },
7
+ :'scala-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ include_recipe 'scalaenv::install'
@@ -0,0 +1,22 @@
1
+ node.reverse_merge!(
2
+ scalaenv: {
3
+ scheme: 'git',
4
+ user: ENV['USER'],
5
+ versions: [],
6
+ },
7
+ :'scala-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ unless node[:scalaenv][:scalaenv_root]
13
+ case node[:platform]
14
+ when 'osx', 'darwin'
15
+ user_dir = '/Users'
16
+ else
17
+ user_dir = '/home'
18
+ end
19
+ node[:scalaenv][:scalaenv_root] = File.join(user_dir, node[:scalaenv][:user], '.scalaenv')
20
+ end
21
+
22
+ include_recipe 'scalaenv::install'
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Scalaenv
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-scalaenv
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-10-17 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 scala with scalaenv
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-scalaenv.gemspec
72
+ - lib/itamae-plugin-recipe-scalaenv.rb
73
+ - lib/itamae/plugin/recipe/scalaenv.rb
74
+ - lib/itamae/plugin/recipe/scalaenv/dependency.rb
75
+ - lib/itamae/plugin/recipe/scalaenv/install.rb
76
+ - lib/itamae/plugin/recipe/scalaenv/system.rb
77
+ - lib/itamae/plugin/recipe/scalaenv/user.rb
78
+ - lib/itamae/plugin/recipe/scalaenv/version.rb
79
+ - mrblib
80
+ homepage: https://github.com/civitaspo/itamae-plugin-recipe-scalaenv
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.6.11
101
+ signing_key:
102
+ specification_version: 4
103
+ summary: Itamae plugin to install scala with scalaenv
104
+ test_files: []