video_sprites 0.1.0
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.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +76 -0
- data/Rakefile +10 -0
- data/Vagrantfile +76 -0
- data/ansible/development-playbook.yml +15 -0
- data/ansible/development.ini +2 -0
- data/ansible/roles/basic-setup/tasks/main.yml +35 -0
- data/ansible/roles/ffmpeg/defaults/main.yml +6 -0
- data/ansible/roles/ffmpeg/tasks/ff-libraries.yml +21 -0
- data/ansible/roles/ffmpeg/tasks/ffmpeg.yml +18 -0
- data/ansible/roles/ffmpeg/tasks/libfdk_aac.yml +19 -0
- data/ansible/roles/ffmpeg/tasks/libmp3lame.yml +20 -0
- data/ansible/roles/ffmpeg/tasks/libogg.yml +18 -0
- data/ansible/roles/ffmpeg/tasks/libopus.yml +20 -0
- data/ansible/roles/ffmpeg/tasks/libvorbis.yml +18 -0
- data/ansible/roles/ffmpeg/tasks/libvpx.yml +18 -0
- data/ansible/roles/ffmpeg/tasks/main.yml +80 -0
- data/ansible/roles/ffmpeg/tasks/x264.yml +18 -0
- data/ansible/roles/ffmpeg/tasks/x265.yml +14 -0
- data/ansible/roles/ffmpeg/tasks/yasm.yml +19 -0
- data/ansible/roles/rvm_io.rvm1-ruby/.gitignore +6 -0
- data/ansible/roles/rvm_io.rvm1-ruby/.travis.yml +52 -0
- data/ansible/roles/rvm_io.rvm1-ruby/LICENSE +22 -0
- data/ansible/roles/rvm_io.rvm1-ruby/README.md +142 -0
- data/ansible/roles/rvm_io.rvm1-ruby/defaults/main.yml +44 -0
- data/ansible/roles/rvm_io.rvm1-ruby/meta/main.yml +21 -0
- data/ansible/roles/rvm_io.rvm1-ruby/tasks/main.yml +4 -0
- data/ansible/roles/rvm_io.rvm1-ruby/tasks/rubies.yml +78 -0
- data/ansible/roles/rvm_io.rvm1-ruby/tasks/rvm.yml +55 -0
- data/ansible/roles/rvm_io.rvm1-ruby/tests/inventory +1 -0
- data/ansible/roles/rvm_io.rvm1-ruby/tests/test.yml +14 -0
- data/ansible/roles/rvm_io.rvm1-ruby/vars/main.yml +22 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/videosprites +6 -0
- data/lib/video_sprites.rb +7 -0
- data/lib/video_sprites/cli.rb +17 -0
- data/lib/video_sprites/processor.rb +167 -0
- data/lib/video_sprites/version.rb +3 -0
- data/video_sprites.gemspec +31 -0
- metadata +173 -0
@@ -0,0 +1,80 @@
|
|
1
|
+
---
|
2
|
+
- include: ff-libraries.yml
|
3
|
+
|
4
|
+
- name: ensure source_dir and build_dir exist
|
5
|
+
file:
|
6
|
+
path: "{{ item }}"
|
7
|
+
state: directory
|
8
|
+
with_items:
|
9
|
+
- "{{ source_dir }}"
|
10
|
+
- "{{ build_dir }}"
|
11
|
+
|
12
|
+
- name: stat yasm
|
13
|
+
stat: path=/usr/local/bin/yasm
|
14
|
+
register: yasm_stat
|
15
|
+
- name: include yasm
|
16
|
+
include: yasm.yml
|
17
|
+
when: yasm_stat.stat.xusr is not defined or yasm_stat.stat.xusr == False
|
18
|
+
|
19
|
+
- name: stat x264
|
20
|
+
stat: path=/usr/local/bin/x264
|
21
|
+
register: x264_stat
|
22
|
+
- name: include x264
|
23
|
+
include: x264.yml
|
24
|
+
when: x264_stat.stat.xusr is not defined or x264_stat.stat.xusr == False
|
25
|
+
|
26
|
+
- name: stat x265
|
27
|
+
stat: path={{ build_dir }}/lib/libx265.a
|
28
|
+
register: x265_stat
|
29
|
+
- name: include x264
|
30
|
+
include: x265.yml
|
31
|
+
when: x265_stat.stat.exists == False
|
32
|
+
|
33
|
+
- name: stat libfdk-aac
|
34
|
+
stat: path={{ build_dir }}/lib/libfdk-aac.a
|
35
|
+
register: aac_stat
|
36
|
+
- name: include libfdk-aac
|
37
|
+
include: libfdk_aac.yml
|
38
|
+
when: aac_stat.stat.exists == False
|
39
|
+
|
40
|
+
- name: stat lame
|
41
|
+
stat: path=/usr/local/bin/lame
|
42
|
+
register: lame_stat
|
43
|
+
- name: include lame
|
44
|
+
include: libmp3lame.yml
|
45
|
+
when: lame_stat.stat.xusr is not defined or lame_stat.stat.xusr == False
|
46
|
+
|
47
|
+
- name: stat libopus
|
48
|
+
stat: path={{ build_dir }}/lib/libopus.a
|
49
|
+
register: opus_stat
|
50
|
+
- name: include libopus
|
51
|
+
include: libopus.yml
|
52
|
+
when: opus_stat.stat.exists == False
|
53
|
+
|
54
|
+
- name: stat libogg
|
55
|
+
stat: path={{ build_dir }}/lib/libogg.a
|
56
|
+
register: ogg_stat
|
57
|
+
- name: include libogg
|
58
|
+
include: libogg.yml
|
59
|
+
when: ogg_stat.stat.exists == False
|
60
|
+
|
61
|
+
- name: stat libvorbis
|
62
|
+
stat: path={{ build_dir }}/lib/libvorbis.a
|
63
|
+
register: vorbis_stat
|
64
|
+
- name: include libvorbis
|
65
|
+
include: libvorbis.yml
|
66
|
+
when: vorbis_stat.stat.exists == False
|
67
|
+
|
68
|
+
- name: stat libvpx
|
69
|
+
stat: path={{ build_dir }}/lib/libvpx.a
|
70
|
+
register: vpx_stat
|
71
|
+
- name: include libvpx
|
72
|
+
include: libvpx.yml
|
73
|
+
when: vpx_stat.stat.exists == False
|
74
|
+
|
75
|
+
- name: stat ffmpeg
|
76
|
+
stat: path=/usr/local/bin/ffmpeg
|
77
|
+
register: ffmpeg_stat
|
78
|
+
- name: include ffmpeg
|
79
|
+
include: ffmpeg.yml
|
80
|
+
when: ffmpeg_stat.stat.xusr is not defined or ffmpeg_stat.stat.xusr == False
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
# H.264 video encoder
|
3
|
+
- name: GIT clone | libx264
|
4
|
+
git: repo=git://git.videolan.org/x264
|
5
|
+
dest={{ source_dir }}/x264
|
6
|
+
accept_hostkey=yes
|
7
|
+
depth=1
|
8
|
+
|
9
|
+
- name: Compile | libx264
|
10
|
+
shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
|
11
|
+
args:
|
12
|
+
chdir: "{{ source_dir }}/x264"
|
13
|
+
creates: "{{ bin_dir }}/x264"
|
14
|
+
with_items:
|
15
|
+
- PKG_CONFIG_PATH="{{build_dir}}/lib/pkgconfig" ./configure --prefix={{ build_dir }} --bindir={{ bin_dir }} --enable-static
|
16
|
+
- make
|
17
|
+
- make install
|
18
|
+
- make distclean
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
- name: Mercurial | libx265
|
3
|
+
hg: repo=https://bitbucket.org/multicoreware/x265
|
4
|
+
dest={{source_dir}}/x265
|
5
|
+
|
6
|
+
- name: Compile | libx265
|
7
|
+
shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
|
8
|
+
args:
|
9
|
+
chdir: "{{ source_dir }}/x265/build/linux"
|
10
|
+
creates: "{{ bin_dir }}/x265"
|
11
|
+
with_items:
|
12
|
+
- cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="{{build_dir}}" -DENABLE_SHARED:bool=off ../../source
|
13
|
+
- make
|
14
|
+
- make install
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
# Yasm is an assembler used by x264 and FFmpeg
|
3
|
+
- name: GIT clone | yasm
|
4
|
+
git: repo=git://github.com/yasm/yasm.git
|
5
|
+
dest={{ source_dir }}/yasm
|
6
|
+
accept_hostkey=yes
|
7
|
+
depth=1
|
8
|
+
|
9
|
+
- name: Compile | yasm
|
10
|
+
shell: "export PATH=/usr/local/bin/:$PATH && {{ item }}"
|
11
|
+
args:
|
12
|
+
chdir: "{{ source_dir }}/yasm"
|
13
|
+
creates: "{{ bin_dir }}/yasm"
|
14
|
+
with_items:
|
15
|
+
- autoreconf -fiv
|
16
|
+
- ./configure --prefix={{ build_dir }} --bindir={{ bin_dir }}
|
17
|
+
- make
|
18
|
+
- make install
|
19
|
+
- make distclean
|
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
language: 'python'
|
3
|
+
python: '2.7'
|
4
|
+
|
5
|
+
env:
|
6
|
+
- SITE_AND_INVENTORY='tests/test.yml -i tests/inventory'
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- '__rvm_unload ; rm -rf ~/.rvm'
|
10
|
+
|
11
|
+
install:
|
12
|
+
- 'pip install ansible==2.0.0'
|
13
|
+
- 'printf "[defaults]\nroles_path = ../" > ansible.cfg'
|
14
|
+
|
15
|
+
script:
|
16
|
+
- >
|
17
|
+
ruby -v
|
18
|
+
| grep -q 'ruby'
|
19
|
+
&& (echo 'No ruby test: pass' && exit 1)
|
20
|
+
|| (echo 'No ruby test: fail' && exit 0)
|
21
|
+
- 'ansible-playbook $SITE_AND_INVENTORY --syntax-check'
|
22
|
+
- 'ansible-playbook $SITE_AND_INVENTORY --connection=local -vvvv'
|
23
|
+
- >
|
24
|
+
ansible-playbook $SITE_AND_INVENTORY --connection=local
|
25
|
+
| grep -q 'changed=0.*failed=0'
|
26
|
+
&& (echo 'Idempotence test: pass' && exit 0)
|
27
|
+
|| (echo 'Idempotence test: fail' && exit 1)
|
28
|
+
- >
|
29
|
+
~/.rvm/wrappers/default/ruby -v
|
30
|
+
| grep -q '2.1.2'
|
31
|
+
&& (echo 'Default ruby test: pass' && exit 0)
|
32
|
+
|| (echo 'Default ruby test: fail' && exit 1)
|
33
|
+
- >
|
34
|
+
ls ~/.rvm/rubies
|
35
|
+
| grep -q 'ruby-2.1.0'
|
36
|
+
&& (echo 'Multiple rubies test: pass' && exit 0)
|
37
|
+
|| (echo 'Multiple rubies test: fail' && exit 1)
|
38
|
+
- >
|
39
|
+
ansible-playbook $SITE_AND_INVENTORY --connection=local --extra-vars='rvm1_delete_ruby=ruby-2.1.0'
|
40
|
+
| grep -q 'ok=1.*failed=0'
|
41
|
+
&& (echo 'Delete ruby test: pass' && exit 0)
|
42
|
+
|| (echo 'Delete ruby test: fail' && exit 1)
|
43
|
+
- >
|
44
|
+
ls ~/.rvm/rubies/ | wc -l
|
45
|
+
| grep -q '2'
|
46
|
+
&& (echo 'Really deleted ruby test: pass' && exit 0)
|
47
|
+
|| (echo 'Really deleted ruby test: fail' && exit 1)
|
48
|
+
- >
|
49
|
+
ls ~/.rvm/wrappers/default/
|
50
|
+
| grep -q 'bundler'
|
51
|
+
&& (echo 'Bundler symlinked on system path test: pass' && exit 0)
|
52
|
+
|| (echo 'Bundler symlinked on system path test: fail' && exit 1)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Nick Janetakis nick.janetakis@gmail.com
|
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 NONINFRINGEMENT.
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,142 @@
|
|
1
|
+
## What is rvm1-ansible? [](http://travis-ci.org/rvm/rvm1-ansible)
|
2
|
+
|
3
|
+
It is an [Ansible](http://www.ansible.com/home) role to install and manage ruby versions using rvm.
|
4
|
+
|
5
|
+
### Why should you use rvm?
|
6
|
+
|
7
|
+
In production it's useful because compiling a new version of ruby can easily
|
8
|
+
take upwards of 10 minutes. That's 10 minutes of your CPU being pegged at 100%.
|
9
|
+
|
10
|
+
rvm has pre-compiled binaries for a lot of operating systems. That means you can
|
11
|
+
install ruby in about 1 minute, even on a slow micro instance.
|
12
|
+
|
13
|
+
This role even adds the ruby binaries to your system path when doing a system
|
14
|
+
wide install. This allows you to access them as if they were installed without
|
15
|
+
using a version manager while still benefiting from what rvm has to offer.
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
`$ ansible-galaxy install rvm_io.rvm1-ruby`
|
20
|
+
|
21
|
+
## Role variables
|
22
|
+
|
23
|
+
Below is a list of default values that you can configure:
|
24
|
+
|
25
|
+
```
|
26
|
+
---
|
27
|
+
|
28
|
+
# Install 1 or more versions of ruby
|
29
|
+
# The last ruby listed will be set as the default ruby
|
30
|
+
rvm1_rubies:
|
31
|
+
- 'ruby-2.1.3'
|
32
|
+
|
33
|
+
# Delete a specific version of ruby (ie. ruby-2.1.0)
|
34
|
+
rvm1_delete_ruby:
|
35
|
+
|
36
|
+
# Install path for rvm (defaults to system wide)
|
37
|
+
rvm1_install_path: '/usr/local/rvm'
|
38
|
+
|
39
|
+
# Add or remove any install flags
|
40
|
+
# NOTE: If you are doing a USER BASED INSTALL then
|
41
|
+
# make sure you ADD the --user-install flag below
|
42
|
+
rvm1_install_flags: '--auto-dotfiles'
|
43
|
+
|
44
|
+
# Add additional ruby install flags
|
45
|
+
rvm1_ruby_install_flags:
|
46
|
+
|
47
|
+
# Set the owner for the rvm directory
|
48
|
+
rvm1_user: 'root'
|
49
|
+
|
50
|
+
# URL for the latest installer script
|
51
|
+
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/wayneeseguin/rvm/master/binscripts/rvm-installer'
|
52
|
+
|
53
|
+
# rvm version to use
|
54
|
+
rvm1_rvm_version: 'stable'
|
55
|
+
|
56
|
+
# Check and update rvm, disabling this will force rvm to never update
|
57
|
+
rvm1_rvm_check_for_updates: True
|
58
|
+
|
59
|
+
# GPG key verification, use an empty string if you want to skip this
|
60
|
+
# Note: Unless you know what you're doing, just keep it as is
|
61
|
+
# Identity proof: https://keybase.io/mpapis
|
62
|
+
# PGP message: https://rvm.io/mpapis.asc
|
63
|
+
rvm1_gpg_keys: 'D39DC0E3'
|
64
|
+
|
65
|
+
# The GPG key server
|
66
|
+
rvm1_gpg_key_server: 'hkp://keys.gnupg.net'
|
67
|
+
|
68
|
+
# autolib mode, see https://rvm.io/rvm/autolibs
|
69
|
+
rvm1_autolib_mode: 3
|
70
|
+
```
|
71
|
+
|
72
|
+
## Example playbook
|
73
|
+
|
74
|
+
```
|
75
|
+
---
|
76
|
+
|
77
|
+
- name: Configure servers with ruby support
|
78
|
+
hosts: all
|
79
|
+
|
80
|
+
roles:
|
81
|
+
- { role: rvm_io.rvm1-ruby, tags: ruby, sudo: True }
|
82
|
+
```
|
83
|
+
|
84
|
+
#### System wide installation
|
85
|
+
|
86
|
+
The above example would setup ruby system wide. It's very important that you
|
87
|
+
run the play with sudo because it will need to write to `/usr/local/rvm`.
|
88
|
+
|
89
|
+
#### To the same user as `ansible_ssh_user`
|
90
|
+
|
91
|
+
In this case, just overwrite `rvm_install_path` and set the `--user-install` flag:
|
92
|
+
|
93
|
+
**Note:** you still need to use sudo because during the ruby
|
94
|
+
installation phase rvm will internally make calls using sudo
|
95
|
+
to install certain ruby dependencies.
|
96
|
+
|
97
|
+
```
|
98
|
+
rvm1_install_flags: '--auto-dotfiles --user-install'
|
99
|
+
rvm1_install_path: '/home/{{ ansible_ssh_user }}/.rvm'
|
100
|
+
```
|
101
|
+
|
102
|
+
#### To a user that is not `ansible_ssh_user`
|
103
|
+
|
104
|
+
You **will need sudo here** because you will be writing outside the ansible
|
105
|
+
user's home directory. Other than that it's the same as above, except you will
|
106
|
+
supply a different user account:
|
107
|
+
|
108
|
+
```
|
109
|
+
rvm1_install_flags: '--auto-dotfiles --user-install'
|
110
|
+
rvm1_install_path: '/home/someuser/.rvm'
|
111
|
+
```
|
112
|
+
|
113
|
+
#### A quick note about `rvm1_user`
|
114
|
+
|
115
|
+
In some cases you may want the rvm folder and its files to be owned by a specific
|
116
|
+
user instead of root. Simply set `rvm1_user: 'foo'` and when ruby gets installed
|
117
|
+
it will ensure that `foo` owns the rvm directory.
|
118
|
+
|
119
|
+
## Upgrading and removing old versions of ruby
|
120
|
+
|
121
|
+
A common work flow for upgrading your ruby version would be:
|
122
|
+
|
123
|
+
1. Install the new version
|
124
|
+
2. Run your application role so that bundle install re-installs your gems
|
125
|
+
3. Delete the previous version of ruby
|
126
|
+
|
127
|
+
### Leverage ansible's `--extra-vars`
|
128
|
+
|
129
|
+
Just add `--extra-vars 'rvm1_delete_ruby=ruby-2.1.0'` to the end of your play book command and that version will be removed.
|
130
|
+
|
131
|
+
## Requirements
|
132
|
+
|
133
|
+
- Tested on ubuntu 12.04 LTS but it should work on other versions that are similar.
|
134
|
+
- Tested on RHEL6.5 and CentOS 6.5
|
135
|
+
|
136
|
+
## Ansible galaxy
|
137
|
+
|
138
|
+
You can find it on the official [ansible galaxy](https://galaxy.ansible.com/list#/roles/1087) if you want to rate it.
|
139
|
+
|
140
|
+
## License
|
141
|
+
|
142
|
+
MIT
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
# Install 1 or more versions of ruby
|
4
|
+
# The last ruby listed will be set as the default ruby
|
5
|
+
rvm1_rubies:
|
6
|
+
- 'ruby-2.2.2'
|
7
|
+
|
8
|
+
# Delete a specific version of ruby (ie. ruby-2.1.0)
|
9
|
+
rvm1_delete_ruby:
|
10
|
+
|
11
|
+
# Install path for rvm (defaults to system wide)
|
12
|
+
rvm1_install_path: '/usr/local/rvm'
|
13
|
+
|
14
|
+
# Add or remove any install flags
|
15
|
+
# NOTE: If you are doing a USER BASED INSTALL then
|
16
|
+
# make sure you ADD the --user-install flag below
|
17
|
+
rvm1_install_flags: '--auto-dotfiles'
|
18
|
+
|
19
|
+
# Add additional ruby install flags
|
20
|
+
rvm1_ruby_install_flags:
|
21
|
+
|
22
|
+
# Set the owner for the rvm directory
|
23
|
+
rvm1_user: 'root'
|
24
|
+
|
25
|
+
# URL for the latest installer script
|
26
|
+
rvm1_rvm_latest_installer: 'https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer'
|
27
|
+
|
28
|
+
# rvm version to use
|
29
|
+
rvm1_rvm_version: 'stable'
|
30
|
+
|
31
|
+
# Check and update rvm, disabling this will force rvm to never update
|
32
|
+
rvm1_rvm_check_for_updates: True
|
33
|
+
|
34
|
+
# GPG key verification, use an empty string if you want to skip this
|
35
|
+
# Note: Unless you know what you're doing, just keep it as is
|
36
|
+
# Identity proof: https://keybase.io/mpapis
|
37
|
+
# PGP message: https://rvm.io/mpapis.asc
|
38
|
+
rvm1_gpg_keys: 'D39DC0E3'
|
39
|
+
|
40
|
+
# The GPG key server
|
41
|
+
rvm1_gpg_key_server: 'hkp://keys.gnupg.net'
|
42
|
+
|
43
|
+
# autolib mode, see https://rvm.io/rvm/autolibs
|
44
|
+
rvm1_autolib_mode: 3
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
galaxy_info:
|
3
|
+
author: Nick Janetakis
|
4
|
+
description: The official rvm role to install and manage your ruby versions.
|
5
|
+
company:
|
6
|
+
license: license (MIT)
|
7
|
+
min_ansible_version: 1.5
|
8
|
+
|
9
|
+
platforms:
|
10
|
+
- name: EL
|
11
|
+
versions:
|
12
|
+
- all
|
13
|
+
- name: Ubuntu
|
14
|
+
versions:
|
15
|
+
- all
|
16
|
+
|
17
|
+
categories:
|
18
|
+
- development
|
19
|
+
- web
|
20
|
+
|
21
|
+
dependencies: []
|
@@ -0,0 +1,78 @@
|
|
1
|
+
---
|
2
|
+
|
3
|
+
- name: Detect if rubies are installed
|
4
|
+
command: '{{ rvm1_rvm }} {{ item }} do true'
|
5
|
+
changed_when: False
|
6
|
+
failed_when: False
|
7
|
+
register: detect_rubies
|
8
|
+
with_items: '{{ rvm1_rubies }}'
|
9
|
+
when: rvm1_rubies
|
10
|
+
|
11
|
+
- name: Install rubies
|
12
|
+
command: '{{ rvm1_rvm }} install {{ item.item }} {{ rvm1_ruby_install_flags }}'
|
13
|
+
when: rvm1_rubies and item.rc|default(0) != 0
|
14
|
+
with_items: '{{ detect_rubies.results }}'
|
15
|
+
become: yes
|
16
|
+
become_user: '{{ rvm1_user }}'
|
17
|
+
|
18
|
+
- name: Detect default ruby version
|
19
|
+
command: '{{ rvm1_rvm }} alias list default'
|
20
|
+
changed_when: False
|
21
|
+
register: detect_default_ruby_version
|
22
|
+
become: yes
|
23
|
+
become_user: '{{ rvm1_user }}'
|
24
|
+
|
25
|
+
- name: Select default ruby
|
26
|
+
command: '{{ rvm1_rvm }} alias create default {{ rvm1_default_ruby_version }}'
|
27
|
+
when: detect_default_ruby_version.stdout|default() == '' or
|
28
|
+
rvm1_default_ruby_version not in detect_default_ruby_version.stdout
|
29
|
+
become: yes
|
30
|
+
become_user: '{{ rvm1_user }}'
|
31
|
+
|
32
|
+
- name: Detect installed ruby patch number
|
33
|
+
shell: >
|
34
|
+
{{ rvm1_rvm }} list strings | grep {{ item }} | tail -n 1
|
35
|
+
with_items: '{{ rvm1_rubies }}'
|
36
|
+
changed_when: False
|
37
|
+
register: ruby_patch
|
38
|
+
always_run: yes # Run even when in --check mode (http://docs.ansible.com/ansible/playbooks_checkmode.html)
|
39
|
+
become: yes
|
40
|
+
become_user: '{{ rvm1_user }}'
|
41
|
+
|
42
|
+
- name: Install bundler if not installed
|
43
|
+
shell: >
|
44
|
+
ls {{ rvm1_install_path }}/wrappers/{{ item.stdout }}
|
45
|
+
| if ! grep "^bundler " ; then {{ rvm1_install_path }}/wrappers/{{ item.stdout }}/gem install bundler ; fi
|
46
|
+
args:
|
47
|
+
creates: '{{ rvm1_install_path }}/wrappers/{{ item.stdout }}/bundler'
|
48
|
+
with_items: '{{ ruby_patch.results }}'
|
49
|
+
register: bundler_install
|
50
|
+
changed_when: '"Successfully installed bundler" in bundler_install.stdout'
|
51
|
+
become: yes
|
52
|
+
become_user: '{{ rvm1_user }}'
|
53
|
+
|
54
|
+
- name: Symlink ruby related binaries on the system path
|
55
|
+
file:
|
56
|
+
state: 'link'
|
57
|
+
src: '{{ rvm1_install_path }}/wrappers/default/{{ item }}'
|
58
|
+
dest: '{{ rvm1_symlink_to }}/{{ item }}'
|
59
|
+
owner: 'root'
|
60
|
+
group: 'root'
|
61
|
+
when: not '--user-install' in rvm1_install_flags
|
62
|
+
with_items: '{{ rvm1_symlink_binaries }}'
|
63
|
+
|
64
|
+
- name: Detect if ruby version can be deleted
|
65
|
+
command: '{{ rvm1_rvm }} {{ rvm1_delete_ruby }} do true'
|
66
|
+
changed_when: False
|
67
|
+
failed_when: False
|
68
|
+
register: detect_delete_ruby
|
69
|
+
when: rvm1_delete_ruby
|
70
|
+
become: yes
|
71
|
+
become_user: '{{ rvm1_user }}'
|
72
|
+
|
73
|
+
- name: Delete ruby version
|
74
|
+
command: '{{ rvm1_rvm }} remove {{ rvm1_delete_ruby }}'
|
75
|
+
changed_when: False
|
76
|
+
when: rvm1_delete_ruby and detect_delete_ruby.rc == 0
|
77
|
+
become: yes
|
78
|
+
become_user: '{{ rvm1_user }}'
|