ridley 4.5.0 → 4.5.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4e00238e54e9232413052abc2f81f5ab712a2bd
|
4
|
+
data.tar.gz: 69cda3ec682d77f62c716c83717b904c928efcb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e3edc7d191b8d3d97874ba964158d09e0451ced2a61e4c48423b3c169c6ffa8909a27096b16a859de8ef71c1f7363da81237cd04cffbd57f15843ffef5b2f11
|
7
|
+
data.tar.gz: 31fdbcbbf0d04f1adbcd8fc2bbfb6d335f6b465969cdd9b3a7de22c034b1c0b0aadce205016c4959f95b03dfe34848df62b94c94547445a0b027ff459749987a
|
@@ -49,6 +49,10 @@ module Ridley::Chef
|
|
49
49
|
VERSION = 'version'.freeze
|
50
50
|
SOURCE_URL = 'source_url'.freeze
|
51
51
|
ISSUES_URL = 'issues_url'.freeze
|
52
|
+
PRIVACY = "privacy".freeze
|
53
|
+
CHEF_VERSIONS = "chef_versions".freeze
|
54
|
+
OHAI_VERSIONS = "ohai_versions".freeze
|
55
|
+
GEMS = "gems".freeze
|
52
56
|
|
53
57
|
COMPILED_FILE_NAME = "metadata.json".freeze
|
54
58
|
RAW_FILE_NAME = "metadata.rb".freeze
|
@@ -58,8 +62,8 @@ module Ridley::Chef
|
|
58
62
|
:maintainer_email, :license, :platforms, :dependencies,
|
59
63
|
:recommendations, :suggestions, :conflicting, :providing,
|
60
64
|
:replacing, :attributes, :groupings, :recipes, :version,
|
61
|
-
:source_url, :issues_url
|
62
|
-
|
65
|
+
:source_url, :issues_url, :privacy, :chef_versions, :ohai_versions,
|
66
|
+
:gems ]
|
63
67
|
|
64
68
|
include Ridley::Mixin::ParamsValidate
|
65
69
|
include Ridley::Mixin::FromFile
|
@@ -77,6 +81,13 @@ module Ridley::Chef
|
|
77
81
|
attr_reader :recipes
|
78
82
|
attr_reader :version
|
79
83
|
|
84
|
+
# @return [Array<Gem::Dependency>] Array of supported Chef versions
|
85
|
+
attr_reader :chef_versions
|
86
|
+
# @return [Array<Gem::Dependency>] Array of supported Ohai versions
|
87
|
+
attr_reader :ohai_versions
|
88
|
+
# @return [Array<Array>] Array of gems to install with *args as an Array
|
89
|
+
attr_reader :gems
|
90
|
+
|
80
91
|
# Builds a new Chef::Cookbook::Metadata object.
|
81
92
|
#
|
82
93
|
# === Parameters
|
@@ -108,6 +119,10 @@ module Ridley::Chef
|
|
108
119
|
@version = Semverse::Version.new("0.0.0")
|
109
120
|
@source_url = ''
|
110
121
|
@issues_url = ''
|
122
|
+
@privacy = false
|
123
|
+
@chef_versions = []
|
124
|
+
@ohai_versions = []
|
125
|
+
@gems = []
|
111
126
|
|
112
127
|
if cookbook
|
113
128
|
@recipes = cookbook.fully_qualified_recipe_names.inject({}) do |r, e|
|
@@ -125,6 +140,12 @@ module Ridley::Chef
|
|
125
140
|
end
|
126
141
|
end
|
127
142
|
|
143
|
+
# Ensure that we don't have to update Ridley every time we add
|
144
|
+
# a new metadata field to Chef
|
145
|
+
def method_missing(method_sym, *args)
|
146
|
+
Ridley::Logging.logger.warn "Ignoring unknown metadata"
|
147
|
+
end
|
148
|
+
|
128
149
|
# Sets the cookbooks maintainer, or returns it.
|
129
150
|
#
|
130
151
|
# === Parameters
|
@@ -346,6 +367,39 @@ module Ridley::Chef
|
|
346
367
|
@replacing[cookbook]
|
347
368
|
end
|
348
369
|
|
370
|
+
# Metadata DSL to set a valid chef_version. May be declared multiple times
|
371
|
+
# with the result being 'OR'd such that if any statements match, the version
|
372
|
+
# is considered supported. Uses Gem::Requirement for its implementation.
|
373
|
+
#
|
374
|
+
# @param version_args [Array<String>] Version constraint in String form
|
375
|
+
# @return [Array<Gem::Dependency>] Current chef_versions array
|
376
|
+
def chef_version(*version_args)
|
377
|
+
@chef_versions << Gem::Dependency.new("chef", *version_args) unless version_args.empty?
|
378
|
+
@chef_versions
|
379
|
+
end
|
380
|
+
|
381
|
+
# Metadata DSL to set a valid ohai_version. May be declared multiple times
|
382
|
+
# with the result being 'OR'd such that if any statements match, the version
|
383
|
+
# is considered supported. Uses Gem::Requirement for its implementation.
|
384
|
+
#
|
385
|
+
# @param version_args [Array<String>] Version constraint in String form
|
386
|
+
# @return [Array<Gem::Dependency>] Current ohai_versions array
|
387
|
+
def ohai_version(*version_args)
|
388
|
+
@ohai_versions << Gem::Dependency.new("ohai", *version_args) unless version_args.empty?
|
389
|
+
@ohai_versions
|
390
|
+
end
|
391
|
+
|
392
|
+
# Metadata DSL to set a gem to install from the cookbook metadata. May be declared
|
393
|
+
# multiple times. All the gems from all the cookbooks are combined into one Gemfile
|
394
|
+
# and depsolved together. Uses Bundler's DSL for its implementation.
|
395
|
+
#
|
396
|
+
# @param args [Array<String>] Gem name and options to pass to Bundler's DSL
|
397
|
+
# @return [Array<Array>] Array of gem statements as args
|
398
|
+
def gem(*args)
|
399
|
+
@gems << args unless args.empty?
|
400
|
+
@gems
|
401
|
+
end
|
402
|
+
|
349
403
|
# Adds a description for a recipe.
|
350
404
|
#
|
351
405
|
# === Parameters
|
@@ -390,7 +444,8 @@ module Ridley::Chef
|
|
390
444
|
:recipes => { :kind_of => [ Array ], :default => [] },
|
391
445
|
:default => { :kind_of => [ String, Array, Hash, Symbol, Numeric, TrueClass, FalseClass ] },
|
392
446
|
:source_url => { :kind_of => String },
|
393
|
-
:issues_url => { :kind_of => String }
|
447
|
+
:issues_url => { :kind_of => String },
|
448
|
+
:privacy => { :kind_of => [ TrueClass, FalseClass ] },
|
394
449
|
}
|
395
450
|
)
|
396
451
|
options[:required] = remap_required_attribute(options[:required]) unless options[:required].nil?
|
@@ -414,6 +469,40 @@ module Ridley::Chef
|
|
414
469
|
@groupings[name]
|
415
470
|
end
|
416
471
|
|
472
|
+
# Convert an Array of Gem::Dependency objects (chef_version/ohai_version) to an Array.
|
473
|
+
#
|
474
|
+
# Gem::Dependencey#to_s is not useful, and there is no #to_json defined on it or its component
|
475
|
+
# objets, so we have to write our own rendering method.
|
476
|
+
#
|
477
|
+
# [ Gem::Dependency.new(">= 12.5"), Gem::Dependency.new(">= 11.18.0", "< 12.0") ]
|
478
|
+
#
|
479
|
+
# results in:
|
480
|
+
#
|
481
|
+
# [ [ ">= 12.5" ], [ ">= 11.18.0", "< 12.0" ] ]
|
482
|
+
#
|
483
|
+
# @param deps [Array<Gem::Dependency>] Multiple Gem-style version constraints
|
484
|
+
# @return [Array<Array<String>]] Simple object representation of version constraints (for json)
|
485
|
+
def gem_requirements_to_array(*deps)
|
486
|
+
deps.map do |dep|
|
487
|
+
dep.requirement.requirements.map do |op, version|
|
488
|
+
"#{op} #{version}"
|
489
|
+
end.sort
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
# Convert an Array of Gem::Dependency objects (chef_version/ohai_version) to a hash.
|
494
|
+
#
|
495
|
+
# This is the inverse of #gem_requirements_to_array
|
496
|
+
#
|
497
|
+
# @param what [String] What version constraint we are constructing ('chef' or 'ohai' presently)
|
498
|
+
# @param array [Array<Array<String>]] Simple object representation of version constraints (from json)
|
499
|
+
# @return [Array<Gem::Dependency>] Multiple Gem-style version constraints
|
500
|
+
def gem_requirements_from_array(what, array)
|
501
|
+
array.map do |dep|
|
502
|
+
Gem::Dependency.new(what, *dep)
|
503
|
+
end
|
504
|
+
end
|
505
|
+
|
417
506
|
def to_hash
|
418
507
|
{
|
419
508
|
NAME => self.name,
|
@@ -434,7 +523,11 @@ module Ridley::Chef
|
|
434
523
|
RECIPES => self.recipes,
|
435
524
|
VERSION => self.version,
|
436
525
|
SOURCE_URL => self.source_url,
|
437
|
-
ISSUES_URL => self.issues_url
|
526
|
+
ISSUES_URL => self.issues_url,
|
527
|
+
PRIVACY => self.privacy,
|
528
|
+
CHEF_VERSIONS => gem_requirements_to_array(*self.chef_versions),
|
529
|
+
OHAI_VERSIONS => gem_requirements_to_array(*self.ohai_versions),
|
530
|
+
GEMS => self.gems,
|
438
531
|
}
|
439
532
|
end
|
440
533
|
|
@@ -466,6 +559,10 @@ module Ridley::Chef
|
|
466
559
|
@version = o[VERSION] if o.has_key?(VERSION)
|
467
560
|
@source_url = o[SOURCE_URL] if o.has_key?(SOURCE_URL)
|
468
561
|
@issues_url = o[ISSUES_URL] if o.has_key?(ISSUES_URL)
|
562
|
+
@privacy = o[PRIVACY] if o.has_key?(PRIVACY)
|
563
|
+
@chef_versions = gem_requirements_from_array("chef", o[CHEF_VERSIONS]) if o.has_key?(CHEF_VERSIONS)
|
564
|
+
@ohai_versions = gem_requirements_from_array("ohai", o[OHAI_VERSIONS]) if o.has_key?(OHAI_VERSIONS)
|
565
|
+
@gems = o[GEMS] if o.has_key?(GEMS)
|
469
566
|
self
|
470
567
|
end
|
471
568
|
|
@@ -503,6 +600,23 @@ module Ridley::Chef
|
|
503
600
|
)
|
504
601
|
end
|
505
602
|
|
603
|
+
#
|
604
|
+
# Sets the cookbook's privacy flag, or returns it.
|
605
|
+
#
|
606
|
+
# === Parameters
|
607
|
+
# privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not
|
608
|
+
#
|
609
|
+
# === Returns
|
610
|
+
# privacy<TrueClass,FalseClass>:: Whether this cookbook is private or not
|
611
|
+
#
|
612
|
+
def privacy(arg = nil)
|
613
|
+
set_or_return(
|
614
|
+
:privacy,
|
615
|
+
arg,
|
616
|
+
:kind_of => [ TrueClass, FalseClass ],
|
617
|
+
)
|
618
|
+
end
|
619
|
+
|
506
620
|
private
|
507
621
|
|
508
622
|
# Verify that the given array is an array of strings
|
data/lib/ridley/version.rb
CHANGED
@@ -131,7 +131,7 @@ describe Ridley::CookbookResource do
|
|
131
131
|
# non-ignored files are the ONLY thing uploaded
|
132
132
|
sandbox_resource.should_receive(:create).with([
|
133
133
|
"211a3a8798d4acd424af15ff8a2e28a5",
|
134
|
-
"
|
134
|
+
"5f025b0817442ec087c4e0172a6d1e67",
|
135
135
|
"75077ba33d2887cc1746d1ef716bf8b7",
|
136
136
|
"7b1ebd2ff580ca9dc46fb27ec1653bf2",
|
137
137
|
"84e12365e6f4ebe7db6a0e6a92473b16",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.5.
|
4
|
+
version: 4.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: addressable
|