stonepath 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/stonepath/task.rb +3 -1
- data/lib/stonepath/work_item.rb +14 -0
- data/rails_generators/stonepath/stonepath_event_log_generator.rb +9 -0
- data/rails_generators/stonepath/stonepath_task_generator.rb +7 -1
- data/rails_generators/stonepath/templates/create_event_records.rb +17 -0
- data/rails_generators/stonepath/templates/event_record.rb +6 -0
- data/rails_generators/stonepath/templates/generic_task.rb +8 -0
- data/rails_generators/stonepath/templates/generic_task_migration.rb +20 -0
- data/stonepath.pdf +0 -0
- data/test/app_root/app/models/assignment.rb +0 -4
- metadata +7 -4
- data/rails_generators/stonepath/stonepath_audit_table_generator.rb +0 -3
- data/stonepath.gemspec +0 -124
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/stonepath/task.rb
CHANGED
@@ -55,8 +55,10 @@ module StonePath
|
|
55
55
|
# a workitem for the specific kind of task, everything just works.
|
56
56
|
belongs_to :workitem, :polymorphic => true
|
57
57
|
|
58
|
-
def
|
58
|
+
def logs_transitions
|
59
59
|
puts "#{self.class} audits transitions"
|
60
|
+
# see notes in work_item's version of this method. This ideally should be an includable
|
61
|
+
# module
|
60
62
|
end
|
61
63
|
|
62
64
|
include AASM
|
data/lib/stonepath/work_item.rb
CHANGED
@@ -8,6 +8,20 @@ module StonePath
|
|
8
8
|
base.instance_eval do
|
9
9
|
include AASM
|
10
10
|
|
11
|
+
#this method needs to be a mixin so we can share it with tasks...
|
12
|
+
def log_events
|
13
|
+
has_many :logged_events, :as => :auditable, :class_name => "EventRecord"
|
14
|
+
|
15
|
+
define_method :aasm_event_fired do |event_name, old_state_name, new_state_name|
|
16
|
+
|
17
|
+
current_user_id = current_user && current_user.id
|
18
|
+
self.logged_events.create(:event_name => event_name.to_s,
|
19
|
+
:old_state_name => old_state_name.to_s,
|
20
|
+
:new_state_name => new_state_name.to_s,
|
21
|
+
:user_id => current_user_id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
11
25
|
def owned_by(owner, options={})
|
12
26
|
options.merge!(:class_name => owner.to_s.classify)
|
13
27
|
belongs_to :owner, options
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class StonepathEventLogGenerator < Rails::Generator::Base
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
task_name = args[0]
|
5
|
+
m.template('event_record.rb', "app/models/event_record.rb")
|
6
|
+
m.migration_template("create_event_records.rb", "db/migrate", :migration_file_name => "create_event_records")
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -1,3 +1,9 @@
|
|
1
1
|
class StonepathTaskGenerator < Rails::Generator::Base
|
2
|
-
|
2
|
+
def manifest
|
3
|
+
record do |m|
|
4
|
+
task_name = args[0]
|
5
|
+
m.template('generic_task.rb', "app/models/#{task_name}.rb")
|
6
|
+
m.migration_template("generic_task_migration.rb", "db/migrate", :migration_file_name => "create_#{task_name.tableize}")
|
7
|
+
end
|
8
|
+
end
|
3
9
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateEventRecords < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :event_records do |t|
|
4
|
+
|
5
|
+
t.references :auditable, :polymorphic => true
|
6
|
+
t.string :event_name
|
7
|
+
t.string :old_state_name
|
8
|
+
t.string :new_state_name
|
9
|
+
t.integer :user_id #This will rely on the acl controller hack
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :event_records
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Create<%= args[0].tableize.classify %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :<%= args[0].tableize %> do |t|
|
4
|
+
|
5
|
+
t.string :aasm_state
|
6
|
+
t.references :workitem, :polymorphic => true
|
7
|
+
t.references :workbench, :polymorphic => true
|
8
|
+
|
9
|
+
t.datetime :due_at
|
10
|
+
t.datetime :completed_at
|
11
|
+
t.timestamps
|
12
|
+
|
13
|
+
# customize your task here
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.down
|
18
|
+
drop_table :<%= args[0].tableize %>
|
19
|
+
end
|
20
|
+
end
|
data/stonepath.pdf
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stonepath
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Bock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-29 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,12 +51,15 @@ files:
|
|
51
51
|
- lib/stonepath/work_bench.rb
|
52
52
|
- lib/stonepath/work_item.rb
|
53
53
|
- lib/stonepath/work_owner.rb
|
54
|
-
- rails_generators/stonepath/
|
54
|
+
- rails_generators/stonepath/stonepath_event_log_generator.rb
|
55
55
|
- rails_generators/stonepath/stonepath_task_generator.rb
|
56
|
+
- rails_generators/stonepath/templates/create_event_records.rb
|
57
|
+
- rails_generators/stonepath/templates/event_record.rb
|
58
|
+
- rails_generators/stonepath/templates/generic_task.rb
|
59
|
+
- rails_generators/stonepath/templates/generic_task_migration.rb
|
56
60
|
- script/console
|
57
61
|
- script/destroy
|
58
62
|
- script/generate
|
59
|
-
- stonepath.gemspec
|
60
63
|
- stonepath.pdf
|
61
64
|
- test/acl_test.rb
|
62
65
|
- test/app_root/app/controllers/application_controller.rb
|
data/stonepath.gemspec
DELETED
@@ -1,124 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{stonepath}
|
8
|
-
s.version = "0.0.5"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["David Bock"]
|
12
|
-
s.date = %q{2009-12-21}
|
13
|
-
s.description = %q{Stateful workflow modeling for Rails}
|
14
|
-
s.email = %q{dbock@codesherpas.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"README.rdoc"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
"History.txt",
|
20
|
-
"Manifest.txt",
|
21
|
-
"PostInstall.txt",
|
22
|
-
"README.rdoc",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"lib/stonepath.rb",
|
26
|
-
"lib/stonepath/acl.rb",
|
27
|
-
"lib/stonepath/acl/controller.rb",
|
28
|
-
"lib/stonepath/acl/role.rb",
|
29
|
-
"lib/stonepath/acl/state.rb",
|
30
|
-
"lib/stonepath/config.rb",
|
31
|
-
"lib/stonepath/controller_hooks.rb",
|
32
|
-
"lib/stonepath/extensions/activerecordbase.rb",
|
33
|
-
"lib/stonepath/group.rb",
|
34
|
-
"lib/stonepath/role.rb",
|
35
|
-
"lib/stonepath/task.rb",
|
36
|
-
"lib/stonepath/work_bench.rb",
|
37
|
-
"lib/stonepath/work_item.rb",
|
38
|
-
"lib/stonepath/work_owner.rb",
|
39
|
-
"rails_generators/stonepath/stonepath_audit_table_generator.rb",
|
40
|
-
"rails_generators/stonepath/stonepath_task_generator.rb",
|
41
|
-
"script/console",
|
42
|
-
"script/destroy",
|
43
|
-
"script/generate",
|
44
|
-
"stonepath.gemspec",
|
45
|
-
"stonepath.pdf",
|
46
|
-
"test/acl_test.rb",
|
47
|
-
"test/app_root/app/controllers/application_controller.rb",
|
48
|
-
"test/app_root/app/models/assignment.rb",
|
49
|
-
"test/app_root/app/models/case.rb",
|
50
|
-
"test/app_root/app/models/custom_assignment.rb",
|
51
|
-
"test/app_root/app/models/user.rb",
|
52
|
-
"test/app_root/config/boot.rb",
|
53
|
-
"test/app_root/config/database.yml",
|
54
|
-
"test/app_root/config/environment.rb",
|
55
|
-
"test/app_root/config/environments/in_memory.rb",
|
56
|
-
"test/app_root/config/environments/mysql.rb",
|
57
|
-
"test/app_root/config/environments/postgresql.rb",
|
58
|
-
"test/app_root/config/environments/sqlite.rb",
|
59
|
-
"test/app_root/config/environments/sqlite3.rb",
|
60
|
-
"test/app_root/config/routes.rb",
|
61
|
-
"test/app_root/db/migrate/01_create_users.rb",
|
62
|
-
"test/app_root/db/migrate/02_create_assignments.rb",
|
63
|
-
"test/app_root/db/migrate/03_create_cases.rb",
|
64
|
-
"test/app_root/lib/console_with_fixtures.rb",
|
65
|
-
"test/app_root/log/.gitignore",
|
66
|
-
"test/app_root/script/console",
|
67
|
-
"test/custom_task_test.rb",
|
68
|
-
"test/fixtures/users.yml",
|
69
|
-
"test/group_test.rb",
|
70
|
-
"test/role_test.rb",
|
71
|
-
"test/stonepath_test.rb",
|
72
|
-
"test/task_test.rb",
|
73
|
-
"test/test_helper.rb",
|
74
|
-
"test/workitem_test.rb",
|
75
|
-
"test/workowner_test.rb"
|
76
|
-
]
|
77
|
-
s.homepage = %q{http://github.com/bokmann/stonepath}
|
78
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
79
|
-
s.require_paths = ["lib"]
|
80
|
-
s.rubygems_version = %q{1.3.5}
|
81
|
-
s.summary = %q{Stonepath: stateful workflow modeling for rails}
|
82
|
-
s.test_files = [
|
83
|
-
"test/acl_test.rb",
|
84
|
-
"test/app_root/app/controllers/application_controller.rb",
|
85
|
-
"test/app_root/app/models/assignment.rb",
|
86
|
-
"test/app_root/app/models/case.rb",
|
87
|
-
"test/app_root/app/models/custom_assignment.rb",
|
88
|
-
"test/app_root/app/models/user.rb",
|
89
|
-
"test/app_root/config/boot.rb",
|
90
|
-
"test/app_root/config/environment.rb",
|
91
|
-
"test/app_root/config/environments/in_memory.rb",
|
92
|
-
"test/app_root/config/environments/mysql.rb",
|
93
|
-
"test/app_root/config/environments/postgresql.rb",
|
94
|
-
"test/app_root/config/environments/sqlite.rb",
|
95
|
-
"test/app_root/config/environments/sqlite3.rb",
|
96
|
-
"test/app_root/config/routes.rb",
|
97
|
-
"test/app_root/db/migrate/01_create_users.rb",
|
98
|
-
"test/app_root/db/migrate/02_create_assignments.rb",
|
99
|
-
"test/app_root/db/migrate/03_create_cases.rb",
|
100
|
-
"test/app_root/lib/console_with_fixtures.rb",
|
101
|
-
"test/custom_task_test.rb",
|
102
|
-
"test/group_test.rb",
|
103
|
-
"test/role_test.rb",
|
104
|
-
"test/stonepath_test.rb",
|
105
|
-
"test/task_test.rb",
|
106
|
-
"test/test_helper.rb",
|
107
|
-
"test/workitem_test.rb",
|
108
|
-
"test/workowner_test.rb"
|
109
|
-
]
|
110
|
-
|
111
|
-
if s.respond_to? :specification_version then
|
112
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
113
|
-
s.specification_version = 3
|
114
|
-
|
115
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
116
|
-
s.add_runtime_dependency(%q<activerecord>, [">= 2.0.0"])
|
117
|
-
else
|
118
|
-
s.add_dependency(%q<activerecord>, [">= 2.0.0"])
|
119
|
-
end
|
120
|
-
else
|
121
|
-
s.add_dependency(%q<activerecord>, [">= 2.0.0"])
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|