lib/search_rails.rb in search_rails-1.1.0 vs lib/search_rails.rb in search_rails-1.1.1

- old
+ new

@@ -14,27 +14,24 @@ FileUtils::mkdir_p "search" puts "Created ".green.bold + '/app/search'.bold end Dir.chdir(root + '/app/search') if File.exists?('search_module.rb') - File.open(root + '/app/search/search_module.rb', 'w') {|file| file.truncate(0) } puts 'Already Exists'.bold.green + ' /app/search/search_module.rb'.bold else File.new "search_module.rb", "w" puts "Created ".green.bold + '/app/search/search_module.rb'.bold end Dir.chdir(root + '/app/controllers') if File.exists?('searches_controller.rb') - File.open(root + '/app/controllers/searches_controller.rb', 'w') {|file| file.truncate(0) } puts 'Already Exists'.bold.green + ' /app/controllers/searches_controller.rb'.bold else File.new "searches_controller.rb", "w" puts "Created ".green.bold + '/app/controllers/searches_controller.rb'.bold end Dir.chdir(root + '/app/models') if File.exists?('search.rb') - File.open(root + '/app/models/search.rb', 'w') {|file| file.truncate(0) } puts 'Already Exists'.bold.green + ' /app/models/search.rb'.bold else File.new "search.rb", "w" puts 'Created '.green.bold + '/app/models/search.rb'.bold end @@ -249,25 +246,12 @@ object = command[1] attributes = command[2..10000000] end SearchInstall.new.create_files - Dir.chdir(root + '/app/controllers') - if File.exists?('searches_controller.rb') - else - SearchInstall.new.write_search_controller - end - Dir.chdir(root + '/app/models') - if File.exists?('search.rb') - else - SearchInstall.new.write_search_model - end - Dir.chdir(root + '/app/search') - if File.exists?('search_module.rb') - else - SearchInstall.new.write_search_module(object, attributes) - end - Dir.chdir(root) + SearchInstall.new.write_search_controller + SearchInstall.new.write_search_model + SearchInstall.new.write_search_module(object, attributes) SearchInstall.new.write_application_controller SearchInstall.new.write_migration SearchInstall.new.update_routes puts 'Done'.bold