paul_rake 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paul_rake/railtie.rb +3 -3
- data/lib/paul_rake/version.rb +1 -1
- metadata +1 -2
- data/lib/tasks/nginx.rake +0 -48
data/lib/paul_rake/railtie.rb
CHANGED
@@ -4,9 +4,9 @@ require 'rails'
|
|
4
4
|
module MyGem
|
5
5
|
class Railtie < Rails::Railtie
|
6
6
|
rake_tasks do
|
7
|
-
load 'lib/tasks/nginx.rake'
|
8
|
-
#
|
9
|
-
|
7
|
+
# load 'lib/tasks/nginx.rake'
|
8
|
+
# this does not work for some reason, code below is suggested
|
9
|
+
Dir[File.join(File.dirname(__FILE__),'tasks/*.rake')].each { |f| load f }
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
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.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -26,7 +26,6 @@ files:
|
|
26
26
|
- lib/paul_rake.rb
|
27
27
|
- lib/paul_rake/railtie.rb
|
28
28
|
- lib/paul_rake/version.rb
|
29
|
-
- lib/tasks/nginx.rake
|
30
29
|
- paul_rake.gemspec
|
31
30
|
homepage: ''
|
32
31
|
licenses: []
|
data/lib/tasks/nginx.rake
DELETED
@@ -1,48 +0,0 @@
|
|
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
|
-
|