busser 0.5.0 → 0.6.0.beta.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: 56c3602ee860ebf5588118323c225a1422f39266
4
- data.tar.gz: 231ce785a23762ebb5df63fd166ac141f8ad4bdf
3
+ metadata.gz: 9a782f54c494ef115c46f5eb93a425ab68fa0a66
4
+ data.tar.gz: db0848cdaf0125f4278ca07235a1e17622e029d6
5
5
  SHA512:
6
- metadata.gz: ecdaa8ecd9ee5da43847c1854bbd89daf83c7827c59868c789516981b673dde52aa348eaf7d91eee4bb4ef56b06b5133d40df83a227bc1de00fe8516df3e183e
7
- data.tar.gz: d38795cb52d203f591cbec7e5d9b1805e05eb804871bde50e5829dba84df7913116c716b90efa5eb16dcda686886109a4ad44266ebac35e9407c62f5720f99dc
6
+ metadata.gz: 1c5dc8dab0ae8e6c2a9308b0672840ff2a7b3f02ea48c34c6c16163ca33b79810cc5e882251158d97fa26f44f4ef5c6107baf5f16da8c150b378b7414cb770bf
7
+ data.tar.gz: 8ea4c37df7a079eba2c40466702c7ac1314255ba83e3be2c0964b59617d4c0bc6c50e5447b037b65d8631857a2094ab7443182d8d2f961fce1d5975dc3435783
@@ -68,8 +68,9 @@ module Busser
68
68
  prepare_recipe = suite_path(runner).join("prepare_recipe.rb")
69
69
 
70
70
  if prepare_recipe.exist?
71
- banner "Preparing #{runner} suite with #{prepare_recipe}"
72
- chef_apply(:file => prepare_recipe)
71
+ warn "Apologies, but Busser no longer supports the" +
72
+ " prepare_recipe.rb file. Please use prepare.sh and optionally" +
73
+ " shell out to chef-apply in an Omnibus installtion."
73
74
  end
74
75
  end
75
76
  end
@@ -47,8 +47,10 @@ module Busser
47
47
  end
48
48
 
49
49
  def chef_apply(config = {}, &block)
50
- require 'busser/chef_apply'
51
- ChefApply.new(config, &block).converge
50
+ warn "Apologies, but Busser no longer supports the chef_apply helper," +
51
+ " so the contents of this block will not be exectued. Please refactor" +
52
+ " your code to use Thor actions, shell out commands or another" +
53
+ " strategy"
52
54
  end
53
55
 
54
56
  def install_gem(gem, version = nil)
@@ -29,17 +29,9 @@ class Busser::RunnerPlugin::Dummy < Busser::RunnerPlugin::Base
29
29
  # use.
30
30
  #
31
31
  postinstall do
32
- # ensure that dummy_path gets pulled into the chef_apply block closure,
33
- # otherwise the Chef will not understand dummy_path in its run context
34
32
  dummy_path = suite_path("dummy").to_s
35
33
 
36
- # expensive operation delegating a directory creation to Chef, but imagine
37
- # using resources such as package, remote_file, etc.
38
- chef_apply do
39
- directory(dummy_path) { recursive true }
40
- end
41
-
42
- # create a dummy file
34
+ empty_directory(dummy_path)
43
35
  create_file("#{dummy_path}/foobar.txt", "The Dummy Driver.")
44
36
  end
45
37
 
@@ -17,5 +17,5 @@
17
17
  # limitations under the License.
18
18
 
19
19
  module Busser
20
- VERSION = "0.5.0"
20
+ VERSION = "0.6.0.beta.1"
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: busser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -208,8 +208,6 @@ files:
208
208
  - features/suite_path_command.feature
209
209
  - features/support/env.rb
210
210
  - lib/busser.rb
211
- - lib/busser/chef_apply.rb
212
- - lib/busser/chef_ext.rb
213
211
  - lib/busser/cli.rb
214
212
  - lib/busser/command/deserialize.rb
215
213
  - lib/busser/command/plugin.rb
@@ -266,9 +264,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
264
  version: 1.9.1
267
265
  required_rubygems_version: !ruby/object:Gem::Requirement
268
266
  requirements:
269
- - - '>='
267
+ - - '>'
270
268
  - !ruby/object:Gem::Version
271
- version: '0'
269
+ version: 1.3.1
272
270
  requirements: []
273
271
  rubyforge_project:
274
272
  rubygems_version: 2.0.3
@@ -1,108 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require 'busser/chef_ext'
20
-
21
- module Busser
22
-
23
- # A modified re-implementation of chef-apply which ships with Chef 11 gems.
24
- #
25
- # @author Fletcher Nichol <fnichol@nichol.ca>
26
- #
27
- class ChefApply
28
-
29
- def initialize(config = {}, &block)
30
- @config = { :why_run => false }.merge(config)
31
- @apply_block = block
32
-
33
- if ! config.has_key?(:file) && ! block_given?
34
- raise ArgumentError, ":file or block must be given"
35
- end
36
- end
37
-
38
- def converge
39
- as_solo do
40
- load_recipe
41
- Chef::Runner.new(run_context).converge
42
- end
43
- end
44
-
45
- private
46
-
47
- attr_reader :config, :apply_block
48
-
49
- COOKBOOK_NAME = "(chef-apply cookbook)".freeze
50
- COOKBOOK_RECIPE = "(chef-apply recipe)".freeze
51
-
52
- def as_solo
53
- log_level = Chef::Log.level
54
- solo_mode = Chef::Config[:solo]
55
- why_run = Chef::Config[:why_run]
56
-
57
- Chef::Log.level = chef_log_level
58
- Chef::Config[:solo] = true
59
- Chef::Config[:why_run] = config[:why_run]
60
- yield
61
- ensure
62
- Chef::Config[:why_run] = why_run
63
- Chef::Config[:solo] = solo_mode
64
- Chef::Log.level = log_level
65
- end
66
-
67
- def load_recipe
68
- recipe = Chef::Recipe.new(COOKBOOK_NAME, COOKBOOK_RECIPE, run_context)
69
-
70
- if config[:file]
71
- recipe.from_file(config[:file].to_s)
72
- else
73
- recipe.instance_eval(&apply_block)
74
- end
75
- end
76
-
77
- def run_context
78
- @run_context ||= begin
79
- if client.events.nil?
80
- Chef::RunContext.new(client.node, cookbook_collection)
81
- else
82
- Chef::RunContext.new(client.node, cookbook_collection, client.events)
83
- end
84
- end
85
- end
86
-
87
- def cookbook_collection
88
- @cookbook_collection ||= begin
89
- cookbook = Chef::CookbookVersion.new(COOKBOOK_NAME)
90
- Chef::CookbookCollection.new({ COOKBOOK_NAME => cookbook })
91
- end
92
- end
93
-
94
- def client
95
- @client ||= begin
96
- client = Chef::Client.new
97
- client.run_ohai
98
- client.load_node
99
- client.build_node
100
- client
101
- end
102
- end
103
-
104
- def chef_log_level
105
- (ENV['BUSSER_LOG_LEVEL'] && ENV['BUSSER_LOG_LEVEL'].to_sym) || :info
106
- end
107
- end
108
- end
@@ -1,52 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- #
3
- # Author:: Fletcher Nichol (<fnichol@nichol.ca>)
4
- #
5
- # Copyright (C) 2013, Fletcher Nichol
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
-
19
- require 'chef/client'
20
- require 'chef/providers'
21
- require 'chef/resources'
22
- require 'chef/cookbook_version'
23
-
24
- # Monkey patches to Chef core classes to allow for chef-apply functionality.
25
- class Chef
26
-
27
- # Backwards compatible shim for older Chef clients.
28
- class Client
29
- attr_reader :events
30
- end
31
-
32
- # Chef::CookbookVersion, monkey patched to use simpler file source
33
- # paths (always uses local files instead of manifest records).
34
- #
35
- # Implementation from the sandwich project at:
36
- # https://github.com/sometimesfood/sandwich
37
- #
38
- class CookbookVersion
39
- # Determines the absolute source filename on disk for various file
40
- # resources from their relative path
41
- #
42
- # @param [Chef::Node] node the node object, ignored
43
- # @param [Symbol] segment the segment of the current resource, ignored
44
- # @param [String] source the source file path
45
- # @param [String] target the target file path, ignored
46
- # @return [String] the preferred source filename
47
- def preferred_filename_on_disk_location(node, segment, source, target = nil)
48
- # keep absolute paths, convert relative paths into absolute paths
49
- source.start_with?('/') ? source : File.join(Dir.getwd, source)
50
- end
51
- end
52
- end