Take the 2008 Git User's Survey and help out! [ hide ]

public
Rubygem
Description: AASM - State machines for Ruby classes
Homepage: http://rubyi.st/aasm
Clone URL: git://github.com/rubyist/aasm.git
Search Repo:
Click here to lend your support to: aasm and make a donation at www.pledgie.com !
Prepare rakefile and rake tasks for gem packaging and rdocing
rubyist (author)
Thu Feb 21 08:41:56 -0800 2008
commit  85baeda50a11b1dae7b970b258618868d279e472
tree    e4d86deae81b0e6d5e05b0b1bfd0aa7de203ff47
parent  03780617a1589b55feacc57676127ddfc0274cdb
...
1
2
3
4
 
 
5
6
7
 
 
8
9
10
11
 
 
 
 
 
 
 
 
12
13
14
15
16
17
18
19
 
 
 
 
 
 
 
 
20
21
22
 
 
 
23
24
25
26
27
28
 
 
 
 
29
30
31
32
33
34
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
37
38
39
40
41
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
...
 
 
 
 
1
2
3
 
 
4
5
6
 
 
 
7
8
9
10
11
12
13
14
15
16
 
 
 
 
 
 
17
18
19
20
21
22
23
24
25
26
 
27
28
29
30
 
 
 
 
 
31
32
33
34
35
36
 
 
 
 
 
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
 
 
 
 
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
0
@@ -1,45 +1,82 @@
0
-require 'rake'
0
-require 'rake/testtask'
0
-require 'rake/rdoctask'
0
-require 'spec/rake/spectask'
0
+# Copyright 2008 Scott Barron (scott@elitists.net)
0
+# All rights reserved
0
 
0
-desc 'Default: run unit tests.'
0
-task :default => [:clean_db, :test]
0
+# This file may be distributed under an MIT style license.
0
+# See MIT-LICENSE for details.
0
 
0
-desc 'Remove the stale db file'
0
-task :clean_db do
0
- `rm -f #{File.dirname(__FILE__)}/test/state_machine.sqlite.db`
0
+begin
0
+ require 'rubygems'
0
+ require 'rake/gempackagetask'
0
+ require 'rake/testtask'
0
+ require 'rake/rdoctask'
0
+ require 'spec/rake/spectask'
0
+rescue Exception
0
+ nil
0
 end
0
 
0
-desc 'Test the acts as state machine plugin.'
0
-Rake::TestTask.new(:test) do |t|
0
- t.libs << 'lib'
0
- t.pattern = 'test/**/*_test.rb'
0
- t.verbose = true
0
-end
0
+# Version
0
+CURRENT_VERSION = '0.0.0'
0
+$package_version = CURRENT_VERSION
0
+
0
+PKG_FILES = FileList['[A-Z]*',
0
+ 'lib/**/*.rb',
0
+ 'doc/**/*'
0
+ ]
0
 
0
 desc 'Generate documentation for the acts as state machine plugin.'
0
-Rake::RDocTask.new(:rdoc) do |rdoc|
0
+rd = Rake::RDocTask.new(:rdoc) do |rdoc|
0
+ rdoc.rdoc_dir = 'html'
0
+ rdoc.template = 'doc/jamis.rb'
0
   rdoc.rdoc_dir = 'rdoc'
0
- rdoc.title = 'Acts As State Machine'
0
- rdoc.options << '--line-numbers --inline-source'
0
- rdoc.rdoc_files.include('README')
0
- rdoc.rdoc_files.include('TODO')
0
- rdoc.rdoc_files.include('lib/**/*.rb')
0
+ rdoc.title = 'AASM'
0
+ rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README' << '--title' << 'AASM'
0
+ rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGELOG')
0
+ rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
0
 end
0
 
0
-desc "Run all examples with RCov"
0
-Spec::Rake::SpecTask.new('cruise') do |t|
0
- t.spec_files = FileList['spec/*.rb']
0
- t.rcov = true
0
- t.rcov_opts = ['--exclude', 'spec']
0
+if !defined?(Gem)
0
+ puts "Package target requires RubyGEMs"
0
+else
0
+ spec = Gem::Specification.new do |s|
0
+ s.name = 'aasm'
0
+ s.version = $package_version
0
+ s.summary = 'State machine mixin for Ruby objects'
0
+ s.description = <<-EOF
0
+AASM is a continuation of the acts as state machine rails plugin, built for plain Ruby objects.
0
+EOF
0
+ s.files = PKG_FILES.to_a
0
+ s.require_path = 'lib'
0
+ s.has_rdoc = true
0
+ s.extra_rdoc_files = rd.rdoc_files.reject {|fn| fn =~ /\.rb$/}.to_a
0
+ s.rdoc_options = rd.options
0
+
0
+ s.author = 'Scott Barron'
0
+ s.email = 'scott@elitists.net'
0
+ s.homepage = 'http://rubyi.st/aasm'
0
+ end
0
+
0
+ package_task = Rake::GemPackageTask.new(spec) do |pkg|
0
+ pkg.need_zip = true
0
+ pkg.need_tar = true
0
+ end
0
 end
0
 
0
-desc "Run all examples"
0
-Spec::Rake::SpecTask.new('spec') do |t|
0
- t.spec_files = FileList['spec/*.rb']
0
- t.rcov = false
0
- t.spec_opts = ['-cfs']
0
+if !defined?(Spec)
0
+ puts "spec and cruise targets require RSpec"
0
+else
0
+ desc "Run all examples with RCov"
0
+ Spec::Rake::SpecTask.new('cruise') do |t|
0
+ t.spec_files = FileList['spec/*.rb']
0
+ t.rcov = true
0
+ t.rcov_opts = ['--exclude', 'spec']
0
+ end
0
+
0
+ desc "Run all examples"
0
+ Spec::Rake::SpecTask.new('spec') do |t|
0
+ t.spec_files = FileList['spec/*.rb']
0
+ t.rcov = false
0
+ t.spec_opts = ['-cfs']
0
+ end
0
 end
0
 
0
 task :default => [:spec]

Comments

    No one has commented yet.