davidlee / state-fu

A rich DSL for describing state, and state-related behaviour, in your ruby classes / models.

nil

This URL has Read+Write access

state-fu / Rakefile
100644 109 lines (94 sloc) 2.992 kb
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/ruby1.9
require "spec/rake/spectask"
#require 'cucumber/rake/task'
require "date"
require "fileutils"
require "rubygems"
 
module Rakefile
  def self.windows?
/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM
  end
end
 
# to build the gem:
#
# gem install jeweller
# rake build
# rake install
begin
  require 'jeweler'
  Jeweler::Tasks.new do |s| # gemspec (Gem::Specification)
  s.name = "state-fu"
  s.rubyforge_project = "state-fu"
  s.platform = Gem::Platform::RUBY
  s.has_rdoc = true
# s.extra_rdoc_files = ["README.rdoc"]
  s.summary = "A rich library for state-oriented programming with state machines / workflows"
  s.description = s.summary
  s.author = "David Lee"
  s.email = "david@rubyist.net.au"
  s.homepage = "http://github.com/davidlee/state-fu"
  s.require_path = "lib"
# s.files = %w(README.rdoc Rakefile) + Dir.glob("{lib,spec}/**/*")
  s.files = %w(Rakefile) + Dir.glob("{lib,spec}/**/*")
  end
rescue LoadError
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
 
namespace :spec do
  desc "Run all specs"
  Spec::Rake::SpecTask.new(:all) do |t|
    t.spec_files = FileList["spec/**/*_spec.rb"]
    t.spec_opts = ["--options", "spec/spec.opts"]
  end
 
  desc "Run unit specs"
  Spec::Rake::SpecTask.new(:units) do |t|
    t.spec_files = FileList["spec/units/*_spec.rb"]
    t.spec_opts = ["--options", "spec/spec.opts"]
  end
  task :unit => :units
 
  desc "Run integration specs"
  Spec::Rake::SpecTask.new(:integration) do |t|
    t.spec_files = FileList["spec/integration/*_spec.rb"]
    t.spec_opts = ["--options", "spec/spec.opts"]
  end
  task :system => :integration
 
  desc "Print Specdoc for all specs (eaxcluding plugin specs)"
  Spec::Rake::SpecTask.new(:doc) do |t|
    t.spec_files = FileList["spec/**/*_spec.rb"]
    t.spec_opts = ["--format", "nested","--backtrace","--color"]
  end
 
  desc "Run autotest"
  task :auto do |t|
    exec 'autospec'
  end
 
    def find_last_modified_spec
    require 'find'
    specs = []
    Find.find( File.expand_path(File.join(File.dirname(__FILE__),'spec'))) do |f|
      next unless f !~ /\.#/ && f =~ /_spec.rb$/
      specs << f
    end
    spec = specs.sort_by { |spec| File.stat( spec ).mtime }.last
  end
 
  desc "runs the last modified spec, without mucking about"
  Spec::Rake::SpecTask.new(:last) do |t|
    t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
    t.spec_files = FileList[find_last_modified_spec]
  end
end
 
desc 'Runs irb in this project\'s context'
task :irb do |t|
  exec 'irb -I lib -r state-fu'
end
 
desc 'Runs rdoc on the project lib directory'
task :doc do |t|
  exec 'rdoc lib/'
end
 
begin
  require 'cucumber/rake/task'
 
  Cucumber::Rake::Task.new(:features) do |t|
      t.cucumber_opts = "--format pretty"
  end
rescue LoadError => e
end
 
task :default => 'spec:all'