cookbook-list-dependencies 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 647ab976cf834d13b2cb471f55753b52d2b4f73f
4
+ data.tar.gz: ac3a7256f94248e61c0a3efa5094544113acce3e
5
+ SHA512:
6
+ metadata.gz: 200c3141a519615f251bdaa636f27967a07d20367e354b8c13b7b28db0b1f4f61efdcf984676bbb609a068255b5986fa5af0aa6214d3ac79e4be79e01813ced3
7
+ data.tar.gz: e36426c1784dfa0796e01732510192f525eac258682fd01d898bcaa80dc321fb42d23176499a30d4bcd2a71ef7aefc5362be85031bd6b315c26caba5d45437c6
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cookbook-list-dependencies.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Azul
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,76 @@
1
+ Usage:
2
+
3
+ from a existing Top-Level application cookbook,
4
+
5
+ \>cat Berksfile
6
+ source 'https://supermarket.chef.io'
7
+
8
+ metadata
9
+
10
+ cookbook 'file',
11
+ git: 'git@github.com:jenssegers/chef-file.git'
12
+
13
+
14
+ Then vendor all the cookbooks used by this cookbook in /tmp/cookbooks
15
+
16
+ \>bundle exec berks vendor /tmp/cookbooks
17
+ Resolving cookbook dependencies...
18
+ Fetching 'myApp' from source at .
19
+ Using myApp (0.1.21) from source at .
20
+ Using apt (2.7.0)
21
+ Using chef-client (4.3.0)
22
+ Using chef-sugar (3.1.0)
23
+ Using chef_handler (1.1.6)
24
+ Using cron (1.6.1)
25
+ Using file (2.0.0) from git@github.com:jenssegers/chef-file.git (at master)
26
+ Using iptables (1.0.0)
27
+ Using java (1.31.0)
28
+ Using logrotate (1.9.1)
29
+ Using openssh (1.3.4)
30
+ Using rsyslog (1.15.0)
31
+ Using tar (0.6.0)
32
+ Using windows (1.36.6)
33
+ Using yum (3.6.0)
34
+ Vendoring myApp (0.1.21) to /tmp/cookbooks/myApp
35
+ Vendoring apt (2.7.0) to /tmp/cookbooks/apt
36
+ Vendoring chef-client (4.3.0) to /tmp/cookbooks/chef-client
37
+ Vendoring chef-sugar (3.1.0) to /tmp/cookbooks/chef-sugar
38
+ Vendoring chef_handler (1.1.6) to /tmp/cookbooks/chef_handler
39
+ Vendoring cron (1.6.1) to /tmp/cookbooks/cron
40
+ Vendoring file (2.0.0) to /tmp/cookbooks/file
41
+ Vendoring iptables (1.0.0) to /tmp/cookbooks/iptables
42
+ Vendoring java (1.31.0) to /tmp/cookbooks/java
43
+ Vendoring logrotate (1.9.1) to /tmp/cookbooks/logrotate
44
+ Vendoring openssh (1.3.4) to /tmp/cookbooks/openssh
45
+ Vendoring rsyslog (1.15.0) to /tmp/cookbooks/rsyslog
46
+ Vendoring tar (0.6.0) to /tmp/cookbooks/tar
47
+ Vendoring windows (1.36.6) to /tmp/cookbooks/windows
48
+ Vendoring yum (3.6.0) to /tmp/cookbooks/yum
49
+
50
+ and find out the exact list of versions being used by this top-level cookbook
51
+
52
+ \>cookbook-list-dependencies /tmp/cookbooks/ myApp
53
+ depends 'apt', '2.7.0'
54
+ depends 'chef-client', '4.3.0'
55
+ depends 'chef-sugar', '3.1.0'
56
+ depends 'cron', '1.6.1'
57
+ depends 'file', '2.0.0'
58
+ depends 'java', '1.31.0'
59
+ depends 'logrotate', '1.9.1'
60
+ depends 'openssh', '1.3.4'
61
+ depends 'rsyslog', '1.15.0'
62
+ depends 'tar', '0.6.0'
63
+ depends 'windows', '1.36.6'
64
+ depends 'yum', '3.6.0'
65
+
66
+ Then you can use these constrains in your application cookbook,
67
+
68
+ \>cookbook-list-dependencies /tmp/cookbooks myApp >> metadata.rb
69
+
70
+ Upload these cookbooks into your chef-server, use berkshelf or whatever
71
+ then constrain the environment for your top myApp cookbook.
72
+
73
+ Converge the node and the chef-client will download the cookbook MyApp and the metadata.rb constrained cookbooks
74
+
75
+
76
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "cookbook/list/dependencies"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ require 'json'
4
+
5
+ if ARGV[0].nil?
6
+ puts "Usage: cookbook-list-dependecies <cookbooks-path> <cookbook name>"
7
+ exit 1
8
+ end
9
+
10
+ cookbooks_path = ARGV[0].to_s
11
+ cookbook = ARGV[1].to_s
12
+
13
+ def get_version(cookbooks_path, cookbook)
14
+ f = File.read("#{cookbooks_path}/#{cookbook}/metadata.json")
15
+ version = JSON.parse(f)['version']
16
+ return "depends '#{cookbook}', '#{version}'"
17
+ end
18
+
19
+ def get_deps(cookbooks_path, cookbook)
20
+ dependencies = []
21
+ f = File.read("#{cookbooks_path}/#{cookbook}/metadata.json")
22
+ deps = JSON.parse(f)['dependencies']
23
+
24
+ deps.each do |k,v|
25
+ dependencies << k
26
+ end
27
+ return dependencies
28
+ end
29
+
30
+ dependencies= []
31
+ get_deps(cookbooks_path, cookbook).each do |top_dependency|
32
+ dependencies << get_version(cookbooks_path, top_dependency)
33
+ get_deps(cookbooks_path, cookbook).each do |middle_dependency|
34
+ dependencies << get_version(cookbooks_path, middle_dependency)
35
+ get_deps(cookbooks_path, middle_dependency).each do |dependency|
36
+ dependencies << get_version(cookbooks_path, dependency)
37
+ end
38
+ end
39
+ end
40
+
41
+ puts dependencies.sort.uniq
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cookbook/list/dependencies/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cookbook-list-dependencies"
8
+ spec.version = Cookbook::List::Dependencies::VERSION
9
+ spec.authors = ["Azul"]
10
+ spec.email = ["mail@azulinho.com"]
11
+
12
+ spec.summary = %q{Manage chef cookbook depencies}
13
+ spec.description = %q{Drills down into your cookbooks and lists all the dependencies they are using}
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.9"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "json", "~> 1.8"
24
+ end
@@ -0,0 +1,9 @@
1
+ require "cookbook/list/dependencies/version"
2
+
3
+ module Cookbook
4
+ module List
5
+ module Dependencies
6
+ # Your code goes here...
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Cookbook
2
+ module List
3
+ module Dependencies
4
+ VERSION = "1.1.0"
5
+ end
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cookbook-list-dependencies
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Azul
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: json
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.8'
55
+ description: Drills down into your cookbooks and lists all the dependencies they are
56
+ using
57
+ email:
58
+ - mail@azulinho.com
59
+ executables: []
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - cookbook-list-dependencies
71
+ - cookbook-list-dependencies.gemspec
72
+ - lib/cookbook/list/dependencies.rb
73
+ - lib/cookbook/list/dependencies/version.rb
74
+ homepage:
75
+ licenses:
76
+ - MIT
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.4.5
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Manage chef cookbook depencies
98
+ test_files: []