poise-ruby 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +11 -0
  3. data/.kitchen.travis.yml +9 -0
  4. data/.kitchen.yml +9 -0
  5. data/.travis.yml +20 -0
  6. data/.yardopts +7 -0
  7. data/Berksfile +28 -0
  8. data/Gemfile +33 -0
  9. data/LICENSE +201 -0
  10. data/README.md +290 -0
  11. data/Rakefile +17 -0
  12. data/chef/attributes/default.rb +23 -0
  13. data/chef/recipes/default.rb +19 -0
  14. data/lib/poise_ruby.rb +24 -0
  15. data/lib/poise_ruby/cheftie.rb +18 -0
  16. data/lib/poise_ruby/error.rb +21 -0
  17. data/lib/poise_ruby/resources.rb +29 -0
  18. data/lib/poise_ruby/resources/bundle_install.rb +221 -0
  19. data/lib/poise_ruby/resources/ruby_execute.rb +91 -0
  20. data/lib/poise_ruby/resources/ruby_gem.rb +118 -0
  21. data/lib/poise_ruby/resources/ruby_runtime.rb +87 -0
  22. data/lib/poise_ruby/ruby_command_mixin.rb +59 -0
  23. data/lib/poise_ruby/ruby_providers.rb +32 -0
  24. data/lib/poise_ruby/ruby_providers/base.rb +116 -0
  25. data/lib/poise_ruby/ruby_providers/chef.rb +53 -0
  26. data/lib/poise_ruby/ruby_providers/scl.rb +77 -0
  27. data/lib/poise_ruby/ruby_providers/system.rb +115 -0
  28. data/lib/poise_ruby/version.rb +20 -0
  29. data/poise-ruby.gemspec +41 -0
  30. data/test/cookbooks/poise-ruby_test/metadata.rb +18 -0
  31. data/test/cookbooks/poise-ruby_test/recipes/bundle_install.rb +102 -0
  32. data/test/cookbooks/poise-ruby_test/recipes/default.rb +85 -0
  33. data/test/gemfiles/chef-12.gemfile +19 -0
  34. data/test/gemfiles/master.gemfile +23 -0
  35. data/test/integration/default/serverspec/bundle_install_spec.rb +73 -0
  36. data/test/integration/default/serverspec/default_spec.rb +46 -0
  37. data/test/spec/resources/bundle_install_spec.rb +306 -0
  38. data/test/spec/resources/ruby_execute_spec.rb +78 -0
  39. data/test/spec/ruby_command_mixin_spec.rb +34 -0
  40. data/test/spec/spec_helper.rb +18 -0
  41. metadata +155 -0
