rails_pwnerer 0.4.15 → 0.4.16

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.4.16. Implemented rubygems download and installation from source.
2
+
1
3
  v0.4.15. Moved temporary installation dirs to / so that it works on CSAIL Debian.
2
4
 
3
5
  v0.4.14. Fixed bug that completely broke new box scaffolding.
data/Manifest CHANGED
@@ -19,6 +19,7 @@ lib/pwnage/scaffolds/hook_dyndns.rb
19
19
  lib/pwnage/scaffolds/hook_mongrels.rb
20
20
  lib/pwnage/scaffolds/mysql_config.rb
21
21
  lib/pwnage/scaffolds/packages.rb
22
+ lib/pwnage/scaffolds/rubygems.rb
22
23
  lib/rails_pwnage.rb
23
24
  LICENSE
24
25
  Manifest
@@ -8,6 +8,8 @@ class RailsPwnage::Executor
8
8
  case args[1]
9
9
  when 'dirs'
10
10
  Dirs.go
11
+ when 'rubygems'
12
+ RubyGems.go
11
13
  when 'gems'
12
14
  Gems.go
13
15
  when 'packages'
@@ -24,6 +26,7 @@ class RailsPwnage::Executor
24
26
  end
25
27
  else
26
28
  Packages.go
29
+ RubyGems.go
27
30
  Gems.go
28
31
  Dirs.go
29
32
  MysqlConfig.go
@@ -0,0 +1,58 @@
1
+ require 'net/http'
2
+ require 'pp'
3
+
4
+ class RailsPwnage::Scaffolds::RubyGems
5
+ include RailsPwnage::Base
6
+
7
+ # retrieves the URI for a Google "I'm Feeling Lucky" search
8
+ def google_lucky_uri(query)
9
+ uri = URI.parse "http://www.google.com/search?q=#{URI.escape query}&btnI=Lucky"
10
+ response = Net::HTTP.start(uri.host, uri.port) { |http| http.get "#{uri.path}?#{uri.query}" }
11
+ response.header['location']
12
+ end
13
+
14
+ # retrieves the download URI for a RubyForge project
15
+ def rubyforge_download_uri(project, gem_name = project, extension = ".gem")
16
+ frs_uri = URI.parse google_lucky_uri("rubyforge project #{project} download")
17
+ frs_contents = Net::HTTP.get frs_uri
18
+ frs_links = frs_contents.scan(/\<a.+href=\"(.+?)\"\>/).flatten.
19
+ select { |link| link.index('.tgz') && link.index("#{gem_name}-") }
20
+ latest_link = frs_links.sort_by { |n| n.match(/#{gem_name}-(.*)\.#{extension}/)[1] }.last
21
+ return frs_uri.merge(latest_link)
22
+ end
23
+
24
+ # installs Rubygems on the system
25
+ def install_rubygems
26
+ with_temp_dir(:root => true) do
27
+ tgz_uri = rubyforge_download_uri('rubygems', 'rubygems', 'tgz')
28
+ file_name = File.basename tgz_uri.path
29
+ loop do
30
+ request_path = tgz_uri.query.to_s.empty? ? tgz_uri.path : "#{tgz_uri.path}?#{tgz_uri.query}"
31
+ response = Net::HTTP.start(tgz_uri.host, tgz_uri.port) { |http| http.get request_path }
32
+ if response.kind_of? Net::HTTPRedirection
33
+ tgz_uri = URI.parse response.header['location']
34
+ next
35
+ end
36
+ File.open(file_name, 'wb') { |f| f.write response.body }
37
+ break
38
+ end
39
+
40
+ system "tar -xzf #{file_name}"
41
+ File.unlink file_name
42
+ Dir.chdir(Dir.glob('*').first) do
43
+ system "ruby setup.rb"
44
+ end
45
+ end
46
+ end
47
+
48
+ def run
49
+ # remove the (retarded) Debian gems package and install from source
50
+ remove_packages %w(rubygems)
51
+ install_rubygems
52
+ end
53
+
54
+ # standalone runner
55
+ def self.go
56
+ self.new.run
57
+ end
58
+ end
data/lib/rails_pwnage.rb CHANGED
@@ -20,6 +20,7 @@ require 'pwnage/scaffolds/hook_mongrels.rb'
20
20
  require 'pwnage/scaffolds/hook_dyndns.rb'
21
21
  require 'pwnage/scaffolds/mysql_config.rb'
22
22
  require 'pwnage/scaffolds/packages.rb'
23
+ require 'pwnage/scaffolds/rubygems.rb'
23
24
 
24
25
  require 'pwnage/app/main.rb'
25
26
  require 'pwnage/app/svn.rb'
@@ -1,10 +1,10 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.4.15
2
+ # Gem::Specification for Rails_pwnerer-0.4.16
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{rails_pwnerer}
7
- s.version = "0.4.15"
7
+ s.version = "0.4.16"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
@@ -15,8 +15,8 @@ Gem::Specification.new do |s|
15
15
  s.description = %q{Rails deployment tool/hack.}
16
16
  s.email = %q{victor@costan.us}
17
17
  s.executables = ["rpwn"]
18
- s.extra_rdoc_files = ["bin/rpwn", "CHANGELOG", "lib/pwnage/app/cluster_config.rb", "lib/pwnage/app/database.rb", "lib/pwnage/app/gems.rb", "lib/pwnage/app/main.rb", "lib/pwnage/app/nginx_config.rb", "lib/pwnage/app/svn.rb", "lib/pwnage/base/dirs.rb", "lib/pwnage/base/gems.rb", "lib/pwnage/base/packages.rb", "lib/pwnage/base/startup.rb", "lib/pwnage/base.rb", "lib/pwnage/config/main.rb", "lib/pwnage/executor.rb", "lib/pwnage/scaffolds/dirs.rb", "lib/pwnage/scaffolds/gems.rb", "lib/pwnage/scaffolds/hook_dyndns.rb", "lib/pwnage/scaffolds/hook_mongrels.rb", "lib/pwnage/scaffolds/mysql_config.rb", "lib/pwnage/scaffolds/packages.rb", "lib/rails_pwnage.rb", "LICENSE", "README"]
19
- s.files = ["bin/rpwn", "CHANGELOG", "lib/pwnage/app/cluster_config.rb", "lib/pwnage/app/database.rb", "lib/pwnage/app/gems.rb", "lib/pwnage/app/main.rb", "lib/pwnage/app/nginx_config.rb", "lib/pwnage/app/svn.rb", "lib/pwnage/base/dirs.rb", "lib/pwnage/base/gems.rb", "lib/pwnage/base/packages.rb", "lib/pwnage/base/startup.rb", "lib/pwnage/base.rb", "lib/pwnage/config/main.rb", "lib/pwnage/executor.rb", "lib/pwnage/scaffolds/dirs.rb", "lib/pwnage/scaffolds/gems.rb", "lib/pwnage/scaffolds/hook_dyndns.rb", "lib/pwnage/scaffolds/hook_mongrels.rb", "lib/pwnage/scaffolds/mysql_config.rb", "lib/pwnage/scaffolds/packages.rb", "lib/rails_pwnage.rb", "LICENSE", "Manifest", "README", "RUBYFORGE", "rails_pwnerer.gemspec"]
18
+ s.extra_rdoc_files = ["bin/rpwn", "CHANGELOG", "lib/pwnage/app/cluster_config.rb", "lib/pwnage/app/database.rb", "lib/pwnage/app/gems.rb", "lib/pwnage/app/main.rb", "lib/pwnage/app/nginx_config.rb", "lib/pwnage/app/svn.rb", "lib/pwnage/base/dirs.rb", "lib/pwnage/base/gems.rb", "lib/pwnage/base/packages.rb", "lib/pwnage/base/startup.rb", "lib/pwnage/base.rb", "lib/pwnage/config/main.rb", "lib/pwnage/executor.rb", "lib/pwnage/scaffolds/dirs.rb", "lib/pwnage/scaffolds/gems.rb", "lib/pwnage/scaffolds/hook_dyndns.rb", "lib/pwnage/scaffolds/hook_mongrels.rb", "lib/pwnage/scaffolds/mysql_config.rb", "lib/pwnage/scaffolds/packages.rb", "lib/pwnage/scaffolds/rubygems.rb", "lib/rails_pwnage.rb", "LICENSE", "README"]
19
+ s.files = ["bin/rpwn", "CHANGELOG", "lib/pwnage/app/cluster_config.rb", "lib/pwnage/app/database.rb", "lib/pwnage/app/gems.rb", "lib/pwnage/app/main.rb", "lib/pwnage/app/nginx_config.rb", "lib/pwnage/app/svn.rb", "lib/pwnage/base/dirs.rb", "lib/pwnage/base/gems.rb", "lib/pwnage/base/packages.rb", "lib/pwnage/base/startup.rb", "lib/pwnage/base.rb", "lib/pwnage/config/main.rb", "lib/pwnage/executor.rb", "lib/pwnage/scaffolds/dirs.rb", "lib/pwnage/scaffolds/gems.rb", "lib/pwnage/scaffolds/hook_dyndns.rb", "lib/pwnage/scaffolds/hook_mongrels.rb", "lib/pwnage/scaffolds/mysql_config.rb", "lib/pwnage/scaffolds/packages.rb", "lib/pwnage/scaffolds/rubygems.rb", "lib/rails_pwnage.rb", "LICENSE", "Manifest", "README", "RUBYFORGE", "rails_pwnerer.gemspec"]
20
20
  s.has_rdoc = true
21
21
  s.homepage = %q{http://www.costan.us/rails_pwnage}
22
22
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rails_pwnerer", "--main", "README"]
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.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
@@ -41,6 +41,7 @@ extra_rdoc_files:
41
41
  - lib/pwnage/scaffolds/hook_mongrels.rb
42
42
  - lib/pwnage/scaffolds/mysql_config.rb
43
43
  - lib/pwnage/scaffolds/packages.rb
44
+ - lib/pwnage/scaffolds/rubygems.rb
44
45
  - lib/rails_pwnage.rb
45
46
  - LICENSE
46
47
  - README
@@ -66,6 +67,7 @@ files:
66
67
  - lib/pwnage/scaffolds/hook_mongrels.rb
67
68
  - lib/pwnage/scaffolds/mysql_config.rb
68
69
  - lib/pwnage/scaffolds/packages.rb
70
+ - lib/pwnage/scaffolds/rubygems.rb
69
71
  - lib/rails_pwnage.rb
70
72
  - LICENSE
71
73
  - Manifest