infrataster 0.2.1 → 0.2.2

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: 30a8caff494d20499e9c34ed7cd0f87bc3d19890
4
- data.tar.gz: fea6e96fc2ca5ba70317c400b0e1b22a6b91d2c8
3
+ metadata.gz: 45802587e55096a8eecbb01c976ee9f496a2dfc6
4
+ data.tar.gz: 8d752d4ff55cf971095bcd47caccf65422263690
5
5
  SHA512:
6
- metadata.gz: ba347d3caf3b0401e8442b9965aaa7588dd22cbab24e05dc5ee95967980ceeb11f062ba3cb679664788dbf598620d6efc53ccd2d821d23b62655ce98033f455b
7
- data.tar.gz: 1f0fc80ef9998d0ea255e0bb7771bc193e58c04ea030669caa945825f02e5b6740eb7ed5fb941cd8a02bf2accd2c3e15b478970a1ae67e09c893f3aab554605a
6
+ metadata.gz: d2e996d6feb987dc561d0d3ea019475d8dc8e206a197b53e00b2c2d8dd873229befa99c9b2bbf0730e3c9abe5794faab5f1b792a1be11cbbe218bcf77c6d71ac
7
+ data.tar.gz: 2382d3fc8e6fa2d1541522d361e2b8ec1a84f655c89570f3295997cec3d4821c516714351ba2179892dff6307d607d344696090c2f6a87d7d67ebb3b903ed769
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Infrataster Changelog
2
2
 
3
+ ## v0.2.2
4
+
5
+ * Server can be defined by block. (https://github.com/ryotarai/infrataster/pull/51 by @otahi)
6
+
3
7
  ## v0.2.1
4
8
 
5
9
  * `http` resource support `ssl` option which is passed to Faraday.new (by @SnehaM)
data/README.md CHANGED
@@ -75,6 +75,24 @@ Infrataster::Server.define(
75
75
  from: :proxy # access to this machine via SSH port forwarding from proxy
76
76
  )
77
77
 
78
+ # Code generated by `rspec --init` is following...
79
+ ```
80
+ Or
81
+
82
+ ```ruby
83
+ # spec/spec_helper.rb
84
+ require 'infrataster/rspec'
85
+
86
+ Infrataster::Server.define(:proxy) do |server|
87
+ server.address = '192.168.0.0/16'
88
+ server.vagrant = true
89
+ end
90
+ Infrataster::Server.define(:app) do |server|
91
+ server.address = '172.16.0.0/16'
92
+ server.vagrant = true
93
+ server.from = :proxy
94
+ end
95
+
78
96
  # Code generated by `rspec --init` is following...
79
97
  ```
80
98
 
@@ -251,6 +269,12 @@ end
251
269
 
252
270
  `pgsql_query` is provided by [infrataster-plugin-pgsql](https://github.com/SnehaM/infrataster-plugin-pgsql) by [@SnehaM](https://github.com/SnehaM).
253
271
 
272
+ ### `dns` resource
273
+
274
+ `dns` resource send query to DNS server.
275
+
276
+ `dns` is provided by [infrataster-plugin-dns](https://github.com/otahi/infrataster-plugin-dns) by [@otahi](https://github.com/otahi).
277
+
254
278
  ## Example
255
279
 
256
280
  * [example](example)
@@ -3,6 +3,7 @@ require 'net/ssh'
3
3
  require 'net/ssh/gateway'
4
4
  require 'ipaddr'
5
5
  require 'shellwords'
6
+ require 'ostruct'
6
7
 
7
8
  module Infrataster
8
9
  class Server
@@ -10,8 +11,16 @@ module Infrataster
10
11
 
11
12
  class << self
12
13
 
13
- def define(*args)
14
- @@servers << Server.new(*args)
14
+ def define(name, *args, &block)
15
+ address = args.shift
16
+ options = args.any? ? args.shift : {}
17
+ if block
18
+ st = OpenStruct.new
19
+ block.call(st)
20
+ address = st.address if st.address
21
+ st.each_pair { |k, v| options[k] = v unless k == :address }
22
+ end
23
+ @@servers << Server.new(name, address, options)
15
24
  end
16
25
 
17
26
  def defined_servers
@@ -1,3 +1,3 @@
1
1
  module Infrataster
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -1,3 +1,3 @@
1
1
  [program:rackup]
2
2
  directory=/vagrant/app
3
- command=rackup -p 80 config.ru
3
+ command=rackup -o 0.0.0.0 -p 80 config.ru
@@ -0,0 +1,2 @@
1
+ name 'apt-mirror'
2
+ depends 'apt'
@@ -11,6 +11,23 @@ module Infrataster
11
11
  expect(servers[0].address).to eq('127.0.0.1')
12
12
  expect(servers[0].options).to eq({})
13
13
  end
14
+ it "adds a Server instance to defined_servers with block" do
15
+ described_class.define(:app) do |server|
16
+ server.address = '127.0.0.1'
17
+ server.vagrant = true
18
+ server.from = :proxy
19
+ end
20
+ described_class.define(:proxy) do |server|
21
+ server.address = '127.0.0.1'
22
+ server.vagrant = true
23
+ end
24
+ servers = described_class.defined_servers
25
+ expect(servers.size).to eq(2)
26
+ expect(servers[0].name).to eq(:app)
27
+ expect(servers[0].address).to eq('127.0.0.1')
28
+ expect(servers[0].options[:vagrant]).to eq(true)
29
+ expect(servers[0].from).to eq(servers[1])
30
+ end
14
31
  end
15
32
 
16
33
  describe "self.find_by_name" do
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.1
4
+ version: 0.2.2
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-06 00:00:00.000000000 Z
11
+ date: 2015-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -208,6 +208,7 @@ files:
208
208
  - spec/integration/vm/app/config.ru
209
209
  - spec/integration/vm/cookbooks/app/files/default/rackup.conf
210
210
  - spec/integration/vm/cookbooks/app/recipes/default.rb
211
+ - spec/integration/vm/cookbooks/apt-mirror/metadata.rb
211
212
  - spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
212
213
  - spec/integration/vm/cookbooks/proxy/files/default/index.html
213
214
  - spec/integration/vm/cookbooks/proxy/recipes/default.rb
@@ -254,6 +255,7 @@ test_files:
254
255
  - spec/integration/vm/app/config.ru
255
256
  - spec/integration/vm/cookbooks/app/files/default/rackup.conf
256
257
  - spec/integration/vm/cookbooks/app/recipes/default.rb
258
+ - spec/integration/vm/cookbooks/apt-mirror/metadata.rb
257
259
  - spec/integration/vm/cookbooks/apt-mirror/recipes/default.rb
258
260
  - spec/integration/vm/cookbooks/proxy/files/default/index.html
259
261
  - spec/integration/vm/cookbooks/proxy/recipes/default.rb