chef_instance 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7afd8dd840314bbff2c9d6dd53d9cf4d92ec8a01
4
- data.tar.gz: 9e35d4d45f34dae440528872aabf49a77bf5bc10
3
+ metadata.gz: c6de492e79f481d20b71d57ff7569c8e3f43e44d
4
+ data.tar.gz: 978812a107552cf7dec8a5aba66fcedebf170628
5
5
  SHA512:
6
- metadata.gz: 318941d2427b7659b10a6e86d17ce4ca1cf7fb0de4e43f200cf53f3e60dfff0ffcf34c7036c412f6b398cb86e288a13765ad288c5caf4ed589916649e03f584e
7
- data.tar.gz: 1e3bda52054a264a8f8e4136e23fba8c18c2cbdebc1fc6f4a34fbdeab5c4ba7a11e133d1ed649fb1491bc4d9ec46c3233c384df384640a66cfbf55cc1679faeb
6
+ metadata.gz: d032245fde3d21920e8c4528a713e73b2d9da30f6a075667db5e30f3e26e97d80783f3783cfbcfa9d243a0331ed51a00f9d10db8c187bcceb3de20ce905dab4a
7
+ data.tar.gz: b3d1ebcc1515504e3c0d123d00e2d0acf4ecd83f3983965f5e84c375ef8ad54a00ac2dda9c7c80ff06b7c29488d344ed32cb39cf0a5732eb585113b35757415f
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  .inch
5
5
  .yardoc
6
6
  *.lock
7
+ .vagrant
7
8
  coverage
8
9
  doc
9
10
  chef_instance-*.gem
@@ -6,7 +6,8 @@ Gem::Specification.new do |spec|
6
6
  spec.version = ChefInstance::VERSION
7
7
  spec.authors = ['Miah Johnson']
8
8
  spec.email = %w(miah@chia-pet.org)
9
- spec.description = IO.read(File.join(File.dirname(__FILE__), 'README.md'))
9
+ spec.description = 'A super class and utility objects to create' \
10
+ ' stand-alone instances of software.'
10
11
  spec.summary = 'Chef Resource & Provider Super Classes for' \
11
12
  'building stand-alone instances of software.'
12
13
  spec.homepage = 'https://gitlab.com/viscera/chef_instance'
@@ -20,10 +20,8 @@ module ChefInstance
20
20
  end
21
21
 
22
22
  # Determines the state of the resource _currently_
23
- # @return [Resource] @current_resource with name of @new_resource
23
+ # @return [TrueClass] This must be overridden in subclasses.
24
24
  def load_current_resource
25
- @current_resource = Chef::Resource::Instance.new(
26
- @new_resource, @run_context)
27
25
  end
28
26
 
29
27
  # Installs the `install_type`
@@ -1,5 +1,5 @@
1
1
  module ChefInstance
2
2
  # The version of the chef_instance library.
3
3
  # This is semver
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -0,0 +1,42 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
5
+ VAGRANTFILE_API_VERSION = '2'
6
+ ENV.delete('SSH_AUTH_SOCK')
7
+
8
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
9
+ # All Vagrant configuration is done here. The most common configuration
10
+ # options are documented and commented below. For a complete reference,
11
+ # please see the online documentation at vagrantup.com.
12
+
13
+ # Every Vagrant virtual environment requires a box to build off of.
14
+ config.vm.box = 'opscode-ubuntu-14.04'
15
+
16
+ # Provider-specific configuration so you can fine-tune various
17
+ # backing providers for Vagrant. These expose provider-specific options.
18
+ # Example for VirtualBox:
19
+ #
20
+ config.vm.provider 'virtualbox' do |vb|
21
+ vb.customize ['modifyvm', :id, '--memory', '1024']
22
+ end
23
+
24
+ config.vm.provision :shell,
25
+ inline: 'sudo apt-get -qqy update'
26
+
27
+ config.vm.provision :shell,
28
+ inline: 'sudo apt-get -qqy install curl'
29
+
30
+ config.vm.provision :shell,
31
+ inline: 'curl -sL' \
32
+ ' https://www.getchef.com/chef/install.sh' \
33
+ ' | sudo bash'
34
+ config.vm.provision :shell,
35
+ inline: 'sudo /opt/chef/embedded/bin/gem' \
36
+ ' install chef_instance'
37
+
38
+ config.vm.provision :chef_solo do |chef|
39
+ chef.cookbooks_path = './cookbooks'
40
+ chef.add_recipe 'exercise::aerobics'
41
+ end
42
+ end
@@ -0,0 +1,12 @@
1
+ require 'chef_instance/provider_instance'
2
+
3
+ class Chef
4
+ class Provider
5
+ # A simple exercise provider.
6
+ class ExerciseProvider < ChefInstance::Provider::Instance
7
+ def initialize(new_resource, run_context = nil)
8
+ super
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ require 'chef_instance/resource_instance'
2
+
3
+ class Chef
4
+ class Resource
5
+ # A simple exercise resource.
6
+ class ExerciseInstance < ChefInstance::Resource::Instance
7
+ def initialize(new_resource, run_context = nil)
8
+ super
9
+ @resource_name = :exercise_instance
10
+ @provider = Chef::Provider::ExerciseProvider
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,6 @@
1
+ name 'exercise'
2
+ maintainer 'Miah Johnson'
3
+ maintainer_email 'miah@chia-pet.org'
4
+ license 'Apache-2.0'
5
+ description 'A test library resource provider and cookbook.'
6
+ version '0.1.0'
@@ -0,0 +1,4 @@
1
+ include_recipe 'exercise::package_runit'
2
+ include_recipe 'exercise::package_service'
3
+ include_recipe 'exercise::existing_runit'
4
+ include_recipe 'exercise::existing_service'
@@ -0,0 +1,7 @@
1
+
2
+ exercise_instance 'sshd' do
3
+ install_type :existing
4
+ service_type :runit
5
+ install_options {}
6
+ service_options {}
7
+ end
@@ -0,0 +1,7 @@
1
+
2
+ exercise_instance 'nc' do
3
+ install_type :existing
4
+ service_type :init
5
+ install_options {}
6
+ service_options {}
7
+ end
@@ -0,0 +1,7 @@
1
+
2
+ exercise_instance 'postfix' do
3
+ install_type :package
4
+ service_type :init
5
+ install_options {}
6
+ service_options {}
7
+ end
@@ -0,0 +1,7 @@
1
+
2
+ exercise_instance 'apache2' do
3
+ install_type :package
4
+ service_type :runit
5
+ install_options {}
6
+ service_options {}
7
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef_instance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miah Johnson
@@ -130,98 +130,8 @@ dependencies:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
132
  version: 0.8.7.3
133
- description: |
134
- # chef_instance
135
-
136
- ## Why
137
-
138
- What is our goal when we install a piece of daemonized software? Why does the
139
- minutia of configuration concern us so greatly? Do we really want to emulate
140
- shell scripts in a recipe and end up with hundreds of random resources on our node?
141
- Why do I even care about resources on my node?
142
-
143
- Before I answer those questions lets get back to our goal, which was?
144
-
145
- Goal: A unique instance of a daemon with our supplied configuration.
146
-
147
- ## Usage
148
-
149
- ```
150
- # In this hypothetical instance we have a 'pie' daemon named 'pumpkin' that stores
151
- # pies recieved on port 314. We may want to run another instance called 'pecan' on
152
- # a different port that receives different types of pies.
153
- # htce::default.rb
154
- pie_instance 'pumpkin' do
155
- # File owner and group.
156
- # Daemon user and group.
157
- user 'pumpkin'
158
- group 'pies'
159
- # creates `/opt/pies/pumpkins` then stores all config and runtime data.
160
- root_path '/opt/pies'
161
- service_options({
162
- port: 314,
163
- store_pies: true,
164
- daemon_args: %w(-Tsteaming -Sdelicious)
165
- })
166
- end
167
- ```
168
-
169
- ## How it works
170
-
171
- Provides resource provider super classes for building instances of software.
172
-
173
- ```
174
- class Chef
175
- class Resource
176
- class Daemon < Chef::Resource::Instance
177
- end
178
- end
179
- end
180
- ```
181
-
182
- Ignores system defaults (configuration, initscripts, etc).
183
-
184
- ## Installation
185
-
186
- Because of Ruby library load race conditions with Chef and Gems you need to ensure that `chef_instance` is
187
- installed before you execute Chef.
188
-
189
- This can be achieved by:
190
-
191
- - Install the Chef (through the Omnibus, or however you do it).
192
- - Install `chef_instance` into the Ruby system used by Chef. If you used Omnibus you'll need to use the `gem`
193
- command provided in `/opt/chef/embedded/bin`
194
-
195
- ## Code Style
196
-
197
- This code follows the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) and all contributions should as well.
198
-
199
- The code style is checked by [Rubocop](http://batsov.com/rubocop/) and can be checked by executing `rake test:rubocop` or `rubocop`.
200
-
201
- [![Build Status](https://travis-ci.org/miah/chef_instance.png?branch=master)](https://travis-ci.org/miah/chef_instance)
202
- [![Code Climate](https://codeclimate.com/github/miah/chef_instance.png)](https://codeclimate.com/github/miah/chef_instance)
203
- [![Code Climate Coverage](https://codeclimate.com/github/miah/chef_instance/coverage.png)](https://codeclimate.com/github/miah/chef_instance)
204
- [![Dependency Status](https://gemnasium.com/miah/chef_instance.svg)](https://gemnasium.com/miah/chef_instance)
205
-
206
- # Author
207
-
208
- Author:: Miah Johnson (<miah@chia-pet.org>)
209
-
210
- # License
211
-
212
- Copyright 2013 Miah Johnson
213
-
214
- Licensed under the Apache License, Version 2.0 (the "License");
215
- you may not use this file except in compliance with the License.
216
- You may obtain a copy of the License at
217
-
218
- http://www.apache.org/licenses/LICENSE-2.0
219
-
220
- Unless required by applicable law or agreed to in writing, software
221
- distributed under the License is distributed on an "AS IS" BASIS,
222
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
223
- See the License for the specific language governing permissions and
224
- limitations under the License.
133
+ description: A super class and utility objects to create stand-alone instances of
134
+ software.
225
135
  email:
226
136
  - miah@chia-pet.org
227
137
  executables: []
@@ -247,6 +157,15 @@ files:
247
157
  - lib/chef_instance/service/init.rb
248
158
  - lib/chef_instance/service/runit.rb
249
159
  - lib/chef_instance/version.rb
160
+ - test/convergence/Vagrantfile
161
+ - test/convergence/cookbooks/exercise/libraries/exercise_provider.rb
162
+ - test/convergence/cookbooks/exercise/libraries/exercise_resource.rb
163
+ - test/convergence/cookbooks/exercise/metadata.rb
164
+ - test/convergence/cookbooks/exercise/recipes/aerobics.rb
165
+ - test/convergence/cookbooks/exercise/recipes/existing_runit.rb
166
+ - test/convergence/cookbooks/exercise/recipes/existing_service.rb
167
+ - test/convergence/cookbooks/exercise/recipes/package_runit.rb
168
+ - test/convergence/cookbooks/exercise/recipes/package_service.rb
250
169
  - test/spec/install/existing_spec.rb
251
170
  - test/spec/install/package_spec.rb
252
171
  - test/spec/install_spec.rb
@@ -282,6 +201,15 @@ specification_version: 4
282
201
  summary: Chef Resource & Provider Super Classes forbuilding stand-alone instances
283
202
  of software.
284
203
  test_files:
204
+ - test/convergence/Vagrantfile
205
+ - test/convergence/cookbooks/exercise/libraries/exercise_provider.rb
206
+ - test/convergence/cookbooks/exercise/libraries/exercise_resource.rb
207
+ - test/convergence/cookbooks/exercise/metadata.rb
208
+ - test/convergence/cookbooks/exercise/recipes/aerobics.rb
209
+ - test/convergence/cookbooks/exercise/recipes/existing_runit.rb
210
+ - test/convergence/cookbooks/exercise/recipes/existing_service.rb
211
+ - test/convergence/cookbooks/exercise/recipes/package_runit.rb
212
+ - test/convergence/cookbooks/exercise/recipes/package_service.rb
285
213
  - test/spec/install/existing_spec.rb
286
214
  - test/spec/install/package_spec.rb
287
215
  - test/spec/install_spec.rb
metadata.gz.sig CHANGED
Binary file