# -*- encoding: utf-8 -*- # stub: dm-is-published 0.0.3 ruby lib Gem::Specification.new do |s| s.name = "dm-is-published".freeze s.version = "0.0.3".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["kematzy".freeze] s.date = "2009-08-20" s.description = "= dm-is-published\n\nThis plugin makes it very easy to add different states to your models, like 'draft' vs 'live'. \nBy default it also adds validations of the field value.\n\nOriginally inspired by the Rails plugin +acts_as_publishable+ by fr.ivolo.us. \n\n\n== Installation\n \n # Add GitHub to your RubyGems sources \n $ gem sources -a http://gems.github.com\n \n $ (sudo)? gem install kematzy-dm-is-published\n \nNB! Depends upon the whole DataMapper suite being installed, and has ONLY been tested with DM 0.10.0 (next branch).\n\n\n== Getting Started\n\nFirst of all, for a better understanding of this gem, make sure you study \nthe 'dm-is-published/spec/integration/published_spec.rb' file.\n\n----\n\nRequire +dm-is-published+ in your app.\n\n require 'dm-core' # must be required first\n require 'dm-is-published'\n\nLets say we have an Article class, and each Article can have a current state, \nie: whether it's Live, Draft or an Obituary awaiting the death of someone famous (real or rumored)\n\n\n class Article\n include DataMapper::Resource\n property :id, Serial\n property :title, String\n ...\n \n is :published\n \n end\n \nOnce you have your Article model we can create our Articles just as normal\n\n Article.create(:title => 'Example 1')\n \n\nThe instance of Article.get(1) now has the following things for free:\n\n* a :publish_status attribute with the value 'live'. Default choices are [ :live, :draft, :hidden ].\n\n* :is_live?, :is_draft? or :is_hidden? methods that returns true/false based upon the state.\n\n* :save_as_live, :save_as_draft or :save_as_hidden converts the instance to the state and saves it.\n\n* :publishable? method that returns true for models where is :published has been declared,\n but false for those where it has not been declared.\n\n\nThe Article class also gets a bit of new functionality:\n\n Article.all(:draft) => finds all Articles with :publish_status = :draft\n \n \n Article.all(:draft, :author => @author_joe ) => finds all Articles with :publish_status = :draft and author == Joe\n \n \n \nTodo Need to write more documentation here..\n\n \n== Usage Scenarios\n\nIn a Blog/Publishing scenario you could use it like this:\n\n class Article \n ......\n \n is :published :live, :draft, :hidden\n \n end\n\nWhereas in another scenario - like in a MenuItem model for a Restaurant - you could use it like this:\n\n class MenuItem\n ......\n \n is :published :on, :off # the item is either on the menu or not\n \n end\n \n\n== RTFM \n\nAs I said above, for a better understanding of this gem/plugin, make sure you study the 'dm-is-published/spec/integration/published_spec.rb' file.\n\n\n== Errors / Bugs\n\nIf something is not behaving intuitively, it is a bug, and should be reported.\nReport it here: http://github.com/kematzy/dm-is-published/issues\n\n== Credits\n\nCopyright (c) 2009-07-11 [kematzy gmail com]\n\nLoosely based on the ActsAsPublishable plugin by [http://fr.ivolo.us/posts/acts-as-publishable]\n\n== Licence\n\nReleased under the MIT license.\n".freeze s.email = "kematzy@gmail.com".freeze s.extra_rdoc_files = ["History.rdoc".freeze, "LICENSE".freeze, "README.rdoc".freeze, "TODO".freeze] s.files = [".gitignore".freeze, "History.rdoc".freeze, "LICENSE".freeze, "README.rdoc".freeze, "Rakefile".freeze, "TODO".freeze, "VERSION".freeze, "dm-is-published.gemspec".freeze, "lib/dm-is-published.rb".freeze, "lib/dm-is-published/is/published.rb".freeze, "lib/dm-is-published/is/version.rb".freeze, "spec/integration/published_spec.rb".freeze, "spec/spec.opts".freeze, "spec/spec_helper.rb".freeze] s.homepage = "http://github.com/kematzy/dm-is-published".freeze s.rdoc_options = ["--charset=UTF-8".freeze] s.rubygems_version = "3.5.10".freeze s.summary = "A DataMapper plugin that provides an easy way to add different states to your models.".freeze s.test_files = ["spec/integration/published_spec.rb".freeze, "spec/spec_helper.rb".freeze] s.specification_version = 3 s.add_runtime_dependency(%q.freeze, [">= 0.10.0".freeze]) s.add_runtime_dependency(%q.freeze, [">= 0.10.0".freeze]) end