infrataster 0.1.6 → 0.1.7

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: 5dc2f4bfbb95e831073eda6fed2e8e08032f351d
4
- data.tar.gz: 47157b14bc98ee9311b1c96075e7ffc14eaccea5
3
+ metadata.gz: b02e1a94765dc0d775d830797454180472654009
4
+ data.tar.gz: 29d0856e7cdce1920a7df6690b5f57f145cb2fc1
5
5
  SHA512:
6
- metadata.gz: 722dcfd3788573323d4e6d78cbc074ace5312ee24eb7738788482ce91d626089e1b352852ff75928a275bd19b74ca4544c50c7c89aa8c01da181c89da1f7f6b5
7
- data.tar.gz: 37cf98854f85b6513a554f0494a98bb97a1cc4757e90ec7e2492368507faf5693f3b30501bd9f8566918a32b2bf2c2a3db81f3097dee25556796de5c057f8105
6
+ metadata.gz: 37fd588b2774e7219915bddd22016bfe7158ffd09bad938259f526e4ace64fc21abfda87884bd0dbb925aef07002f36dcec005cb7fde760dc23b8182e0b2ab20
7
+ data.tar.gz: 7b10de04e16a5a507f9119aacd8c35f72948a595907c25f96ab7c61a004a69b812f67c3fa2d724c3405f2a91715a9eb2b1b6410e46b1936eafcedd0e09e5503a
@@ -1,5 +1,9 @@
1
1
  # Infrataster Changelog
2
2
 
3
+ ## v0.1.7
4
+
5
+ * Fix a key name in a config passed to Net::SSH.start. (by @rrreeeyyy)
6
+
3
7
  ## v0.1.6
4
8
 
5
9
  * Implement `Server#ssh\_exec` which executes a command on the server via SSH.
@@ -5,21 +5,21 @@ require 'capybara/poltergeist'
5
5
  module Infrataster
6
6
  module Contexts
7
7
  class CapybaraContext < BaseContext
8
+ CAPYBARA_DRIVER_NAME = :infrataster_driver
9
+
8
10
  def self.session
9
11
  @session ||= prepare_session
10
12
  end
11
13
 
12
14
  def self.prepare_session
13
- capybara_driver_name = :infrataster_driver
14
-
15
15
  proxy = BrowsermobProxy.proxy
16
- Capybara.register_driver capybara_driver_name do |app|
16
+ Capybara.register_driver CAPYBARA_DRIVER_NAME do |app|
17
17
  Capybara::Poltergeist::Driver.new(
18
18
  app,
19
19
  phantomjs_options: ["--proxy=http://#{proxy.host}:#{proxy.port}"],
20
20
  )
21
21
  end
22
- Capybara::Session.new(capybara_driver_name)
22
+ Capybara::Session.new(CAPYBARA_DRIVER_NAME)
23
23
  end
24
24
 
25
25
  def initialize(*args)
@@ -124,7 +124,7 @@ module Infrataster
124
124
 
125
125
  if @options[:ssh]
126
126
  config = @options[:ssh]
127
- config[:host] ||= @address
127
+ config[:host_name] ||= @address
128
128
  elsif @options[:vagrant]
129
129
  vagrant_name = if @options[:vagrant] != true
130
130
  @options[:vagrant]
@@ -136,7 +136,7 @@ module Infrataster
136
136
  raise Error, "Can't get configuration to connect to the server via SSH. Please set ssh option or vagrant option."
137
137
  end
138
138
 
139
- [config[:host], config[:user], config]
139
+ [config[:host_name], config[:user], config]
140
140
  end
141
141
 
142
142
  def ssh_config_for_vagrant(name)
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -13,6 +13,15 @@ describe server(:proxy) do
13
13
  expect(response.body).to include('static')
14
14
  end
15
15
  end
16
+
17
+ # If accept-encoding is not specified explicitly,
18
+ # Net::HTTP (faraday's default adapter) sends request with accept-encoding=gzip
19
+ # and inflate response as gzip automaticallly
20
+ describe http('http://static.example.com', headers: {"Accept-Encoding" => "gzip"}) do
21
+ it "gets response compressed by gzip" do
22
+ expect(response.headers['content-encoding']).to eq('gzip')
23
+ end
24
+ end
16
25
  end
17
26
 
18
27
  describe server(:app) do
@@ -1,4 +1,12 @@
1
- execute "sed -i -e 's| \\(http[^ ]\\+\\)| mirror://mirrors.ubuntu.com/mirrors.txt|g' /etc/apt/sources.list"
1
+ require 'net/http'
2
+ require 'uri'
3
+
4
+ apt_servers = Net::HTTP.get(URI.parse('http://mirrors.ubuntu.com/mirrors.txt')).split("\n")
5
+ # ftp.riken.jp is unstable and slow?
6
+ apt_servers.delete('http://ftp.riken.jp/Linux/ubuntu/')
7
+ apt_server = apt_servers[rand(apt_servers.size)]
8
+
9
+ execute "sed -i -e 's| \\(http[^ ]\\+\\)| #{apt_server}|g' /etc/apt/sources.list"
2
10
 
3
11
  include_recipe 'apt'
4
12
 
@@ -1,6 +1,9 @@
1
1
  server {
2
2
  listen 80;
3
3
 
4
+ gzip on;
5
+ gzip_min_length 0;
6
+
4
7
  root /usr/share/nginx/www;
5
8
  index index.html index.htm;
6
9
 
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.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec