Skip to content

Instantly share code, notes, and snippets.

@sue445
Created June 20, 2013 05:38
Show Gist options
  • Save sue445/5820532 to your computer and use it in GitHub Desktop.
Save sue445/5820532 to your computer and use it in GitHub Desktop.
Railsプロジェクトの不要ファイルを削除する
# -*- 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