Changeset 2174
- Timestamp:
- 09/09/05 09:02:55 (5 years ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/rails_generator/commands.rb (modified) (4 diffs)
- trunk/railties/lib/rails_generator/options.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r2173 r2174 1 1 *SVN* 2 3 * Added -c/--svn option to the generator that'll add new files and remove destroyed files using svn add/revert/remove as appropriate #2064 [kevin.clark@gmail.com] 2 4 3 5 * Added -c/--charset option to WEBrick controller, so you can specify a default charset (which without changes is UTF-8) #2084 [wejn@box.cz] trunk/railties/lib/rails_generator/commands.rb
r691 r2174 203 203 FileUtils.chmod(file_options[:chmod], destination) 204 204 end 205 206 # Optionally add file to subversion 207 system("svn add #{destination}") if options[:svn] 205 208 end 206 209 … … 247 250 logger.create relative_path 248 251 FileUtils.mkdir_p(path) unless options[:pretend] 252 253 # Optionally add file to subversion 254 system("svn add #{path}") if options[:svn] 249 255 end 250 256 end … … 295 301 class Destroy < RewindBase 296 302 # Remove a file if it exists and is a file. 297 def file(relative_source, relative_destination, options = {})303 def file(relative_source, relative_destination, file_options = {}) 298 304 destination = destination_path(relative_destination) 299 305 if File.exists?(destination) 300 306 logger.rm relative_destination 301 FileUtils.rm(destination) unless options[:pretend] 307 unless options[:pretend] 308 if options[:svn] 309 # If the file has been marked to be added 310 # but has not yet been checked in, revert and elete 311 if options[:svn][relative_destination] 312 system("svn revert #{destination}") 313 FileUtils.rm(destination) 314 else 315 # If the directory is not in the status list, it 316 # has no modifications so we can simply remove it 317 system("svn rm #{destination}") 318 end 319 else 320 FileUtils.rm(destination) 321 end 322 end 302 323 else 303 324 logger.missing relative_destination … … 320 341 if Dir[File.join(path, '*')].empty? 321 342 logger.rmdir partial 322 FileUtils.rmdir(path) unless options[:pretend] 343 unless options[:pretend] 344 if options[:svn] 345 # If the directory has been marked to be added 346 # but has not yet been checked in, revert and elete 347 if options[:svn][relative_path] 348 system("svn revert #{path}") 349 FileUtils.rmdir(path) 350 else 351 # If the directory is not in the status list, it 352 # has no modifications so we can simply remove it 353 system("svn rm #{path}") 354 end 355 else 356 FileUtils.rmdir(path) 357 end 358 end 323 359 else 324 360 logger.notempty partial trunk/railties/lib/rails_generator/options.rb
r1107 r2174 128 128 opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |options[:backtrace]| } 129 129 opt.on('-h', '--help', 'Show this help message.') { |options[:help]| } 130 opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') { options[:svn] = Hash[*`svn status`.collect { |e| e.chop.split.reverse unless e.chop.split.size != 2 }.flatten] } 130 131 end 131 132