nginx 0.0.2
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +2 -0
- data/bin/nginx-config +46 -0
- data/lib/nginx.rb +5 -0
- data/lib/nginx/version.rb +3 -0
- data/nginx.gemspec +17 -0
- metadata +55 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Kirill Radzikhovskyy
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Nginx
|
2
|
+
|
3
|
+
Very small CLI for nginx configuration.
|
4
|
+
|
5
|
+
Sorry that I took name nginx.
|
6
|
+
|
7
|
+
|
8
|
+
TODO: Write a gem description
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'nginx'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install nginx
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
$ nginx-config add passenger www.example.com.au /path/to/public
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/nginx-config
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# detect nginx prefix
|
3
|
+
# get to config
|
4
|
+
# inject server statements
|
5
|
+
# parse arguments, for now only passenger is supported
|
6
|
+
|
7
|
+
#TODO fix detection of location of file
|
8
|
+
def nginx_conf
|
9
|
+
possible_locations = [
|
10
|
+
'/usr/local/etc/nginx/nginx.conf',
|
11
|
+
'/opt/nginx/conf/nginx.conf'
|
12
|
+
]
|
13
|
+
conf = possible_locations.select{|x| File.exists? x }.first
|
14
|
+
raise "Could not find confi" unless conf
|
15
|
+
return conf
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_server_to_conf conf_string
|
19
|
+
puts "Adding: \n #{conf_string}"
|
20
|
+
File.open(nginx_conf,'r+') do |f|
|
21
|
+
f.seek(-3, IO::SEEK_END)
|
22
|
+
f.write conf_string
|
23
|
+
f.write "\n}\n"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def add_passenger_server server_name, path_to_public
|
29
|
+
string = "
|
30
|
+
server {
|
31
|
+
listen 80;
|
32
|
+
server_name #{server_name};
|
33
|
+
root #{path_to_public};
|
34
|
+
passenger_enabled on;
|
35
|
+
}
|
36
|
+
"
|
37
|
+
add_server_to_conf string
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
#initial usage for passenger sites
|
42
|
+
puts "sample usage: "
|
43
|
+
puts "nginx add passenger www.example.com /home/user/path_to_public"
|
44
|
+
|
45
|
+
#TODO for now we only supporting passenger related config
|
46
|
+
add_passenger_server *ARGV[2..-1]
|
data/lib/nginx.rb
ADDED
data/nginx.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/nginx/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Kirill Radzikhovskyy"]
|
6
|
+
gem.email = ["kirillrdy@gmail.com"]
|
7
|
+
gem.description = %q{Small gem to manage nginx configuration}
|
8
|
+
gem.summary = %q{Gem for managin nginx configurations}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "nginx"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Nginx::VERSION
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nginx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kirill Radzikhovskyy
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-06-22 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Small gem to manage nginx configuration
|
15
|
+
email:
|
16
|
+
- kirillrdy@gmail.com
|
17
|
+
executables:
|
18
|
+
- nginx-config
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- .gitignore
|
23
|
+
- Gemfile
|
24
|
+
- LICENSE
|
25
|
+
- README.md
|
26
|
+
- Rakefile
|
27
|
+
- bin/nginx-config
|
28
|
+
- lib/nginx.rb
|
29
|
+
- lib/nginx/version.rb
|
30
|
+
- nginx.gemspec
|
31
|
+
homepage: ''
|
32
|
+
licenses: []
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 1.8.23
|
52
|
+
signing_key:
|
53
|
+
specification_version: 3
|
54
|
+
summary: Gem for managin nginx configurations
|
55
|
+
test_files: []
|