Created
June 20, 2013 05:38
-
-
Save sue445/5820532 to your computer and use it in GitHub Desktop.
Railsプロジェクトの不要ファイルを削除する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
=begin | |
railsプロジェクトの不要ファイルを削除する | |
usage: | |
/path/to/workspace/ | |
├── app1 | |
└── app2 | |
のような構成の時に | |
ruby clean_rails_project.rb /path/to/workspace | |
のように使うとapp1とapp2に対して不要ファイルを削除する | |
=end | |
base_dir = ARGV[0] | |
#puts "before" | |
#system "du -s -c -k #{base_dir}" | |
Dir.glob("#{base_dir}/*").each do |app_dir| | |
Dir.chdir(app_dir) do | |
puts "chdir: #{app_dir}" | |
unless File.exists?("Gemfile") | |
puts "#{app_dir} is not app dir" | |
next | |
end | |
system "git gc" | |
system "rm log/*.log" | |
system "bundle clean" | |
end | |
end | |
#puts "after" | |
#system "du -s -c -k #{base_dir}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment