knife-helper 0.0.3 → 0.0.4
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/chef/knife/helper_list.rb +42 -0
- data/lib/knife/helper/commands.rb +2 -0
- data/lib/knife/helper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78adf4c9784639e68738be65b5fbee92afda29b
|
4
|
+
data.tar.gz: fc00c910f235ff14e367ca59f06d357a4f8cec3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 021e049241049d555172c8d497f11d8ce8e2f26d20b96d10cf8c30d89a467eace0957ef04d954dd68866949254afef30f8430f531df968e7e0f0586924befbf7
|
7
|
+
data.tar.gz: f5035e53a8c15a3bd03af4b5f8be69321cfa3b5643a26885b8f9b6a4439b30c1612ef5cd3fcf1d506ec611c32f99c1887fc7e19fa80c8c7afa1704dba0d7b3d2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.0.4
|
2
|
+
|
3
|
+
* Add `list` subcommand [#4] ([@sawanoboly])
|
4
|
+
|
1
5
|
## 0.0.3
|
2
6
|
|
3
7
|
* Support some external configuration files [#2]
|
@@ -13,3 +17,5 @@
|
|
13
17
|
|
14
18
|
<!--- The following link definition list is generated by PimpMyChangelog --->
|
15
19
|
[#2]: https://github.com/marcy-terui/knife-helper/issues/2
|
20
|
+
[#4]: https://github.com/marcy-terui/knife-helper/issues/4
|
21
|
+
[@sawanoboly]: https://github.com/sawanoboly
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'chef'
|
2
|
+
require 'knife/helper/commands'
|
3
|
+
require 'knife/helper/config'
|
4
|
+
|
5
|
+
class Chef
|
6
|
+
class Knife
|
7
|
+
class HelperList < Chef::Knife
|
8
|
+
|
9
|
+
banner "knife helper list REGEX (option)"
|
10
|
+
|
11
|
+
option :file,
|
12
|
+
:short => "-f FILE",
|
13
|
+
:long => "--file FILE",
|
14
|
+
:description => "Path to config file(yaml)",
|
15
|
+
:default => ""
|
16
|
+
|
17
|
+
def run
|
18
|
+
file = config[:file] == "" ? default_config_file : config[:file]
|
19
|
+
commands = ::Knife::Helper::Commands.new(
|
20
|
+
::Knife::Helper::Config.new(file).data
|
21
|
+
)
|
22
|
+
unless @name_args.empty?
|
23
|
+
cm = commands.commands.select{|c| Regexp.new(@name_args.first).match(c['name']) }
|
24
|
+
else
|
25
|
+
cm = commands.commands
|
26
|
+
end
|
27
|
+
hash = {}
|
28
|
+
cm.map! do |c|
|
29
|
+
hash[c['name']] = c['command']
|
30
|
+
end
|
31
|
+
output(ui.presenter.format_for_display(hash))
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def default_config_file
|
37
|
+
::File.join(Dir.pwd, ".knife.helper.yml")
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/knife/helper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masashi Terui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- knife-helper.gemspec
|
113
113
|
- lib/chef/knife/helper_exec.rb
|
114
114
|
- lib/chef/knife/helper_init.rb
|
115
|
+
- lib/chef/knife/helper_list.rb
|
115
116
|
- lib/knife/helper.rb
|
116
117
|
- lib/knife/helper/commands.rb
|
117
118
|
- lib/knife/helper/config.rb
|