infraction 0.0.5 → 0.0.6

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.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/infraction.rb +32 -0
  3. metadata +4 -8
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ M2FjZTViNmZkOThjM2MyOGE0ZjBkNjEwMDcxN2M2NWU1Nzc1ZjFjYQ==
5
+ data.tar.gz: !binary |-
6
+ Yjg3MDA4MWRkZjcyOTA4OTRjYjIzMjhjOTg2ZTYwMWE4NzBiNGUwZg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ YjA2NDQ0YjA1ZmMxNmYwOWI5YThiNTQ5YmY5YmQxNDEwMmJhMmNhYzIyZTk2
10
+ NjQ1ZDA5YzJlODYxYzIzODRkYjJkYjYxYjgxMDQ3ZTA2ZTliYzYyOThkNTQw
11
+ ODQwZDJiODBkNjA0NDQ0ODk4Yzc4ZDdjNmRhYzc5ODEwNjYwMzc=
12
+ data.tar.gz: !binary |-
13
+ OWU0Yzk1MjU5ZjA0ZjIxNjg1MDBjYTQxZTAzNDI0MGU4YmE3ZjcwNjRiYjBl
14
+ ZDUwNjE3OTA1ZGRjN2JhZTkyZGIwZGFjNjhhMWM4ZWEyZWZjMjI2YWVjMmI2
15
+ ODI2ZTIzMjZkZTc0NjYxZjQ4NDY1MTkyZDdiMzY4NWM1M2NjNTE=
data/lib/infraction.rb CHANGED
@@ -6,34 +6,66 @@ module Infraction
6
6
  end
7
7
 
8
8
  end
9
+
9
10
  def self.nginx(&block)
10
11
  Nginx::NginxBuildContext.new.exec &block
11
12
  end
13
+
12
14
  module Nginx
13
15
  module Dsl
14
16
  def pass_through(host)
15
17
  Infraction::Nginx::PassthroughBuilder.new(host)
16
18
  end
19
+
20
+ def redirect(source_url)
21
+ Infraction::Nginx::RedirectBuilder.new(source_url)
22
+ end
23
+
17
24
  end
25
+
18
26
  class NginxBuildContext < ::Infraction::BuildContext
19
27
  include Nginx::Dsl
20
28
  end
29
+
30
+ class RedirectBuilder
31
+ def initialize(source_url)
32
+ @source_url = source_url
33
+ end
34
+
35
+ def to(destination_url)
36
+ @destination_url = destination_url
37
+ self
38
+ end
39
+
40
+ def generate
41
+ "
42
+ location #{@source_url} {
43
+ rewrite ^#{@source_url}$ #{@destination_url} permanent;
44
+ }
45
+ "
46
+ end
47
+ end
48
+
21
49
  class PassthroughBuilder
22
50
  def initialize(host)
23
51
  @host = host
24
52
  end
53
+
25
54
  def including(subdomain)
26
55
  @subdomain = subdomain
27
56
  self
28
57
  end
58
+
29
59
  def on(port)
30
60
  @port = port
31
61
  self
32
62
  end
63
+
33
64
  def forward_to(host)
34
65
  @forward_host = host
35
66
  self
36
67
  end
68
+
37
69
  def generate
38
70
  "server {
39
71
  listen #{@port};
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infraction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - www-thoughtworks-com
@@ -14,7 +13,6 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - '='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - '='
28
25
  - !ruby/object:Gem::Version
@@ -36,26 +33,25 @@ files:
36
33
  - lib/infraction.rb
37
34
  homepage: https://github.com/www-thoughtworks-com/infraction
38
35
  licenses: []
36
+ metadata: {}
39
37
  post_install_message:
40
38
  rdoc_options: []
41
39
  require_paths:
42
40
  - lib
43
41
  required_ruby_version: !ruby/object:Gem::Requirement
44
- none: false
45
42
  requirements:
46
43
  - - ! '>='
47
44
  - !ruby/object:Gem::Version
48
45
  version: '0'
49
46
  required_rubygems_version: !ruby/object:Gem::Requirement
50
- none: false
51
47
  requirements:
52
48
  - - ! '>='
53
49
  - !ruby/object:Gem::Version
54
50
  version: '0'
55
51
  requirements: []
56
52
  rubyforge_project:
57
- rubygems_version: 1.8.24
53
+ rubygems_version: 2.0.7
58
54
  signing_key:
59
- specification_version: 3
55
+ specification_version: 4
60
56
  summary: simple infrastructure configuration generator, expressed in ruby
61
57
  test_files: []