rails_pwnerer 0.4.8 → 0.4.9

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.9. Added app directory cleanup before backup.
2
+
1
3
  v0.4.8. Implemented app directory cleanup (removes cached .js and .css files) on 'update'.
2
4
 
3
5
  v0.4.7. Actually implemented 'console'.
data/README CHANGED
@@ -17,7 +17,8 @@ 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, or insecure file permissions.
20
+ production passwords in the repository, or insecure file permissions, or
21
+ you'll forget to delete cached javascripts and stylesheets from public/.
21
22
  I won't even mention backups.
22
23
 
23
24
  Life with +rails_pwnerer+:
@@ -56,14 +56,8 @@ class RailsPwnage::App::Svn
56
56
  FileUtils.rm_r cold_copy if File.exists? cold_copy
57
57
  FileUtils.cp_r RailsPwnage::Config.path_to(app_name), 'tmp'
58
58
 
59
- # remove the temp garbage in the cold copy
60
- fs = File::SEPARATOR
61
- ["cache#{fs}*", "pids#{fs}*.pid", "sessions#{fs}*"].each do |pattern|
62
- Dir.glob("tmp#{fs}#{app_name}#{pattern}") do |entry|
63
- next if entry =~ /\.svn$/
64
- FileUtils.rm_r entry
65
- end
66
- end
59
+ # remove the garbage in the cold copy
60
+ cleanup_app_caches File.join('tmp', app_name), true
67
61
 
68
62
  # pack and protect the cold copy
69
63
  Dir.chdir 'tmp' do
@@ -92,8 +86,8 @@ class RailsPwnage::App::Svn
92
86
  end
93
87
 
94
88
  # 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
89
+ def cleanup_app_dir(app_name, target_dir, app_name_is_dir = false)
90
+ Dir.chdir(app_name_is_dir ? app_name : RailsPwnage::Config.path_to(app_name)) do
97
91
  # get a listing of what happened in that directory
98
92
  xml_status = `svn status --xml #{target_dir}`
99
93
  xsdoc = REXML::Document.new xml_status
@@ -108,12 +102,12 @@ class RailsPwnage::App::Svn
108
102
  end
109
103
 
110
104
  # clean up the application directory by removing caches
111
- def cleanup_app_caches(app_name)
105
+ def cleanup_app_caches(app_name, app_name_is_dir = false)
112
106
  # TODO: learn how Rails caches work and kill those too
113
107
  ['app', 'lib', 'public/images',
114
108
  'public/javascripts', 'public/stylesheets', 'script',
115
109
  'test', 'tmp', 'vendor'
116
- ].each { |dir| cleanup_app_dir app_name, dir }
110
+ ].each { |dir| cleanup_app_dir app_name, dir, app_name_is_dir }
117
111
  end
118
112
 
119
113
  def manage(app_name, action)
@@ -1,10 +1,10 @@
1
1
 
2
- # Gem::Specification for Rails_pwnerer-0.4.8
2
+ # Gem::Specification for Rails_pwnerer-0.4.9
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.8"
7
+ s.version = "0.4.9"
8
8
 
9
9
  s.specification_version = 2 if s.respond_to? :specification_version=
10
10
 
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.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan