lib/marv/project/actions.rb in marv-0.6.5 vs lib/marv/project/actions.rb in marv-0.7.0

- old
+ new

@@ -14,26 +14,32 @@ # Link project def link(dir) @link_dir = dir + @task.say_warning "This will link project #{@project.project_id} to server #{dir}." + link_options link_target + + @task.say_empty create_link end # Packgage project def package(filename) @package_name = filename + pkg_name = filename || get_package_name + @task.say_warning "This will package project #{@project.project_id} as #{pkg_name}.zip." create_package end # Ask for link details def link_options options = {} - options[:folder] = @task.ask "Where do you want to link your project?", :limited_to => ["themes", "plugins"], :default => "themes" + options[:folder] = @task.ask_input "Where do you want to link your project?", :limited_to => ["themes", "plugins"], :default => "themes" @link_options = options end # Link to server @@ -68,12 +74,12 @@ target = link_to_server unless link_to_server.nil? target = link_to_folder unless link_to_folder.nil? target = link_global unless link_global.nil? if target.nil? - @task.say "Destination server does not exist!", :red - exit + @task.say_error "Destination server does not exist!", nil, false, true + abort end @link_target = target end @@ -86,12 +92,12 @@ end begin @task.create_link @link_target, @project.build_path rescue Exception => e - @task.say "An error occured while creating project link", :red - @task.say e.message + @task.say_error "An error occured while creating project link", e.message, false. true + abort end end # Create package def create_package @@ -113,11 +119,16 @@ end # Set the package file name def set_package_filename if @package_name.nil? - @package_name = ::File.basename(@project.root) + @package_name = get_package_name end + end + + # Get package name + def get_package_name + ::File.basename(@project.root) end # Built to a temporary directory def build_to_temp_dir @builder.build_project