rails_pwnerer 0.4.7 → 0.4.8

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 CHANGED
@@ -1,3 +1,5 @@
1
+ v0.4.8. Implemented app directory cleanup (removes cached .js and .css files) on 'update'.
2
+
1
3
  v0.4.7. Actually implemented 'console'.
2
4
 
3
5
  v0.4.6. Implemented 'console' and 'scaffold ddns'. Bug fixes across the board. Removed with_dir, switched to block use of Dir.chdir.
data/README CHANGED
@@ -17,18 +17,18 @@ accomplished at the end. Assuming you don't do something wrong.
17
17
 
18
18
  Read a couple more 20-page guides, and learn to push newer versions
19
19
  of your application. You'll become lazy, and take shortcuts, like having
20
- production passwords in the repository, insecure file permissions.
20
+ production passwords in the repository, or insecure file permissions.
21
21
  I won't even mention backups.
22
22
 
23
23
  Life with +rails_pwnerer+:
24
24
 
25
25
  1) Install ruby and rubygems (one command should be enough, but the rubygems in Ubuntu 8.04 doesn't work):
26
26
 
27
- sudo apt-get install ruby
27
+ sudo apt-get -y install rubygems
28
28
 
29
- sudo apt-get install rubygems
29
+ sudo gem update --system (you'll have to retry this if you get an error)
30
30
 
31
- sudo gem update --system
31
+ sudo apt-get -y install ruby (yes you read it right, this comes last)
32
32
 
33
33
  2) Install +rails_pwnerer+:
34
34
  sudo gem install rails_pwnerer
@@ -1,6 +1,7 @@
1
1
  # checks out the application
2
2
 
3
3
  require 'fileutils'
4
+ require 'rexml/document'
4
5
 
5
6
  class RailsPwnage::App::Svn
6
7
  include RailsPwnage::Base
@@ -90,6 +91,31 @@ class RailsPwnage::App::Svn
90
91
  FileUtils.rm_r RailsPwnage::Config.path_to(app_name) if File.exists? RailsPwnage::Config.path_to(app_name)
91
92
  end
92
93
 
94
+ # remove any files not in SVN in the application dir
95
+ def cleanup_app_dir(app_name, target_dir)
96
+ Dir.chdir(RailsPwnage::Config.path_to(app_name)) do
97
+ # get a listing of what happened in that directory
98
+ xml_status = `svn status --xml #{target_dir}`
99
+ xsdoc = REXML::Document.new xml_status
100
+
101
+ xsdoc.root.elements['target'].each_element do |e|
102
+ next unless e.name == 'entry'
103
+ next unless e.elements['wc-status'].attribute('item').value == 'unversioned'
104
+
105
+ File.delete e.attribute('path').value
106
+ end
107
+ end
108
+ end
109
+
110
+ # clean up the application directory by removing caches
111
+ def cleanup_app_caches(app_name)
112
+ # TODO: learn how Rails caches work and kill those too
113
+ ['app', 'lib', 'public/images',
114
+ 'public/javascripts', 'public/stylesheets', 'script',
115
+ 'test', 'tmp', 'vendor'
116
+ ].each { |dir| cleanup_app_dir app_name, dir }
117
+ end
118
+
93
119
  def manage(app_name, action)
94
120
  case action
95
121
  when :checkpoint
@@ -119,6 +145,7 @@ class RailsPwnage::App::Svn
119
145
 
120
146
  # TODO: maybe backup old version before issuing the svn update?
121
147
 
148
+ cleanup_app_caches(app_name)
122
149
  svn_update(app_name)
123
150
  end
124
151
 
@@ -5,17 +5,23 @@ class RailsPwnage::Scaffolds::Packages
5
5
 
6
6
  # the packages needed to manage the server remotely and instal applications
7
7
  def install_management
8
- install_packages %w(openssh-server subversion ddclient)
8
+ # openssh-server allows us to ssh into the box
9
+ # subversion is needed to pull code from SVN repositories
10
+ # ddclient does dynamic DNS
11
+ # avahi-daemon does mDNS, a.k.a. Bonjour (makes "ping hostname.local" work)
12
+ install_packages %w(openssh-server subversion ddclient avahi-daemon)
9
13
  end
10
14
 
11
15
  # packages that are needed by popular gems
12
16
  def install_tools
17
+ # needed by rmagick which does image processing
13
18
  install_packages %w(libmagick9-dev)
14
19
  end
15
20
 
16
21
  # the packages comprising ruby
17
22
  def install_ruby
18
- install_packages %w(build-essential ruby rubygems ruby1.8-dev irb)
23
+ # irb, rdoc, ri aren't really essential but they come in handy
24
+ install_packages %w(build-essential ruby rubygems ruby1.8-dev irb rdoc ri)
19
25
  end
20
26
 
21
27
  # the packages for a mysql server and development libraries
@@ -1,16 +1,16 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.4.7
2
+ # Gem::Specification for Rails_pwnerer-0.4.8
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.7"
7
+ s.version = "0.4.8"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Victor Costan"]
13
- s.date = %q{2008-04-25}
13
+ s.date = %q{2008-04-27}
14
14
  s.default_executable = %q{rpwn}
15
15
  s.description = %q{Rails deployment tool/hack.}
16
16
  s.email = %q{victor@costan.us}
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.7
4
+ version: 0.4.8
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-04-25 00:00:00 -04:00
12
+ date: 2008-04-27 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15