@@ -0,0 +1,78 @@
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
+ require 'spec_helper'
18
+
19
+ describe PoiseRuby::Resources::RubyExecute do
20
+ describe PoiseRuby::Resources::RubyExecute::Resource do
21
+ recipe do
22
+ ruby_execute 'myapp.rb'
23
+ end
24
+
25
+ it { is_expected.to run_ruby_execute('myapp.rb') }
26
+ end
27
+
28
+ describe PoiseRuby::Resources::RubyExecute::Provider do
29
+ let(:command) { nil }
30
+ let(:environment) { nil }
31
+ let(:ruby) { '/ruby' }
32
+ let(:parent_ruby) { nil }
33
+ let(:parent_bundle) { nil }
34
+ let(:new_resource) do
35
+ double('new_resource',
36
+ command: command,
37
+ environment: environment,
38
+ ruby: ruby,
39
+ parent_ruby: parent_ruby,
40
+ parent_bundle: parent_bundle,
41
+ )
42
+ end
43
+ subject { described_class.new(new_resource, nil) }
44
+
45
+ context 'string command' do
46
+ let(:command) { 'myapp.rb' }
47
+ its(:command) { is_expected.to eq '/ruby myapp.rb' }
48
+ its(:environment) { is_expected.to eq({}) }
49
+ end # /context string command
50
+
51
+ context 'array command' do
52
+ let(:command) { %w{myapp.rb} }
53
+ its(:command) { is_expected.to eq %w{/ruby myapp.rb} }
54
+ its(:environment) { is_expected.to eq({}) }
55
+ end # /context array command
56
+
57
+ context 'with a bundle parent' do
58
+ let(:command) { 'myapp.rb' }
59
+ let(:parent_bundle) { double('parent_bundle', bundler_binary: '/bundle', gemfile_path: '/srv/Gemfile') }
60
+ its(:command) { is_expected.to eq '/ruby /bundle exec myapp.rb' }
61
+ its(:environment) { is_expected.to eq({'BUNDLE_GEMFILE' => '/srv/Gemfile'}) }
62
+ end # /context with a bundle parent
63
+
64
+ context 'with a bundle parent and an array command' do
65
+ let(:command) { %w{myapp.rb} }
66
+ let(:parent_bundle) { double('parent_bundle', bundler_binary: '/bundle', gemfile_path: '/srv/Gemfile') }
67
+ its(:command) { is_expected.to eq %w{/ruby /bundle exec myapp.rb} }
68
+ its(:environment) { is_expected.to eq({'BUNDLE_GEMFILE' => '/srv/Gemfile'}) }
69
+ end # /context with a bundle parent and an array command
70
+
71
+ context 'with a ruby parent' do
72
+ let(:command) { 'myapp.rb' }
73
+ let(:parent_ruby) { double('parent_ruby', ruby_environment: {'PATH' => '/bin'}) }
74
+ its(:command) { is_expected.to eq '/ruby myapp.rb' }
75
+ its(:environment) { is_expected.to eq({'PATH' => '/bin'}) }
76
+ end # /context with a ruby parent
77
+ end
78
+ end
@@ -0,0 +1,34 @@
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
+ require 'spec_helper'
18
+
19
+ describe PoiseRuby::RubyCommandMixin do
20
+ describe PoiseRuby::RubyCommandMixin::Resource do
21
+ resource(:poise_test) do
22
+ include described_class
23
+ end
24
+ subject { resource(:poise_test).new('test', nil) }
25
+
26
+ it { is_expected.to respond_to :parent_ruby }
27
+ it { is_expected.to respond_to :ruby }
28
+ it { is_expected.to respond_to :gem_binary }
29
+ it { expect(subject.respond_to?(:ruby_from_parent, true)).to be true }
30
+ end # /describe PoiseRuby::RubyCommandMixin::Resource
31
+
32
+ describe PoiseRuby::RubyCommandMixin::Provider do
33
+ end # /describe PoiseRuby::RubyCommandMixin::Provider
34
+ end
@@ -0,0 +1,18 @@
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
+ require 'poise_boiler/spec_helper'
18
+ require 'poise_ruby'
metadata ADDED
@@ -0,0 +1,155 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: poise-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Noah Kantrowitz
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: halite
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: poise
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: poise-languages
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.pre
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.pre
55
+ - !ruby/object:Gem::Dependency
56
+ name: poise-boiler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ description: A Chef cookbook for managing Ruby installations.
70
+ email:
71
+ - noah@coderanger.net
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".kitchen.travis.yml"
78
+ - ".kitchen.yml"
79
+ - ".travis.yml"
80
+ - ".yardopts"
81
+ - Berksfile
82
+ - Gemfile
83
+ - LICENSE
84
+ - README.md
85
+ - Rakefile
86
+ - chef/attributes/default.rb
87
+ - chef/recipes/default.rb
88
+ - lib/poise_ruby.rb
89
+ - lib/poise_ruby/cheftie.rb
90
+ - lib/poise_ruby/error.rb
91
+ - lib/poise_ruby/resources.rb
92
+ - lib/poise_ruby/resources/bundle_install.rb
93
+ - lib/poise_ruby/resources/ruby_execute.rb
94
+ - lib/poise_ruby/resources/ruby_gem.rb
95
+ - lib/poise_ruby/resources/ruby_runtime.rb
96
+ - lib/poise_ruby/ruby_command_mixin.rb
97
+ - lib/poise_ruby/ruby_providers.rb
98
+ - lib/poise_ruby/ruby_providers/base.rb
99
+ - lib/poise_ruby/ruby_providers/chef.rb
100
+ - lib/poise_ruby/ruby_providers/scl.rb
101
+ - lib/poise_ruby/ruby_providers/system.rb
102
+ - lib/poise_ruby/version.rb
103
+ - poise-ruby.gemspec
104
+ - test/cookbooks/poise-ruby_test/metadata.rb
105
+ - test/cookbooks/poise-ruby_test/recipes/bundle_install.rb
106
+ - test/cookbooks/poise-ruby_test/recipes/default.rb
107
+ - test/docker/docker.ca
108
+ - test/docker/docker.pem
109
+ - test/gemfiles/chef-12.gemfile
110
+ - test/gemfiles/master.gemfile
111
+ - test/integration/default/serverspec/bundle_install_spec.rb
112
+ - test/integration/default/serverspec/default_spec.rb
113
+ - test/spec/resources/bundle_install_spec.rb
114
+ - test/spec/resources/ruby_execute_spec.rb
115
+ - test/spec/ruby_command_mixin_spec.rb
116
+ - test/spec/spec_helper.rb
117
+ homepage: https://github.com/poise/poise-ruby
118
+ licenses:
119
+ - Apache 2.0
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.4.8
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: A Chef cookbook for managing Ruby installations.
141
+ test_files:
142
+ - test/cookbooks/poise-ruby_test/metadata.rb
143
+ - test/cookbooks/poise-ruby_test/recipes/bundle_install.rb
144
+ - test/cookbooks/poise-ruby_test/recipes/default.rb
145
+ - test/docker/docker.ca
146
+ - test/docker/docker.pem
147
+ - test/gemfiles/chef-12.gemfile
148
+ - test/gemfiles/master.gemfile
149
+ - test/integration/default/serverspec/bundle_install_spec.rb
150
+ - test/integration/default/serverspec/default_spec.rb
151
+ - test/spec/resources/bundle_install_spec.rb
152
+ - test/spec/resources/ruby_execute_spec.rb
153
+ - test/spec/ruby_command_mixin_spec.rb
154
+ - test/spec/spec_helper.rb
155
+ has_rdoc: