itamae-plugin-recipe-sbtenv 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 58e46d390c9b8ce233b3cbcae2f19b1f557b6388
4
+ data.tar.gz: 01d9546fbfa6f9c33ff464c641209e2ce059f072
5
+ SHA512:
6
+ metadata.gz: 5843dfb773a3c1c2d78b31a60cac433776bd36fe5983b1c4a99cc3a5ad2d738f3e32284649dfb84aad72430ffc7373129171dfc76175430174ade1d8777cf187
7
+ data.tar.gz: 9909e4cfaef9301ea68f9769f6dc1c5a3ce86ba7372b1c18adc9592bba5f5661663ea0cd6e8c95f58d31e3b1ab2f86b1095ba1b6f112023bc0527d7ff150c6d4
@@ -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-sbtenv.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::Sbtenv
2
+
3
+ [Itamae](https://github.com/ryotarai/itamae) plugin to install sbt with [sbtenv](https://github.com/sbtenv/sbtenv)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'itamae-plugin-recipe-sbtenv'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install itamae-plugin-recipe-sbtenv
20
+
21
+ # Usage
22
+ ## System wide installation
23
+
24
+ Install sbtenv to /usr/local/sbtenv or some shared path
25
+
26
+ ### Recipe
27
+
28
+ ```ruby
29
+ # your recipe
30
+ include_recipe "sbtenv::system"
31
+ ```
32
+
33
+ ### Node
34
+
35
+ Use this with `itamae -y node.yml`
36
+
37
+ ```yaml
38
+ # node.yml
39
+ sbtenv:
40
+ global: sbt-0.13.15
41
+ versions:
42
+ - sbt-0.13.15
43
+ - sbt-0.12.4
44
+
45
+ # sbtenv install dir, optional (default: /usr/local/sbtenv)
46
+ sbtenv_root: "/path/to/sbtenv"
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 SBTENV_ROOT=/usr/local/sbtenv
58
+ export PATH="${SBTENV_ROOT}/bin:${PATH}"
59
+ eval "$(sbtenv init -)"
60
+ ```
61
+
62
+ ## Installation for a user
63
+
64
+ Install sbtenv to `~#{node[:sbtenv][:user]}/.sbtenv`
65
+
66
+ ### Recipe
67
+
68
+ ```ruby
69
+ # your recipe
70
+ include_recipe "sbtenv::user"
71
+ ```
72
+
73
+ ### Node
74
+
75
+ Use this with `itamae -y node.yml`
76
+
77
+ ```yaml
78
+ # node.yml
79
+ sbtenv:
80
+ user: civitaspo
81
+ global: sbt-0.13.15
82
+ versions:
83
+ - sbt-0.13.15
84
+ - sbt-0.12.4
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
+ sbtenv: {
106
+ user: 'civitaspo',
107
+ global: 'sbt-0.13.15',
108
+ versions: %w[
109
+ sbt-0.13.15
110
+ sbt-0.12.4
111
+ ],
112
+ }
113
+ )
114
+
115
+ include_recipe "sbtenv::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
+ sbtenv:
2
+ user: vagrant
3
+ global: sbt-0.13.15
4
+ versions:
5
+ - sbt-0.13.15
6
+ - sbt-0.12.4
@@ -0,0 +1 @@
1
+ include_recipe "sbtenv::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/sbtenv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-sbtenv"
8
+ spec.version = Itamae::Plugin::Recipe::Sbtenv::VERSION
9
+ spec.authors = ["Civitaspo"]
10
+ spec.email = ["civitaspo@gmail.com"]
11
+ spec.summary = %q{Itamae plugin to install sbt with sbtenv}
12
+ spec.description = %q{Itamae plugin to install sbt with sbtenv}
13
+ spec.homepage = "https://github.com/civitaspo/itamae-plugin-recipe-sbtenv"
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/sbtenv"
@@ -0,0 +1 @@
1
+ require "itamae/plugin/recipe/sbtenv/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 `sbtenv_root` is defined.
2
+
3
+ include_recipe 'sbtenv::dependency'
4
+
5
+ # TODO: configure the sbtenv repo url?
6
+ # repo_host = nodo[:sbtenv][:sbtenv_repo_host] || 'github.com'
7
+ # repo_org = node[:sbtenv][:sbtenv_repo_org] || 'sbtenv'
8
+ scheme = node[:sbtenv][:scheme]
9
+ sbtenv_root = node[:sbtenv][:sbtenv_root]
10
+
11
+ git sbtenv_root do
12
+ repository "#{scheme}://github.com/sbtenv/sbtenv.git"
13
+ revision node[:sbtenv][:revision] if node[:sbtenv][:revision]
14
+ user node[:sbtenv][:user] if node[:sbtenv][:user]
15
+ end
16
+
17
+ directory File.join(sbtenv_root, 'plugins') do
18
+ user node[:sbtenv][:user] if node[:sbtenv][:user]
19
+ end
20
+
21
+ # TODO: if some sbtenv plugins are released, pubilsh this.
22
+ # ex)
23
+ # sbtenv_plugin:
24
+ # - github.com/civitaspo/sbtenv-default-packages
25
+ #
26
+ # define :sbtenv_plugin do
27
+ # repo_url = "#{scheme}://#{params[:name]}.git"
28
+ # pkg = params[:name].split('/').last
29
+ #
30
+ # git "#{sbtenv_root}/plugins/#{pkg}" do
31
+ # repository repo_url
32
+ # revision node[name][:rdevision] if node[name][:revision]
33
+ # user node[:sbtenv][:user] if node[:sbtenv][:user]
34
+ # end
35
+ # end
36
+
37
+ sbtenv_init = <<-EOS
38
+ export SBTENV_ROOT=#{sbtenv_root}
39
+ export PATH="#{sbtenv_root}/bin:${PATH}"
40
+ eval "$(sbtenv init -)"
41
+ EOS
42
+
43
+ # nodoc
44
+ build_envs = node[:'sbt-build'][:build_envs].map do |key, value|
45
+ %Q[export #{key}="#{value}"\n]
46
+ end.join
47
+
48
+ node[:sbtenv][:versions].each do |version|
49
+ execute "sbtenv install #{version}" do
50
+ command "#{sbtenv_init} #{build_envs} sbtenv install #{version}"
51
+ not_if "#{sbtenv_init} sbtenv versions | grep #{version}"
52
+ user node[:sbtenv][:user] if node[:sbtenv][:user]
53
+ end
54
+ end
55
+
56
+ if node[:sbtenv][:global]
57
+ node[:sbtenv][:global].tap do |version|
58
+ execute "sbtenv global #{version}" do
59
+ command "#{sbtenv_init} sbtenv global #{version}"
60
+ not_if "#{sbtenv_init} sbtenv version | grep #{version}"
61
+ user node[:sbtenv][:user] if node[:sbtenv][:user]
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,12 @@
1
+ node.reverse_merge!(
2
+ sbtenv: {
3
+ sbtenv_root: '/usr/local/sbtenv',
4
+ scheme: 'git',
5
+ versions: [],
6
+ },
7
+ :'sbt-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ include_recipe 'sbtenv::install'
@@ -0,0 +1,22 @@
1
+ node.reverse_merge!(
2
+ sbtenv: {
3
+ scheme: 'git',
4
+ user: ENV['USER'],
5
+ versions: [],
6
+ },
7
+ :'sbt-build' => {
8
+ build_envs: [],
9
+ }
10
+ )
11
+
12
+ unless node[:sbtenv][:sbtenv_root]
13
+ case node[:platform]
14
+ when 'osx', 'darwin'
15
+ user_dir = '/Users'
16
+ else
17
+ user_dir = '/home'
18
+ end
19
+ node[:sbtenv][:sbtenv_root] = File.join(user_dir, node[:sbtenv][:user], '.sbtenv')
20
+ end
21
+
22
+ include_recipe 'sbtenv::install'
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module Sbtenv
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-sbtenv
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 sbt with sbtenv
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-sbtenv.gemspec
72
+ - lib/itamae-plugin-recipe-sbtenv.rb
73
+ - lib/itamae/plugin/recipe/sbtenv.rb
74
+ - lib/itamae/plugin/recipe/sbtenv/dependency.rb
75
+ - lib/itamae/plugin/recipe/sbtenv/install.rb
76
+ - lib/itamae/plugin/recipe/sbtenv/system.rb
77
+ - lib/itamae/plugin/recipe/sbtenv/user.rb
78
+ - lib/itamae/plugin/recipe/sbtenv/version.rb
79
+ - mrblib
80
+ homepage: https://github.com/civitaspo/itamae-plugin-recipe-sbtenv
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 sbt with sbtenv
104
+ test_files: []