nginx-conf 0.0.4 → 0.0.5
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/lib/nginx-conf/nginx_conf.rb +5 -2
- metadata +16 -3
- data/lib/nginx-conf/conf.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06cbad9bea68ffecddc43e4e88d9c66c39053dff
|
4
|
+
data.tar.gz: 2514c8e44ec96405da6ce68073a5346cb2c5f77c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b8bf040afc0cefe5d1728be8c781c3b4ddd82895c1f22c1b39bef6d8acabf7a888cc0c42b0805b727919693864722540fa853a19f536c43c195b5592605412e
|
7
|
+
data.tar.gz: ee951034a8ba1893da07a4adfb797e64175d90a67116a977df92eac6f80063a2f7a05e3bc276cc506ac26b83998c453dcf96750ba83fe25df1de1a42a9413d76
|
@@ -1,7 +1,10 @@
|
|
1
|
-
|
1
|
+
require 'block-is-hash'
|
2
|
+
|
3
|
+
require_relative 'compiler'
|
2
4
|
|
3
5
|
|
4
6
|
|
5
7
|
def nginx_conf &block
|
6
|
-
|
8
|
+
repeats = %i(server load_module)
|
9
|
+
Compiler.new(repeats).compile block_is_hash(repeats, &block)
|
7
10
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nginx-conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yota Toyama
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2016-10-23 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: block-is-hash
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: nginx.conf generator with pretty DSL
|
14
28
|
email: raviqqe@gmail.com
|
15
29
|
executables: []
|
@@ -18,7 +32,6 @@ extra_rdoc_files: []
|
|
18
32
|
files:
|
19
33
|
- lib/nginx-conf.rb
|
20
34
|
- lib/nginx-conf/compiler.rb
|
21
|
-
- lib/nginx-conf/conf.rb
|
22
35
|
- lib/nginx-conf/nginx_conf.rb
|
23
36
|
homepage: https://github.com/raviqqe/nginx-conf.rb
|
24
37
|
licenses:
|
data/lib/nginx-conf/conf.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require_relative 'compiler'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class Conf
|
6
|
-
def initialize repeats, &block
|
7
|
-
@repeats = repeats
|
8
|
-
@attrs = {}
|
9
|
-
instance_eval(&block)
|
10
|
-
end
|
11
|
-
|
12
|
-
def method_missing name, *args, &block
|
13
|
-
if not (args or block)
|
14
|
-
@attrs[name]
|
15
|
-
end
|
16
|
-
|
17
|
-
if block
|
18
|
-
args.push Conf.new(@repeats, &block).to_hash
|
19
|
-
end
|
20
|
-
|
21
|
-
value = args.length == 1 ? args[0] : args
|
22
|
-
|
23
|
-
if @repeats.include? name and @attrs.include? name
|
24
|
-
@attrs[name].push value
|
25
|
-
elsif @repeats.include? name
|
26
|
-
@attrs[name] = [value]
|
27
|
-
else
|
28
|
-
@attrs[name] = value
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_hash
|
33
|
-
@attrs
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_s
|
37
|
-
Compiler.new(@repeats).compile(@attrs)
|
38
|
-
end
|
39
|
-
end
|