chef-encrypted-attributes 0.6.0.beta.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8957490821771911a13f88beedb3c1062cecdada
4
- data.tar.gz: 83d2ccac8b9e7501fb064f1c330952b40fc382e8
3
+ metadata.gz: 9152cd93c8d694d37df7659cae3d93bf00ae85f0
4
+ data.tar.gz: 539393acaeef1511dd82dc035a38365ec012b043
5
5
  SHA512:
6
- metadata.gz: 7fa1dc731720540385d2989062205e8542f6c4756d9cca635cabfdbfb29640b15b2722bc32aa059d43b2220d50e721a4a86a2e6602c35311ed3006aabed30518
7
- data.tar.gz: 519810b6191fd1ba8b4f34746531f0341621d25f9d8eec9d3a206e4ab298389efb0beff22621274d8c0c058b700a280dd70dab46a6de79bf4a00f932babbe1dc
6
+ metadata.gz: 5a943ad2d06b15cd9d39a00c81da3907ecbf42e7e3a9c506db815296b32245203a3d1bd3e7076a4afd0aefb06576a43c34524abc938b61965c86c10c663f3b65
7
+ data.tar.gz: 1f11c694453b7fc80717808159e81c242909fe2b18b271a45400d1bfd11c21fb696155978a5604eba048a5d6795caa70102f37ad9803de26f068fbd5a9b9667f
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -2,9 +2,11 @@
2
2
 
3
3
  This file is used to list changes made in each version of `chef-encrypted-attributes`.
4
4
 
5
- ## 0.6.0.beta.1 (2015-05-01)
5
+ ## 0.6.0 (2015-05-08)
6
6
 
7
7
  * Conditional gem dependency installation within a gemspec ([issue #2](https://github.com/onddo/chef-encrypted-attributes/pull/2), thanks [@chhsiung](https://github.com/chhsiung) for the help).
8
+ * Choose YAJL library based on chef version ([issue #4](https://github.com/onddo/chef-encrypted-attributes/pull/4), thanks [Lisa Danz](https://github.com/ldanz)).
9
+ * Add doc Rake task to generate the documentation.
8
10
 
9
11
  ## 0.5.0 (2015-04-03)
10
12
 
data/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
  [![Gem Version](http://img.shields.io/gem/v/chef-encrypted-attributes.svg?style=flat)](http://badge.fury.io/rb/chef-encrypted-attributes)
3
3
  [![Dependency Status](http://img.shields.io/gemnasium/onddo/chef-encrypted-attributes.svg?style=flat)](https://gemnasium.com/onddo/chef-encrypted-attributes)
4
4
  [![Code Climate](http://img.shields.io/codeclimate/github/onddo/chef-encrypted-attributes.svg?style=flat)](https://codeclimate.com/github/onddo/chef-encrypted-attributes)
5
- [![Build Status](http://img.shields.io/travis/onddo/chef-encrypted-attributes.svg?style=flat)](https://travis-ci.org/onddo/chef-encrypted-attributes)
6
- [![Coverage Status](http://img.shields.io/coveralls/onddo/chef-encrypted-attributes.svg?style=flat)](https://coveralls.io/r/onddo/chef-encrypted-attributes?branch=master)
5
+ [![Build Status](http://img.shields.io/travis/onddo/chef-encrypted-attributes/0.6.0.svg?style=flat)](https://travis-ci.org/onddo/chef-encrypted-attributes)
6
+ [![Coverage Status](http://img.shields.io/coveralls/onddo/chef-encrypted-attributes/0.6.0.svg?style=flat)](https://coveralls.io/r/onddo/chef-encrypted-attributes?branch=0.6.0)
7
7
  [![Inline docs](http://inch-ci.org/github/onddo/chef-encrypted-attributes.svg?branch=master&style=flat)](http://inch-ci.org/github/onddo/chef-encrypted-attributes)
8
8
 
9
9
  [Chef](https://www.chef.io/) plugin to add Node encrypted attributes support using client keys.
@@ -20,7 +20,7 @@ Node attributes are encrypted using chef client and user keys with public key in
20
20
 
21
21
  * Ruby `>= 1.9`
22
22
  * Chef Client `~> 11.4`
23
- * ffi_yajl `~> 1.0` (included with Chef)
23
+ * yajl_ruby `~> 1.1` or ffi_yajl `>= 1.0, <3.0` (included with Chef)
24
24
  * If you want to use protocol version 2 to use [GCM](http://en.wikipedia.org/wiki/Galois/Counter_Mode) (disabled by default):
25
25
  * Ruby `>= 2`.
26
26
  * OpenSSL `>= 1.0.1`.
@@ -243,6 +243,7 @@ See [TODO.md](https://github.com/onddo/chef-encrypted-attributes/blob/master/TOD
243
243
  | **Author:** | [Xabier de Zuazo](https://github.com/zuazo) (<xabier@onddo.com>)
244
244
  | **Contributor:** | [Josh Kalderimis](https://github.com/joshk)
245
245
  | **Contributor:** | [@chhsiung](https://github.com/chhsiung)
246
+ | **Contributor:** | [Lisa Danz](https://github.com/ldanz)
246
247
  | **Copyright:** | Copyright (c) 2014-2015 Onddo Labs, SL. (www.onddo.com)
247
248
  | **License:** | Apache License, Version 2.0
248
249
 
data/Rakefile CHANGED
@@ -27,6 +27,16 @@ Bundler::GemHelper.install_tasks
27
27
 
28
28
  require 'rake/testtask'
29
29
 
30
+ desc 'Generate Ruby documentation'
31
+ task :yard do
32
+ require 'yard'
33
+ YARD::Rake::YardocTask.new do |t|
34
+ t.stats_options = %w(--list-undoc)
35
+ end
36
+ end
37
+
38
+ task doc: %w(yard)
39
+
30
40
  desc 'Run RuboCop style checks'
31
41
  task :rubocop do
32
42
  require 'rubocop/rake_task'
data/TESTING.md CHANGED
@@ -7,6 +7,12 @@ You can install gem dependencies with bundler:
7
7
  $ gem install bundler
8
8
  $ bundler install
9
9
 
10
+ ## Generate Documentation
11
+
12
+ $ bundle exec rake doc
13
+
14
+ This will generate the HTML documentation in the `doc/` directory.
15
+
10
16
  ## All the Tests
11
17
 
12
18
  $ bundle exec rake test
@@ -17,9 +17,14 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
+ require 'chef/version'
20
21
  require 'chef/encrypted_attribute/encrypted_mash'
21
22
  require 'chef/encrypted_attribute/exceptions'
22
- require 'ffi_yajl'
23
+ require 'chef/encrypted_attribute/yajl'
24
+
25
+ # Use the YAJL library that Chef provides. Determine which to use based on
26
+ # Chef version.
27
+ YAJL_NAMESPACE = Chef::EncryptedAttribute::Yajl.load_requirement(Chef::VERSION)
23
28
 
24
29
  class Chef
25
30
  class EncryptedAttribute
@@ -197,7 +202,7 @@ class Chef
197
202
  def json_encode(o)
198
203
  # TODO: This does not check if the object is correct, should be an
199
204
  # Array or a Hash
200
- FFI_Yajl::Encoder.encode(o)
205
+ YAJL_NAMESPACE::Encoder.encode(o)
201
206
  end
202
207
 
203
208
  # Decodes a JSON string.
@@ -206,8 +211,8 @@ class Chef
206
211
  # @return [Mixed] Ruby representation of the JSON string.
207
212
  # @raise [DecryptionFailure] if JSON string format is wrong.
208
213
  def json_decode(o)
209
- FFI_Yajl::Parser.parse(o.to_s)
210
- rescue FFI_Yajl::ParseError => e
214
+ YAJL_NAMESPACE::Parser.parse(o.to_s)
215
+ rescue YAJL_NAMESPACE::ParseError => e
211
216
  raise DecryptionFailure, "#{e.class.name}: #{e}"
212
217
  end
213
218
 
@@ -20,6 +20,6 @@
20
20
  class Chef
21
21
  class EncryptedAttribute
22
22
  # `chef-encrypted-attributes` gem version.
23
- VERSION = '0.6.0.beta.2'
23
+ VERSION = '0.6.0'
24
24
  end
25
25
  end
@@ -0,0 +1,45 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Author:: Lisa Danz (<lisa.danz@opower.com>)
4
+ # Author:: Xabier de Zuazo (<xabier@onddo.com>)
5
+ # Copyright:: Copyright (c) 2015 Onddo Labs, SL. (www.onddo.com)
6
+ # License:: Apache License, Version 2.0
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ class Chef
22
+ class EncryptedAttribute
23
+ # Helper module to abstract the required Yajl (JSON) dependecy.
24
+ module Yajl
25
+ # Loads the required Yajl JSON library depending on the installed Chef
26
+ # version.
27
+ #
28
+ # * Loads the `yajl` gem in Chef `< 11.13`.
29
+ # * Loads the `ffi_yajl` gem in Chef `>= 11.13`.
30
+ #
31
+ # @return [Class] The correct JSON class to use.
32
+ def self.load_requirement(chef_version)
33
+ if Gem::Requirement.new('< 11.13').satisfied_by?(
34
+ Gem::Version.new(chef_version)
35
+ )
36
+ require 'yajl'
37
+ ::Yajl
38
+ else
39
+ require 'ffi_yajl'
40
+ ::FFI_Yajl
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -116,7 +116,7 @@ class Chef
116
116
  def edit_data_obj_to_string(data, format)
117
117
  case format
118
118
  when 'JSON', 'json'
119
- FFI_Yajl::Parser.parse(data)
119
+ YAJL_NAMESPACE::Parser.parse(data)
120
120
  else
121
121
  data
122
122
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-encrypted-attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0.beta.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Onddo Labs, SL.
@@ -30,28 +30,8 @@ cert_chain:
30
30
  cYe8PqNEkky7ugvF4zU3sB6TW+96XasuwDv1uJmyr35LF15U6Cs83+osMbAKJTmG
31
31
  /vqKzw==
32
32
  -----END CERTIFICATE-----
33
- date: 2015-05-02 00:00:00.000000000 Z
33
+ date: 2015-05-08 00:00:00.000000000 Z
34
34
  dependencies:
35
- - !ruby/object:Gem::Dependency
36
- name: ffi-yajl
37
- requirement: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: '1.0'
42
- - - "<"
43
- - !ruby/object:Gem::Version
44
- version: '3.0'
45
- type: :runtime
46
- prerelease: false
47
- version_requirements: !ruby/object:Gem::Requirement
48
- requirements:
49
- - - ">="
50
- - !ruby/object:Gem::Version
51
- version: '1.0'
52
- - - "<"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
35
  - !ruby/object:Gem::Dependency
56
36
  name: chef
57
37
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +178,20 @@ dependencies:
198
178
  - - '='
199
179
  - !ruby/object:Gem::Version
200
180
  version: 0.29.1
181
+ - !ruby/object:Gem::Dependency
182
+ name: yard
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '0.8'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '0.8'
201
195
  description: Chef plugin to add Node encrypted attributes support using client keys
202
196
  email: team@onddo.com
203
197
  executables: []
@@ -233,6 +227,7 @@ files:
233
227
  - lib/chef/encrypted_attribute/remote_users.rb
234
228
  - lib/chef/encrypted_attribute/search_helper.rb
235
229
  - lib/chef/encrypted_attribute/version.rb
230
+ - lib/chef/encrypted_attribute/yajl.rb
236
231
  - lib/chef/encrypted_attributes.rb
237
232
  - lib/chef/knife/core/config.rb
238
233
  - lib/chef/knife/core/encrypted_attribute_base.rb
@@ -261,12 +256,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
261
256
  version: 1.9.2
262
257
  required_rubygems_version: !ruby/object:Gem::Requirement
263
258
  requirements:
264
- - - ">"
259
+ - - ">="
265
260
  - !ruby/object:Gem::Version
266
- version: 1.3.1
261
+ version: '0'
267
262
  requirements: []
268
263
  rubyforge_project:
269
- rubygems_version: 2.2.2
264
+ rubygems_version: 2.4.3
270
265
  signing_key:
271
266
  specification_version: 4
272
267
  summary: Chef Encrypted Attributes
metadata.gz.sig CHANGED
Binary file