Permalink
Browse files

init

  • Loading branch information...
0 parents commit 49a87e11e18172635dcf9d8fd3c345b334cc8d04 @Elland committed May 8, 2012
BIN .DS_Store
Binary file not shown.
64 Gemfile
@@ -0,0 +1,64 @@
+require 'pathname'
+
+source 'http://rubygems.org'
+
+SOURCE = ENV.fetch('SOURCE', :git).to_sym
+REPO_POSTFIX = SOURCE == :path ? '' : '.git'
+DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
+DM_VERSION = '~> 1.2.0'
+DO_VERSION = '~> 0.10.6'
+DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
+CURRENT_BRANCH = ENV.fetch('GIT_BRANCH', 'master')
+
+gem 'dm-core', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-core#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
+
+group :development do
+
+ gem 'dm-validations', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-validations#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
+ gem 'jeweler', '~> 1.6.4'
+ gem 'rake', '~> 0.9.2'
+ gem 'rspec', '~> 1.3.2'
+
+end
+
+platforms :mri_18 do
+ group :quality do
+
+ gem 'rcov', '~> 0.9.10'
+ gem 'yard', '~> 0.7.2'
+ gem 'yardstick', '~> 0.4'
+
+ end
+end
+
+group :datamapper do
+
+ adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
+ adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
+
+ if (do_adapters = DM_DO_ADAPTERS & adapters).any?
+ do_options = {}
+ do_options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
+
+ gem 'data_objects', DO_VERSION, do_options.dup
+
+ do_adapters.each do |adapter|
+ adapter = 'sqlite3' if adapter == 'sqlite'
+ gem "do_#{adapter}", DO_VERSION, do_options.dup
+ end
+
+ gem 'dm-do-adapter', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
+ end
+
+ adapters.each do |adapter|
+ gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
+ end
+
+ plugins = ENV['PLUGINS'] || ENV['PLUGIN']
+ plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
+
+ plugins.each do |plugin|
+ gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}", :branch => CURRENT_BRANCH
+ end
+
+end
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2011 Bobby Calderwood
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,139 @@
+= dm-tags
+
+http://github.com/datamapper/dm-more/tree/master
+
+== Description
+
+This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids.
+
+== Features and Problems
+
+=== Features
+
+* Contextual tagging using Model.has_tags_on (see below for usage)
+* Traditional 'tags-only' tagging using Model.has_tags
+
+=== Problems
+
+* None known yet, but this is very alpha software. Sorry if it misbehaves. Please send me a github message if you find a bug.
+
+== Synopsis
+
+ require 'rubygems'
+ require 'dm-core'
+ require 'dm-tags'
+
+ DataMapper.setup(:default, "sqlite3::memory:")
+
+ class MyModel
+ include DataMapper::Resource
+ property :id, Serial
+ has_tags_on :tags, :skills
+ end
+
+ DataMapper.auto_migrate!
+
+ # Contextual tagging
+ MyModel.taggable? #=> true
+ MyModel.new.taggable? #=> true
+
+ model = MyModel.new
+ model.tag_list = 'test, me out, please '
+ model.tag_list #=> ['me out', 'please', 'test'] # Sanitized and alphabetized
+ model.save #=> true
+ model.tags
+ #=> [#<Tag id=1 name="me out">, #<Tag id=2 name="please">, #<Tag id=3 name="test">]
+ model.tag_list = 'test, again'
+ model.save #=> true
+ model.tags
+ #=> [#<Tag id=3 name="test">, #<Tag id=4 name="again">] # Checks for existing tags
+ Tag.all
+ #=> [#<Tag id=1 name="me out">, #<Tag id=2 name="please">, #<Tag id=3 name="test">, #<Tag id=4 name="again">]
+
+ another = MyModel.new
+ another.skill_list = 'test, all, you, like'
+ another.save #=> true
+ another.tag_list #=> []
+ another.skills
+ #=> [#<Tag id=5 name="all">, #<Tag id=6 name="like">, #<Tag id=3 name="test">, #<Tag id=7 name="you">]
+
+ MyModel.tagged_with('test') #=> [#<MyModel id=1>, #<MyModel id=2>]
+ MyModel.tagged_with('test', :on => 'tags') #=> [#<MyModel id=1>]
+ MyModel.tagged_with('test', :on => 'skills') #=> [#<MyModel id=2>]
+
+ # Deleting tags
+ model.tag_list = ''
+ model.save #=> true
+ model.tags
+ #=> []
+ another.skill_list = ''
+ another.save #=> true
+ another.skills
+ #= []
+
+ #Helper methods for text fields
+ model.tag_collection = "tag1, tag2, tag3"
+ model.save
+ model.tag_collection #=> "tag1, tag2, tag3"
+ model.tags
+ #=> [#<Tag id=1 name="tag1">, #<Tag id=2 name="tag2">, #<Tag id=3 name="tag3">]
+ model.tag_collection = ''
+ model.save
+ model.tag_collection = '' #=> ""
+
+ # Traditional 'tags only' tagging
+
+ class TagsOnly
+ include DataMapper::Resource
+ property :id, Serial
+ has_tags
+ end
+
+ TagsOnly.auto_migrate!
+
+ TagsOnly.taggable? #=> true
+ TagsOnly.new.taggable? #=> true
+
+ tags_only = TagsOnly.new
+ tags_only.tag_list = 'tags, only'
+ tags_only.tag_list #=> ['only', 'tags']
+ tags_only.save #=> true
+ tags_only.tags #=> [#<Tag id=8 name="only">, #<Tag id=9 name="tags">]
+ tags_only.tag_list = ''
+ tags_only.save #= true
+ tags_only.tags #=> []
+
+== Requirements
+
+* DataMapper (dm-core)
+
+== Installation
+
+ git clone http://github.com/datamapper/dm-more/tree/master
+ cd dm-tags
+ rake install
+
+== License
+
+(The MIT License)
+
+Copyright (c) 2011 Bobby Calderwood
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
+require 'rubygems'
+require 'rake'
+
+begin
+ gem 'jeweler', '~> 1.6.4'
+ require 'jeweler'
+
+ Jeweler::Tasks.new do |gem|
+ gem.name = 'dm-tags'
+ gem.summary = "This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids."
+ gem.description = gem.summary
+ gem.email = 'bobby_calderwood [a] me [d] com'
+ gem.homepage = 'http://github.com/datamapper/%s' % gem.name
+ gem.authors = [ 'Bobby Calderwood' ]
+ gem.has_rdoc = 'yard'
+
+ gem.rubyforge_project = 'datamapper'
+ end
+
+ Jeweler::GemcutterTasks.new
+
+ FileList['tasks/**/*.rake'].each { |task| import task }
+rescue LoadError
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.6.4'
+end
@@ -0,0 +1 @@
+1.2.0
@@ -0,0 +1,72 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = "dm-tags"
+ s.version = "1.2.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Bobby Calderwood"]
+ s.date = "2011-10-09"
+ s.description = "This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids."
+ s.email = "bobby_calderwood [a] me [d] com"
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.rdoc"
+ ]
+ s.files = [
+ "Gemfile",
+ "LICENSE",
+ "README.rdoc",
+ "Rakefile",
+ "VERSION",
+ "dm-tags.gemspec",
+ "lib/dm-tags.rb",
+ "lib/dm-tags/dm_tags.rb",
+ "lib/dm-tags/tag.rb",
+ "lib/dm-tags/tagging.rb",
+ "spec/dm-tags/dm_tags_spec.rb",
+ "spec/dm-tags/tag_spec.rb",
+ "spec/dm-tags/taggable_spec.rb",
+ "spec/dm-tags/tagging_spec.rb",
+ "spec/dm-tags/updating_spec.rb",
+ "spec/rcov.opts",
+ "spec/spec.opts",
+ "spec/spec_helper.rb",
+ "tasks/spec.rake",
+ "tasks/yard.rake",
+ "tasks/yardstick.rake"
+ ]
+ s.homepage = "http://github.com/datamapper/dm-tags"
+ s.require_paths = ["lib"]
+ s.rubyforge_project = "datamapper"
+ s.rubygems_version = "1.8.11"
+ s.summary = "This package brings tagging to DataMapper. It is inspired by Acts As Taggable On by Michael Bleigh, github's mbleigh. Props to him for the contextual tagging based on Acts As Taggable on Steroids."
+
+ if s.respond_to? :specification_version then
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<dm-core>, ["~> 1.2.0"])
+ s.add_development_dependency(%q<dm-validations>, ["~> 1.2.0"])
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
+ s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
+ s.add_development_dependency(%q<rspec>, ["~> 1.3.2"])
+ else
+ s.add_dependency(%q<dm-core>, ["~> 1.2.0"])
+ s.add_dependency(%q<dm-validations>, ["~> 1.2.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
+ end
+ else
+ s.add_dependency(%q<dm-core>, ["~> 1.2.0"])
+ s.add_dependency(%q<dm-validations>, ["~> 1.2.0"])
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
+ s.add_dependency(%q<rake>, ["~> 0.9.2"])
+ s.add_dependency(%q<rspec>, ["~> 1.3.2"])
+ end
+end
+
@@ -0,0 +1,7 @@
+#encoding: utf-8
+require 'dm-core'
+require 'dm-validations'
+
+require 'dm-tags/tagging'
+require 'dm-tags/tag'
+require 'dm-tags/dm_tags'
Oops, something went wrong.

0 comments on commit 49a87e1

Please sign in to comment.