From dc068014afe262345f99bf483ba2230ccf3ea174 Mon Sep 17 00:00:00 2001 From: Travis Tilley Date: Wed, 14 Oct 2009 23:03:38 -0400 Subject: [PATCH] cleanup, move to jeweler, nuke gemspec --- .document | 5 + .gitignore | 9 +- CHANGELOG | 35 --- MIT-LICENSE => LICENSE | 0 Rakefile | 152 +++++------ TODO | 9 - VERSION | 1 + aasm.gemspec | 19 -- doc/jamis.rb | 591 ----------------------------------------- lib/aasm/aasm.rb | 4 - spec/spec_helper.rb | 11 +- 11 files changed, 87 insertions(+), 749 deletions(-) create mode 100644 .document delete mode 100644 CHANGELOG rename MIT-LICENSE => LICENSE (100%) delete mode 100644 TODO create mode 100644 VERSION delete mode 100644 aasm.gemspec delete mode 100644 doc/jamis.rb diff --git a/.document b/.document new file mode 100644 index 0000000..ecf3673 --- /dev/null +++ b/.document @@ -0,0 +1,5 @@ +README.rdoc +lib/**/*.rb +bin/* +features/**/*.feature +LICENSE diff --git a/.gitignore b/.gitignore index 09e06c0..93918b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -rdoc -pkg -coverage -*~ *.sw? +*~ +.DS_Store +coverage +pkg +rdoc diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 35c55e4..0000000 --- a/CHANGELOG +++ /dev/null @@ -1,35 +0,0 @@ -* Fixed compatibility issue with Ruby 1.9.1 - -* In AR persistence, move state column from class level variables into the StateMachine object for the class - -* allowed :to array and :on_transition callback [Kevin Triplett] - -* Support enter and exit actions on states - -* Use named_scope in AR persistence layer, if available [Jan De Poorter] - -* Incremented version number - -* Cleaned up aasm_states_for_select to return the value as a string - -* Specs and bug fixes for the ActiveRecordPersistence, keeping persistence columns in sync - Allowing for nil values in states for active record - Only set state to default state before_validation_on_create - New rake task to uninstall, build and reinstall the gem (useful for development) - Changed scott's email address to protect it from spambots when publishing rdocs - New non-(!) methods that allow for firing events without persisting [Jeff Dean] - -* Added aasm_states_for_select that will return a select friendly collection of states. - -* Add some event callbacks, #aasm_event_fired(from, to), and #aasm_event_failed(event) - Based on transition logging suggestion [Artem Vasiliev] and timestamp column suggestion [Mike Ferrier] - -* Add #aasm_events_for_state and #aasm_events_for_current_state [Joao Paulo Lins] - -* Ensure that a state is written for a new record even if aasm_current_state or - {state}= are never called. - -* Fix AR persistence so new records have their state set. [Joao Paulo Lins] - -* Make #event! methods return a boolean [Joel Chippindale] - diff --git a/MIT-LICENSE b/LICENSE similarity index 100% rename from MIT-LICENSE rename to LICENSE diff --git a/Rakefile b/Rakefile index a547215..f593be8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,95 +1,75 @@ -# Copyright 2008 Scott Barron (scott@elitists.net) -# All rights reserved - -# This file may be distributed under an MIT style license. -# See MIT-LICENSE for details. +require 'rubygems' +require 'rake' begin - require 'rubygems' - require 'rake/gempackagetask' - require 'rake/testtask' - require 'rake/rdoctask' - require 'spec/rake/spectask' -rescue Exception - nil + require 'jeweler' + Jeweler::Tasks.new do |gem| + gem.name = "ttilley-aasm" + gem.summary = %Q{State machine mixin for Ruby objects} + gem.description = %Q{AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.} + gem.homepage = "http://github.com/ttilley/aasm" + gem.authors = ["Scott Barron", "Scott Petersen", "Travis Tilley"] + gem.email = "ttilley@gmail.com" + gem.add_development_dependency "rspec" + # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings + end + Jeweler::GemcutterTasks.new +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler" end -if `ruby -Ilib -raasm -e "print AASM.Version"` =~ /([0-9.]+)$/ - CURRENT_VERSION = $1 -else - CURRENT_VERSION = '0.0.0' +require 'spec/rake/spectask' +Spec::Rake::SpecTask.new(:spec) do |spec| + spec.libs << 'lib' << 'spec' + spec.spec_files = FileList['spec/**/*_spec.rb'] + spec.spec_opts = ['-cfs'] end -$package_version = CURRENT_VERSION -PKG_FILES = FileList['[A-Z]*', - 'lib/**/*.rb', - 'doc/**/*' -] +Spec::Rake::SpecTask.new(:rcov) do |spec| + spec.libs << 'lib' << 'spec' + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true +end + +task :spec => :check_dependencies + +begin + require 'reek/rake_task' + Reek::RakeTask.new do |t| + t.fail_on_error = true + t.verbose = false + t.source_files = 'lib/**/*.rb' + end +rescue LoadError + task :reek do + abort "Reek is not available. In order to run reek, you must: sudo gem install reek" + end +end + +begin + require 'roodi' + require 'roodi_task' + RoodiTask.new do |t| + t.verbose = false + end +rescue LoadError + task :roodi do + abort "Roodi is not available. In order to run roodi, you must: sudo gem install roodi" + end +end + +task :default => :spec + +require 'rake/rdoctask' +Rake::RDocTask.new do |rdoc| + if File.exist?('VERSION') + version = File.read('VERSION') + else + version = "" + end -desc 'Generate documentation for the acts as state machine plugin.' -rd = Rake::RDocTask.new(:rdoc) do |rdoc| - rdoc.rdoc_dir = 'html' - rdoc.template = 'doc/jamis.rb' rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'AASM' - rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README.rdoc' << '--title' << 'AASM' - rdoc.rdoc_files.include('README.rdoc', 'MIT-LICENSE', 'TODO', 'CHANGELOG') - rdoc.rdoc_files.include('lib/*.rb', 'lib/**/*.rb', 'doc/**/*.rdoc') + rdoc.title = "ttilley-aasm #{version}" + rdoc.rdoc_files.include('README*') + rdoc.rdoc_files.include('lib/**/*.rb') end - -if !defined?(Gem) - puts "Package target requires RubyGEMs" -else - spec = Gem::Specification.new do |s| - s.name = 'aasm' - s.version = $package_version - s.summary = 'State machine mixin for Ruby objects' - s.description = < [:spec] diff --git a/TODO b/TODO deleted file mode 100644 index efeb98c..0000000 --- a/TODO +++ /dev/null @@ -1,9 +0,0 @@ -Before Next Release: - -* Add #aasm_next_state_for_event -* Add #aasm_next_states_for_event - -Cool ideas from users: - -* Support multiple state machines on one object (Chris Nelson) -* http://justbarebones.blogspot.com/2007/11/actsasstatemachine-enhancements.html (Chetan Patil) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..8f9174b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.1.2 \ No newline at end of file diff --git a/aasm.gemspec b/aasm.gemspec deleted file mode 100644 index c819319..0000000 --- a/aasm.gemspec +++ /dev/null @@ -1,19 +0,0 @@ -PKG_FILES = ["CHANGELOG", "MIT-LICENSE", "Rakefile", "README.rdoc", "TODO", "lib/aasm.rb", "lib/aasm/aasm.rb", "lib/aasm/event.rb", "lib/aasm/persistence/active_record_persistence.rb", "lib/aasm/persistence.rb", "lib/aasm/state.rb", "lib/aasm/state_machine.rb", "lib/aasm/state_transition.rb", "doc/jamis.rb"] - -Gem::Specification.new do |s| - s.name = 'aasm' - s.version = "2.1.1" - s.summary = 'State machine mixin for Ruby objects' - s.description = <<-EOF -AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects. This fork adds Ruby 1.9.1 compatibility. -EOF - s.files = PKG_FILES - s.require_path = 'lib' - s.has_rdoc = true - s.extra_rdoc_files = ['README.rdoc', 'MIT-LICENSE', 'TODO', 'CHANGELOG'] - s.rdoc_options = ['--line-numbers', '--inline-source', '--main', 'README.rdoc', '--title', 'AASM'] - - s.author = 'Scott Barron, David Palm' - s.email = 'scott@elitists.net, dvdplm@gmail.com' - s.homepage = 'http://github.com/dvdplm/aasm' -end diff --git a/doc/jamis.rb b/doc/jamis.rb deleted file mode 100644 index c7439d8..0000000 --- a/doc/jamis.rb +++ /dev/null @@ -1,591 +0,0 @@ -module RDoc -module Page - -FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif" - -STYLE = < pre { - padding: 0.5em; - border: 1px dotted black; - background: #FFE; -} - -CSS - -XHTML_PREAMBLE = %{ - -} - -HEADER = XHTML_PREAMBLE + < - - %title% - - - - - - - -ENDHEADER - -FILE_PAGE = < - - - - -
File
%short_name%
- - - - - - - - - -
Path:%full_path% -IF:cvsurl -  (CVS) -ENDIF:cvsurl -
Modified:%dtm_modified%
-
- -
-HTML - -################################################################### - -CLASS_PAGE = < - %classmod%
%full_name% - - - - - - -IF:parent - - - - -ENDIF:parent -
In: -START:infiles -HREF:full_path_url:full_path: -IF:cvsurl - (CVS) -ENDIF:cvsurl -END:infiles -
Parent: -IF:par_url - -ENDIF:par_url -%parent% -IF:par_url - -ENDIF:par_url -
- - - -HTML - -################################################################### - -METHOD_LIST = < -IF:diagram -
- %diagram% -
-ENDIF:diagram - -IF:description -
%description%
-ENDIF:description - -IF:requires -
Required Files
-
    -START:requires -
  • HREF:aref:name:
  • -END:requires -
-ENDIF:requires - -IF:toc -
Contents
- -ENDIF:toc - -IF:methods -
Methods
-
    -START:methods -
  • HREF:aref:name:
  • -END:methods -
-ENDIF:methods - -IF:includes -
Included Modules
-
    -START:includes -
  • HREF:aref:name:
  • -END:includes -
-ENDIF:includes - -START:sections -IF:sectitle - -IF:seccomment -
-%seccomment% -
-ENDIF:seccomment -ENDIF:sectitle - -IF:classlist -
Classes and Modules
- %classlist% -ENDIF:classlist - -IF:constants -
Constants
- -START:constants - - - - - -IF:desc - - - - -ENDIF:desc -END:constants -
%name%=%value%
 %desc%
-ENDIF:constants - -IF:attributes -
Attributes
- -START:attributes - - - - - -END:attributes -
-IF:rw -[%rw%] -ENDIF:rw - %name%%a_desc%
-ENDIF:attributes - -IF:method_list -START:method_list -IF:methods -
%type% %category% methods
-START:methods -
-
-IF:callseq - %callseq% -ENDIF:callseq -IFNOT:callseq - %name%%params% -ENDIF:callseq -IF:codeurl -[ source ] -ENDIF:codeurl -
-IF:m_desc -
- %m_desc% -
-ENDIF:m_desc -IF:aka -
- This method is also aliased as -START:aka - %name% -END:aka -
-ENDIF:aka -IF:sourcecode -
- -
-
-%sourcecode%
-
-
-
-ENDIF:sourcecode -
-END:methods -ENDIF:methods -END:method_list -ENDIF:method_list -END:sections - -HTML - -FOOTER = < - -ENDFOOTER - -BODY = HEADER + < - -
- #{METHOD_LIST} -
- - #{FOOTER} -ENDBODY - -########################## Source code ########################## - -SRC_PAGE = XHTML_PREAMBLE + < -%title% - - - - -
%code%
- - -HTML - -########################## Index ################################ - -FR_INDEX_BODY = < - - - - - - - -
-START:entries -%name%
-END:entries -
- -HTML - -CLASS_INDEX = FILE_INDEX -METHOD_INDEX = FILE_INDEX - -INDEX = XHTML_PREAMBLE + < - - %title% - - - - - - - - - -IF:inline_source - -ENDIF:inline_source -IFNOT:inline_source - - - - -ENDIF:inline_source - - <body bgcolor="white"> - Click <a href="html/index.html">here</a> for a non-frames - version of this page. - </body> - - - - -HTML - -end -end - - diff --git a/lib/aasm/aasm.rb b/lib/aasm/aasm.rb index 9c23162..16e0391 100644 --- a/lib/aasm/aasm.rb +++ b/lib/aasm/aasm.rb @@ -4,10 +4,6 @@ require File.join(File.dirname(__FILE__), 'state_machine') require File.join(File.dirname(__FILE__), 'persistence') module AASM - def self.Version - '2.1.1' - end - class InvalidTransition < RuntimeError end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7619412..e4d3fc0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,2 +1,11 @@ +$LOAD_PATH.unshift(File.dirname(__FILE__)) +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + +require 'aasm' + require 'spec' -require File.join(File.dirname(__FILE__), '..', 'lib', 'aasm', 'aasm') +require 'spec/autorun' + +Spec::Runner.configure do |config| + +end