knife-info 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZWM1ODkyZTJlNzc3MDBhZjdlZGIyZTg0YzE2NzRiYTQ5MmM2YzdlMg==
5
+ data.tar.gz: !binary |-
6
+ Y2VkYTg1YWQxMmI4N2U3ZThmZDI4ZDliNjdhMGJkN2JkN2NiMWE3NQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NWEyZjAwYzIzZjUzMjU1OGZjNzEwOTgwODliODQ2MjAwZWFkZWVlMWQzZmY0
10
+ NjQ0YzliNzM2YTVkOTAwYzBmMzVkNGMyNDQ3NDlmZGIyMTg0MmYwZmI5NDcy
11
+ ZjdkNjJmNzhhMTljOWYxOWVkNzM4ZDExZmFhNzYxYzM0ZDNkM2I=
12
+ data.tar.gz: !binary |-
13
+ NGVmOTcwNTZkYmU5ODk4OWMzYWI0YTFmYzk2ZDYyMmFkMTJhMTgzNzg2YTI1
14
+ ODlmNTYzZTMwZDM1NzRkYTIyNDUyNTQ0NDFlMjY1MTc0YjdjNzliNDMyOTE0
15
+ NjNlMTM0YzVmZDA4NmRiYTZkNmEzZDlmNDliOTYzYzNlNTc0Yzk=
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # knife Info [![Build Status](https://travis-ci.org/outofjungle/knife-info.png?branch=master)](https://travis-ci.org/outofjungle/knife-info)
2
+
3
+ ## Description
4
+
5
+ This is an EXPERIMENTAL knife plugin that displays the information from the `knife.rb` config file in the kinfe search path.
6
+
7
+ ## Installation
8
+
9
+ This knife plugin is packaged as a gem. To install it, clone the
10
+ git repository and run the following:
11
+
12
+ rake install
13
+
14
+ ## Subcommands
15
+
16
+ ### `knife info [options]`
17
+
18
+ *Options*
19
+
20
+ * `--tiny`: Show concise information in oneline
21
+ * `--medium`: Show important information in oneline
22
+ * `--long`: Show all information in multi-lines
23
+
24
+ ## TODO
25
+
26
+ * Support for `--[no-]color` option
@@ -0,0 +1,68 @@
1
+ require 'chef/knife'
2
+ require 'uri'
3
+
4
+ module KnifeInfo
5
+ class Info < Chef::Knife
6
+
7
+ category 'CHEF KNIFE INFO'
8
+ banner 'knife info'
9
+
10
+ option :tiny,
11
+ :long => '--tiny',
12
+ :description => 'Print concise information in oneline',
13
+ :boolean => true | false,
14
+ :default => true
15
+
16
+ option :medium,
17
+ :long => '--medium',
18
+ :description => 'Print important information in oneline',
19
+ :boolean => true | false
20
+
21
+ option :long,
22
+ :long => '--long',
23
+ :description => 'Print all information in multiple lines',
24
+ :boolean => true | false
25
+
26
+ def run
27
+ @config_file_location = Chef::Knife.locate_config_file
28
+
29
+ uri = URI(server_url)
30
+ @host = uri.host
31
+
32
+ %r(.*/(?<org>.*)$) =~ uri.path
33
+ @organization = org || ''
34
+
35
+ if config[:long]
36
+ ui.msg(long_print)
37
+ elsif config[:medium]
38
+ ui.msg(medium_print)
39
+ else config[:tiny]
40
+ ui.msg(tiny_print)
41
+ end
42
+ end
43
+
44
+ def user_string
45
+ (username != ENV['USER']) ? "#{username}@" : ''
46
+ end
47
+
48
+ def tiny_print
49
+ %r(^(?<host>[a-zA-Z0-9-]+)\..*$) =~ @host
50
+ "#{user_string}#{host}/#{@organization}"
51
+ end
52
+
53
+ def medium_print
54
+ "#{user_string}#{@host}/#{organization}"
55
+ end
56
+
57
+ def long_print
58
+ <<-VERBOSE.gsub(/^\s+/, '')
59
+ Host: #{@host}
60
+ Username: #{username}
61
+ Organization: #{@organization}
62
+ Config File: #{@config_file_location}
63
+ VERBOSE
64
+ end
65
+
66
+ attr_reader :host, :organization, :user, :config_file_location
67
+ end
68
+ end
@@ -0,0 +1,4 @@
1
+ module KnifeInfo
2
+ VERSION = "0.0.2"
3
+ end
4
+
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: knife-info
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Venkat Venkataraju
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: chef
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Displays which .chef config dir knife will be using
70
+ email: venkat.venkataraju@yahoo.com
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - README.md
76
+ - lib/chef/knife/info.rb
77
+ - lib/knife-info/version.rb
78
+ homepage: https://github.com/outofjungle/knife-info
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '1.9'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.1.11
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: knife info
102
+ test_files: []