jackdempsey-sequel_taggable 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackdempsey-sequel_taggable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Dempsey
@@ -9,7 +9,7 @@ autorequire: sequel_taggable
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-08 00:00:00 -08:00
12
+ date: 2009-01-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,7 +34,6 @@ extra_rdoc_files:
34
34
  files:
35
35
  - LICENSE
36
36
  - README.markdown
37
- - Rakefile
38
37
  - TODO
39
38
  - lib/sequel_taggable
40
39
  - lib/sequel_taggable/migration.rb
@@ -42,14 +41,7 @@ files:
42
41
  - lib/sequel_taggable/tag.rb
43
42
  - lib/sequel_taggable/tagging.rb
44
43
  - lib/sequel_taggable.rb
45
- - spec/sequel-setup.rb
46
- - spec/sequel_taggable
47
- - spec/sequel_taggable/sequel_taggable_spec.rb
48
- - spec/sequel_taggable/tag_spec.rb
49
- - spec/sequel_taggable/tagging_spec.rb
50
- - spec/spec.opts
51
- - spec/spec_helper.rb
52
- has_rdoc: true
44
+ has_rdoc: false
53
45
  homepage: http://jackndempsey.blogspot.com
54
46
  post_install_message:
55
47
  rdoc_options: []
data/Rakefile DELETED
@@ -1,57 +0,0 @@
1
- require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rubygems/specification'
4
- require 'date'
5
- require 'spec/rake/spectask'
6
-
7
- GEM = "sequel_taggable"
8
- GEM_VERSION = "0.0.1"
9
- AUTHOR = "Jack Dempsey"
10
- EMAIL = "jack.dempsey@gmail.com"
11
- HOMEPAGE = "http://jackndempsey.blogspot.com"
12
- SUMMARY = "A gem that provides Sequel::Models with tagging capabilities"
13
-
14
- spec = Gem::Specification.new do |s|
15
- s.name = GEM
16
- s.version = GEM_VERSION
17
- s.platform = Gem::Platform::RUBY
18
- s.has_rdoc = false
19
- s.extra_rdoc_files = ["README.markdown", "LICENSE", 'TODO']
20
- s.summary = SUMMARY
21
- s.description = s.summary
22
- s.author = AUTHOR
23
- s.email = EMAIL
24
- s.homepage = HOMEPAGE
25
-
26
- # Uncomment this to add a dependency
27
- s.add_dependency "sequel_polymorphic"
28
-
29
- s.require_path = 'lib'
30
- s.autorequire = GEM
31
- s.files = %w(LICENSE README.markdown Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
32
- end
33
-
34
- task :default => :spec
35
-
36
- desc "Run specs"
37
- Spec::Rake::SpecTask.new do |t|
38
- t.spec_files = FileList['spec/**/*_spec.rb']
39
- t.spec_opts = %w(-fs --color)
40
- end
41
-
42
-
43
- Rake::GemPackageTask.new(spec) do |pkg|
44
- pkg.gem_spec = spec
45
- end
46
-
47
- desc "install the gem locally"
48
- task :install => [:package] do
49
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
50
- end
51
-
52
- desc "create a gemspec file"
53
- task :make_spec do
54
- File.open("#{GEM}.gemspec", "w") do |file|
55
- file.puts spec.to_ruby
56
- end
57
- end
@@ -1,18 +0,0 @@
1
- DB = Sequel.sqlite
2
-
3
- require File.dirname(__FILE__) + '/../lib/sequel_taggable/migration'
4
- CreateTags.apply(DB, :up)
5
-
6
- #DB["select * from sqlite_master"].print
7
-
8
-
9
- class TaggedModel < Sequel::Model
10
- set_schema do
11
- primary_key :id
12
- varchar :name
13
- end
14
-
15
- is :taggable
16
- end
17
-
18
- TaggedModel.create_table!
@@ -1,57 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Sequel::Plugins::Taggable do
4
- before do
5
- @tagged_model = TaggedModel.new
6
- end
7
-
8
- it "should add a .has_tags method to models which include DataMapper::Resource" do
9
- TaggedModel.should respond_to(:has_tags)
10
- # AnotherTaggedModel.should respond_to(:has_tags)
11
- # DefaultTaggedModel.should respond_to(:has_tags)
12
- # UntaggedModel.should respond_to(:has_tags)
13
- end
14
-
15
- it "should add a .has_tags_on method to models which include DataMapper::Resource" do
16
- TaggedModel.should respond_to(:has_tags_on)
17
- # AnotherTaggedModel.should respond_to(:has_tags_on)
18
- # DefaultTaggedModel.should respond_to(:has_tags_on)
19
- # UntaggedModel.should respond_to(:has_tags_on)
20
- end
21
-
22
- describe ".has_tags_on" do
23
- it "should accept an array of context names" do
24
- class HasTagsOnTestModel < Sequel::Model
25
- is :taggable
26
- end
27
- lambda{HasTagsOnTestModel.has_tags_on(:should, 'not', :raise)}.should_not raise_error(ArgumentError)
28
- end
29
-
30
- it "should create taggable functionality for each of the context names passed" do
31
- class TestModel < Sequel::Model
32
- is :taggable
33
- has_tags_on :pets, 'skills', :tags
34
- end
35
- TestModel.should be_taggable
36
- a = TestModel.new
37
- a.should be_taggable
38
- a.should respond_to(:pet_list)
39
- a.should respond_to(:skill_list)
40
- a.should respond_to(:tag_list)
41
- a.should respond_to(:pet_list=)
42
- a.should respond_to(:skill_list=)
43
- a.should respond_to(:tag_list=)
44
- end
45
- end
46
-
47
- describe ".has_tags" do
48
- it "should raise an error message if someone uses has_tags with an argument list" do
49
- lambda do
50
- class TagsOnly < Sequel::Model
51
- is :taggable
52
- has_tags :pets, :skills
53
- end
54
- end.should raise_error(RuntimeError)
55
- end
56
- end
57
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper.rb'
2
-
3
- describe Tag do
4
- before(:each) do
5
- @tag = Tag.new
6
- end
7
-
8
- it "should have id and name properties" do
9
- @tag.should respond_to(:id)
10
- @tag.should respond_to(:name)
11
- end
12
-
13
- it "should have many Taggings" do
14
- Tag.associations.should include(:taggings)
15
- end
16
-
17
- it "should validate the presence of name" do
18
- @tag.should_not be_valid
19
- @tag.name = "Meme"
20
- @tag.should be_valid
21
- end
22
- end
@@ -1,41 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper.rb'
2
-
3
- describe Tagging do
4
- before(:each) do
5
- @tagging = Tagging.new
6
- end
7
-
8
- it "should have properties: id, tag_id, taggable_id, taggable_type, tagger_id, tagger_type, and tag_context" do
9
- @tagging.should respond_to(:id)
10
- @tagging.should respond_to(:tag_id)
11
- @tagging.should respond_to(:taggable_id)
12
- @tagging.should respond_to(:taggable_type)
13
- @tagging.should respond_to(:tag_context)
14
- end
15
-
16
- it "should validate the presence of tag_id, taggable_id, taggable_type and tag_context" do
17
- @tagging.should_not be_valid
18
- @tagging.tag_id = 1
19
- @tagging.should_not be_valid
20
- @tagging.taggable_id = 1
21
- @tagging.should_not be_valid
22
- @tagging.taggable_type = "TaggedModel"
23
- @tagging.should_not be_valid
24
- @tagging.tag_context = "skills"
25
- @tagging.should be_valid
26
- end
27
-
28
- it "should many_to_one :tag" do
29
- Tagging.associations.should include(:tag)
30
- Tagging.association_reflection(:tag)[:class_name].should == "Tag"
31
- end
32
-
33
- it "should have a method Tagging#taggable which returns the associated taggable instance" do
34
- @tagging.should respond_to(:taggable)
35
- @tagging.taggable.should_not be
36
- @tagging.taggable_id = 11111
37
- @tagging.taggable_type = "TaggedModel"
38
- TaggedModel.should_receive(:get!).with(11111)
39
- @tagging.taggable
40
- end
41
- end
@@ -1 +0,0 @@
1
- --color
@@ -1,12 +0,0 @@
1
- $TESTING=true
2
- $:.push File.join(File.dirname(__FILE__), '..', 'lib')
3
-
4
- require 'rubygems'
5
- require 'spec'
6
- require 'sequel'
7
-
8
- require File.dirname(__FILE__) + '/sequel-setup'
9
- require File.dirname(__FILE__) + '/../lib/sequel_taggable'
10
-
11
-
12
-