rails_pwnerer 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/Manifest +1 -1
- data/README +3 -3
- data/bin/rpwn +1 -1
- data/bin/rpwnctl +1 -1
- data/bin/rpwndev +1 -1
- data/lib/pwnage/base/gems.rb +14 -7
- data/lib/pwnage/executor.rb +5 -1
- data/lib/pwnage/scaffolds/hook_daemon.rb +1 -1
- data/lib/pwnage/scaffolds/packages.rb +2 -2
- data/lib/pwnage/scaffolds/rubygems.rb +17 -3
- data/lib/{rails_pwnage.rb → rails_pwnerer.rb} +0 -0
- data/rails_pwnerer.gemspec +5 -5
- metadata +4 -4
data/CHANGELOG
CHANGED
data/Manifest
CHANGED
data/README
CHANGED
@@ -41,9 +41,9 @@ sudo rpwn scaffold
|
|
41
41
|
|
42
42
|
If this doesn't work, you have a retarded Debian version of rubygems.
|
43
43
|
Workaround:
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
|
45
|
+
a) Find the path to the gems: gem environment gemdir (e.g. /var/lib/gems/1.8/gems/)
|
46
|
+
b) run bin/rpwn from there:
|
47
47
|
sudo /var/lib/gems/1.8/bin/rails_pwnerer scaffold
|
48
48
|
|
49
49
|
After you scaffold, you'll get good rubygems which put rpwn in your path.
|
data/bin/rpwn
CHANGED
data/bin/rpwnctl
CHANGED
data/bin/rpwndev
CHANGED
data/lib/pwnage/base/gems.rb
CHANGED
@@ -14,21 +14,28 @@ module RailsPwnage::Base
|
|
14
14
|
# update the metadata for all the gems
|
15
15
|
def update_gems()
|
16
16
|
system "gem update --system"
|
17
|
-
# patch Ubuntu's broken rubygems installation
|
18
|
-
system "cp /usr/bin/gem1.8 /usr/bin/gem"
|
19
17
|
end
|
20
18
|
|
21
19
|
# locates the main file in a gem (used to locate the gem)
|
22
20
|
def path_to_gem(gem_name, discard_suffix = '')
|
23
21
|
# TODO: use the rubygems API instead of this hack
|
24
22
|
|
25
|
-
#
|
26
|
-
|
23
|
+
# method 1: peek inside rubygems' treasure chest
|
24
|
+
begin
|
25
|
+
gem_pattern = File.join `gem environment gemdir`.strip, 'gems', gem_name
|
26
|
+
gem_path = Dir.glob(gem_pattern + '*').max
|
27
|
+
rescue
|
28
|
+
gem_path = nil
|
29
|
+
end
|
30
|
+
return gem_path unless gem_path.nil? or gem_path.empty?
|
31
|
+
|
32
|
+
# method 2: look for the main file in the gem
|
33
|
+
gem_path = `gem which '#{gem_name}'`.strip
|
27
34
|
# discard the given suffix
|
28
|
-
if
|
29
|
-
|
35
|
+
if gem_path[-(discard_suffix.length)..-1] == discard_suffix
|
36
|
+
gem_path[-(discard_suffix.length)..-1] = ''
|
30
37
|
end
|
31
|
-
return
|
38
|
+
return gem_path
|
32
39
|
end
|
33
40
|
end
|
34
41
|
|
data/lib/pwnage/executor.rb
CHANGED
@@ -23,6 +23,7 @@ class RailsPwnage::Executor
|
|
23
23
|
when 'packages'
|
24
24
|
Packages.go
|
25
25
|
when 'rubygems'
|
26
|
+
RubyGems.pre_go
|
26
27
|
RubyGems.go
|
27
28
|
when 'ddns'
|
28
29
|
if args.length < 5
|
@@ -30,7 +31,8 @@ class RailsPwnage::Executor
|
|
30
31
|
else
|
31
32
|
HookDyndns.go args[2], args[3], args[4]
|
32
33
|
end
|
33
|
-
|
34
|
+
when nil
|
35
|
+
RubyGems.pre_go
|
34
36
|
Packages.go
|
35
37
|
RubyGems.go
|
36
38
|
Gems.go
|
@@ -39,6 +41,8 @@ class RailsPwnage::Executor
|
|
39
41
|
DirPermissions.go
|
40
42
|
MysqlConfig.go
|
41
43
|
HookDaemon.go
|
44
|
+
else
|
45
|
+
print "Unrecognized scaffold command #{args[1]}\n"
|
42
46
|
end
|
43
47
|
|
44
48
|
when 'install', 'micro'
|
@@ -5,7 +5,7 @@ class RailsPwnage::Scaffolds::HookDaemon
|
|
5
5
|
|
6
6
|
# runner
|
7
7
|
def run
|
8
|
-
daemon_ctl = path_to_gem('
|
8
|
+
daemon_ctl = File.join path_to_gem('rails_pwnerer', '/lib/rails_pwnerer.rb'), 'bin/rpwnctl'
|
9
9
|
hook_boot_script daemon_ctl, 'rpwn'
|
10
10
|
end
|
11
11
|
|
@@ -35,8 +35,8 @@ class RailsPwnage::Scaffolds::Packages
|
|
35
35
|
# wipe the old version (and pray we don't die until we're done, otherwise we're on a ruby-less system)
|
36
36
|
remove_packages %w(ruby1.8 libruby1.8)
|
37
37
|
|
38
|
-
# install ruby from source
|
39
|
-
install_packages %w(ruby1.8 rdoc libsetup-ruby1.8 ruby-pkg-tools rubygems irb), :source => true
|
38
|
+
# install ruby from source
|
39
|
+
install_packages %w(ruby1.8 rdoc libsetup-ruby1.8 ruby-pkg-tools rubygems1.8 rubygems irb), :source => true
|
40
40
|
end
|
41
41
|
|
42
42
|
# the packages for a mysql server and development libraries
|
@@ -46,19 +46,33 @@ class RailsPwnage::Scaffolds::RubyGems
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def run
|
49
|
-
#
|
50
|
-
old_gems =
|
49
|
+
# get the old path set by pre-go
|
50
|
+
old_gems = @@old_gems
|
51
51
|
|
52
52
|
# remove the (retarded) Debian gems package and install from source
|
53
53
|
remove_packages %w(rubygems)
|
54
54
|
install_rubygems
|
55
55
|
|
56
|
+
# patch Ubuntu's broken rubygems installation
|
57
|
+
system "cp /usr/bin/gem1.8 /usr/bin/gem"
|
58
|
+
|
56
59
|
# remove the gems that are trailing behind
|
57
|
-
new_gems = path_to_gem('
|
60
|
+
new_gems = File.dirname(File.dirname(path_to_gem('sources', '/lib/sources.rb')))
|
58
61
|
return if new_gems == old_gems # don't wipe the new dir by mistake
|
59
62
|
FileUtils.rm_r old_gems
|
60
63
|
end
|
61
64
|
|
65
|
+
def preflight
|
66
|
+
# save old lib path, in case we need to wipe it
|
67
|
+
# we need to do this because setting up packages might wipe Ubuntu's gems
|
68
|
+
@@old_gems = File.dirname(File.dirname(path_to_gem('sources', '/lib/sources.rb')))
|
69
|
+
end
|
70
|
+
|
71
|
+
# called before packages get installed
|
72
|
+
def self.pre_go
|
73
|
+
self.new.preflight
|
74
|
+
end
|
75
|
+
|
62
76
|
# standalone runner
|
63
77
|
def self.go
|
64
78
|
self.new.run
|
File without changes
|
data/rails_pwnerer.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rails_pwnerer-0.5.
|
2
|
+
# Gem::Specification for Rails_pwnerer-0.5.9
|
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.
|
8
|
+
version: 0.5.9
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Victor Costan
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
|
15
|
-
date: 2008-08-
|
15
|
+
date: 2008-08-22 00:00:00 -04:00
|
16
16
|
default_executable:
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
@@ -70,7 +70,7 @@ extra_rdoc_files:
|
|
70
70
|
- lib/pwnage/scaffolds/mysql_config.rb
|
71
71
|
- lib/pwnage/scaffolds/packages.rb
|
72
72
|
- lib/pwnage/scaffolds/rubygems.rb
|
73
|
-
- lib/
|
73
|
+
- lib/rails_pwnerer.rb
|
74
74
|
- LICENSE
|
75
75
|
- README
|
76
76
|
files:
|
@@ -110,7 +110,7 @@ files:
|
|
110
110
|
- lib/pwnage/scaffolds/mysql_config.rb
|
111
111
|
- lib/pwnage/scaffolds/packages.rb
|
112
112
|
- lib/pwnage/scaffolds/rubygems.rb
|
113
|
-
- lib/
|
113
|
+
- lib/rails_pwnerer.rb
|
114
114
|
- LICENSE
|
115
115
|
- Manifest
|
116
116
|
- Rakefile
|
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.
|
4
|
+
version: 0.5.9
|
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-
|
12
|
+
date: 2008-08-22 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -67,7 +67,7 @@ extra_rdoc_files:
|
|
67
67
|
- lib/pwnage/scaffolds/mysql_config.rb
|
68
68
|
- lib/pwnage/scaffolds/packages.rb
|
69
69
|
- lib/pwnage/scaffolds/rubygems.rb
|
70
|
-
- lib/
|
70
|
+
- lib/rails_pwnerer.rb
|
71
71
|
- LICENSE
|
72
72
|
- README
|
73
73
|
files:
|
@@ -107,7 +107,7 @@ files:
|
|
107
107
|
- lib/pwnage/scaffolds/mysql_config.rb
|
108
108
|
- lib/pwnage/scaffolds/packages.rb
|
109
109
|
- lib/pwnage/scaffolds/rubygems.rb
|
110
|
-
- lib/
|
110
|
+
- lib/rails_pwnerer.rb
|
111
111
|
- LICENSE
|
112
112
|
- Manifest
|
113
113
|
- Rakefile
|