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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c72d0e44295ab3589e7b7e704fe9252816c48712
4
- data.tar.gz: 0eb2e5c9d4d70a949db79a0487ab508d6a38b5a4
3
+ metadata.gz: 6004130893e0dbbf3076601daa87a18c33c65ae5
4
+ data.tar.gz: e122ca4b0c615d20458b6364be4dd7b7a55b5449
5
5
  SHA512:
6
- metadata.gz: 4206313a0332a8e67e42189e85056d651b901d73c48bc595ec2a9d2bb5426984457db45e419c3c85dd334ee1db455994d63db7cf09c5d240248aa527e315fc00
7
- data.tar.gz: 087447bfa725cd290ca7c268777b1267462f235c6fce931df4fd8dc535e6818bff1449b102ffeb3f380d8c0e768ee59902be8f5a03d5b01120b4b33e472657b3
6
+ metadata.gz: ad59eacc961fbc1ab9d12463b6ba93ac4b7372b0e053df38216956fbd6f02c3de24fa3537048e346c93826ae7f2619cb4287e23ccd4b05873a823c03aefc9128
7
+ data.tar.gz: e5eeeca767a8c5f83ffd940e44cfc5e3238d8ee17f449ecfb96d5407e10ee3406e993c32cce8df2ffc435fd177624c639115827091af648798410dd6320cb702
@@ -38,7 +38,7 @@ class Flay::Commands::Release < Thor::Group
38
38
 
39
39
  def berks_upload
40
40
  say "Uploading cookbook to chef server...", :green
41
- shell_exec("chef exec berks upload")
41
+ shell_exec("chef exec berks upload --except=test integration")
42
42
  end
43
43
 
44
44
  def all_done
@@ -1,3 +1,3 @@
1
1
  module Flay
2
- VERSION = "1.0.1".freeze
2
+ VERSION = "1.1.0".freeze
3
3
  end
@@ -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 = ChefDK::Generator.context
2
- cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
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 = ChefDK::Generator.context
2
- cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
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
- helper(:sanitized_cookbook_name) { cookbook_name.sub(/\Achef-/, "") }
11
- helpers new_resource.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
- helper(:sanitized_cookbook_name) { cookbook_name.sub(/\Achef-/, "") }
19
- helpers new_resource.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("#").rstrip %>
1
+ <%= license_description.rstrip %>
@@ -1,8 +1,8 @@
1
- # <%= sanitized_cookbook_name %>
1
+ # <%= cookbook_name %>
2
2
 
3
- [![Build Status](https://travis-ci.org/sweeperio/<%= cookbook_name %>.svg?branch=master)](https://travis-ci.org/sweeperio/<%= cookbook_name %>)
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 <%= sanitized_cookbook_name %>
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["<%= sanitized_cookbook_name %>"]["value"]` | some description | `""` |
19
+ | `node["<%= cookbook_name %>"]["value"]` | some description | `""` |
20
20
 
21
21
  ## Recipes
22
22
 
23
- ### <%= sanitized_cookbook_name %>::default
23
+ ### <%= cookbook_name %>::default
24
24
 
25
25
  TODO: description
26
26
 
27
- **Usage:** add `recipe[<%= sanitized_cookbook_name %>]` to your run list.
27
+ **Usage:** add `recipe[<%= cookbook_name %>]` to your run list.
28
28
 
29
29
  ## License
30
30
 
@@ -13,5 +13,5 @@ platforms:
13
13
  suites:
14
14
  - name: default
15
15
  run_list:
16
- - recipe[<%= sanitized_cookbook_name %>]
16
+ - recipe[<%= cookbook_name %>]
17
17
  attributes:
@@ -1,17 +1,17 @@
1
1
  # rubocop:disable Style/SingleSpaceBeforeFirstArg
2
- name "<%= sanitized_cookbook_name %>"
2
+ name "<%= cookbook_name %>"
3
3
  maintainer "<%= copyright_holder %>"
4
4
  maintainer_email "<%= email %>"
5
5
  license "<%= license %>"
6
- description "Installs/Configures <%= sanitized_cookbook_name %>"
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 "core", "~> 0.0"
13
+ depends "swpr_core", "~> 0.0"
14
14
 
15
15
  chef_version ">= 12.5" if respond_to?(:chef_version)
16
- source_url "YOUR SOURCE REPO URL" if respond_to?(:source_url)
17
- issues_url "WHERE TO LOG ISSUES" if respond_to?(: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,5 +1,5 @@
1
1
  #
2
- # Cookbook Name:: <%= sanitized_cookbook_name %>
2
+ # Cookbook Name:: <%= cookbook_name %>
3
3
  # Recipe:: <%= recipe_name %>
4
4
  #
5
5
  <%= license_description("#").rstrip %>
@@ -1,10 +1,10 @@
1
1
  #
2
- # Cookbook Name:: <%= sanitized_cookbook_name %>
2
+ # Cookbook Name:: <%= cookbook_name %>
3
3
  # Spec:: <%= recipe_name %>
4
4
  #
5
5
  <%= license_description("#").rstrip %>
6
6
 
7
- describe "<%= sanitized_cookbook_name %>::<%= recipe_name %>" do
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)
@@ -1,4 +1,4 @@
1
1
  require "spec_helper"
2
2
 
3
- describe "<%= sanitized_cookbook_name %>" do
3
+ describe "<%= cookbook_name %>" do
4
4
  end
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.1
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-09 00:00:00.000000000 Z
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