rails_pwnerer 0.6.81 → 0.6.82
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -77,7 +77,7 @@ ENDSQL
|
|
77
77
|
!(/mysql/ =~ configuration['production']['adapter'])
|
78
78
|
configuration['production']['adapter'] = 'mysql2'
|
79
79
|
end
|
80
|
-
configuration['production']['encoding'] ||= '
|
80
|
+
configuration['production']['encoding'] ||= 'utf8'
|
81
81
|
configuration['production'].merge! 'database' => db_name, 'username' => db_user, 'password' => db_pass
|
82
82
|
configuration['production'].merge! mysql_host_info()
|
83
83
|
File.open(config_file, 'w') { |f| YAML.dump(configuration, f) }
|
@@ -1,41 +1,11 @@
|
|
1
1
|
# extends Base with process management features
|
2
|
-
|
3
|
-
begin
|
4
|
-
require 'sys/proctable'
|
5
|
-
rescue Exception
|
6
|
-
# the sys-proctable gem isn't available during scaffolding
|
7
|
-
# (or if the compilation breaks for some reason); mock it
|
8
|
-
|
9
|
-
module Sys
|
10
|
-
end
|
11
|
-
|
12
|
-
module Sys::ProcTable
|
13
|
-
class ProcInfo
|
14
|
-
def initialize(pid, cmdline)
|
15
|
-
@pid = pid
|
16
|
-
@cmdline = cmdline
|
17
|
-
end
|
18
|
-
attr_reader :pid, :cmdline
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.ps
|
22
|
-
retval = []
|
23
|
-
ps_output = `ps ax`
|
24
|
-
ps_output.each_line do |pline|
|
25
|
-
pdata = pline.split(nil, 5)
|
26
|
-
pinfo = ProcInfo.new(pdata[0].strip, pdata[4].strip)
|
27
|
-
retval << pinfo
|
28
|
-
end
|
29
|
-
return retval
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
2
|
+
require 'zerg_support'
|
33
3
|
|
34
4
|
module RailsPwnerer::Base
|
35
5
|
# returns information about a process
|
36
6
|
def process_info(pid = nil)
|
37
7
|
info = Hash.new
|
38
|
-
|
8
|
+
Zerg::Support::ProcTable.ps.each do |process|
|
39
9
|
item = { :cmdline => process.cmdline, :pid => process.pid.to_s }
|
40
10
|
|
41
11
|
if pid.nil?
|
@@ -50,4 +20,8 @@ module RailsPwnerer::Base
|
|
50
20
|
return nil
|
51
21
|
end
|
52
22
|
end
|
23
|
+
|
24
|
+
def kill_tree
|
25
|
+
Zerg::Support::Process.kill_tree pid
|
26
|
+
end
|
53
27
|
end
|
@@ -7,6 +7,9 @@ class RailsPwnerer::Scaffolds::Gems
|
|
7
7
|
# The gem repository gets wiped on new Debian and Ubuntu installs, so we
|
8
8
|
# need to reinstall ourselves.
|
9
9
|
install_gems %w(rails_pwnerer)
|
10
|
+
|
11
|
+
# Process management.
|
12
|
+
install_gems %w(zerg_support)
|
10
13
|
end
|
11
14
|
|
12
15
|
def install_databases
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'zerg_support'
|
2
|
+
|
1
3
|
module RailsPwnerer::Util
|
2
4
|
# Complex procedure for killing a process or a bunch of process replicas
|
3
5
|
# kill_command is the script that's supposed to kill the process / processes (tried first)
|
@@ -38,7 +40,7 @@ module RailsPwnerer::Util
|
|
38
40
|
# avoid killing innocent victims
|
39
41
|
if pinfo[pid].nil? or process_patterns.all? { |pattern| process_cmdline.index pattern }
|
40
42
|
print "Killing #{pid}: #{process_cmdline}\n" if options[:verbose]
|
41
|
-
|
43
|
+
kill_tree pid.to_i
|
42
44
|
end
|
43
45
|
rescue
|
44
46
|
# just in case the file gets wiped before we see it
|
@@ -56,7 +58,7 @@ module RailsPwnerer::Util
|
|
56
58
|
pinfo.each do |pid, info|
|
57
59
|
next unless process_patterns.all? { |pattern| info[:cmdline].index pattern }
|
58
60
|
print "Killing #{pid}: #{pinfo[pid][:cmdline]}\n" if options[:verbose]
|
59
|
-
|
61
|
+
kill_tree pid.to_i
|
60
62
|
end
|
61
63
|
end
|
62
64
|
end
|
data/rails_pwnerer.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{rails_pwnerer}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.82"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Victor Costan"]
|
9
|
-
s.date = %q{2010-10-
|
9
|
+
s.date = %q{2010-10-21}
|
10
10
|
s.default_executable = %q{bin/rpwn}
|
11
11
|
s.description = %q{Rails deployment hack.}
|
12
12
|
s.email = %q{victor@costan.us}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_pwnerer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 163
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 82
|
10
|
+
version: 0.6.82
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Victor Costan
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-21 00:00:00 -04:00
|
19
19
|
default_executable: bin/rpwn
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|