sbfaulkner-sequel_cascading 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 unwwwired.net
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,39 @@
1
+ # sequel\_cascading
2
+
3
+ my take on cascading deletes via a plugin for sequel
4
+
5
+ ## WHY?
6
+
7
+ DRY up my code.
8
+
9
+ No more explicit `before_destroy` to delete the children of `one_to_many`
10
+ associations.
11
+
12
+ ## Installation
13
+
14
+ Run the following if you haven't already:
15
+
16
+ $ gem sources -a http://gems.github.com
17
+
18
+ Install the gem(s):
19
+
20
+ $ sudo gem install -r sbfaulkner-sequel_cascading
21
+
22
+ ## Example
23
+
24
+ require 'rubygems'
25
+ require 'sequel'
26
+
27
+ class Comment < Sequel::Model
28
+ many_to_one :post
29
+ end
30
+
31
+ class Post < Sequel::Model
32
+ one_to_many :comment, :order => :name
33
+ is :cascading, :destroy => :comments
34
+ end
35
+
36
+ ## Legal
37
+
38
+ **Author:** S. Brent Faulkner <brentf@unwwwired.net>
39
+ **License:** Copyright &copy; 2009 unwwwired.net, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ Gem::manage_gems
3
+ require 'rake/gempackagetask'
4
+
5
+ load File.join(File.dirname(__FILE__),'sequel_cascading.gemspec')
6
+
7
+ Rake::GemPackageTask.new(SPEC) do |pkg|
8
+ end
9
+
10
+ task :default => :package
@@ -0,0 +1,11 @@
1
+ module Sequel
2
+ module Plugins
3
+ module Cascading
4
+ def self.apply(model, options = {})
5
+ Array(options[:destroy]).each do |assoc|
6
+ model.instance_eval "before_destroy { #{assoc}_dataset.destroy }"
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ SPEC = Gem::Specification.new do |s|
2
+ # identify the gem
3
+ s.name = "sequel_cascading"
4
+ s.version = "1.0.0"
5
+ s.author = "S. Brent Faulkner"
6
+ s.email = "brentf@unwwwired.net"
7
+ s.homepage = "http://github.com/sbfaulkner/sequel_cascading"
8
+ # platform of choice
9
+ s.platform = Gem::Platform::RUBY
10
+ # description of gem
11
+ s.summary = "my take on cascading deletes via a plugin for sequel"
12
+ s.files = %w(lib/sequel_cascading.rb MIT-LICENSE Rakefile README.markdown sequel_cascading.gemspec)
13
+ s.require_path = "lib"
14
+ # s.test_file = "test/sequel_cascading.rb"
15
+ s.has_rdoc = true
16
+ s.extra_rdoc_files = ["README.markdown"]
17
+ s.add_dependency "sequel"
18
+ # s.rubyforge_project = "sequel_cascading"
19
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sbfaulkner-sequel_cascading
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - S. Brent Faulkner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-12-22 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sequel
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ version:
24
+ description:
25
+ email: brentf@unwwwired.net
26
+ executables: []
27
+
28
+ extensions: []
29
+
30
+ extra_rdoc_files:
31
+ - README.markdown
32
+ files:
33
+ - lib/sequel_cascading.rb
34
+ - MIT-LICENSE
35
+ - Rakefile
36
+ - README.markdown
37
+ - sequel_cascading.gemspec
38
+ has_rdoc: true
39
+ homepage: http://github.com/sbfaulkner/sequel_cascading
40
+ post_install_message:
41
+ rdoc_options: []
42
+
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.2.0
61
+ signing_key:
62
+ specification_version: 2
63
+ summary: my take on cascading deletes via a plugin for sequel
64
+ test_files: []
65
+