Sha256: a8ede226aac326b1a43649fda2e7bffeda9b210dd47faa38bf1c173b4ee6ba5a

Contents?: true

Size: 690 Bytes

Versions: 11

Compression:

Stored size: 690 Bytes

Contents

require 'sugar-high/array'

module Rails3::Assist::Artifact::CRUD
  module Delete
    def remove_artifact name, type
      type = type[:type] if type.kind_of? Hash
      begin
        file = existing_file_name name, type
        FileUtils.rm_f(file) 
        debug "removed artifact: #{name}"  
        true
      rescue
        debug "artifact to remove not found: #{name}"          
        nil
      end
    end
    alias_method :delete_artifact, :remove_artifact

    def remove_artifacts *names
      type = last_option(names)[:type]
      names.flatten.select_labels.each{|name| remove_artifact(name, type) }
    end
    alias_method :delete_artifacts, :remove_artifacts    
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails3_artifactor-0.2.7 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.6 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.5 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.4 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.3 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.2 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.2.1 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.1.5 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.1.4 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.1.3 lib/rails3_artifactor/base/crud/delete.rb
rails3_artifactor-0.1.2 lib/rails3_artifactor/base/crud/delete.rb