chef-flavor-flay 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flay/commands/release.rb +1 -1
- data/lib/flay/version.rb +1 -1
- data/shared/flavor/flay/libraries/context.rb +23 -0
- data/shared/flavor/flay/libraries/cookbook.rb +24 -0
- data/shared/flavor/flay/recipes/cookbook.rb +2 -2
- data/shared/flavor/flay/recipes/recipe.rb +2 -2
- data/shared/flavor/flay/resources/template.rb +4 -9
- data/shared/flavor/flay/templates/default/LICENSE.erb +1 -1
- data/shared/flavor/flay/templates/default/README.md.erb +6 -6
- data/shared/flavor/flay/templates/default/kitchen.yml.erb +1 -1
- data/shared/flavor/flay/templates/default/metadata.rb.erb +5 -5
- data/shared/flavor/flay/templates/default/recipe.rb.erb +1 -1
- data/shared/flavor/flay/templates/default/recipe_spec.rb.erb +2 -2
- data/shared/flavor/flay/templates/default/serverspec_default_spec.rb.erb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6004130893e0dbbf3076601daa87a18c33c65ae5
|
4
|
+
data.tar.gz: e122ca4b0c615d20458b6364be4dd7b7a55b5449
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad59eacc961fbc1ab9d12463b6ba93ac4b7372b0e053df38216956fbd6f02c3de24fa3537048e346c93826ae7f2619cb4287e23ccd4b05873a823c03aefc9128
|
7
|
+
data.tar.gz: e5eeeca767a8c5f83ffd940e44cfc5e3238d8ee17f449ecfb96d5407e10ee3406e993c32cce8df2ffc435fd177624c639115827091af648798410dd6320cb702
|
data/lib/flay/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Flay # rubocop:disable Style/ClassAndModuleChildren
|
2
|
+
class Context < SimpleDelegator
|
3
|
+
alias_method :context, :__getobj__
|
4
|
+
|
5
|
+
def self.current
|
6
|
+
@current ||= Context.new(ChefDK::Generator.context)
|
7
|
+
end
|
8
|
+
|
9
|
+
module Helper
|
10
|
+
extend Forwardable
|
11
|
+
|
12
|
+
delegate %i(cookbook_name directory_name) => :flay_cookbook
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def flay_cookbook
|
17
|
+
@flay_cookbook ||= Flay::Cookbook.new(ChefDK::Generator.context.cookbook_name)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
include Helper
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Flay # rubocop:disable Style/ClassAndModuleChildren
|
2
|
+
class Cookbook
|
3
|
+
PREFIX = "chef-".freeze
|
4
|
+
NAMESPACE = "swpr_".freeze
|
5
|
+
PATTERN = /\A(#{PREFIX})?(#{NAMESPACE})?(.*)\z/.freeze
|
6
|
+
|
7
|
+
attr_reader :prefix, :namespace, :name
|
8
|
+
|
9
|
+
def initialize(name)
|
10
|
+
match = PATTERN.match(name)
|
11
|
+
@prefix = match[1] || PREFIX
|
12
|
+
@namespace = match[2] || NAMESPACE
|
13
|
+
@name = match[3]
|
14
|
+
end
|
15
|
+
|
16
|
+
def cookbook_name
|
17
|
+
@cookbook_name ||= "#{namespace}#{name}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def directory_name
|
21
|
+
@directory_name ||= "#{prefix}#{namespace}#{name}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
context =
|
2
|
-
cookbook_dir = File.join(context.cookbook_root, context.
|
1
|
+
context = Flay::Context.current
|
2
|
+
cookbook_dir = File.join(context.cookbook_root, context.directory_name)
|
3
3
|
kitchen_dir = File.join(cookbook_dir, "test", "integration")
|
4
4
|
|
5
5
|
# Common Cookbook Things
|
@@ -1,5 +1,5 @@
|
|
1
|
-
context =
|
2
|
-
cookbook_dir = File.join(context.cookbook_root, context.
|
1
|
+
context = Flay::Context.current
|
2
|
+
cookbook_dir = File.join(context.cookbook_root, context.directory_name)
|
3
3
|
recipe_path = File.join(cookbook_dir, "recipes", "#{context.new_file_basename}.rb")
|
4
4
|
spec_helper_path = File.join(cookbook_dir, "test", "unit", "spec_helper.rb")
|
5
5
|
spec_path = File.join(cookbook_dir, "test", "unit", "recipes", "#{context.new_file_basename}_spec.rb")
|
@@ -2,25 +2,20 @@ default_action :create_if_missing
|
|
2
2
|
|
3
3
|
property :name, String, name_property: true
|
4
4
|
property :source, String
|
5
|
-
property :use_helpers, [TrueClass, FalseClass], default: true
|
6
5
|
|
7
6
|
action :create do
|
8
7
|
template new_resource.name do
|
9
8
|
source new_resource.source
|
10
|
-
|
11
|
-
helpers
|
9
|
+
helpers ChefDK::Generator::TemplateHelper
|
10
|
+
helpers Flay::Context::Helper
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
14
|
action :create_if_missing do
|
16
15
|
template new_resource.name do
|
17
16
|
source new_resource.source
|
18
|
-
|
19
|
-
helpers
|
17
|
+
helpers ChefDK::Generator::TemplateHelper
|
18
|
+
helpers Flay::Context::Helper
|
20
19
|
action :create_if_missing
|
21
20
|
end
|
22
21
|
end
|
23
|
-
|
24
|
-
def helpers
|
25
|
-
use_helpers ? ChefDK::Generator::TemplateHelper : []
|
26
|
-
end
|
@@ -1 +1 @@
|
|
1
|
-
<%= license_description
|
1
|
+
<%= license_description.rstrip %>
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# <%=
|
1
|
+
# <%= cookbook_name %>
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/sweeperio/<%=
|
3
|
+
[![Build Status](https://travis-ci.org/sweeperio/<%= directory_name %>.svg?branch=master)](https://travis-ci.org/sweeperio/<%= directory_name %>)
|
4
4
|
|
5
|
-
Install/configure <%=
|
5
|
+
Install/configure <%= cookbook_name %>
|
6
6
|
|
7
7
|
## What This Does
|
8
8
|
|
@@ -16,15 +16,15 @@ Install/configure <%= sanitized_cookbook_name %>
|
|
16
16
|
|
17
17
|
| attribute | description | default |
|
18
18
|
|-----------|-------------|---------|
|
19
|
-
| `node["<%=
|
19
|
+
| `node["<%= cookbook_name %>"]["value"]` | some description | `""` |
|
20
20
|
|
21
21
|
## Recipes
|
22
22
|
|
23
|
-
### <%=
|
23
|
+
### <%= cookbook_name %>::default
|
24
24
|
|
25
25
|
TODO: description
|
26
26
|
|
27
|
-
**Usage:** add `recipe[<%=
|
27
|
+
**Usage:** add `recipe[<%= cookbook_name %>]` to your run list.
|
28
28
|
|
29
29
|
## License
|
30
30
|
|
@@ -1,17 +1,17 @@
|
|
1
1
|
# rubocop:disable Style/SingleSpaceBeforeFirstArg
|
2
|
-
name "<%=
|
2
|
+
name "<%= cookbook_name %>"
|
3
3
|
maintainer "<%= copyright_holder %>"
|
4
4
|
maintainer_email "<%= email %>"
|
5
5
|
license "<%= license %>"
|
6
|
-
description "Installs/Configures <%=
|
6
|
+
description "Installs/Configures <%= cookbook_name %>"
|
7
7
|
long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
|
8
8
|
version "0.1.0"
|
9
9
|
# rubocop:enable Style/SingleSpaceBeforeFirstArg
|
10
10
|
|
11
11
|
supports "ubuntu"
|
12
12
|
|
13
|
-
depends "
|
13
|
+
depends "swpr_core", "~> 0.0"
|
14
14
|
|
15
15
|
chef_version ">= 12.5" if respond_to?(:chef_version)
|
16
|
-
source_url "
|
17
|
-
issues_url "
|
16
|
+
source_url "https://github.com/sweeperio/<%= directory_name %>" if respond_to?(:source_url)
|
17
|
+
issues_url "https://github.com/sweeperio/<%= directory_name %>/issues" if respond_to?(:issues_url)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
#
|
2
|
-
# Cookbook Name:: <%=
|
2
|
+
# Cookbook Name:: <%= cookbook_name %>
|
3
3
|
# Spec:: <%= recipe_name %>
|
4
4
|
#
|
5
5
|
<%= license_description("#").rstrip %>
|
6
6
|
|
7
|
-
describe "<%=
|
7
|
+
describe "<%= cookbook_name %>::<%= recipe_name %>" do
|
8
8
|
cached(:chef_run) do
|
9
9
|
runner = ChefSpec::SoloRunner.new
|
10
10
|
runner.converge(described_recipe)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-flavor-flay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pseudomuto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-gen-flavors
|
@@ -87,6 +87,8 @@ files:
|
|
87
87
|
- shared/flavor/flay/files/default/test/integration/helpers/serverspec/spec_helper.rb
|
88
88
|
- shared/flavor/flay/files/default/test/unit/spec_helper.rb
|
89
89
|
- shared/flavor/flay/files/default/travis.yml
|
90
|
+
- shared/flavor/flay/libraries/context.rb
|
91
|
+
- shared/flavor/flay/libraries/cookbook.rb
|
90
92
|
- shared/flavor/flay/metadata.rb
|
91
93
|
- shared/flavor/flay/recipes/cookbook.rb
|
92
94
|
- shared/flavor/flay/recipes/recipe.rb
|