itamae 1.9.0 → 1.9.1
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/Gemfile +1 -1
- data/README.md +3 -1
- data/lib/itamae/resource/http_request.rb +36 -2
- data/lib/itamae/version.txt +1 -1
- data/spec/integration/default_spec.rb +21 -0
- data/spec/integration/recipes/default.rb +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1922ba87b574d058801766b1b549a9a26e9b9b20
|
4
|
+
data.tar.gz: ddf59e714b58036d98cc1e11510adb54e41fb6eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d44161aadb0e9a388e14668fbedb08ef4bf3e585f95347e529751a2b6a98f6949c1f41c2d940c485b8db95df0bcb50504d8b7f43c3ba1b00c8ee6e2141761dd
|
7
|
+
data.tar.gz: bde120804a97c6109a37ceece9667d17214c1f1cb155b69938ded9c43b5be181e5932c0e548bc9c7429d98b008d70cd52ff756a571e49a8360a2d7e9425658e6
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in itamae.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'vagrant', github: '
|
6
|
+
gem 'vagrant', github: 'ryotarai/vagrant', branch: 'latest-bundler'
|
7
7
|
gem 'vagrant-digitalocean'
|
8
8
|
|
9
9
|
path = Pathname.new("Gemfile.local")
|
data/README.md
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# [](https://github.com/itamae-kitchen/itamae)
|
2
|
+
|
3
|
+
[](http://badge.fury.io/rb/itamae) [](https://codeclimate.com/github/ryotarai/itamae) [](https://app.wercker.com/project/bykey/3e7be3b982d3671940a07e3ef45d9f5f) [](https://itamae-slackin.herokuapp.com/)
|
2
4
|
|
3
5
|
Simple and lightweight configuration management tool inspired by Chef.
|
4
6
|
|
@@ -1,19 +1,53 @@
|
|
1
1
|
require 'itamae'
|
2
|
-
require '
|
2
|
+
require 'uri'
|
3
|
+
require 'net/http'
|
3
4
|
|
4
5
|
module Itamae
|
5
6
|
module Resource
|
6
7
|
class HttpRequest < File
|
7
8
|
UrlNotFoundError = Class.new(StandardError)
|
8
9
|
|
10
|
+
define_attribute :action, default: :get
|
9
11
|
define_attribute :headers, type: Hash, default: {}
|
12
|
+
define_attribute :message, type: String, default: ""
|
10
13
|
define_attribute :url, type: String, required: true
|
11
14
|
|
12
15
|
def pre_action
|
13
|
-
|
16
|
+
uri = URI.parse(attributes.url)
|
17
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
18
|
+
http.use_ssl = true if uri.scheme == "https"
|
19
|
+
|
20
|
+
case attributes.action
|
21
|
+
when :delete, :get, :options
|
22
|
+
response = http.method(attributes.action).call(uri.request_uri, attributes.headers)
|
23
|
+
when :post, :put
|
24
|
+
response = http.method(attributes.action).call(uri.request_uri, attributes.message, attributes.headers)
|
25
|
+
end
|
26
|
+
|
27
|
+
attributes.content = response.body
|
14
28
|
|
15
29
|
super
|
16
30
|
end
|
31
|
+
|
32
|
+
def action_delete(options)
|
33
|
+
action_create(options)
|
34
|
+
end
|
35
|
+
|
36
|
+
def action_get(options)
|
37
|
+
action_create(options)
|
38
|
+
end
|
39
|
+
|
40
|
+
def action_options(options)
|
41
|
+
action_create(options)
|
42
|
+
end
|
43
|
+
|
44
|
+
def action_post(options)
|
45
|
+
action_create(options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def action_put(options)
|
49
|
+
action_create(options)
|
50
|
+
end
|
17
51
|
end
|
18
52
|
end
|
19
53
|
end
|
data/lib/itamae/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.9.
|
1
|
+
1.9.1
|
@@ -75,6 +75,27 @@ describe file('/tmp/http_request.html') do
|
|
75
75
|
its(:content) { should match(/"from": "itamae"/) }
|
76
76
|
end
|
77
77
|
|
78
|
+
describe file('/tmp/http_request_delete.html') do
|
79
|
+
it { should be_file }
|
80
|
+
its(:content) { should match(/"from": "itamae"/) }
|
81
|
+
end
|
82
|
+
|
83
|
+
describe file('/tmp/http_request_post.html') do
|
84
|
+
it { should be_file }
|
85
|
+
its(:content) do
|
86
|
+
should match(/"from": "itamae"/)
|
87
|
+
should match(/"love": "sushi"/)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
describe file('/tmp/http_request_put.html') do
|
92
|
+
it { should be_file }
|
93
|
+
its(:content) do
|
94
|
+
should match(/"from": "itamae"/)
|
95
|
+
should match(/"love": "sushi"/)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
78
99
|
describe file('/tmp/http_request_headers.html') do
|
79
100
|
it { should be_file }
|
80
101
|
its(:content) { should match(/"User-Agent": "Itamae"/) }
|
@@ -160,6 +160,23 @@ http_request "/tmp/http_request.html" do
|
|
160
160
|
url "https://httpbin.org/get?from=itamae"
|
161
161
|
end
|
162
162
|
|
163
|
+
http_request "/tmp/http_request_delete.html" do
|
164
|
+
action :delete
|
165
|
+
url "https://httpbin.org/delete?from=itamae"
|
166
|
+
end
|
167
|
+
|
168
|
+
http_request "/tmp/http_request_post.html" do
|
169
|
+
action :post
|
170
|
+
message "love=sushi"
|
171
|
+
url "https://httpbin.org/post?from=itamae"
|
172
|
+
end
|
173
|
+
|
174
|
+
http_request "/tmp/http_request_put.html" do
|
175
|
+
action :put
|
176
|
+
message "love=sushi"
|
177
|
+
url "https://httpbin.org/put?from=itamae"
|
178
|
+
end
|
179
|
+
|
163
180
|
http_request "/tmp/http_request_headers.html" do
|
164
181
|
headers "User-Agent" => "Itamae"
|
165
182
|
url "https://httpbin.org/get"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itamae
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryota Arai
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -313,7 +313,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
313
|
version: '0'
|
314
314
|
requirements: []
|
315
315
|
rubyforge_project:
|
316
|
-
rubygems_version: 2.4.5
|
316
|
+
rubygems_version: 2.4.5.1
|
317
317
|
signing_key:
|
318
318
|
specification_version: 4
|
319
319
|
summary: Simple Configuration Management Tool
|