Sha256: 479f71780b1fc90cad79e50cce938b5bc4f3ae51832daf9b2831a41a39353ed9
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 KB
Contents
require 'rails_cleaner/version' require 'colorize' class RailsCleaner DIRECTORY_PATH = '.rails_cleaner/' TRACKED_FILES_LIST = 'tracked_files.txt' TO_DELETE_LIST = 'files_to_delete.txt' ASSETS_PATH = 'app/assets' attr_reader :tracked_files, :files_to_delete def create_rc_directory Dir.mkdir DIRECTORY_PATH unless File.exist? DIRECTORY_PATH end def create_rc_file filename File.open DIRECTORY_PATH + filename, 'w' end def set_tracked_files @tracked_files = Dir.glob("#{ASSETS_PATH}/**/*").select do |file| file.match(/.(scss|coffee)$/) end end def set_files_to_delete file_path @files_to_delete = [] File.open DIRECTORY_PATH + file_path, 'r' do |file| file.each_line do |line| @files_to_delete << line.strip if File.ctime(line.strip)==File.birthtime(line.strip) end end end def write_data_to_file data, file File.open DIRECTORY_PATH + file, 'w' do |f| data.each do |d| f.write "#{d}\n" end end end def remove_to_delete_list File.delete DIRECTORY_PATH + TO_DELETE_LIST if File.exist? DIRECTORY_PATH + TO_DELETE_LIST end def clear_tracked_files_list if File.exist? DIRECTORY_PATH + TRACKED_FILES_LIST File.open DIRECTORY_PATH + TRACKED_FILES_LIST, 'w' do |file| file.truncate 0 end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_cleaner-0.0.6 | lib/rails_cleaner.rb |