berkshelf-solo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +4 -0
- data/Rakefile +19 -0
- data/lib/berkshelf/solo/version.rb +5 -0
- data/lib/berkshelf/solo.rb +85 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 25f56005c305a9338010d5345de97dea117f910d
|
4
|
+
data.tar.gz: ad64806f3c518daacd7e190802d54bdfdf8dadfa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0558fed1bbe14ce71851dc932073ced54f683ef29ac1b196fb155aec07307ba836f2802760347a7428a327456e8616ab49f772f5cf2be4f6820aa40317e383db
|
7
|
+
data.tar.gz: 248abebed963c913d97f89c7c793c00e57d30d1ba7b2aabe28ee8230c5dc5adf7531e421611fedd329fcfcb6493c9524c62dffcab5058391d476efaf860e524c
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$:.unshift File.expand_path '../lib', __FILE__
|
2
|
+
require 'berkshelf/solo'
|
3
|
+
require 'rake'
|
4
|
+
require 'rubygems/package_task'
|
5
|
+
require "rake/testtask"
|
6
|
+
|
7
|
+
Gem::PackageTask.new(eval File.read('berkshelf-solo.gemspec')) do |pkg|
|
8
|
+
pkg.need_zip = false
|
9
|
+
pkg.need_tar = false
|
10
|
+
end
|
11
|
+
|
12
|
+
task :build => [:compile] do
|
13
|
+
`rake gem`
|
14
|
+
end
|
15
|
+
|
16
|
+
task :install => [:build] do
|
17
|
+
sh "gem install pkg/berkshelf-solo"
|
18
|
+
Rake::Task['clobber_package'].execute
|
19
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'berkshelf'
|
2
|
+
require 'berkshelf/dependency'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Berkshelf
|
7
|
+
module Solo
|
8
|
+
class Runner
|
9
|
+
|
10
|
+
Berkshelf::Dependency.add_valid_option :recipes
|
11
|
+
|
12
|
+
def initialize dependencies, cookbook_path
|
13
|
+
@dependencies = dependencies
|
14
|
+
@options = get_options cookbook_path
|
15
|
+
@solo_config = { "run_list" => [] }.merge load_solo_config
|
16
|
+
end
|
17
|
+
|
18
|
+
attr_reader :options, :dependencies, :solo_config
|
19
|
+
|
20
|
+
def run
|
21
|
+
[
|
22
|
+
:cookbook_path,
|
23
|
+
:roles_path,
|
24
|
+
:environments_path,
|
25
|
+
:data_bags_path
|
26
|
+
].map(&options.method(:fetch)).map(&FileUtils.method(:mkdir_p))
|
27
|
+
|
28
|
+
dependencies.each do |name, opt|
|
29
|
+
solo_config["run_list"] += (opt[:recipes] || ['default']).map {|o| "recipe[#{name}::#{o}]"}
|
30
|
+
end
|
31
|
+
solo_config["run_list"].uniq!
|
32
|
+
|
33
|
+
File.open(options[:solo_config_path],'w') { |f| f.puts JSON.pretty_generate(solo_config) }
|
34
|
+
File.open(options[:solo_config_rb_path],'w') { |f| f.puts solo_config_rb }
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def load_solo_config
|
40
|
+
JSON.parse(File.read(options[:solo_config_path])) rescue Hash.new
|
41
|
+
end
|
42
|
+
|
43
|
+
def solo_config_rb
|
44
|
+
<<-TEXT.gsub(/^\s+/,'')
|
45
|
+
file_cache_path File.expand_path(File.dirname(__FILE__))
|
46
|
+
cookbook_path File.expand_path('../#{File.basename(options[:cookbook_path])}',__FILE__)
|
47
|
+
role_path File.expand_path('../roles',__FILE__)
|
48
|
+
environment_path File.expand_path('../environments',__FILE__)
|
49
|
+
data_bag_path File.expand_path('../data_bags',__FILE__)
|
50
|
+
solo true
|
51
|
+
TEXT
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_options cookbook_path
|
55
|
+
base = File.expand_path('..',cookbook_path)
|
56
|
+
{
|
57
|
+
:path => base,
|
58
|
+
:cookbook_path => File.expand_path(cookbook_path),
|
59
|
+
:roles_path => File.join(base,'roles'),
|
60
|
+
:solo_config_path => File.join(base,'solo.json'),
|
61
|
+
:solo_config_rb_path => File.join(base,'solo.rb'),
|
62
|
+
:environments_path => File.join(base,'environments'),
|
63
|
+
:data_bags_path => File.join(base,'data_bags')
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
set_trace_func proc { |_,file,_,_,binding,_|
|
72
|
+
if file =~ /Berksfile/i and ARGV.include? "vendor"
|
73
|
+
cookbook_path = ARGV[ARGV.index('vendor')+1]
|
74
|
+
FileUtils.mkdir_p(File.expand_path('..',cookbook_path))
|
75
|
+
Kernel.at_exit {
|
76
|
+
dependencies = Hash[
|
77
|
+
eval("@instance",binding).instance_variable_get(:@dependencies).map { |name, dep|
|
78
|
+
[name, dep.instance_variable_get(:@options)]
|
79
|
+
}
|
80
|
+
]
|
81
|
+
Berkshelf::Solo::Runner.new(dependencies,cookbook_path).run
|
82
|
+
}
|
83
|
+
set_trace_func(nil)
|
84
|
+
end
|
85
|
+
}
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: berkshelf-solo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eran Barak Levi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: minitest
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.0.0
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mocha
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.14.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.14.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: berkshelf
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0.beta2
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0.beta2
|
55
|
+
description: Makes Berkshelf more friendly to chef-solo by generating chef-solo folder
|
56
|
+
layout
|
57
|
+
email: eran@kontera.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- lib/berkshelf/solo/version.rb
|
65
|
+
- lib/berkshelf/solo.rb
|
66
|
+
homepage: http://www.kontera.com
|
67
|
+
licenses: []
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.9.1
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project: berkshelf-solo
|
85
|
+
rubygems_version: 2.0.3
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Makes Berkshelf more friendly to chef-solo
|
89
|
+
test_files: []
|