knife-api 0.1.2 → 0.1.3

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: b4370de6d156d548e5cf1ebb5f42ece6682503ca
4
- data.tar.gz: 76233ba0c36beb967d3d4082194a29a79192e763
3
+ metadata.gz: 0b1e51c37cdc8fa59d64ac86b2a6113d3bcbeaea
4
+ data.tar.gz: f4760fd287804caf1fdea752f7769a346375a81b
5
5
  SHA512:
6
- metadata.gz: 408296dce47fe9a4ee687b0010dbc4657f19ce02df3b47e4ee2cf83175baf262e37ce21fb9a7bf357dfdbfef87dbeb611ae46df5915f5076576d2c7d9746c7c3
7
- data.tar.gz: 14d3e5eb32e1650e690ac0c73ab664eeac50463d40ab4a271f5c8247fb3dcf8d64b91fff898fac1ed82c4ce7a784de100571426c9493924920e9467b6f932a59
6
+ metadata.gz: 6de226eb15c0b2eca1167e58ab9aea712e5c6479efc5038046a6fdae9310d813c8b5d5bef1b01520020a512b27728bdc068d5df82427c8fc128dec208a5c4a4b
7
+ data.tar.gz: a0c878bca2f89ad902b1acb67cfbba8314e2a670c17bc36475ba9c9b92cff73c21b3f047141181bd9cd868fa307010710334d01670af82bae05d42bb36f8cf74
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.1.1
5
+ script:
6
+ - bundle exec rake build
data/Gemfile CHANGED
@@ -1,11 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'chef-zero', '3.1.2'
4
-
5
- gem 'json', '1.8.1'
6
-
7
- gem 'ohai', '>= 6.0.0', '< 8.0.0'
8
-
9
- gem 'rake', '~> 10.3.2'
3
+ gem 'chef-zero', '3.2.1'
4
+ gem 'json', '1.8.2'
5
+ gem 'ohai', '< 9.0.0'
10
6
 
11
7
  # Specify your gem's dependencies in knife-api.gemspec
8
+ gemspec
data/LICENSE.txt CHANGED
@@ -1,4 +1,5 @@
1
1
  Copyright (c) 2012 Erik Hollensbe
2
+ Copyright (c) 2014 Andy Glick
2
3
 
3
4
  MIT License
4
5
 
data/README.md CHANGED
@@ -1,3 +1,8 @@
1
+ [![Build Status](https://travis-ci.org/andyglick/knife-api.png)](https://travis-ci.org/andyglick/knife-api)
2
+ [![Gem Version](https://badge.fury.io/rb/knife-api.svg)](http://badge.fury.io/rb/knife-api)
3
+ [![Dependency Status](https://gemnasium.com/andyglick/knife-api.svg)](https://gemnasium.com/andyglick/knife-api)
4
+ [![Coverage Status](https://img.shields.io/coveralls/andyglick/knife-api.svg)](https://coveralls.io/r/andyglick/knife-api)
5
+ [![Code Climate](https://codeclimate.com/github/andyglick/knife-api/badges/gpa.svg)](https://codeclimate.com/github/andyglick/knife-api)
1
6
  # Knife-API
2
7
 
3
8
  Erik Hollensbe first released knife-dsl in November of 2012. His last release took place in December of 2012. Today it
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
data/knife-api.gemspec CHANGED
@@ -4,19 +4,21 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'knife/api/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "knife-api"
7
+ gem.name = 'knife-api'
8
8
  gem.version = Chef::Knife::API::VERSION
9
- gem.authors = ["Erik Hollensbe", "Andy Glick"]
10
- gem.email = ["andyglick@gmailcom"]
11
- gem.description = %q{A small library that lets you drive Chef's 'knife' programmatically}
12
- gem.summary = %q{A small library that lets you drive Chef's 'knife' programmatically}
13
- gem.homepage = "https://github.com/andyglick/knife-api"
9
+ gem.authors = ['Erik Hollensbe', 'Andy Glick']
10
+ gem.email = ['andyglick@gmailcom']
11
+ gem.description =
12
+ %w(A small library that lets you drive Chef's 'knife' programmatically)
13
+ gem.summary =
14
+ %w(A small library that lets you drive Chef's 'knife' programmatically)
15
+ gem.homepage = 'https://github.com/andyglick/knife-api'
14
16
 
15
- gem.files = `git ls-files`.split($/)
16
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
19
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
- gem.require_paths = ["lib"]
20
+ gem.require_paths = ['lib']
19
21
 
20
- gem.add_dependency 'chef', '>= 10.0', '< 13.0.0'
21
- gem.add_development_dependency 'rake', '~> 10.3.2'
22
+ gem.add_dependency 'chef', '>= 10.32', '< 13.0.0'
23
+ gem.add_development_dependency 'rake', '>= 10.4.2'
22
24
  end
@@ -1,7 +1,8 @@
1
1
  class Chef
2
2
  class Knife
3
+ # adding API module to existing Chef::Knife packaging
3
4
  module API
4
- VERSION = "0.1.2"
5
+ VERSION = '0.1.3'
5
6
  end
6
7
  end
7
8
  end
data/lib/knife/api.rb CHANGED
@@ -2,53 +2,59 @@ require 'chef/application/knife'
2
2
  require 'knife/api/version'
3
3
  require 'stringio'
4
4
 
5
- module Chef::Knife::API
6
- module Chef::Knife::API::Support
7
- def self.run_knife(command, args)
8
- unless command.kind_of?(Array)
9
- command = command.to_s.split(/[\s_]+/)
10
- end
5
+ module Chef
6
+ module Knife
7
+ # adding API module to existing Chef::Knife packaging
8
+ module API
9
+ # adding Support module
10
+ module Support
11
+ def self.run_knife(command, args)
12
+ unless command.is_a?(Array)
13
+ command = command.to_s.split(/[\s_]+/)
14
+ end
15
+
16
+ command += args
11
17
 
12
- command += args
18
+ if ENV['CHEF_CONFIG']
19
+ command += ['-c', ENV['CHEF_CONFIG']]
20
+ end
13
21
 
14
- if ENV["CHEF_CONFIG"]
15
- command += ['-c', ENV["CHEF_CONFIG"]]
22
+ opts = Chef::Application::Knife.new.options
23
+ Chef::Knife.run(command, opts)
24
+ return 0
25
+ rescue SystemExit => e
26
+ return e.status
27
+ end
16
28
  end
17
29
 
18
- opts = Chef::Application::Knife.new.options
19
- Chef::Knife.run(command, opts)
20
- return 0
21
- rescue SystemExit => e
22
- return e.status
23
- end
24
- end
30
+ def knife(command, args = [])
31
+ Chef::Knife::API::Support.run_knife(command, args)
32
+ end
25
33
 
26
- def knife(command, args=[])
27
- Chef::Knife::API::Support.run_knife(command, args)
28
- end
34
+ def knife_capture(command, args = [], input = nil)
35
+ null = Gem.win_platform? ? File.open('NUL:', 'r') : File.open('/dev/null', 'r')
29
36
 
30
- def knife_capture(command, args=[], input=nil)
31
- null = Gem.win_platform? ? File.open('NUL:', 'r') : File.open('/dev/null', 'r')
32
-
33
- warn = $VERBOSE
34
- $VERBOSE = nil
35
- stderr, stdout, stdin = STDERR, STDOUT, STDIN
36
-
37
- Object.const_set("STDERR", StringIO.new('', 'r+'))
38
- Object.const_set("STDOUT", StringIO.new('', 'r+'))
39
- Object.const_set("STDIN", input ? StringIO.new(input, 'r') : null)
40
- $VERBOSE = warn
41
-
42
- status = Chef::Knife::API::Support.run_knife(command, args)
43
- return STDOUT.string, STDERR.string, status
44
- ensure
45
- warn = $VERBOSE
46
- $VERBOSE = nil
47
- Object.const_set("STDERR", stderr)
48
- Object.const_set("STDOUT", stdout)
49
- Object.const_set("STDIN", stdin)
50
- $VERBOSE = warn
51
- null.close
37
+ warn = $VERBOSE
38
+ $VERBOSE = nil
39
+ stderr, stdout, stdin = STDERR, STDOUT, STDIN
40
+
41
+ Object.const_set('STDERR', StringIO.new('', 'r+'))
42
+ Object.const_set('STDOUT', StringIO.new('', 'r+'))
43
+ Object.const_set('STDIN', input ? StringIO.new(input, 'r') : null)
44
+ $VERBOSE = warn
45
+
46
+ status = Chef::Knife::API::Support.run_knife(command, args)
47
+ return STDOUT.string, STDERR.string, status
48
+ ensure
49
+ warn = $VERBOSE
50
+ $VERBOSE = nil
51
+ Object.const_set('STDERR', stderr)
52
+ Object.const_set('STDOUT', stdout)
53
+ Object.const_set('STDIN', stdin)
54
+ $VERBOSE = warn
55
+ null.close
56
+ end
57
+ end
52
58
  end
53
59
  end
54
60
 
@@ -57,7 +63,10 @@ class << eval("self", TOPLEVEL_BINDING)
57
63
  end
58
64
 
59
65
  if defined? Rake::API
60
- module Rake::API
61
- include Chef::Knife::API
66
+ module Rake
67
+ # adding the API module to Rake in the context of this gem
68
+ module API
69
+ include Chef::Knife::API
70
+ end
62
71
  end
63
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Hollensbe
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-23 00:00:00.000000000 Z
12
+ date: 2015-01-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -17,7 +17,7 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '10.0'
20
+ version: '10.32'
21
21
  - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: 13.0.0
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
- version: '10.0'
30
+ version: '10.32'
31
31
  - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 13.0.0
@@ -35,17 +35,18 @@ dependencies:
35
35
  name: rake
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 10.3.2
40
+ version: 10.4.2
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 10.3.2
48
- description: A small library that lets you drive Chef's 'knife' programmatically
47
+ version: 10.4.2
48
+ description: '["A", "small", "library", "that", "lets", "you", "drive", "Chef''s",
49
+ "''knife''", "programmatically"]'
49
50
  email:
50
51
  - andyglick@gmailcom
51
52
  executables: []
@@ -53,6 +54,7 @@ extensions: []
53
54
  extra_rdoc_files: []
54
55
  files:
55
56
  - ".gitignore"
57
+ - ".travis.yml"
56
58
  - Gemfile
57
59
  - LICENSE.txt
58
60
  - README.md
@@ -82,5 +84,6 @@ rubyforge_project:
82
84
  rubygems_version: 2.4.1
83
85
  signing_key:
84
86
  specification_version: 4
85
- summary: A small library that lets you drive Chef's 'knife' programmatically
87
+ summary: '["A", "small", "library", "that", "lets", "you", "drive", "Chef''s", "''knife''",
88
+ "programmatically"]'
86
89
  test_files: []