poise-ruby-build 1.0.0 → 1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/lib/poise_ruby/ruby_build/provider.rb +34 -44
- data/lib/poise_ruby/ruby_build/version.rb +1 -1
- data/poise-ruby-build.gemspec +1 -1
- data/test/cookbooks/poise-ruby-build_test/recipes/default.rb +4 -12
- data/test/integration/default/serverspec/Gemfile +19 -0
- data/test/integration/default/serverspec/default_spec.rb +3 -5
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a07eca70f6f3304b38de491b2126559cce39fdc
|
4
|
+
data.tar.gz: 33230f856c92200db06613fe73a23fa07290c168
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9737a634499b2f4235d298f5366e64dd3dacc0a6c20b12ac1b8dc3ba8c8b425e58a375e5fe3dc00f84ef9c00108a8cb4dbebba09e411eb68fff96f58fde2320
|
7
|
+
data.tar.gz: 369afe47117c8ea584f192fbc237d91e09d00416504d4dfcbb5dcb64a10c426fa2f48a99f23c4dc72eb075d2d54877930cb90aae40e809e3f59cf5038bd8b2f1
|
data/CHANGELOG.md
ADDED
@@ -43,47 +43,6 @@ module PoiseRuby
|
|
43
43
|
})
|
44
44
|
end
|
45
45
|
|
46
|
-
# `install` action for the `ruby_runtime` resource. Installs ruby-build
|
47
|
-
# and then uses that to install Ruby.
|
48
|
-
#
|
49
|
-
# @return [void]
|
50
|
-
def action_install
|
51
|
-
# We assume that if the version_file exists, ruby-build is already
|
52
|
-
# installed. Calling #ruby_definition will shell out to ruby-build.
|
53
|
-
if ::File.exists?(version_file) && IO.read(version_file) == ruby_definition
|
54
|
-
# All set, bail out.
|
55
|
-
return
|
56
|
-
end
|
57
|
-
|
58
|
-
converge_by("Installing Ruby #{options['version'].empty? ? new_resource.name : options['version']} via ruby-build") do
|
59
|
-
notifying_block do
|
60
|
-
create_prefix_directory
|
61
|
-
create_install_directory
|
62
|
-
create_builds_directory
|
63
|
-
install_ruby_build
|
64
|
-
install_dependencies
|
65
|
-
# Possible failed install or a version change. Wipe the existing build.
|
66
|
-
remove_ruby if ::File.exists?(::File.join(options['prefix'], 'builds', new_resource.name))
|
67
|
-
end
|
68
|
-
# Second converge has ruby-build installed so using #ruby_definition
|
69
|
-
# is safe.
|
70
|
-
notifying_block do
|
71
|
-
install_ruby
|
72
|
-
create_version_file
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# `uninstall` action for the `ruby_runtime` resource. Remove Ruby, but
|
78
|
-
# leave ruby-build installed as it may be shared by other resources.
|
79
|
-
#
|
80
|
-
# @return [void]
|
81
|
-
def action_uninstall
|
82
|
-
notifying_block do
|
83
|
-
remove_ruby
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
46
|
# Path to the compiled Ruby binary.
|
88
47
|
#
|
89
48
|
# @return [String]
|
@@ -118,6 +77,36 @@ module PoiseRuby
|
|
118
77
|
::File.join(options['prefix'], 'builds', new_resource.name, 'VERSION')
|
119
78
|
end
|
120
79
|
|
80
|
+
# Installs ruby-build and then uses that to install Ruby.
|
81
|
+
#
|
82
|
+
# @return [void]
|
83
|
+
def install_ruby
|
84
|
+
# We assume that if the version_file exists, ruby-build is already
|
85
|
+
# installed. Calling #ruby_definition will shell out to ruby-build.
|
86
|
+
if ::File.exists?(version_file) && IO.read(version_file) == ruby_definition
|
87
|
+
# All set, bail out.
|
88
|
+
return
|
89
|
+
end
|
90
|
+
|
91
|
+
converge_by("Installing Ruby #{options['version'].empty? ? new_resource.name : options['version']} via ruby-build") do
|
92
|
+
notifying_block do
|
93
|
+
create_prefix_directory
|
94
|
+
create_install_directory
|
95
|
+
create_builds_directory
|
96
|
+
install_ruby_build
|
97
|
+
install_dependencies
|
98
|
+
# Possible failed install or a version change. Wipe the existing build.
|
99
|
+
remove_ruby if ::File.exists?(::File.join(options['prefix'], 'builds', new_resource.name))
|
100
|
+
end
|
101
|
+
# Second converge has ruby-build installed so using #ruby_definition
|
102
|
+
# is safe.
|
103
|
+
notifying_block do
|
104
|
+
build_ruby
|
105
|
+
create_version_file
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
121
110
|
# Create the base prefix directory.
|
122
111
|
#
|
123
112
|
# @return [Chef::Resource::Directory]
|
@@ -185,7 +174,7 @@ module PoiseRuby
|
|
185
174
|
# Compile Ruby using ruby-build.
|
186
175
|
#
|
187
176
|
# @return [Chef::Resource::Execute]
|
188
|
-
def
|
177
|
+
def build_ruby
|
189
178
|
# Figure out the argument to disable docs
|
190
179
|
disable_docs = if options['install_doc']
|
191
180
|
nil
|
@@ -216,10 +205,11 @@ module PoiseRuby
|
|
216
205
|
end
|
217
206
|
end
|
218
207
|
|
219
|
-
# Delete the compiled Ruby
|
208
|
+
# Delete the compiled Ruby, but leave ruby-build installed as it may be
|
209
|
+
# shared by other resources.
|
220
210
|
#
|
221
211
|
# @return [Chef::Resource::Directory]
|
222
|
-
def
|
212
|
+
def uninstall_ruby
|
223
213
|
directory ::File.join(options['prefix'], 'builds', new_resource.name) do
|
224
214
|
action :delete
|
225
215
|
end
|
data/poise-ruby-build.gemspec
CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
spec.add_dependency 'halite', '~> 1.0'
|
37
37
|
spec.add_dependency 'poise', '~> 2.0'
|
38
|
-
spec.add_dependency 'poise-ruby', '~> 2.
|
38
|
+
spec.add_dependency 'poise-ruby', '~> 2.1'
|
39
39
|
|
40
40
|
spec.add_development_dependency 'poise-boiler', '~> 1.0'
|
41
41
|
|
@@ -14,17 +14,9 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
|
18
|
-
provider :ruby_build
|
19
|
-
end
|
17
|
+
require 'poise_ruby/resources/ruby_runtime_test'
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
mode '644'
|
25
|
-
content <<-EOH
|
26
|
-
IO.write(ARGV[0], RUBY_VERSION)
|
27
|
-
EOH
|
19
|
+
ruby_runtime_test 'ruby_build' do
|
20
|
+
version '2.2.2'
|
21
|
+
runtime_provider :ruby_build
|
28
22
|
end
|
29
|
-
|
30
|
-
ruby_execute '/root/poise_ruby_test.rb /root/one'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015, Noah Kantrowitz
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
source 'https://rubygems.org/'
|
18
|
+
|
19
|
+
gem 'poise-ruby-spechelper'
|
@@ -14,10 +14,8 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
-
require '
|
18
|
-
set :backend, :exec
|
17
|
+
require 'poise_ruby/spec_helper'
|
19
18
|
|
20
|
-
describe
|
21
|
-
|
22
|
-
its(:content) { are_expected.to eq '2.2.2' }
|
19
|
+
describe 'ruby_build provider' do
|
20
|
+
it_should_behave_like 'a ruby_runtime_test', 'ruby_build', '2.2.2'
|
23
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poise-ruby-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Kantrowitz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: '2.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: poise-boiler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,6 +79,7 @@ files:
|
|
79
79
|
- ".travis.yml"
|
80
80
|
- ".yardopts"
|
81
81
|
- Berksfile
|
82
|
+
- CHANGELOG.md
|
82
83
|
- Gemfile
|
83
84
|
- LICENSE
|
84
85
|
- README.md
|
@@ -95,6 +96,7 @@ files:
|
|
95
96
|
- test/docker/docker.pem
|
96
97
|
- test/gemfiles/chef-12.gemfile
|
97
98
|
- test/gemfiles/master.gemfile
|
99
|
+
- test/integration/default/serverspec/Gemfile
|
98
100
|
- test/integration/default/serverspec/default_spec.rb
|
99
101
|
- test/spec/provider_spec.rb
|
100
102
|
- test/spec/spec_helper.rb
|
@@ -130,6 +132,7 @@ test_files:
|
|
130
132
|
- test/docker/docker.pem
|
131
133
|
- test/gemfiles/chef-12.gemfile
|
132
134
|
- test/gemfiles/master.gemfile
|
135
|
+
- test/integration/default/serverspec/Gemfile
|
133
136
|
- test/integration/default/serverspec/default_spec.rb
|
134
137
|
- test/spec/provider_spec.rb
|
135
138
|
- test/spec/spec_helper.rb
|