paul_rake 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paul_rake/tasks/nginx.rake +48 -0
- data/lib/paul_rake/version.rb +1 -1
- metadata +2 -1
@@ -0,0 +1,48 @@
|
|
1
|
+
namespace :nginx do
|
2
|
+
|
3
|
+
def ask message
|
4
|
+
print message
|
5
|
+
STDIN.gets.chomp
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Creates nginx conf files for single domain'
|
9
|
+
task :conf,[:domain] do |cmd,args|
|
10
|
+
domain = args[:domain]
|
11
|
+
puts domain
|
12
|
+
puts domain.strip
|
13
|
+
content = ERB.new(File.read(Rails.root.join('lib','domain_server_name.conf.erb'))).result(binding)
|
14
|
+
File.open(Rails.root.join('config','nginx',domain), 'w') {|f| f.write(content) }
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
desc 'Creates nginx conf files for all domains'
|
19
|
+
task :create do
|
20
|
+
domains = []
|
21
|
+
File.open(Rails.root.join('lib','domains_for_sale')).each_line do |line|
|
22
|
+
p line
|
23
|
+
domains << line.strip
|
24
|
+
end
|
25
|
+
domains.each do |domain|
|
26
|
+
Rake::Task['nginx:conf'].reenable
|
27
|
+
Rake::Task['nginx:conf'].invoke(domain)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'copy all nginx files to nginx direcotry'
|
32
|
+
task :copy do
|
33
|
+
command = "cp #{Rails.root.join('config','nginx')}/* /etc/nginx/domains_for_sale/"
|
34
|
+
system(command)
|
35
|
+
end
|
36
|
+
|
37
|
+
desc 'Choose port for this app'
|
38
|
+
task :port do
|
39
|
+
puts "The following ports are already used on this server:"
|
40
|
+
system ('cat ../*/port') # refactor to ruby code
|
41
|
+
port = ask("\nWhich starting port you want to use for this app? ")
|
42
|
+
File.open('port', 'w') {|f| f.write(port) }
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
end
|
48
|
+
|
data/lib/paul_rake/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paul_rake
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- Rakefile
|
26
26
|
- lib/paul_rake.rb
|
27
27
|
- lib/paul_rake/railtie.rb
|
28
|
+
- lib/paul_rake/tasks/nginx.rake
|
28
29
|
- lib/paul_rake/version.rb
|
29
30
|
- paul_rake.gemspec
|
30
31
|
homepage: ''
|