rails_pwnerer 0.5.12 → 0.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/lib/pwnage/app/cluster_config.rb +2 -1
- data/lib/pwnage/app/config.rb +2 -0
- data/lib/pwnage/app/gems.rb +15 -2
- data/lib/pwnage/base/gems.rb +12 -1
- data/rails_pwnerer.gemspec +2 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
v0.5.14. App-directed gem installation (because Rails 2.1.0 doesn't quite work yet).
|
2
|
+
|
3
|
+
v0.5.13. Writable dirs are created if they didn't exist before.
|
4
|
+
|
1
5
|
v0.5.12. Scaffolding sets up sshd for tunneling.
|
2
6
|
|
3
7
|
v0.5.11. Added check for Rails application root on SVN checkout.
|
@@ -12,12 +12,13 @@ class RailsPwnage::App::ClusterConfig
|
|
12
12
|
pwnerer_group = group_for_username(pwnerer_user)
|
13
13
|
|
14
14
|
writable_dirs = %w(log tmp public)
|
15
|
-
if app_config[:writable_dirs]
|
15
|
+
if app_config[:writable_dirs]
|
16
16
|
writable_dirs += app_config[:writable_dirs].split ','
|
17
17
|
end
|
18
18
|
|
19
19
|
Dir.chdir app_config[:app_path] do
|
20
20
|
writable_dirs.each do |writable_dir|
|
21
|
+
FileUtils.mkpath writable_dir unless File.exists? writable_dir
|
21
22
|
FileUtils.chown_R(pwnerer_uid, pwnerer_group, writable_dir)
|
22
23
|
end
|
23
24
|
end
|
data/lib/pwnage/app/config.rb
CHANGED
@@ -35,6 +35,8 @@ class RailsPwnage::App::Config
|
|
35
35
|
app_db[:max_request_mb] = 48
|
36
36
|
# comma-separated directories that should be writable by the application user
|
37
37
|
app_db[:writable_dirs] = ''
|
38
|
+
# comma-separated gems that should be installed for the application
|
39
|
+
app_db[:gems] = ''
|
38
40
|
|
39
41
|
RailsPwnage::Config.flush_db app_db
|
40
42
|
return app_path
|
data/lib/pwnage/app/gems.rb
CHANGED
@@ -4,8 +4,21 @@ class RailsPwnage::App::Gems
|
|
4
4
|
include RailsPwnage::Base
|
5
5
|
|
6
6
|
def update(app_name, instance_name)
|
7
|
-
|
8
|
-
|
7
|
+
app_config = RailsPwnage::Config[app_name, instance_name]
|
8
|
+
|
9
|
+
# Phase 1: app-directed install
|
10
|
+
if app_config[:gems]
|
11
|
+
install_gems = app_config[:gems].split(',')
|
12
|
+
install_gems.each do |gem_name|
|
13
|
+
#begin
|
14
|
+
install_gem gem_name unless gem_exists? gem_name
|
15
|
+
#rescue Exception
|
16
|
+
#end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Phase 2: rails install
|
21
|
+
Dir.chdir app_config[:app_path] do
|
9
22
|
# install the gems needed by the app
|
10
23
|
system "rake gems:install RAILS_ENV=production"
|
11
24
|
end
|
data/lib/pwnage/base/gems.rb
CHANGED
@@ -15,6 +15,17 @@ module RailsPwnage::Base
|
|
15
15
|
def update_gems()
|
16
16
|
system "gem update --system"
|
17
17
|
end
|
18
|
+
|
19
|
+
# checks if a gem exists
|
20
|
+
def gem_exists?(gem_name)
|
21
|
+
begin
|
22
|
+
output = `gem specification --local #{gem_name} 2> /dev/null`
|
23
|
+
return output =~ /$\-\-\- \!ruby\/object\:Gem\:\:Specification/
|
24
|
+
rescue
|
25
|
+
# we get here if gem exits with an error code
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
end
|
18
29
|
|
19
30
|
# locates the main file in a gem (used to locate the gem)
|
20
31
|
def path_to_gem(gem_name, discard_suffix = '')
|
@@ -22,7 +33,7 @@ module RailsPwnage::Base
|
|
22
33
|
|
23
34
|
# method 1: peek inside rubygems' treasure chest
|
24
35
|
begin
|
25
|
-
gem_pattern = File.join `gem environment gemdir`.strip, 'gems', gem_name
|
36
|
+
gem_pattern = (File.join `gem environment gemdir`.strip, 'gems', gem_name) + '-'
|
26
37
|
gem_path = Dir.glob(gem_pattern + '*').max
|
27
38
|
rescue
|
28
39
|
gem_path = nil
|
data/rails_pwnerer.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
# Gem::Specification for Rails_pwnerer-0.5.
|
2
|
+
# Gem::Specification for Rails_pwnerer-0.5.14
|
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.14
|
9
9
|
platform: ruby
|
10
10
|
authors:
|
11
11
|
- Victor Costan
|