rails_pwnerer 0.5.14 → 0.5.15

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.5.15. Home-baked process info (in case Sys::Proctable doesn't work).
2
+
1
3
  v0.5.14. App-directed gem installation (because Rails 2.1.0 doesn't quite work yet).
2
4
 
3
5
  v0.5.13. Writable dirs are created if they didn't exist before.
@@ -20,7 +20,7 @@ module RailsPwnage::Base
20
20
  def gem_exists?(gem_name)
21
21
  begin
22
22
  output = `gem specification --local #{gem_name} 2> /dev/null`
23
- return output =~ /$\-\-\- \!ruby\/object\:Gem\:\:Specification/
23
+ return output =~ /^\-\-\- \!ruby\/object\:Gem\:\:Specification/
24
24
  rescue
25
25
  # we get here if gem exits with an error code
26
26
  return false
@@ -2,37 +2,52 @@
2
2
 
3
3
  begin
4
4
  require 'sys/proctable'
5
-
6
- module RailsPwnage::Base
5
+ rescue Exception
6
+ # the sys-proctable gem isn't available during scaffolding
7
+ # (or if the compilation breaks for some reason); mock it
7
8
 
8
- # returns information about a process
9
- def process_info(pid = nil)
10
- info = Hash.new
11
- Sys::ProcTable.ps.each do |process|
12
- item = { :cmdline => process.cmdline, :pid => pid.to_s }
9
+ module Sys
10
+ end
13
11
 
14
- if pid.nil?
15
- info[process.pid.to_s] = item
16
- else
17
- return item if item.pid.to_s == pid.to_s
18
- end
12
+ module Sys::ProcTable
13
+ class ProcInfo
14
+ def initialize(pid, cmdline)
15
+ @pid = pid
16
+ @cmdline = cmdline
19
17
  end
20
- if pid.nil?
21
- return info
22
- else
23
- return nil
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
24
28
  end
29
+ return retval
25
30
  end
26
31
  end
27
- rescue Exception
28
- # the sys-proctable gem isn't available during scaffolding
29
- module RailsPwnage::Base
30
- def process_info(pid = nil)
32
+ end
33
+
34
+ module RailsPwnage::Base
35
+ # returns information about a process
36
+ def process_info(pid = nil)
37
+ info = Hash.new
38
+ Sys::ProcTable.ps.each do |process|
39
+ item = { :cmdline => process.cmdline, :pid => process.pid.to_s }
40
+
31
41
  if pid.nil?
32
- return {}
42
+ info[process.pid.to_s] = item
33
43
  else
34
- return nil
44
+ return item if item.pid.to_s == pid.to_s
35
45
  end
36
46
  end
47
+ if pid.nil?
48
+ return info
49
+ else
50
+ return nil
51
+ end
37
52
  end
38
53
  end
@@ -1,18 +1,18 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.5.14
2
+ # Gem::Specification for Rails_pwnerer-0.5.15
3
3
  # Originally generated by Echoe
4
4
 
5
5
  --- !ruby/object:Gem::Specification
6
6
  name: rails_pwnerer
7
7
  version: !ruby/object:Gem::Version
8
- version: 0.5.14
8
+ version: 0.5.15
9
9
  platform: ruby
10
10
  authors:
11
11
  - Victor Costan
12
12
  autorequire:
13
13
  bindir: bin
14
14
 
15
- date: 2008-08-23 00:00:00 -04:00
15
+ date: 2008-08-24 00:00:00 -04:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_pwnerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.5.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-23 00:00:00 -04:00
12
+ date: 2008-08-24 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency