infrataster 0.2.2 → 0.2.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: 45802587e55096a8eecbb01c976ee9f496a2dfc6
4
- data.tar.gz: 8d752d4ff55cf971095bcd47caccf65422263690
3
+ metadata.gz: fb8def0e55eb1343153794f2f022fe53ff1dfb8e
4
+ data.tar.gz: cbc7037c6aa72c1d22c4bb93d88f1950a8cac967
5
5
  SHA512:
6
- metadata.gz: d2e996d6feb987dc561d0d3ea019475d8dc8e206a197b53e00b2c2d8dd873229befa99c9b2bbf0730e3c9abe5794faab5f1b792a1be11cbbe218bcf77c6d71ac
7
- data.tar.gz: 2382d3fc8e6fa2d1541522d361e2b8ec1a84f655c89570f3295997cec3d4821c516714351ba2179892dff6307d607d344696090c2f6a87d7d67ebb3b903ed769
6
+ metadata.gz: ada742cc200febf95205853d485e131d95db9153d359a73e96466cd172fcc7ff63b979303cb8290c7fa4a4f53bc09e9c9585f7052e4b3081807f857b3cb550fb
7
+ data.tar.gz: 7d29a0373733bca78c7747d3bb52975a853f3fa0918847182661827314d53076745afb5d2d8a8aa806c9f72e07d705506ed215a9153b1b461626ea7257877148
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Infrataster Changelog
2
2
 
3
+ ## v0.2.3
4
+
5
+ * [http resource supports basic auth. (by @winebarrel)](https://github.com/ryotarai/infrataster/pull/54)
6
+
3
7
  ## v0.2.2
4
8
 
5
9
  * Server can be defined by block. (https://github.com/ryotarai/infrataster/pull/51 by @otahi)
@@ -16,6 +16,7 @@ module Infrataster
16
16
  faraday.request :url_encoded
17
17
  faraday.response :logger, Logger
18
18
  faraday.adapter Faraday.default_adapter
19
+ faraday.basic_auth(*resource.basic_auth) if resource.basic_auth
19
20
  end
20
21
 
21
22
  conn.public_send(resource.method) do |req|
@@ -44,6 +44,10 @@ module Infrataster
44
44
  def ssl_option
45
45
  @options[:ssl]
46
46
  end
47
+
48
+ def basic_auth
49
+ @options[:basic_auth]
50
+ end
47
51
  end
48
52
  end
49
53
  end
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -22,6 +22,19 @@ describe server(:proxy) do
22
22
  expect(response.headers['content-encoding']).to eq('gzip')
23
23
  end
24
24
  end
25
+
26
+ describe http('http://static.example.com/auth') do
27
+ it "sends GET request without basic auth" do
28
+ expect(response.status).to eq 401
29
+ end
30
+ end
31
+
32
+ describe http('http://static.example.com/auth', basic_auth: ['dummy', 'dummy']) do
33
+ it "sends GET request with basic auth" do
34
+ expect(response.status).to eq 200
35
+ expect(response.body).to include('auth')
36
+ end
37
+ end
25
38
  end
26
39
 
27
40
  describe server(:app) do
@@ -0,0 +1 @@
1
+ dummy:$apr1$xLfour3i$43BqMHRaaXxY8eRzmBtKr1
@@ -20,3 +20,10 @@ cookbook_file '/usr/share/nginx/www/index.html' do
20
20
  mode '0644'
21
21
  end
22
22
 
23
+ cookbook_file '/usr/share/nginx/www/auth' do
24
+ mode '0644'
25
+ end
26
+
27
+ cookbook_file '/etc/nginx/.htpasswd' do
28
+ mode '0644'
29
+ end
@@ -12,6 +12,11 @@ server {
12
12
  location / {
13
13
  try_files $uri $uri/ /index.html;
14
14
  }
15
+
16
+ location = /auth {
17
+ auth_basic "Restricted";
18
+ auth_basic_user_file /etc/nginx/.htpasswd;
19
+ }
15
20
  }
16
21
 
17
22
  server {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infrataster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
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-01-17 00:00:00.000000000 Z
11
+ date: 2015-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -210,6 +210,8 @@ files:
210
210
  - spec/integration/vm/cookbooks/app/recipes/default.rb
211
211
  - spec/integration/vm/cookbooks/apt-mirror/metadata.rb
212
212
  - spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
213
+ - spec/integration/vm/cookbooks/proxy/files/default/.htpasswd
214
+ - spec/integration/vm/cookbooks/proxy/files/default/auth
213
215
  - spec/integration/vm/cookbooks/proxy/files/default/index.html
214
216
  - spec/integration/vm/cookbooks/proxy/recipes/default.rb
215
217
  - spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb
@@ -257,6 +259,8 @@ test_files:
257
259
  - spec/integration/vm/cookbooks/app/recipes/default.rb
258
260
  - spec/integration/vm/cookbooks/apt-mirror/metadata.rb
259
261
  - spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
262
+ - spec/integration/vm/cookbooks/proxy/files/default/.htpasswd
263
+ - spec/integration/vm/cookbooks/proxy/files/default/auth
260
264
  - spec/integration/vm/cookbooks/proxy/files/default/index.html
261
265
  - spec/integration/vm/cookbooks/proxy/recipes/default.rb
262
266
  - spec/integration/vm/cookbooks/proxy/templates/default/integration-test.erb