Class: Swiftly::Destroy
- Inherits:
-
Thor
- Object
- Thor
- Swiftly::Destroy
- Includes:
- Helpers, Thor::Actions
- Defined in:
- lib/swiftly/destroy.rb
Instance Method Summary collapse
Methods included from Helpers
#find_and_replace, #find_and_replace_all, #fix_serialization, #fix_text, #mina, #return_cmd, #swiftly_shell, #unzip, #update_setting, #verifiy_mina_credentials, #zip
Instance Method Details
#destroy(project_name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/swiftly/destroy.rb', line 12 def destroy( project_name ) settings = Swiftly::Project.settings project_name directory = File.join( settings[:project][:path], '' ) zipfile_name = settings[:project][:path] + '.zip' if File.exist? zipfile_name say_status "#{APP_NAME}:", "There is already a zip file named [#{project_name}.zip]. \n\n", :red responses = ['y','Y',''] unless responses.include? ask set_color "Do you want to overwrite it? [Y/n]", :yellow say #spacer say_status "#{APP_NAME}:", "No changes were made. Please remove [#{project_name}.zip] before running destroy again.\n\n", :yellow abort end end database = Swiftly::Database.new( project_name ) database.dump( :local ) database.drop( :local ) remove_file zipfile_name zip zipfile_name, directory FileUtils.remove_dir( settings[:project][:path] ) say #spacer say_status "#{APP_NAME}:", "A backup was stored at [#{settings[:project][:path]}.zip].\n\n", :green end |