chef-analytics 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +49 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +102 -0
- data/LICENSE +201 -0
- data/README.md +56 -0
- data/Rakefile +28 -0
- data/chef-analytics.gemspec +25 -0
- data/lib/chef-analytics.rb +22 -0
- data/lib/chef-analytics/config.rb +26 -0
- data/lib/chef-analytics/http/token_authenticator.rb +46 -0
- data/lib/chef-analytics/identity.rb +112 -0
- data/lib/chef-analytics/knife.rb +59 -0
- data/lib/chef-analytics/server_api.rb +45 -0
- data/lib/chef-analytics/token.rb +149 -0
- data/lib/chef-analytics/version.rb +20 -0
- data/spec/spec_helper.rb +36 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23c3add65a602a90756b13ff7aa551a4763c544f
|
4
|
+
data.tar.gz: 98274fe8aa6114778c346dda6b8c08cf63c35b3b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4de9af3c7a196bd377900aadfffefb7f3820d2bb00c1d12f777203879bd512d10d707b15990425720d03e371587af9c3ce6c3670576d7fddc875e19953fe8c4b
|
7
|
+
data.tar.gz: dbd5db64b04e257055df7d316e82dc852572916d86c84d1eb6282e7d23a55339a0ed03ba9ecc5bdc31388346ef5c3cc6e9a6dfe17862a818b41f0df478ab1956
|
data/.gitignore
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
coverage.data
|
4
|
+
|
5
|
+
# rdoc generated
|
6
|
+
rdoc
|
7
|
+
|
8
|
+
# yard generated
|
9
|
+
doc
|
10
|
+
.yardoc
|
11
|
+
|
12
|
+
# bundler
|
13
|
+
.bundle
|
14
|
+
|
15
|
+
# jeweler generated
|
16
|
+
pkg
|
17
|
+
|
18
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
19
|
+
#
|
20
|
+
# * Create a file at ~/.gitignore
|
21
|
+
# * Include files you want ignored
|
22
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
23
|
+
#
|
24
|
+
# After doing this, these files will be ignored in all your git projects,
|
25
|
+
# saving you from having to 'pollute' every project you touch with them
|
26
|
+
#
|
27
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
28
|
+
#
|
29
|
+
# For MacOS:
|
30
|
+
#
|
31
|
+
#.DS_Store
|
32
|
+
|
33
|
+
# For TextMate
|
34
|
+
#*.tmproj
|
35
|
+
#tmtags
|
36
|
+
|
37
|
+
# For emacs:
|
38
|
+
#*~
|
39
|
+
#\#*
|
40
|
+
#.\#*
|
41
|
+
|
42
|
+
# For vim:
|
43
|
+
#*.swp
|
44
|
+
|
45
|
+
# For redcar:
|
46
|
+
#.redcar
|
47
|
+
|
48
|
+
# For rubinius:
|
49
|
+
#*.rbc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
chef-analytics (0.1.0)
|
5
|
+
chef
|
6
|
+
mixlib-config
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
chef (11.16.4)
|
12
|
+
chef-zero (~> 2.1, >= 2.1.4)
|
13
|
+
diff-lcs (~> 1.2, >= 1.2.4)
|
14
|
+
erubis (~> 2.7)
|
15
|
+
ffi-yajl (~> 1.0)
|
16
|
+
highline (~> 1.6, >= 1.6.9)
|
17
|
+
mime-types (~> 1.16)
|
18
|
+
mixlib-authentication (~> 1.3)
|
19
|
+
mixlib-cli (~> 1.4)
|
20
|
+
mixlib-config (~> 2.0)
|
21
|
+
mixlib-log (~> 1.3)
|
22
|
+
mixlib-shellout (~> 1.4)
|
23
|
+
net-ssh (~> 2.6)
|
24
|
+
net-ssh-multi (~> 1.1)
|
25
|
+
ohai (~> 7.4)
|
26
|
+
plist (~> 3.1.0)
|
27
|
+
pry (~> 0.9)
|
28
|
+
rest-client (>= 1.0.4, <= 1.6.7)
|
29
|
+
chef-zero (2.2.1)
|
30
|
+
ffi-yajl (~> 1.1)
|
31
|
+
hashie (~> 2.0)
|
32
|
+
mixlib-log (~> 1.3)
|
33
|
+
rack
|
34
|
+
coderay (1.1.0)
|
35
|
+
diff-lcs (1.2.5)
|
36
|
+
erubis (2.7.0)
|
37
|
+
ffi (1.9.6)
|
38
|
+
ffi-yajl (1.2.0)
|
39
|
+
ffi (~> 1.5)
|
40
|
+
libyajl2 (~> 1.0)
|
41
|
+
hashie (2.1.2)
|
42
|
+
highline (1.6.21)
|
43
|
+
ipaddress (0.8.0)
|
44
|
+
libyajl2 (1.1.0)
|
45
|
+
method_source (0.8.2)
|
46
|
+
mime-types (1.25.1)
|
47
|
+
mixlib-authentication (1.3.0)
|
48
|
+
mixlib-log
|
49
|
+
mixlib-cli (1.5.0)
|
50
|
+
mixlib-config (2.1.0)
|
51
|
+
mixlib-log (1.6.0)
|
52
|
+
mixlib-shellout (1.6.0)
|
53
|
+
net-ssh (2.9.1)
|
54
|
+
net-ssh-gateway (1.2.0)
|
55
|
+
net-ssh (>= 2.6.5)
|
56
|
+
net-ssh-multi (1.2.0)
|
57
|
+
net-ssh (>= 2.6.5)
|
58
|
+
net-ssh-gateway (>= 1.2.0)
|
59
|
+
ohai (7.4.0)
|
60
|
+
ffi (~> 1.9)
|
61
|
+
ffi-yajl (~> 1.0)
|
62
|
+
ipaddress
|
63
|
+
mime-types (~> 1.16)
|
64
|
+
mixlib-cli
|
65
|
+
mixlib-config (~> 2.0)
|
66
|
+
mixlib-log
|
67
|
+
mixlib-shellout (~> 1.2)
|
68
|
+
systemu (~> 2.6.4)
|
69
|
+
wmi-lite (~> 1.0)
|
70
|
+
plist (3.1.0)
|
71
|
+
pry (0.10.1)
|
72
|
+
coderay (~> 1.1.0)
|
73
|
+
method_source (~> 0.8.1)
|
74
|
+
slop (~> 3.4)
|
75
|
+
rack (1.5.2)
|
76
|
+
rake (10.3.2)
|
77
|
+
rest-client (1.6.7)
|
78
|
+
mime-types (>= 1.16)
|
79
|
+
rspec (3.1.0)
|
80
|
+
rspec-core (~> 3.1.0)
|
81
|
+
rspec-expectations (~> 3.1.0)
|
82
|
+
rspec-mocks (~> 3.1.0)
|
83
|
+
rspec-core (3.1.7)
|
84
|
+
rspec-support (~> 3.1.0)
|
85
|
+
rspec-expectations (3.1.2)
|
86
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
87
|
+
rspec-support (~> 3.1.0)
|
88
|
+
rspec-mocks (3.1.3)
|
89
|
+
rspec-support (~> 3.1.0)
|
90
|
+
rspec-support (3.1.2)
|
91
|
+
slop (3.6.0)
|
92
|
+
systemu (2.6.4)
|
93
|
+
wmi-lite (1.0.0)
|
94
|
+
|
95
|
+
PLATFORMS
|
96
|
+
ruby
|
97
|
+
|
98
|
+
DEPENDENCIES
|
99
|
+
chef-analytics!
|
100
|
+
pry
|
101
|
+
rake (~> 10.3)
|
102
|
+
rspec (~> 3.0)
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright 2013 Seth Vargo <sethvargo@gmail.com>
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Chef analytics Client
|
2
|
+
==============
|
3
|
+
|
4
|
+
ChefAnalytics is a Ruby client for interacting with a Chef analytics Server.
|
5
|
+
|
6
|
+
|
7
|
+
Quick start
|
8
|
+
-----------
|
9
|
+
Install via Rubygems:
|
10
|
+
|
11
|
+
$ gem install chef-analytics
|
12
|
+
|
13
|
+
or add it to your Gemfile if you are using Bundler:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'chef-analytics', '~> 0.1'
|
17
|
+
```
|
18
|
+
|
19
|
+
In your library or project, you will likely want to include the `ChefAnalytics` namespace:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
include ChefAnalytics
|
23
|
+
```
|
24
|
+
|
25
|
+
Development
|
26
|
+
-----------
|
27
|
+
1. Clone the project on GitHub
|
28
|
+
2. Create a feature branch
|
29
|
+
3. Submit a Pull Request
|
30
|
+
|
31
|
+
Important Notes:
|
32
|
+
|
33
|
+
- **All new features must include test coverage.** At a bare minimum, Unit tests are required. It is preferred if you include acceptance tests as well.
|
34
|
+
- **The tests must be be idempotent.** The HTTP calls made during a test should be able to be run over and over.
|
35
|
+
- **Tests are order independent.** The default RSpec configuration randomizes the test order, so this should not be a problem.
|
36
|
+
|
37
|
+
|
38
|
+
License & Authors
|
39
|
+
-----------------
|
40
|
+
- Author: James Casey <james@getchef.com>
|
41
|
+
|
42
|
+
```text
|
43
|
+
Copyright 2014, Chef Software
|
44
|
+
|
45
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
46
|
+
you may not use this file except in compliance with the License.
|
47
|
+
You may obtain a copy of the License at
|
48
|
+
|
49
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
50
|
+
|
51
|
+
Unless required by applicable law or agreed to in writing, software
|
52
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
53
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
54
|
+
See the License for the specific language governing permissions and
|
55
|
+
limitations under the License.
|
56
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'bundler/gem_tasks'
|
19
|
+
|
20
|
+
require 'rspec/core/rake_task'
|
21
|
+
RSpec::Core::RakeTask.new do |t|
|
22
|
+
t.rspec_opts = [
|
23
|
+
'--color',
|
24
|
+
'--format progress',
|
25
|
+
].join(' ')
|
26
|
+
end
|
27
|
+
|
28
|
+
task default: :spec
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chef-analytics/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'chef-analytics'
|
8
|
+
spec.version = ChefAnalytics::VERSION
|
9
|
+
spec.authors = ['James Casey']
|
10
|
+
spec.email = ['james@getchef.com']
|
11
|
+
spec.description = 'A Chef analytics API client with minimal dependencies'
|
12
|
+
spec.summary = 'A Chef analytics API client in Ruby'
|
13
|
+
spec.homepage = 'https://github.com/opscode/chef-analytics-api'
|
14
|
+
spec.license = 'Apache 2.0'
|
15
|
+
|
16
|
+
spec.required_ruby_version = '>= 1.9'
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
|
+
spec.require_paths = ['lib']
|
22
|
+
|
23
|
+
spec.add_dependency 'chef'
|
24
|
+
spec.add_dependency 'mixlib-config'
|
25
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics/identity'
|
19
|
+
require 'chef-analytics/knife'
|
20
|
+
require 'chef-analytics/server_api'
|
21
|
+
require 'chef-analytics/token'
|
22
|
+
require 'chef-analytics/version'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
module ChefAnalytics
|
21
|
+
module Config
|
22
|
+
extend Mixlib::Config
|
23
|
+
config_strict_mode true
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
module ChefAnalytics
|
19
|
+
class HTTP
|
20
|
+
class TokenAuthenticator
|
21
|
+
|
22
|
+
attr_reader :token
|
23
|
+
|
24
|
+
def initialize(opts={})
|
25
|
+
@token = opts[:authentication_token]
|
26
|
+
end
|
27
|
+
|
28
|
+
def handle_request(method, url, headers={}, data=false)
|
29
|
+
headers.merge!(@token.authentication_header)
|
30
|
+
[method, url, headers, data]
|
31
|
+
end
|
32
|
+
|
33
|
+
def handle_response(http_response, rest_request, return_value)
|
34
|
+
[http_response, rest_request, return_value]
|
35
|
+
end
|
36
|
+
|
37
|
+
def stream_response_handler(response)
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def handle_stream_complete(http_response, rest_request, return_value)
|
42
|
+
[http_response, rest_request, return_value]
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,112 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics/token'
|
19
|
+
require 'chef/config'
|
20
|
+
require 'chef/http'
|
21
|
+
require 'chef/http/authenticator'
|
22
|
+
require 'chef/http/json_output'
|
23
|
+
require 'chef/util/path_helper'
|
24
|
+
require 'digest/md5'
|
25
|
+
|
26
|
+
module ChefAnalytics
|
27
|
+
class Identity
|
28
|
+
|
29
|
+
class IdentityServerAPI < Chef::HTTP
|
30
|
+
attr_accessor :url
|
31
|
+
|
32
|
+
def initialize(options)
|
33
|
+
super(options[:identity_server_url], options)
|
34
|
+
end
|
35
|
+
use Chef::HTTP::Authenticator
|
36
|
+
use Chef::HTTP::JSONOutput
|
37
|
+
end
|
38
|
+
|
39
|
+
def initialize(options = {})
|
40
|
+
options = options.dup
|
41
|
+
options[:identity_server_url] ||= default_identity_server_url
|
42
|
+
options[:client_name] ||= Chef::Config[:node_name]
|
43
|
+
options[:signing_key_filename] ||= Chef::Config[:client_key]
|
44
|
+
|
45
|
+
Chef::Log.debug("Using Identity Server: #{options[:identity_server_url]}")
|
46
|
+
|
47
|
+
@options = options
|
48
|
+
@identity_server = IdentityServerAPI.new(options)
|
49
|
+
@cache_file_name = construct_file_name(options[:identity_server_url],
|
50
|
+
options[:client_name])
|
51
|
+
end
|
52
|
+
|
53
|
+
def token
|
54
|
+
fs_token = token_from_filesystem
|
55
|
+
if fs_token
|
56
|
+
fs_token
|
57
|
+
else
|
58
|
+
token_from_signed_request
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def token_from_signed_request
|
63
|
+
begin
|
64
|
+
result = @identity_server.request(:post, "oauth/token?grant_type=password",
|
65
|
+
{'Content-Type' => 'application/json'})
|
66
|
+
token = ChefAnalytics::Token.from_hash(result)
|
67
|
+
token.identity_server_url @options[:identity_server_url]
|
68
|
+
token.client_name @options[:client_name]
|
69
|
+
token.to_file(@cache_file_name)
|
70
|
+
token
|
71
|
+
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
|
72
|
+
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
|
73
|
+
Net::ProtocolError => e
|
74
|
+
Chef::Log.error("Exception caught on getting token: #{e}")
|
75
|
+
nil
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def token_from_filesystem
|
80
|
+
if File.exists?(@cache_file_name) && File.readable?(@cache_file_name)
|
81
|
+
Chef::Log.debug("Loading token from FS: #{@cache_file_name}")
|
82
|
+
token = ChefAnalytics::Token.from_file(@cache_file_name)
|
83
|
+
if token.expired?
|
84
|
+
Chef::Log.debug("Found expired cached credentials: #{@cache_file_name}")
|
85
|
+
return nil
|
86
|
+
end
|
87
|
+
|
88
|
+
token
|
89
|
+
else
|
90
|
+
Chef::Log.debug("Couldn't find cached credentials: #{@cache_file_name}")
|
91
|
+
nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def identity_cache_dir
|
98
|
+
File.join(Chef::Config[:file_cache_path], 'identity')
|
99
|
+
end
|
100
|
+
|
101
|
+
def construct_file_name(url, client_name)
|
102
|
+
md5 = Digest::MD5.new
|
103
|
+
md5.update url
|
104
|
+
md5.update client_name
|
105
|
+
File.join(identity_cache_dir,"#{md5.hexdigest}.json")
|
106
|
+
end
|
107
|
+
|
108
|
+
def default_identity_server_url
|
109
|
+
URI.join(Chef::Config[:chef_server_url],'/id').to_s
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics/identity'
|
19
|
+
require 'chef/config'
|
20
|
+
|
21
|
+
module ChefAnalytics
|
22
|
+
class Knife < Chef::Knife
|
23
|
+
attr_accessor :analytics_server_url
|
24
|
+
|
25
|
+
def initialize(arg)
|
26
|
+
super(arg)
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# helper functions
|
31
|
+
#
|
32
|
+
|
33
|
+
def fetch_token
|
34
|
+
identity = ChefAnalytics::Identity.new(identity_server_url: @identity_server_url)
|
35
|
+
token = identity.token
|
36
|
+
if token.nil?
|
37
|
+
ui.error "Couldn't get OAuth2 token from OC-ID server"
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
token
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate_and_set_params
|
44
|
+
@analytics_server_url ||= Chef::Config[:analytics_server_url]
|
45
|
+
@analytics_server_url ||= config[:analytics_server_url]
|
46
|
+
@identity_server_url ||= Chef::Config[:identity_server_url]
|
47
|
+
@identity_server_url ||= config[:identity_server_url]
|
48
|
+
|
49
|
+
unless @analytics_server_url
|
50
|
+
ui.error "analytics_server_url not set in config or command line"
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def analytics_server_root
|
56
|
+
URI.join(@analytics_server_url, '/').to_s
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef/http'
|
19
|
+
require 'chef/http/json_output'
|
20
|
+
require 'chef-analytics/http/token_authenticator'
|
21
|
+
|
22
|
+
module ChefAnalytics
|
23
|
+
class ServerAPI < Chef::HTTP
|
24
|
+
attr_accessor :url, :authentication_token
|
25
|
+
|
26
|
+
def initialize(url, token, options = {})
|
27
|
+
options = options.dup
|
28
|
+
options[:authentication_token] = token
|
29
|
+
super(url, options)
|
30
|
+
|
31
|
+
@authenticator = ChefAnalytics::HTTP::TokenAuthenticator.new(options)
|
32
|
+
@request_id = RemoteRequestID.new(options)
|
33
|
+
|
34
|
+
@middlewares << Chef::HTTP::JSONOutput.new(options)
|
35
|
+
@middlewares << @authenticator
|
36
|
+
@middlewares << @request_id
|
37
|
+
end
|
38
|
+
|
39
|
+
def authentication_token
|
40
|
+
authenticator.token
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
|
@@ -0,0 +1,149 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef/json_compat'
|
19
|
+
require 'chef/mixin/params_validate'
|
20
|
+
require 'chef/util/path_helper'
|
21
|
+
|
22
|
+
module ChefAnalytics
|
23
|
+
class Token
|
24
|
+
|
25
|
+
include Chef::Mixin::ParamsValidate
|
26
|
+
|
27
|
+
def initialize
|
28
|
+
@access_token = nil
|
29
|
+
@token_type = nil
|
30
|
+
@refresh_token = nil
|
31
|
+
@expiry = nil
|
32
|
+
@identity_server_url = nil
|
33
|
+
@client_name = nil
|
34
|
+
end
|
35
|
+
|
36
|
+
def access_token(arg=nil)
|
37
|
+
set_or_return(:access_token, arg,
|
38
|
+
:kind_of => String)
|
39
|
+
end
|
40
|
+
|
41
|
+
def token_type(arg=nil)
|
42
|
+
set_or_return(:token_type, arg,
|
43
|
+
:kind_of => String)
|
44
|
+
end
|
45
|
+
|
46
|
+
def refresh_token(arg=nil)
|
47
|
+
set_or_return(:refresh_token, arg,
|
48
|
+
:kind_of => String)
|
49
|
+
end
|
50
|
+
|
51
|
+
def expiry(arg=nil)
|
52
|
+
set_or_return(:expiry, arg,
|
53
|
+
:kind_of => DateTime)
|
54
|
+
end
|
55
|
+
|
56
|
+
def identity_server_url(arg=nil)
|
57
|
+
set_or_return(:identity_server_url, arg,
|
58
|
+
:kind_of => String)
|
59
|
+
end
|
60
|
+
|
61
|
+
def client_name(arg=nil)
|
62
|
+
set_or_return(:client_name, arg,
|
63
|
+
:kind_of => String)
|
64
|
+
end
|
65
|
+
|
66
|
+
|
67
|
+
def authentication_header
|
68
|
+
{"Authorization" => "Bearer #{access_token}"}
|
69
|
+
end
|
70
|
+
|
71
|
+
def to_hash
|
72
|
+
{
|
73
|
+
'access_token' => access_token,
|
74
|
+
'token_type' => token_type,
|
75
|
+
'refresh_token' => refresh_token,
|
76
|
+
'expiry' => expiry.rfc3339,
|
77
|
+
'client_name' => client_name,
|
78
|
+
'identity_server_url' => identity_server_url
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_json(*a)
|
83
|
+
Chef::JSONCompat.to_json(to_hash, *a)
|
84
|
+
end
|
85
|
+
|
86
|
+
def to_file(file_name)
|
87
|
+
Chef::Log.debug("Saving token to #{file_name}")
|
88
|
+
dir = ::File.dirname(file_name)
|
89
|
+
::FileUtils.mkdir_p(dir)
|
90
|
+
#object = to_json
|
91
|
+
File.open(file_name, "w") do |newfile|
|
92
|
+
newfile.puts Chef::JSONCompat.to_json_pretty(self)
|
93
|
+
newfile.flush
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_s
|
98
|
+
"token[#{@access_token}]"
|
99
|
+
end
|
100
|
+
|
101
|
+
def inspect
|
102
|
+
"ChefAnalytics::Token access_token:'#{access_token}' token_type:'#{token_type}' " +
|
103
|
+
"refresh_token:'#{refresh_token}' expiry:'#{expiry.rfc3339}'"
|
104
|
+
end
|
105
|
+
|
106
|
+
def expired?
|
107
|
+
@expiry < DateTime.now
|
108
|
+
end
|
109
|
+
|
110
|
+
def valid?
|
111
|
+
!expired?
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# Class methods
|
116
|
+
#
|
117
|
+
def self.from_file(filename)
|
118
|
+
if File.exists?(filename) && File.readable?(filename)
|
119
|
+
contents = IO.read(filename)
|
120
|
+
ChefAnalytics::Token.from_json(contents)
|
121
|
+
else
|
122
|
+
raise IOError, "Cannot open or read #{filename}!"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def self.from_json(json)
|
127
|
+
ChefAnalytics::Token.from_hash(Chef::JSONCompat.from_json(json))
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.from_hash(hash)
|
131
|
+
token = ChefAnalytics::Token.new
|
132
|
+
token.access_token hash['access_token']
|
133
|
+
token.token_type hash['token_type']
|
134
|
+
token.refresh_token hash['refresh_token']
|
135
|
+
if hash.has_key?('expires_in')
|
136
|
+
token.expiry DateTime.now + Rational(hash['expires_in'],86400)
|
137
|
+
else
|
138
|
+
token.expiry DateTime.rfc3339(hash['expiry'])
|
139
|
+
end
|
140
|
+
token.identity_server_url hash['identity_server_url'] if hash['identity_server_url']
|
141
|
+
token.client_name hash['client_name'] if hash['client_name']
|
142
|
+
token
|
143
|
+
end
|
144
|
+
|
145
|
+
class << self
|
146
|
+
alias_method :json_create, :from_json
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
module ChefAnalytics
|
19
|
+
VERSION='0.1.0'
|
20
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Copyright:: Copyright (c) 2014 Chef Software, Inc.
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef-analytics'
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
# Basic configuraiton
|
22
|
+
config.run_all_when_everything_filtered = true
|
23
|
+
config.filter_run(:focus)
|
24
|
+
|
25
|
+
#
|
26
|
+
config.before(:each) do
|
27
|
+
Logify.level = :fatal
|
28
|
+
end
|
29
|
+
|
30
|
+
# Run specs in random order to surface order dependencies. If you find an
|
31
|
+
# order dependency and want to debug it, you can fix the order by providing
|
32
|
+
# the seed, which is printed after each run.
|
33
|
+
# --seed 1234
|
34
|
+
config.order = 'random'
|
35
|
+
end
|
36
|
+
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef-analytics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Casey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-20 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: mixlib-config
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A Chef analytics API client with minimal dependencies
|
42
|
+
email:
|
43
|
+
- james@getchef.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- Gemfile
|
50
|
+
- Gemfile.lock
|
51
|
+
- LICENSE
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- chef-analytics.gemspec
|
55
|
+
- lib/chef-analytics.rb
|
56
|
+
- lib/chef-analytics/config.rb
|
57
|
+
- lib/chef-analytics/http/token_authenticator.rb
|
58
|
+
- lib/chef-analytics/identity.rb
|
59
|
+
- lib/chef-analytics/knife.rb
|
60
|
+
- lib/chef-analytics/server_api.rb
|
61
|
+
- lib/chef-analytics/token.rb
|
62
|
+
- lib/chef-analytics/version.rb
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
homepage: https://github.com/opscode/chef-analytics-api
|
65
|
+
licenses:
|
66
|
+
- Apache 2.0
|
67
|
+
metadata: {}
|
68
|
+
post_install_message:
|
69
|
+
rdoc_options: []
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.9'
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
requirements: []
|
83
|
+
rubyforge_project:
|
84
|
+
rubygems_version: 2.2.2
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: A Chef analytics API client in Ruby
|
88
|
+
test_files:
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
has_rdoc:
|